	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function runtest
_runtest:                               ## @runtest
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r12
	movq	%rdi, %rbx
	callq	_fopen
	movq	%rax, %r14
	xorl	%edi, %edi
	testq	%rax, %rax
	setne	%dil
	leaq	L_.str(%rip), %rsi
	movq	%rbx, %rdx
	movq	%r12, %rcx
	xorl	%eax, %eax
	callq	_ATF_REQUIRE_MSG
	movq	%r14, %rdi
	callq	_fileno
	movl	%eax, %r15d
	movl	%eax, %edi
	notl	%edi
	shrl	$31, %edi
	leaq	L_.str.1(%rip), %rsi
	xorl	%eax, %eax
	callq	_ATF_REQUIRE_MSG
	movq	%r12, %rdi
	movl	$101, %esi
	callq	_strchr
	movl	$0, %ebx
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	_FD_CLOEXEC@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
LBB0_2:
	movq	_F_GETFD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r15d, %edi
	callq	_fcntl
	xorl	%edi, %edi
	cmpl	%ebx, %eax
	sete	%dil
	leaq	L_.str.2(%rip), %rsi
	movl	%ebx, %edx
	movl	%eax, %ecx
	xorl	%eax, %eax
	callq	_ATF_REQUIRE_MSG
	movq	_F_GETFL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r15d, %edi
	callq	_fcntl
	movl	%eax, %r15d
	movq	%r12, %rdi
	movl	$43, %esi
	callq	_strchr
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	movq	_O_RDWR@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	cmpb	$97, (%r12)
	je	LBB0_9
	jmp	LBB0_10
LBB0_4:
	movb	(%r12), %al
	cmpb	$97, %al
	je	LBB0_8
## %bb.5:
	cmpb	$114, %al
	je	LBB0_16
## %bb.6:
	cmpb	$119, %al
	jne	LBB0_17
## %bb.7:
	movq	_O_WRONLY@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_11
LBB0_8:
	movq	_O_WRONLY@GOTPCREL(%rip), %rax
LBB0_9:
	movq	_O_APPEND@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ebx
LBB0_10:
	orl	(%rax), %ebx
LBB0_11:
	movq	%r14, %rdi
	callq	_fclose
	cmpl	$-1, %ebx
	je	LBB0_18
## %bb.12:
	movq	_CORRECT_O_ACCMODE@GOTPCREL(%rip), %rax
	movq	_O_APPEND@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	andl	%r15d, %ecx
	cmpl	%ebx, %ecx
	jne	LBB0_15
## %bb.13:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_15:
	leaq	L_.str.4(%rip), %rdi
	jmp	LBB0_19
LBB0_16:
	movq	_O_RDONLY@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_11
LBB0_17:
	movq	%r14, %rdi
	callq	_fclose
LBB0_18:
	leaq	L_.str.3(%rip), %rdi
LBB0_19:
	movq	%r12, %rsi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_atf_tc_fail                    ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"fopen(\"%s\", \"%s\") failed"

L_.str.1:                               ## @.str.1
	.asciz	"fileno() failed for fopen"

	.comm	_FD_CLOEXEC,4,2                 ## @FD_CLOEXEC
	.comm	_F_GETFD,4,2                    ## @F_GETFD
L_.str.2:                               ## @.str.2
	.asciz	"fcntl(.., F_GETFD) didn't FD_CLOEXEC as expected %d != %d"

	.comm	_F_GETFL,4,2                    ## @F_GETFL
	.comm	_O_RDWR,4,2                     ## @O_RDWR
	.comm	_O_APPEND,4,2                   ## @O_APPEND
	.comm	_O_RDONLY,4,2                   ## @O_RDONLY
	.comm	_O_WRONLY,4,2                   ## @O_WRONLY
L_.str.3:                               ## @.str.3
	.asciz	"unrecognized mode: %s"

	.comm	_CORRECT_O_ACCMODE,4,2          ## @CORRECT_O_ACCMODE
L_.str.4:                               ## @.str.4
	.asciz	"incorrect access mode: %s"

	.no_dead_strip	_runtest
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function runtest
_runtest:                               ; @runtest
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x1
	mov	x21, x0
	bl	_fopen
	mov	x20, x0
	cmp	x0, #0
	cset	w0, ne
	stp	x21, x19, [sp]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_ATF_REQUIRE_MSG
	mov	x0, x20
	bl	_fileno
	mov	x21, x0
	mvn	w8, w0
	lsr	w0, w8, #31
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_ATF_REQUIRE_MSG
	mov	x0, x19
	mov	w1, #101
	bl	_strchr
Lloh4:
	adrp	x8, _FD_CLOEXEC@GOTPAGE
