	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function test_open
_test_open:                             ## @test_open
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	_filename@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_O_RDWR@GOTPCREL(%rip), %rax
	movq	_O_CREAT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	(%rax), %esi
	movq	_S_IRUSR@GOTPCREL(%rip), %rax
	movq	_S_IWUSR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	callq	_open
	movl	%eax, %ebx
	cmpl	$-1, %eax
	jne	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
	callq	_die
LBB0_2:
	movq	_needs_unlink@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	movq	_full_buf@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_DEFAULT_XLOG_SEG_SIZE@GOTPCREL(%rip), %r14
	movq	(%r14), %rdx
	movl	%ebx, %edi
	callq	_write
	cmpq	(%r14), %rax
	je	LBB0_4
## %bb.3:
	leaq	L_.str.1(%rip), %rdi
	callq	_die
LBB0_4:
	movl	%ebx, %edi
	callq	_fsync
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	leaq	L_.str.2(%rip), %rdi
	callq	_die
LBB0_6:
	movl	%ebx, %edi
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_close                          ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_filename,4,2                   ## @filename
	.comm	_O_RDWR,4,2                     ## @O_RDWR
	.comm	_O_CREAT,4,2                    ## @O_CREAT
	.comm	_S_IRUSR,4,2                    ## @S_IRUSR
	.comm	_S_IWUSR,4,2                    ## @S_IWUSR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"could not open output file"

	.comm	_needs_unlink,4,2               ## @needs_unlink
	.comm	_full_buf,4,2                   ## @full_buf
	.comm	_DEFAULT_XLOG_SEG_SIZE,8,3      ## @DEFAULT_XLOG_SEG_SIZE
L_.str.1:                               ## @.str.1
	.asciz	"write failed"

L_.str.2:                               ## @.str.2
	.asciz	"fsync failed"

	.no_dead_strip	_test_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function test_open
_test_open:                             ; @test_open
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
Lloh0:
	adrp	x8, _filename@GOTPAGE
Lloh1:
	ldr	x8, [x8, _filename@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
Lloh3:
	adrp	x8, _O_RDWR@GOTPAGE
Lloh4:
	ldr	x8, [x8, _O_RDWR@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
Lloh6:
	adrp	x9, _O_CREAT@GOTPAGE
Lloh7:
	ldr	x9, [x9, _O_CREAT@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
Lloh9:
	adrp	x10, _S_IRUSR@GOTPAGE
Lloh10:
	ldr	x10, [x10, _S_IRUSR@GOTPAGEOFF]
	orr	w1, w9, w8
Lloh11:
	ldr	w8, [x10]
Lloh12:
	adrp	x9, _S_IWUSR@GOTPAGE
Lloh13:
	ldr	x9, [x9, _S_IWUSR@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	orr	w2, w9, w8
	bl	_open
	mov	x19, x0
	cmn	w0, #1
	b.ne	LBB0_2
; %bb.1:
Lloh15:
	adrp	x0, l_.str@PAGE
Lloh16:
	add	x0, x0, l_.str@PAGEOFF
	bl	_die
LBB0_2:
Lloh17:
	adrp	x8, _needs_unlink@GOTPAGE
Lloh18:
	ldr	x8, [x8, _needs_unlink@GOTPAGEOFF]
	mov	w9, #1
Lloh19:
	str	w9, [x8]
Lloh20:
	adrp	x8, _full_buf@GOTPAGE
Lloh21:
	ldr	x8, [x8, _full_buf@GOTPAGEOFF]
Lloh22:
	ldr	w1, [x8]
Lloh23:
	adrp	x20, _DEFAULT_XLOG_SEG_SIZE@GOTPAGE
Lloh24:
	ldr	x20, [x20, _DEFAULT_XLOG_SEG_SIZE@GOTPAGEOFF]
	ldr	x2, [x20]
	mov	x0, x19
	bl	_write
	ldr	x8, [x20]
	cmp	x0, x8
	b.eq	LBB0_4
; %bb.3:
Lloh25:
	adrp	x0, l_.str.1@PAGE
Lloh26:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_die
LBB0_4:
	mov	x0, x19
	bl	_fsync
	cbz	x0, LBB0_6
; %bb.5:
Lloh27:
	adrp	x0, l_.str.2@PAGE
Lloh28:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_die
LBB0_6:
	mov	x0, x19
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_close
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotStr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpAdd	Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_filename,4,2                   ; @filename
	.comm	_O_RDWR,4,2                     ; @O_RDWR
	.comm	_O_CREAT,4,2                    ; @O_CREAT
	.comm	_S_IRUSR,4,2                    ; @S_IRUSR
	.comm	_S_IWUSR,4,2                    ; @S_IWUSR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"could not open output file"

	.comm	_needs_unlink,4,2               ; @needs_unlink
	.comm	_full_buf,4,2                   ; @full_buf
	.comm	_DEFAULT_XLOG_SEG_SIZE,8,3      ; @DEFAULT_XLOG_SEG_SIZE
l_.str.1:                               ; @.str.1
	.asciz	"write failed"

l_.str.2:                               ; @.str.2
	.asciz	"fsync failed"

	.no_dead_strip	_test_open
.subsections_via_symbols
