	.section	.text
	.intel_syntax
	.global open
	.type	open, @function
open:
	mov	%eax, 5		# Open system call
	.ifdef	NetBSD
	push	511		# Create with full permission
	push	[%esp + 12]	# Flags
	push	[%esp + 12]	# File name
	push	0		# Extra double-word
	int	128
	add	%esp, 16		# Clean up the stack
	.else
	push	%ebx
	mov	%ebx, [%esp + 8]	# File name
	mov	%ecx, [%esp + 12]	# Flags
	mov	%edx, 511		# Create with full permission
	int	128
	pop	%ebx
	.endif
	ret
