	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function it8172_set_pio_mode
_it8172_set_pio_mode:                   ## @it8172_set_pio_mode
	.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
	movl	%esi, %r14d
	movq	%rdi, %rbx
	movq	16(%rdi), %rax
	movl	(%rax), %edi
	callq	_to_pci_dev
	movq	%rax, %r15
	leaq	-28(%rbp), %rdx
	movq	%rax, %rdi
	movl	$64, %esi
	callq	_pci_read_config_word
	leaq	-32(%rbp), %rdx
	movq	%r15, %rdi
	movl	$68, %esi
	callq	_pci_read_config_dword
	movl	$16384, %edx                    ## imm = 0x4000
	orl	-28(%rbp), %edx
	movl	(%rbx), %ecx
	testl	%ecx, %ecx
	movl	$49248, %esi                    ## imm = 0xC060
	movl	$49158, %eax                    ## imm = 0xC006
	cmovel	%esi, %eax
	andl	%edx, %eax
	movl	%eax, -28(%rbp)
	movq	8(%rbx), %rdx
	movq	_ide_disk@GOTPCREL(%rip), %rsi
	cmpq	(%rsi), %rdx
	jne	LBB0_2
## %bb.1:
	shll	$2, %ecx
	movl	$4, %edx
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %edx
	orl	%edx, %eax
	movl	%eax, -28(%rbp)
LBB0_2:
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_ide_pio_need_iordy
	movl	(%rbx), %esi
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	leal	(,%rsi,4), %ecx
	movl	$2, %edx
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %edx
	orl	-28(%rbp), %edx
	movl	%edx, -28(%rbp)
	jmp	LBB0_5
LBB0_3:
	movl	-28(%rbp), %edx
LBB0_5:
	testl	%esi, %esi
	movl	$1032192, %eax                  ## imm = 0xFC000
	movl	$16128, %edi                    ## imm = 0x3F00
	cmovel	%eax, %edi
	movslq	%r14d, %rax
	leaq	_it8172_set_pio_mode.timings(%rip), %rcx
	movl	(%rcx,%rax,4), %eax
	addl	%esi, %esi
	leal	(%rsi,%rsi,2), %ecx
	addb	$8, %cl
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %eax
	andl	-32(%rbp), %edi
	orl	%edi, %eax
	movl	%eax, -32(%rbp)
	movq	%r15, %rdi
	movl	$64, %esi
	callq	_pci_write_config_word
	movl	-32(%rbp), %edx
	movq	%r15, %rdi
	movl	$68, %esi
	callq	_pci_write_config_dword
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__const
	.p2align	4                               ## @it8172_set_pio_mode.timings
_it8172_set_pio_mode.timings:
	.long	63                              ## 0x3f
	.long	60                              ## 0x3c
	.long	27                              ## 0x1b
	.long	18                              ## 0x12
	.long	10                              ## 0xa

	.comm	_ide_disk,8,3                   ## @ide_disk
	.no_dead_strip	_it8172_set_pio_mode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function it8172_set_pio_mode
_it8172_set_pio_mode:                   ; @it8172_set_pio_mode
	.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	x20, x1
	mov	x21, x0
	ldr	x8, [x0, #16]
	ldr	w0, [x8]
	bl	_to_pci_dev
	mov	x19, x0
	add	x2, sp, #12
	mov	w1, #64
	bl	_pci_read_config_word
	add	x2, sp, #8
	mov	x0, x19
	mov	w1, #68
	bl	_pci_read_config_dword
	ldr	w8, [sp, #12]
	orr	w9, w8, #0x4000
	ldr	w8, [x21]
	mov	w10, #49158
	mov	w11, #49248
	cmp	w8, #0
	csel	w10, w11, w10, eq
	and	w9, w10, w9
	str	w9, [sp, #12]
	ldr	x10, [x21, #8]
Lloh0:
	adrp	x11, _ide_disk@GOTPAGE
Lloh1:
	ldr	x11, [x11, _ide_disk@GOTPAGEOFF]
Lloh2:
	ldr	x11, [x11]
	cmp	x10, x11
	b.ne	LBB0_2
; %bb.1:
	lsl	w8, w8, #2
	mov	w10, #4
	lsl	w8, w10, w8
	orr	w8, w9, w8
	str	w8, [sp, #12]
LBB0_2:
	mov	x0, x21
	mov	x1, x20
	bl	_ide_pio_need_iordy
	ldr	w8, [x21]
	cbz	x0, LBB0_4
; %bb.3:
	lsl	w9, w8, #2
	mov	w10, #2
	lsl	w9, w10, w9
	ldr	w10, [sp, #12]
	orr	w2, w9, w10
	str	w2, [sp, #12]
	b	LBB0_5
LBB0_4:
	ldr	w2, [sp, #12]
LBB0_5:
	mov	w9, #16128
	mov	w10, #1032192
	cmp	w8, #0
	csel	w9, w10, w9, eq
	ldr	w10, [sp, #8]
	and	w9, w9, w10
Lloh3:
	adrp	x10, _it8172_set_pio_mode.timings@PAGE
Lloh4:
	add	x10, x10, _it8172_set_pio_mode.timings@PAGEOFF
	ldr	w10, [x10, w20, sxtw #2]
	mov	w11, #6
	orr	w12, wzr, #0x8
	madd	w8, w8, w11, w12
	lsl	w8, w10, w8
	orr	w8, w8, w9
	str	w8, [sp, #8]
	mov	x0, x19
	mov	w1, #64
	bl	_pci_write_config_word
	ldr	w2, [sp, #8]
	mov	x0, x19
	mov	w1, #68
	bl	_pci_write_config_dword
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__const
	.p2align	2                               ; @it8172_set_pio_mode.timings
_it8172_set_pio_mode.timings:
	.long	63                              ; 0x3f
	.long	60                              ; 0x3c
	.long	27                              ; 0x1b
	.long	18                              ; 0x12
	.long	10                              ; 0xa

	.comm	_ide_disk,8,3                   ; @ide_disk
	.no_dead_strip	_it8172_set_pio_mode
.subsections_via_symbols