Lloh5:
	ldr	x8, [x8, _FD_CLOEXEC@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	cmp	x0, #0
	csel	w22, wzr, w8, eq
Lloh7:
	adrp	x8, _F_GETFD@GOTPAGE
Lloh8:
	ldr	x8, [x8, _F_GETFD@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_fcntl
                                        ; kill: def $w0 killed $w0 def $x0
	cmp	w0, w22
	cset	w8, eq
	stp	x22, x0, [sp]
Lloh10:
	adrp	x1, l_.str.2@PAGE
Lloh11:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x8
	bl	_ATF_REQUIRE_MSG
Lloh12:
	adrp	x8, _F_GETFL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _F_GETFL@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_fcntl
	mov	x21, x0
	mov	x0, x19
	mov	w1, #43
	bl	_strchr
Lloh15:
	adrp	x22, _O_APPEND@GOTPAGE
Lloh16:
	ldr	x22, [x22, _O_APPEND@GOTPAGEOFF]
	cbz	x0, LBB0_6
; %bb.1:
Lloh17:
	adrp	x8, _O_RDWR@GOTPAGE
Lloh18:
	ldr	x8, [x8, _O_RDWR@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	ldrb	w9, [x19]
	ldr	w10, [x22]
	cmp	w9, #97
	csel	w9, w10, wzr, eq
LBB0_2:
	orr	w23, w9, w8
LBB0_3:
	mov	x0, x20
	bl	_fclose
	cmn	w23, #1
	b.eq	LBB0_14
; %bb.4:
Lloh20:
	adrp	x8, _CORRECT_O_ACCMODE@GOTPAGE
Lloh21:
	ldr	x8, [x8, _CORRECT_O_ACCMODE@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	ldr	w9, [x22]
	orr	w8, w9, w8
	and	w8, w8, w21
	cmp	w8, w23
	b.ne	LBB0_10
; %bb.5:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_6:
	ldrb	w8, [x19]
	cmp	w8, #97
	b.eq	LBB0_11
; %bb.7:
	cmp	w8, #114
	b.eq	LBB0_12
; %bb.8:
	cmp	w8, #119
	b.ne	LBB0_13
; %bb.9:
Lloh23:
	adrp	x8, _O_WRONLY@GOTPAGE
Lloh24:
	ldr	x8, [x8, _O_WRONLY@GOTPAGEOFF]
Lloh25:
	ldr	w23, [x8]
	b	LBB0_3
LBB0_10:
Lloh26:
	adrp	x0, l_.str.4@PAGE
Lloh27:
	add	x0, x0, l_.str.4@PAGEOFF
	b	LBB0_15
LBB0_11:
Lloh28:
	adrp	x8, _O_WRONLY@GOTPAGE
Lloh29:
	ldr	x8, [x8, _O_WRONLY@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
	ldr	w9, [x22]
	b	LBB0_2
LBB0_12:
Lloh31:
	adrp	x8, _O_RDONLY@GOTPAGE
Lloh32:
	ldr	x8, [x8, _O_RDONLY@GOTPAGEOFF]
Lloh33:
	ldr	w23, [x8]
	b	LBB0_3
LBB0_13:
	mov	x0, x20
	bl	_fclose
LBB0_14:
Lloh34:
	adrp	x0, l_.str.3@PAGE
Lloh35:
	add	x0, x0, l_.str.3@PAGEOFF
LBB0_15:
	mov	x1, x19
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	b	_atf_tc_fail
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpAdd	Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"fopen(\"%s\", \"%s\") failed"

l_.str.1:                               ; @.str.1
	.asciz	"fileno() failed for fopen"

	.comm	_FD_CLOEXEC,4,2                 ; @FD_CLOEXEC
	.comm	_F_GETFD,4,2                    ; @F_GETFD
l_.str.2:                               ; @.str.2
	.asciz	"fcntl(.., F_GETFD) didn't FD_CLOEXEC as expected %d != %d"

	.comm	_F_GETFL,4,2                    ; @F_GETFL
	.comm	_O_RDWR,4,2                     ; @O_RDWR
	.comm	_O_APPEND,4,2                   ; @O_APPEND
	.comm	_O_RDONLY,4,2                   ; @O_RDONLY
	.comm	_O_WRONLY,4,2                   ; @O_WRONLY
l_.str.3:                               ; @.str.3
	.asciz	"unrecognized mode: %s"

	.comm	_CORRECT_O_ACCMODE,4,2          ; @CORRECT_O_ACCMODE
l_.str.4:                               ; @.str.4
	.asciz	"incorrect access mode: %s"

	.no_dead_strip	_runtest
.subsections_via_symbols
