	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function init_hwif_ns87415
_init_hwif_ns87415:                     ## @init_hwif_ns87415
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movl	56(%rdi), %edi
	callq	_to_pci_dev
	movq	%rax, %r14
	leaq	-28(%rbp), %rdx
	movq	%rax, %rdi
	movl	$64, %esi
	callq	_pci_read_config_dword
	leaq	-32(%rbp), %rdx
	movq	%r14, %rdi
	movl	$9, %esi
	callq	_pci_read_config_byte
	movl	(%r15), %eax
	leal	(%rax,%rax), %ecx
	movl	$1, %edx
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %edx
	movl	$1, %ebx
	andl	-32(%rbp), %edx
	addb	$4, %al
	movl	%eax, %ecx
	shll	%cl, %ebx
	movl	-28(%rbp), %eax
	andl	%eax, %ebx
	testl	%edx, %edx
	cmovnel	%edx, %ebx
	movq	48(%r15), %rcx
	testq	%rcx, %rcx
	je	LBB0_2
## %bb.1:
	movq	(%rcx), %rax
	movq	%rax, 8(%r15)
	testl	%ebx, %ebx
	jne	LBB0_5
LBB0_4:
	movl	(%r15), %esi
	movq	%r14, %rdi
	callq	_pci_get_legacy_ide_irq
	movl	%eax, 24(%r15)
LBB0_5:
	movq	16(%r15), %rsi
	testq	%rsi, %rsi
	je	LBB0_7
## %bb.6:
	movq	_ATA_DMA_STATUS@GOTPCREL(%rip), %rax
	addq	(%rax), %rsi
	movl	$96, %edi
	callq	_outb
LBB0_7:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movq	_ns87415_control@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	_ns87415_count@GOTPCREL(%rip), %rdx
	movslq	(%rdx), %rsi
	leal	1(%rsi), %edi
	movl	%edi, (%rdx)
	leaq	(%rcx,%rsi,4), %rdx
	orl	$768, %eax                      ## imm = 0x300
	movl	%eax, %edi
	andl	$-65, %edi
	testl	%ebx, %ebx
	cmovel	%eax, %edi
	movq	%rdx, 8(%r15)
	movl	%edi, -28(%rbp)
	movl	%edi, (%rcx,%rsi,4)
	movl	-28(%rbp), %edx
	movq	%r14, %rdi
	movl	$64, %esi
	callq	_pci_write_config_dword
	movq	%r14, %rdi
	movl	$85, %esi
	movl	$238, %edx
	callq	_pci_write_config_byte
	testl	%ebx, %ebx
	jne	LBB0_5
	jmp	LBB0_4
	.cfi_endproc
                                        ## -- End function
	.comm	_ns87415_control,8,3            ## @ns87415_control
	.comm	_ns87415_count,4,2              ## @ns87415_count
	.comm	_ATA_DMA_STATUS,8,3             ## @ATA_DMA_STATUS
	.comm	_ATA_BUSY,4,2                   ## @ATA_BUSY
	.no_dead_strip	_init_hwif_ns87415
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function init_hwif_ns87415
_init_hwif_ns87415:                     ; @init_hwif_ns87415
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x19, x0
	ldr	w0, [x0, #56]
	bl	_to_pci_dev
	mov	x20, x0
	add	x2, sp, #12
	mov	w1, #64
	bl	_pci_read_config_dword
	add	x2, sp, #8
	mov	x0, x20
	mov	w1, #9
	bl	_pci_read_config_byte
	ldr	w10, [x19]
	lsl	w8, w10, #1
	mov	w11, #1
	lsl	w12, w11, w8
	ldp	w9, w8, [sp, #8]
	add	w10, w10, #4
	lsl	w10, w11, w10
	and	w10, w10, w8
	ands	w9, w12, w9
	csel	w21, w10, w9, eq
	ldr	x9, [x19, #48]
	cbz	x9, LBB0_6
; %bb.1:
	ldr	x8, [x9]
	str	x8, [x19, #8]
	cbnz	w21, LBB0_3
LBB0_2:
	ldr	w1, [x19]
	mov	x0, x20
	bl	_pci_get_legacy_ide_irq
	str	w0, [x19, #24]
LBB0_3:
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_5
; %bb.4:
Lloh0:
	adrp	x9, _ATA_DMA_STATUS@GOTPAGE
Lloh1:
	ldr	x9, [x9, _ATA_DMA_STATUS@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	w0, #96
	bl	_outb
LBB0_5:
	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
	add	sp, sp, #64
	ret
LBB0_6:
Lloh3:
	adrp	x9, _ns87415_control@GOTPAGE
Lloh4:
	ldr	x9, [x9, _ns87415_control@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
Lloh6:
	adrp	x10, _ns87415_count@GOTPAGE
Lloh7:
	ldr	x10, [x10, _ns87415_count@GOTPAGEOFF]
	ldrsw	x11, [x10]
	add	w12, w11, #1
	str	w12, [x10]
	lsl	x10, x11, #2
	add	x11, x9, x10
	str	x11, [x19, #8]
	orr	w8, w8, #0x300
	and	w11, w8, #0xffffffbf
	cmp	w21, #0
	csel	w8, w8, w11, eq
	str	w8, [sp, #12]
	str	w8, [x9, x10]
	ldr	w2, [sp, #12]
	mov	x0, x20
	mov	w1, #64
	bl	_pci_write_config_dword
	mov	x0, x20
	mov	w1, #85
	mov	w2, #238
	bl	_pci_write_config_byte
	cbnz	w21, LBB0_3
	b	LBB0_2
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_ns87415_control,8,3            ; @ns87415_control
	.comm	_ns87415_count,4,2              ; @ns87415_count
	.comm	_ATA_DMA_STATUS,8,3             ; @ATA_DMA_STATUS
	.comm	_ATA_BUSY,4,2                   ; @ATA_BUSY
	.no_dead_strip	_init_hwif_ns87415
.subsections_via_symbols
