	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function piix_set_piomode
_piix_set_piomode:                      ## @piix_set_piomode
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r12
	movq	%rdi, %rbx
	movq	16(%rdi), %rax
	movl	(%rax), %edi
	callq	_to_pci_dev
	movq	%rax, %r13
	movl	(%r12), %r15d
	movq	_XFER_PIO_0@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
	movl	4(%r12), %eax
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	xorl	%eax, %eax
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	cmpl	$0, (%rbx)
	setne	%al
	leal	(%rax,%rax), %r14d
	addl	$64, %r14d
	xorl	%ebx, %ebx
	cmpl	$2, %r15d
	setae	%bl
	movq	%r12, %rdi
	callq	_ata_pio_need_iordy
	leal	2(%rbx), %ecx
	testq	%rax, %rax
	cmovel	%ebx, %ecx
	movq	%r12, -80(%rbp)                 ## 8-byte Spill
	movq	8(%r12), %rax
	movq	_ATA_DEV_ATA@GOTPCREL(%rip), %rdx
	leal	4(%rcx), %r12d
	cmpq	(%rdx), %rax
	cmovnel	%ecx, %r12d
	movq	_piix_lock@GOTPCREL(%rip), %rdi
	callq	_spin_lock_irqsave
	leaq	-44(%rbp), %rdx
	movq	%r13, %rdi
	movl	%r14d, -52(%rbp)                ## 4-byte Spill
	movl	%r14d, %esi
	callq	_pci_read_config_word
	movl	-44(%rbp), %eax
	cmpl	$0, -60(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_1
## %bb.2:
	andl	$48911, %eax                    ## imm = 0xBF0F
	shll	$4, %r12d
	addl	%r12d, %eax
	addl	$16384, %eax                    ## imm = 0x4000
	movl	%eax, -44(%rbp)
	leaq	-48(%rbp), %rdx
	movq	%r13, %rdi
	movl	$68, %esi
	callq	_pci_read_config_byte
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	cmpl	$0, (%rbx)
	setne	%cl
	movl	$240, %eax
	movl	$15, %edx
	cmovel	%eax, %edx
	andl	-48(%rbp), %edx
	movl	%r15d, %eax
	leaq	_piix_set_piomode.timings(%rip), %rsi
	movl	(%rsi,%rax,8), %edi
	shll	$2, %edi
	orl	4(%rsi,%rax,8), %edi
	shlb	$2, %cl
	shll	%cl, %edi
	orl	%edx, %edi
	movl	%edi, -48(%rbp)
	movl	-44(%rbp), %edx
	movq	%r13, %rdi
	movl	-52(%rbp), %esi                 ## 4-byte Reload
	callq	_pci_write_config_word
	movl	-48(%rbp), %edx
	movq	%r13, %rdi
	movl	$68, %esi
	callq	_pci_write_config_byte
	cmpq	$0, 8(%rbx)
	je	LBB0_5
LBB0_4:
	leaq	-56(%rbp), %rdx
	movq	%r13, %rdi
	movl	$72, %esi
	callq	_pci_read_config_byte
	movl	(%rbx), %eax
	addl	%eax, %eax
	movq	-80(%rbp), %rcx                 ## 8-byte Reload
	addl	4(%rcx), %eax
	movl	-56(%rbp), %edx
	btrl	%eax, %edx
	movl	%edx, -56(%rbp)
	movq	%r13, %rdi
	movl	$72, %esi
	callq	_pci_write_config_byte
LBB0_5:
	movq	_piix_lock@GOTPCREL(%rip), %rdi
	callq	_spin_unlock_irqrestore
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	andl	$52464, %eax                    ## imm = 0xCCF0
	orl	%r12d, %eax
	movl	%r15d, %ecx
	leaq	_piix_set_piomode.timings(%rip), %rdx
	movl	(%rdx,%rcx,8), %esi
	movl	4(%rdx,%rcx,8), %edx
	shll	$12, %esi
	shll	$8, %edx
	orl	%esi, %edx
	orl	%eax, %edx
	movl	%edx, -44(%rbp)
	movq	%r13, %rdi
	movl	-52(%rbp), %esi                 ## 4-byte Reload
	callq	_pci_write_config_word
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	cmpq	$0, 8(%rbx)
	jne	LBB0_4
	jmp	LBB0_5
	.cfi_endproc
                                        ## -- End function
	.comm	_XFER_PIO_0,4,2                 ## @XFER_PIO_0
	.section	__TEXT,__const
	.p2align	4                               ## @piix_set_piomode.timings
_piix_set_piomode.timings:
	.space	8
	.space	8
	.long	1                               ## 0x1
	.long	0                               ## 0x0
	.long	2                               ## 0x2
	.long	1                               ## 0x1
	.long	2                               ## 0x2
	.long	3                               ## 0x3

	.comm	_ATA_DEV_ATA,8,3                ## @ATA_DEV_ATA
	.comm	_piix_lock,4,2                  ## @piix_lock
	.no_dead_strip	_piix_set_piomode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function piix_set_piomode
_piix_set_piomode:                      ; @piix_set_piomode
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x20, x1
	mov	x21, x0
	ldr	x8, [x0, #16]
	ldr	w0, [x8]
	bl	_to_pci_dev
	mov	x19, x0
Lloh0:
	adrp	x8, _XFER_PIO_0@GOTPAGE
Lloh1:
	ldr	x8, [x8, _XFER_PIO_0@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	ldp	w9, w25, [x20]
	sub	w23, w9, w8
	ldr	w8, [x21]
	mov	w9, #66
	mov	w10, #64
	cmp	w8, #0
	csel	w22, w10, w9, eq
	cmp	w23, #1
	cset	w24, hi
	mov	x0, x20
	bl	_ata_pio_need_iordy
	orr	w8, w24, #0x2
	cmp	x0, #0
	csel	w8, w24, w8, eq
	ldr	x9, [x20, #8]
Lloh3:
	adrp	x10, _ATA_DEV_ATA@GOTPAGE
Lloh4:
	ldr	x10, [x10, _ATA_DEV_ATA@GOTPAGEOFF]
Lloh5:
	ldr	x10, [x10]
	orr	w11, w8, #0x4
	cmp	x9, x10
	csel	w24, w11, w8, eq
Lloh6:
	adrp	x0, _piix_lock@GOTPAGE
Lloh7:
	ldr	x0, [x0, _piix_lock@GOTPAGEOFF]
	bl	_spin_lock_irqsave
	add	x2, sp, #12
	mov	x0, x19
	mov	x1, x22
	bl	_pci_read_config_word
	ldr	w8, [sp, #12]
	cbz	w25, LBB0_4
; %bb.1:
	mov	w9, #48911
	and	w8, w8, w9
	bfi	w8, w24, #4, #3
	orr	w8, w8, #0x4000
	str	w8, [sp, #12]
	add	x2, sp, #8
	mov	x0, x19
	mov	w1, #68
	bl	_pci_read_config_byte
	ldr	w8, [x21]
	mov	w9, #15
	mov	w10, #240
	cmp	w8, #0
	csel	w8, w10, w9, eq
	cset	w9, ne
	ldp	w10, w2, [sp, #8]
	and	w8, w8, w10
Lloh8:
	adrp	x10, _piix_set_piomode.timings@PAGE
Lloh9:
	add	x10, x10, _piix_set_piomode.timings@PAGEOFF
	add	x10, x10, w23, uxtw #3
	ldp	w11, w10, [x10]
	orr	w10, w10, w11, lsl #2
	lsl	x9, x9, #2
	lsl	w9, w10, w9
	orr	w8, w9, w8
	str	w8, [sp, #8]
	mov	x0, x19
	mov	x1, x22
	bl	_pci_write_config_word
	ldr	w2, [sp, #8]
	mov	x0, x19
	mov	w1, #68
	bl	_pci_write_config_byte
	ldr	x8, [x21, #8]
	cbz	x8, LBB0_3
LBB0_2:
	add	x2, sp, #4
	mov	x0, x19
	mov	w1, #72
	bl	_pci_read_config_byte
	ldr	w8, [x21]
	ldr	w9, [x20, #4]
	add	w8, w9, w8, lsl #1
	mov	w9, #1
	lsl	w8, w9, w8
	ldr	w9, [sp, #4]
	bic	w2, w9, w8
	str	w2, [sp, #4]
	mov	x0, x19
	mov	w1, #72
	bl	_pci_write_config_byte
LBB0_3:
Lloh10:
	adrp	x0, _piix_lock@GOTPAGE
Lloh11:
	ldr	x0, [x0, _piix_lock@GOTPAGEOFF]
	bl	_spin_unlock_irqrestore
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_4:
	mov	w9, #52464
	and	w8, w8, w9
	orr	w8, w8, w24
Lloh12:
	adrp	x9, _piix_set_piomode.timings@PAGE
Lloh13:
	add	x9, x9, _piix_set_piomode.timings@PAGEOFF
	add	x9, x9, w23, uxtw #3
	ldp	w10, w9, [x9]
	orr	w8, w8, w10, lsl #12
	orr	w2, w8, w9, lsl #8
	str	w2, [sp, #12]
	mov	x0, x19
	mov	x1, x22
	bl	_pci_write_config_word
	ldr	x8, [x21, #8]
	cbnz	x8, LBB0_2
	b	LBB0_3
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_XFER_PIO_0,4,2                 ; @XFER_PIO_0
	.section	__TEXT,__const
	.p2align	2                               ; @piix_set_piomode.timings
_piix_set_piomode.timings:
	.space	8
	.space	8
	.long	1                               ; 0x1
	.long	0                               ; 0x0
	.long	2                               ; 0x2
	.long	1                               ; 0x1
	.long	2                               ; 0x2
	.long	3                               ; 0x3

	.comm	_ATA_DEV_ATA,8,3                ; @ATA_DEV_ATA
	.comm	_piix_lock,4,2                  ; @piix_lock
	.no_dead_strip	_piix_set_piomode
.subsections_via_symbols
