	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_dup2                           ## -- Begin function dup2
	.p2align	4, 0x90
_dup2:                                  ## @dup2
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movl	%edi, %r15d
	xorl	%eax, %eax
	callq	_init_preload
	movq	_idm@GOTPCREL(%rip), %rdi
	movl	%r15d, %esi
	callq	_idm_lookup
	movq	%rax, %rbx
	testq	%rax, %rax
	je	LBB0_5
## %bb.1:
	movq	(%rbx), %rax
	movq	_fd_fork_passive@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_3
## %bb.2:
	movl	%r15d, %edi
	callq	_fork_passive
	jmp	LBB0_5
LBB0_3:
	movq	_fd_fork_active@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_5
## %bb.4:
	movl	%r15d, %edi
	callq	_fork_active
LBB0_5:
	movq	_idm@GOTPCREL(%rip), %rdi
	movl	%r14d, %esi
	callq	_idm_lookup
	testq	%rax, %rax
	je	LBB0_10
## %bb.6:
	addq	$12, %rax
	movq	%rax, %rdi
	callq	_atomic_load
	cmpl	$2, %eax
	jl	LBB0_9
## %bb.7:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	jmp	LBB0_8
LBB0_9:
	movl	%r14d, %edi
	callq	_close
LBB0_10:
	movq	_real@GOTPCREL(%rip), %rax
	movl	%r15d, %edi
	movl	%r14d, %esi
	callq	*(%rax)
	testq	%rbx, %rbx
	je	LBB0_18
## %bb.11:
	cmpl	%r14d, %eax
	jne	LBB0_18
## %bb.12:
	movl	$1, %edi
	movl	$24, %esi
	callq	_calloc
	testq	%rax, %rax
	je	LBB0_13
## %bb.14:
	movq	%rax, %r12
	movq	_mut@GOTPCREL(%rip), %r13
	movq	%r13, %rdi
	callq	_pthread_mutex_lock
	movq	_idm@GOTPCREL(%rip), %rdi
	movl	%r14d, %esi
	movq	%r12, %rdx
	callq	_idm_set
	movq	%r13, %rdi
	callq	_pthread_mutex_unlock
	movl	20(%rbx), %eax
	movl	%eax, 20(%r12)
	movl	16(%rbx), %eax
	movl	%eax, 16(%r12)
	movl	8(%rbx), %eax
	cmpl	$-1, %eax
	je	LBB0_16
## %bb.15:
	movl	%eax, 8(%r12)
	movl	8(%rbx), %esi
	movq	_idm@GOTPCREL(%rip), %rdi
	callq	_idm_lookup
	movq	%rax, %rbx
	jmp	LBB0_17
LBB0_13:
	movl	%r14d, %edi
	callq	_close
	movq	_ENOMEM@GOTPCREL(%rip), %rax
LBB0_8:
	movl	(%rax), %edi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ERR                            ## TAILCALL
LBB0_16:
	movl	%r15d, 8(%r12)
LBB0_17:
	addq	$12, %r12
	movq	%r12, %rdi
	movl	$1, %esi
	callq	_atomic_store
	addq	$12, %rbx
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_atomic_fetch_add
	movl	%r14d, %eax
LBB0_18:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_idm,4,2                        ## @idm
	.comm	_fd_fork_passive,8,3            ## @fd_fork_passive
	.comm	_fd_fork_active,8,3             ## @fd_fork_active
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_real,8,3                       ## @real
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_mut,4,2                        ## @mut
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_dup2                           ; -- Begin function dup2
	.p2align	2
_dup2:                                  ; @dup2
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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	_init_preload
Lloh0:
	adrp	x0, _idm@GOTPAGE
Lloh1:
	ldr	x0, [x0, _idm@GOTPAGEOFF]
	mov	x1, x21
	bl	_idm_lookup
	mov	x20, x0
	cbz	x0, LBB0_5
; %bb.1:
	ldr	x8, [x20]
Lloh2:
	adrp	x9, _fd_fork_passive@GOTPAGE
Lloh3:
	ldr	x9, [x9, _fd_fork_passive@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_3
; %bb.2:
	mov	x0, x21
	bl	_fork_passive
	b	LBB0_5
LBB0_3:
Lloh5:
	adrp	x9, _fd_fork_active@GOTPAGE
Lloh6:
	ldr	x9, [x9, _fd_fork_active@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_5
; %bb.4:
	mov	x0, x21
	bl	_fork_active
LBB0_5:
Lloh8:
	adrp	x0, _idm@GOTPAGE
Lloh9:
	ldr	x0, [x0, _idm@GOTPAGEOFF]
	mov	x1, x19
	bl	_idm_lookup
	cbz	x0, LBB0_9
; %bb.6:
	add	x0, x0, #12
	bl	_atomic_load
	cmp	w0, #2
	b.lt	LBB0_8
; %bb.7:
Lloh10:
	adrp	x8, _EBUSY@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
	b	LBB0_14
LBB0_8:
	mov	x0, x19
	bl	_close
LBB0_9:
Lloh12:
	adrp	x8, _real@GOTPAGE
Lloh13:
	ldr	x8, [x8, _real@GOTPAGEOFF]
Lloh14:
	ldr	x8, [x8]
	mov	x0, x21
	mov	x1, x19
	blr	x8
	cmp	x20, #0
	ccmp	w0, w19, #0, ne
	b.ne	LBB0_17
; %bb.10:
	mov	w0, #1
	mov	w1, #24
	bl	_calloc
	cbz	x0, LBB0_13
; %bb.11:
	mov	x22, x0
Lloh15:
	adrp	x23, _mut@GOTPAGE
Lloh16:
	ldr	x23, [x23, _mut@GOTPAGEOFF]
	mov	x0, x23
	bl	_pthread_mutex_lock
Lloh17:
	adrp	x0, _idm@GOTPAGE
Lloh18:
	ldr	x0, [x0, _idm@GOTPAGEOFF]
	mov	x1, x19
	mov	x2, x22
	bl	_idm_set
	mov	x0, x23
	bl	_pthread_mutex_unlock
	ldr	d0, [x20, #16]
	str	d0, [x22, #16]
	ldr	w8, [x20, #8]
	cmn	w8, #1
	b.eq	LBB0_15
; %bb.12:
	str	w8, [x22, #8]
	ldr	w1, [x20, #8]
Lloh19:
	adrp	x0, _idm@GOTPAGE
Lloh20:
	ldr	x0, [x0, _idm@GOTPAGEOFF]
	bl	_idm_lookup
	mov	x20, x0
	b	LBB0_16
LBB0_13:
	mov	x0, x19
	bl	_close
Lloh21:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh22:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_14:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_ERR
LBB0_15:
	str	w21, [x22, #8]
LBB0_16:
	add	x0, x22, #12
	mov	w1, #1
	bl	_atomic_store
	add	x0, x20, #12
	mov	w1, #1
	bl	_atomic_fetch_add
	mov	x0, x19
LBB0_17:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_idm,4,2                        ; @idm
	.comm	_fd_fork_passive,8,3            ; @fd_fork_passive
	.comm	_fd_fork_active,8,3             ; @fd_fork_active
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_real,8,3                       ; @real
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_mut,4,2                        ; @mut
.subsections_via_symbols
