	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	___ps2_acquire_descriptor       ## -- Begin function __ps2_acquire_descriptor
	.p2align	4, 0x90
___ps2_acquire_descriptor:              ## @__ps2_acquire_descriptor
	.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
	xorl	%eax, %eax
	callq	__lock
	movq	_MAX_OPEN_FILES@GOTPCREL(%rip), %r14
	movl	(%r14), %eax
	testl	%eax, %eax
	jle	LBB0_4
## %bb.1:
	movq	___ps2_fdmap@GOTPCREL(%rip), %r15
	movq	(%r15), %rcx
	movq	___ps2_fdmap_pool@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	xorl	%ebx, %ebx
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_3:                                 ##   in Loop: Header=BB0_2 Depth=1
	incq	%rbx
	cmpq	%rax, %rbx
	je	LBB0_4
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_6 Depth 2
	cmpq	$0, (%rcx,%rbx,8)
	movq	%rax, %rdi
	movq	%rdx, %rsi
	jne	LBB0_3
	.p2align	4, 0x90
LBB0_6:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	cmpq	$0, (%rsi)
	je	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_6 Depth=2
	addq	$16, %rsi
	decq	%rdi
	jne	LBB0_6
	jmp	LBB0_3
LBB0_7:
	movl	%ebx, %r12d
	shlq	$3, %r12
	movq	%rsi, (%rcx,%r12)
	movq	(%r15), %rax
	movq	(%rax,%r12), %rax
	movq	$1, (%rax)
	movl	$-1, 8(%rax)
	movq	_FILEENTRY_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$4, %edi
	callq	_calloc
	movq	(%r15), %rcx
	movq	(%rcx,%r12), %rcx
	movl	%eax, 12(%rcx)
	xorl	%eax, %eax
	callq	__unlock
	movl	(%r14), %eax
	subl	%ebx, %eax
	jmp	LBB0_8
LBB0_4:
	xorl	%eax, %eax
	callq	__unlock
	movl	$-1, %eax
LBB0_8:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_OPEN_FILES,4,2             ## @MAX_OPEN_FILES
	.comm	___ps2_fdmap,8,3                ## @__ps2_fdmap
	.comm	___ps2_fdmap_pool,8,3           ## @__ps2_fdmap_pool
	.comm	_FILEENTRY_SIZE,4,2             ## @FILEENTRY_SIZE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	___ps2_acquire_descriptor       ; -- Begin function __ps2_acquire_descriptor
	.p2align	2
___ps2_acquire_descriptor:              ; @__ps2_acquire_descriptor
	.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
	bl	__lock
Lloh0:
	adrp	x19, _MAX_OPEN_FILES@GOTPAGE
Lloh1:
	ldr	x19, [x19, _MAX_OPEN_FILES@GOTPAGEOFF]
	ldr	w8, [x19]
	cmp	w8, #1
	b.lt	LBB0_7
; %bb.1:
	mov	x20, #0
Lloh2:
	adrp	x21, ___ps2_fdmap@GOTPAGE
Lloh3:
	ldr	x21, [x21, ___ps2_fdmap@GOTPAGEOFF]
	ldr	x9, [x21]
Lloh4:
	adrp	x10, ___ps2_fdmap_pool@GOTPAGE
Lloh5:
	ldr	x10, [x10, ___ps2_fdmap_pool@GOTPAGEOFF]
Lloh6:
	ldr	x10, [x10]
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x20, x20, #1
	cmp	x20, x8
	b.eq	LBB0_7
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_4 Depth 2
	ldr	x13, [x9, x20, lsl #3]
	mov	x12, x8
	mov	x11, x10
	cbnz	x13, LBB0_2
LBB0_4:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x13, [x11]
	cbz	x13, LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=2
	add	x11, x11, #16
	subs	x12, x12, #1
	b.ne	LBB0_4
	b	LBB0_2
LBB0_6:
	ubfiz	x22, x20, #3, #32
	str	x11, [x9, x22]
	ldr	x8, [x21]
	ldr	x8, [x8, x22]
	mov	w9, #1
	str	x9, [x8]
	mov	w9, #-1
	str	w9, [x8, #8]
Lloh7:
	adrp	x8, _FILEENTRY_SIZE@GOTPAGE
Lloh8:
	ldr	x8, [x8, _FILEENTRY_SIZE@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	mov	w0, #4
	bl	_calloc
	ldr	x8, [x21]
	ldr	x8, [x8, x22]
	str	w0, [x8, #12]
	bl	__unlock
	ldr	w8, [x19]
	sub	w0, w8, w20
	b	LBB0_8
LBB0_7:
	bl	__unlock
	mov	w0, #-1
LBB0_8:
	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
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_OPEN_FILES,4,2             ; @MAX_OPEN_FILES
	.comm	___ps2_fdmap,8,3                ; @__ps2_fdmap
	.comm	___ps2_fdmap_pool,8,3           ; @__ps2_fdmap_pool
	.comm	_FILEENTRY_SIZE,4,2             ; @FILEENTRY_SIZE
.subsections_via_symbols
