	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function fd_open
_fd_open:                               ## @fd_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	%r15
	pushq	%r14
	pushq	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	$1, %edi
	movl	$8, %esi
	callq	_calloc
	testq	%rax, %rax
	je	LBB0_6
## %bb.1:
	movq	%rax, %rbx
	movq	_O_RDONLY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdi
	callq	_open
	movl	%eax, %r14d
	testl	%eax, %eax
	js	LBB0_4
## %bb.2:
	movl	$-1, (%rbx)
	movq	%rbx, %rdi
	addq	$4, %rdi
	movl	$1, %esi
	callq	_atomic_store
	movq	_mut@GOTPCREL(%rip), %r12
	movq	%r12, %rdi
	callq	_pthread_mutex_lock
	movq	_idm@GOTPCREL(%rip), %rdi
	movl	%r14d, %esi
	movq	%rbx, %rdx
	callq	_idm_set
	movl	%eax, %r15d
	movq	%r12, %rdi
	callq	_pthread_mutex_unlock
	testl	%r15d, %r15d
	jns	LBB0_5
## %bb.3:
	movq	_real@GOTPCREL(%rip), %rax
	movl	%r14d, %edi
	callq	*(%rax)
	movl	%r15d, %r14d
LBB0_4:
	movq	%rbx, %rdi
	callq	_free
LBB0_5:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ERR                            ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"/dev/null"

	.comm	_O_RDONLY,4,2                   ## @O_RDONLY
	.comm	_mut,4,2                        ## @mut
	.comm	_idm,4,2                        ## @idm
	.comm	_real,8,3                       ## @real
	.no_dead_strip	_fd_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function fd_open
_fd_open:                               ; @fd_open
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	w0, #1
	mov	w1, #8
	bl	_calloc
	cbz	x0, LBB0_6
; %bb.1:
	mov	x19, x0
Lloh0:
	adrp	x8, _O_RDONLY@GOTPAGE
Lloh1:
	ldr	x8, [x8, _O_RDONLY@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	bl	_open
	mov	x20, x0
	tbnz	w0, #31, LBB0_4
; %bb.2:
	mov	w8, #-1
	mov	x0, x19
	str	w8, [x0], #4
	mov	w1, #1
	bl	_atomic_store
Lloh5:
	adrp	x22, _mut@GOTPAGE
Lloh6:
	ldr	x22, [x22, _mut@GOTPAGEOFF]
	mov	x0, x22
	bl	_pthread_mutex_lock
Lloh7:
	adrp	x0, _idm@GOTPAGE
Lloh8:
	ldr	x0, [x0, _idm@GOTPAGEOFF]
	mov	x1, x20
	mov	x2, x19
	bl	_idm_set
	mov	x21, x0
	mov	x0, x22
	bl	_pthread_mutex_unlock
	tbz	w21, #31, LBB0_5
; %bb.3:
Lloh9:
	adrp	x8, _real@GOTPAGE
Lloh10:
	ldr	x8, [x8, _real@GOTPAGEOFF]
Lloh11:
	ldr	x8, [x8]
	mov	x0, x20
	blr	x8
	mov	x20, x21
LBB0_4:
	mov	x0, x19
	bl	_free
LBB0_5:
	mov	x0, x20
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_6:
Lloh12:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_ERR
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"/dev/null"

	.comm	_O_RDONLY,4,2                   ; @O_RDONLY
	.comm	_mut,4,2                        ; @mut
	.comm	_idm,4,2                        ; @idm
	.comm	_real,8,3                       ; @real
	.no_dead_strip	_fd_open
.subsections_via_symbols
