	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ns87415_prepare_drive
_ns87415_prepare_drive:                 ## @ns87415_prepare_drive
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r15d
	movq	%rdi, %r12
	movq	8(%rdi), %rbx
	movl	16(%rbx), %edi
	callq	_to_pci_dev
	movq	%rax, %r13
	movq	8(%rbx), %r14
	callq	_local_irq_save
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	movl	(%r14), %eax
	movl	(%rbx), %edx
	leal	8(%rdx), %ecx
	movq	_IDE_DFLAG_PRESENT@GOTPCREL(%rip), %rsi
	movl	(%rsi), %esi
	movl	%eax, %edi
	btrl	%ecx, %edi
	movl	%eax, %r14d
	btsl	%ecx, %r14d
	testl	%esi, (%r12)
	cmovnel	%edi, %r14d
	movl	4(%r12), %edi
	andl	$1, %edi
	leal	(%rdi,%rdx,2), %ecx
	addb	$20, %cl
	movl	$1, %esi
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %esi
	testl	%r15d, %r15d
	je	LBB0_2
## %bb.1:
	addl	%edx, %edx
	subl	%edi, %edx
	addb	$21, %dl
	btrl	%edx, %r14d
	orl	%esi, %r14d
	cmpl	%eax, %r14d
	jne	LBB0_4
	jmp	LBB0_8
LBB0_2:
	notl	%esi
	andl	%esi, %r14d
	cmpl	%eax, %r14d
	je	LBB0_8
LBB0_4:
	leaq	-41(%rbp), %rdx
	movq	%r13, %rdi
	movl	$67, %esi
	callq	_pci_read_config_byte
	testb	$3, -41(%rbp)
	je	LBB0_7
## %bb.5:
	leaq	-41(%rbp), %rbx
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movl	$1, %edi
	callq	_udelay
	movq	%r13, %rdi
	movl	$67, %esi
	movq	%rbx, %rdx
	callq	_pci_read_config_byte
	testb	$3, -41(%rbp)
	jne	LBB0_6
LBB0_7:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	%r14d, (%rax)
	movq	%r13, %rdi
	movl	$64, %esi
	movl	%r14d, %edx
	callq	_pci_write_config_dword
	movl	$10, %edi
	callq	_udelay
LBB0_8:
	callq	_local_irq_restore
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_IDE_DFLAG_PRESENT,4,2          ## @IDE_DFLAG_PRESENT
	.no_dead_strip	_ns87415_prepare_drive
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ns87415_prepare_drive
_ns87415_prepare_drive:                 ; @ns87415_prepare_drive
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x20, x1
	mov	x21, x0
	ldr	x23, [x0, #8]
	ldr	w0, [x23, #16]
	bl	_to_pci_dev
	mov	x19, x0
	ldr	x22, [x23, #8]
	bl	_local_irq_save
	ldr	w8, [x22]
	ldr	w9, [x23]
	add	w10, w9, #8
	mov	w11, #1
	lsl	w10, w11, w10
Lloh0:
	adrp	x12, _IDE_DFLAG_PRESENT@GOTPAGE
Lloh1:
	ldr	x12, [x12, _IDE_DFLAG_PRESENT@GOTPAGEOFF]
Lloh2:
	ldr	w12, [x12]
	bic	w13, w8, w10
	orr	w10, w10, w8
	ldp	w14, w15, [x21]
	tst	w12, w14
	csel	w10, w10, w13, eq
	and	w12, w15, #0x1
	lsl	w13, w9, #1
	bfi	w15, w9, #1, #31
	add	w9, w15, #20
	lsl	w9, w11, w9
	bic	w14, w10, w9
	sub	w12, w13, w12
	add	w12, w12, #21
	lsl	w11, w11, w12
	bic	w10, w10, w11
	orr	w9, w10, w9
	cmp	w20, #0
	csel	w20, w14, w9, eq
	cmp	w20, w8
	b.eq	LBB0_4
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	add	x2, sp, #15
	mov	x0, x19
	mov	w1, #67
	bl	_pci_read_config_byte
	ldrb	w8, [sp, #15]
	tst	w8, #0x3
	b.eq	LBB0_3
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	w0, #1
	bl	_udelay
	b	LBB0_1
LBB0_3:
	str	w20, [x22]
	mov	x0, x19
	mov	w1, #64
	mov	x2, x20
	bl	_pci_write_config_dword
	mov	w0, #10
	bl	_udelay
LBB0_4:
	bl	_local_irq_restore
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_IDE_DFLAG_PRESENT,4,2          ; @IDE_DFLAG_PRESENT
	.no_dead_strip	_ns87415_prepare_drive
.subsections_via_symbols
