	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function check_write
_check_write:                           ## @check_write
	.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	%r13
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, -72(%rbp)                 ## 8-byte Spill
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	testl	%r8d, %r8d
	jle	LBB0_15
## %bb.1:
	movq	%rdx, %rbx
	movl	%r8d, %r14d
	xorl	%r12d, %r12d
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_3:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	leaq	L_.str(%rip), %rsi
	movl	%r15d, %edx
	callq	_notok_mode
LBB0_14:                                ##   in Loop: Header=BB0_2 Depth=1
	incq	%r12
	cmpq	%r12, %r14
	je	LBB0_15
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax,%r12,4), %r15d
	movq	%rbx, %rdi
	movl	%r15d, %esi
	callq	_open
	testl	%eax, %eax
	js	LBB0_3
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	%eax, %r13d
	movl	%eax, %edi
	leaq	-41(%rbp), %rsi
	movl	$1, %edx
	callq	*-64(%rbp)                      ## 8-byte Folded Reload
	movq	_O_ACCMODE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	andl	%r15d, %ecx
	movq	_O_WRONLY@GOTPCREL(%rip), %rdx
	cmpl	(%rdx), %ecx
	sete	%dl
	movq	_O_RDWR@GOTPCREL(%rip), %rsi
	cmpl	(%rsi), %ecx
	sete	%cl
	orb	%dl, %cl
	testq	%rax, %rax
	js	LBB0_5
## %bb.9:                               ##   in Loop: Header=BB0_2 Depth=1
	testb	%cl, %cl
	je	LBB0_10
## %bb.11:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	testb	%cl, %cl
	je	LBB0_8
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_7
LBB0_10:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	leaq	L_.str.2(%rip), %rsi
LBB0_7:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	%r15d, %edx
	callq	_notok_mode
	jmp	LBB0_13
LBB0_8:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	leaq	L_.str.1(%rip), %rsi
LBB0_12:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	%r15d, %edx
	callq	_ok_mode
LBB0_13:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	%r13d, %edi
	callq	_close
	jmp	LBB0_14
LBB0_15:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"open"

	.comm	_O_ACCMODE,4,2                  ## @O_ACCMODE
	.comm	_O_WRONLY,4,2                   ## @O_WRONLY
	.comm	_O_RDWR,4,2                     ## @O_RDWR
L_.str.1:                               ## @.str.1
	.asciz	"write failed"

L_.str.2:                               ## @.str.2
	.asciz	"write succeeded"

	.no_dead_strip	_check_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function check_write
_check_write:                           ; @check_write
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	cmp	w4, #1
	b.lt	LBB0_11
; %bb.1:
	mov	x19, x3
	mov	x20, x2
	mov	x21, x1
	mov	x22, x0
	mov	w28, w4
Lloh0:
	adrp	x24, _O_ACCMODE@GOTPAGE
Lloh1:
	ldr	x24, [x24, _O_ACCMODE@GOTPAGEOFF]
Lloh2:
	adrp	x23, _O_WRONLY@GOTPAGE
Lloh3:
	ldr	x23, [x23, _O_WRONLY@GOTPAGEOFF]
Lloh4:
	adrp	x25, _O_RDWR@GOTPAGE
Lloh5:
	ldr	x25, [x25, _O_RDWR@GOTPAGEOFF]
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x22
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x27
	bl	_notok_mode
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	x19, x19, #4
	subs	x28, x28, #1
	b.eq	LBB0_11
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w27, [x19]
	mov	x0, x20
	mov	x1, x27
	bl	_open
	tbnz	w0, #31, LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x26, x0
	add	x1, sp, #15
	mov	w2, #1
	blr	x21
	ldr	w8, [x24]
	and	w8, w8, w27
	ldr	w9, [x23]
	cmp	w8, w9
	ldr	w9, [x25]
	ccmp	w8, w9, #4, ne
	cset	w8, eq
	tbnz	x0, #63, LBB0_8
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x22
Lloh8:
	adrp	x1, l_.str.2@PAGE
Lloh9:
	add	x1, x1, l_.str.2@PAGEOFF
	tbz	w8, #0, LBB0_9
LBB0_7:                                 ;   in Loop: Header=BB0_4 Depth=1
	mov	x2, x27
	bl	_ok_mode
	b	LBB0_10
LBB0_8:                                 ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x22
Lloh10:
	adrp	x1, l_.str.1@PAGE
Lloh11:
	add	x1, x1, l_.str.1@PAGEOFF
	cbz	w8, LBB0_7
LBB0_9:                                 ;   in Loop: Header=BB0_4 Depth=1
	mov	x2, x27
	bl	_notok_mode
LBB0_10:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x26
	bl	_close
	b	LBB0_3
LBB0_11:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"open"

	.comm	_O_ACCMODE,4,2                  ; @O_ACCMODE
	.comm	_O_WRONLY,4,2                   ; @O_WRONLY
	.comm	_O_RDWR,4,2                     ; @O_RDWR
l_.str.1:                               ; @.str.1
	.asciz	"write failed"

l_.str.2:                               ; @.str.2
	.asciz	"write succeeded"

	.no_dead_strip	_check_write
.subsections_via_symbols
