	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ide_find_port_slot
_ide_find_port_slot:                    ## @ide_find_port_slot
	.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	_ENOENT@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	testq	%rdi, %rdi
	je	LBB0_1
## %bb.2:
	movl	(%rdi), %eax
	movq	_IDE_HFLAG_NON_BOOTABLE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r12d
	andl	%eax, %r12d
	movq	_IDE_HFLAG_QD_2ND_PORT@GOTPCREL(%rip), %rcx
	xorl	%ebx, %ebx
	andl	(%rcx), %eax
	setne	%r15b
	movq	_ide_cfg_mtx@GOTPCREL(%rip), %rdi
	callq	_mutex_lock
	testl	%r12d, %r12d
	je	LBB0_3
## %bb.5:
	movq	_ide_indexes@GOTPCREL(%rip), %rax
	movq	_MAX_HWIFS@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	movl	$-1, %edx
	shll	%cl, %edx
	movl	(%rax), %eax
	movl	%eax, %ebx
	orl	$3, %ebx
	notl	%edx
	cmpl	%edx, %ebx
	jne	LBB0_7
## %bb.6:
	movl	%eax, %ecx
	notl	%ecx
	movl	%eax, %ebx
	testb	$3, %cl
	jne	LBB0_7
	jmp	LBB0_8
LBB0_1:
	movq	_ide_cfg_mtx@GOTPCREL(%rip), %rdi
	callq	_mutex_lock
	jmp	LBB0_4
LBB0_3:
	movb	%r15b, %bl
LBB0_4:
	movq	_ide_indexes@GOTPCREL(%rip), %rax
	movq	_MAX_HWIFS@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	movl	$-1, %edx
	shll	%cl, %edx
	orl	(%rax), %ebx
	notl	%edx
	cmpl	%edx, %ebx
	je	LBB0_8
LBB0_7:
	movl	%ebx, %edi
	callq	_ffz
	movl	%eax, %r14d
LBB0_8:
	testl	%r14d, %r14d
	js	LBB0_10
## %bb.9:
	movl	$1, %eax
	movl	%r14d, %ecx
	shll	%cl, %eax
	movq	_ide_indexes@GOTPCREL(%rip), %rcx
	orl	%eax, (%rcx)
LBB0_10:
	movq	_ide_cfg_mtx@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
	movl	%r14d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOENT,4,2                     ## @ENOENT
	.comm	_IDE_HFLAG_NON_BOOTABLE,4,2     ## @IDE_HFLAG_NON_BOOTABLE
	.comm	_IDE_HFLAG_QD_2ND_PORT,4,2      ## @IDE_HFLAG_QD_2ND_PORT
	.comm	_ide_cfg_mtx,4,2                ## @ide_cfg_mtx
	.comm	_ide_indexes,4,2                ## @ide_indexes
	.comm	_MAX_HWIFS,4,2                  ## @MAX_HWIFS
	.no_dead_strip	_ide_find_port_slot
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ide_find_port_slot
_ide_find_port_slot:                    ; @ide_find_port_slot
	.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
Lloh0:
	adrp	x8, _ENOENT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ENOENT@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w19, w8
Lloh3:
	adrp	x20, _ide_indexes@GOTPAGE
Lloh4:
	ldr	x20, [x20, _ide_indexes@GOTPAGEOFF]
	cbz	x0, LBB0_4
; %bb.1:
	ldr	w8, [x0]
Lloh5:
	adrp	x9, _IDE_HFLAG_NON_BOOTABLE@GOTPAGE
Lloh6:
	ldr	x9, [x9, _IDE_HFLAG_NON_BOOTABLE@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	and	w22, w9, w8
Lloh8:
	adrp	x9, _IDE_HFLAG_QD_2ND_PORT@GOTPAGE
Lloh9:
	ldr	x9, [x9, _IDE_HFLAG_QD_2ND_PORT@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	tst	w9, w8
	cset	w21, ne
Lloh11:
	adrp	x0, _ide_cfg_mtx@GOTPAGE
Lloh12:
	ldr	x0, [x0, _ide_cfg_mtx@GOTPAGEOFF]
	bl	_mutex_lock
	cbz	w22, LBB0_5
; %bb.2:
	ldr	w8, [x20]
Lloh13:
	adrp	x9, _MAX_HWIFS@GOTPAGE
Lloh14:
	ldr	x9, [x9, _MAX_HWIFS@GOTPAGEOFF]
	orr	w0, w8, #0x3
Lloh15:
	ldr	w9, [x9]
	mov	w10, #-1
	lsl	w9, w10, w9
	mvn	w9, w9
	cmp	w0, w9
	b.ne	LBB0_6
; %bb.3:
	mvn	w9, w8
	mov	x0, x8
	tst	w9, #0x3
	b.ne	LBB0_6
	b	LBB0_7
LBB0_4:
Lloh16:
	adrp	x0, _ide_cfg_mtx@GOTPAGE
Lloh17:
	ldr	x0, [x0, _ide_cfg_mtx@GOTPAGEOFF]
	bl	_mutex_lock
	mov	w21, #0
LBB0_5:
	ldr	w8, [x20]
Lloh18:
	adrp	x9, _MAX_HWIFS@GOTPAGE
Lloh19:
	ldr	x9, [x9, _MAX_HWIFS@GOTPAGEOFF]
	orr	w0, w8, w21
Lloh20:
	ldr	w8, [x9]
	mov	w9, #-1
	lsl	w8, w9, w8
	mvn	w8, w8
	cmp	w0, w8
	b.eq	LBB0_7
LBB0_6:
	bl	_ffz
	mov	x19, x0
LBB0_7:
	tbnz	w19, #31, LBB0_9
; %bb.8:
	mov	w8, #1
	lsl	w8, w8, w19
	ldr	w9, [x20]
	orr	w8, w9, w8
	str	w8, [x20]
LBB0_9:
Lloh21:
	adrp	x0, _ide_cfg_mtx@GOTPAGE
Lloh22:
	ldr	x0, [x0, _ide_cfg_mtx@GOTPAGEOFF]
	bl	_mutex_unlock
	mov	x0, x19
	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	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOENT,4,2                     ; @ENOENT
	.comm	_IDE_HFLAG_NON_BOOTABLE,4,2     ; @IDE_HFLAG_NON_BOOTABLE
	.comm	_IDE_HFLAG_QD_2ND_PORT,4,2      ; @IDE_HFLAG_QD_2ND_PORT
	.comm	_ide_cfg_mtx,4,2                ; @ide_cfg_mtx
	.comm	_ide_indexes,4,2                ; @ide_indexes
	.comm	_MAX_HWIFS,4,2                  ; @MAX_HWIFS
	.no_dead_strip	_ide_find_port_slot
.subsections_via_symbols
