	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ali_set_pio_mode
_ali_set_pio_mode:                      ## @ali_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	%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
	movl	%esi, %ebx
	movq	%rdi, %r12
	movq	16(%rdi), %r15
	movl	8(%r15), %edi
	callq	_to_pci_dev
	movq	%rax, %r14
	movq	_XFER_PIO_0@GOTPCREL(%rip), %rax
	addl	(%rax), %ebx
	movl	%ebx, %edi
	callq	_ide_timing_find_mode
	movl	(%rax), %ecx
	movl	%ecx, -68(%rbp)                 ## 4-byte Spill
	movl	4(%rax), %ecx
	movl	%ecx, -64(%rbp)                 ## 4-byte Spill
	movl	8(%rax), %ebx
	movq	_ide_pci_clk@GOTPCREL(%rip), %rax
	movq	(%r15), %rcx
	movq	%rcx, -80(%rbp)                 ## 8-byte Spill
	cmpq	$1, %rcx
	movl	$85, %r15d
	sbbl	$0, %r15d
	movl	(%rax), %eax
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	movl	$0, -44(%rbp)
	movl	(%r12), %r13d
	andl	$1, %r13d
	callq	_local_irq_save
	leaq	-44(%rbp), %rdx
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	movq	%r14, %rdi
	movl	%r15d, %esi
	callq	_pci_read_config_byte
	movq	8(%r12), %rax
	movq	_ide_disk@GOTPCREL(%rip), %rcx
	movl	-44(%rbp), %edx
	cmpq	(%rcx), %rax
	jne	LBB0_4
## %bb.1:
	testl	%r13d, %r13d
	jne	LBB0_2
## %bb.3:
	andl	$240, %edx
	orl	$5, %edx
	jmp	LBB0_7
LBB0_4:
	testl	%r13d, %r13d
	jne	LBB0_5
## %bb.6:
	andl	$240, %edx
	jmp	LBB0_7
LBB0_2:
	andl	$15, %edx
	orl	$80, %edx
	jmp	LBB0_7
LBB0_5:
	andl	$15, %edx
LBB0_7:
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	movq	%r12, %rdi
	movl	%r15d, %esi
	callq	_pci_write_config_byte
	movl	-60(%rbp), %eax                 ## 4-byte Reload
	testl	%eax, %eax
	movl	$33, %ecx
	cmovnel	%eax, %ecx
	imull	%ecx, %ebx
	addl	$999, %ebx                      ## imm = 0x3E7
	movslq	%ebx, %rax
	imulq	$274877907, %rax, %rax          ## imm = 0x10624DD3
	movq	%rax, %rsi
	shrq	$63, %rsi
	sarq	$38, %rax
	movl	-64(%rbp), %edi                 ## 4-byte Reload
	imull	%ecx, %edi
	xorl	%edx, %edx
	movl	$0, %r15d
	cmpl	$7000, %edi                     ## imm = 0x1B58
	jg	LBB0_9
## %bb.8:
	addl	$999, %edi                      ## imm = 0x3E7
	movslq	%edi, %rdi
	imulq	$274877907, %rdi, %r15          ## imm = 0x10624DD3
	movq	%r15, %rdi
	shrq	$63, %rdi
	sarq	$38, %r15
	addl	%edi, %r15d
LBB0_9:
	addl	%esi, %eax
	imull	-68(%rbp), %ecx                 ## 4-byte Folded Reload
	cmpl	$7000, %ecx                     ## imm = 0x1B58
	jg	LBB0_11
## %bb.10:
	addl	$999, %ecx                      ## imm = 0x3E7
	movslq	%ecx, %rcx
	imulq	$274877907, %rcx, %rdx          ## imm = 0x10624DD3
	movq	%rdx, %rcx
	shrq	$63, %rcx
	sarq	$38, %rdx
	addl	%ecx, %edx
LBB0_11:
	leal	(%r15,%rdx), %ecx
	movl	%eax, %esi
	subl	%ecx, %esi
	xorl	%edi, %edi
	cmpl	$16, %esi
	cmovll	%esi, %edi
	cmpl	%ecx, %eax
	movl	$1, %r14d
	cmovnel	%edi, %r14d
	xorl	%ebx, %ebx
	cmpq	$0, -80(%rbp)                   ## 8-byte Folded Reload
	setne	%bl
	leal	88(,%rbx,4), %esi
	movq	%r12, %rdi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_pci_write_config_byte
	leal	90(%r13,%rbx,4), %esi
	shll	$4, %r15d
	orl	%r14d, %r15d
	movq	%r12, %rdi
	movl	%r15d, %edx
	callq	_pci_write_config_byte
	callq	_local_irq_restore
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_XFER_PIO_0,4,2                 ## @XFER_PIO_0
	.comm	_ide_pci_clk,4,2                ## @ide_pci_clk
	.comm	_ide_disk,8,3                   ## @ide_disk
	.no_dead_strip	_ali_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 ali_set_pio_mode
_ali_set_pio_mode:                      ; @ali_set_pio_mode
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x1
	mov	x21, x0
	ldr	x22, [x0, #16]
	ldr	w0, [x22, #8]
	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]
	add	w0, w8, w20
	bl	_ide_timing_find_mode
	ldp	w24, w25, [x0]
	ldr	w26, [x0, #8]
Lloh3:
	adrp	x8, _ide_pci_clk@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ide_pci_clk@GOTPAGEOFF]
Lloh5:
	ldr	w27, [x8]
	ldr	x23, [x22]
	cmp	x23, #0
	mov	w8, #84
	cinc	w20, w8, ne
	str	wzr, [sp, #12]
	ldr	w8, [x21]
	and	w22, w8, #0x1
	bl	_local_irq_save
	add	x2, sp, #12
	mov	x0, x19
	mov	x1, x20
	bl	_pci_read_config_byte
	ldr	x8, [x21, #8]
Lloh6:
	adrp	x9, _ide_disk@GOTPAGE
Lloh7:
	ldr	x9, [x9, _ide_disk@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	ldr	w10, [sp, #12]
	and	w11, w10, #0xf0
	and	w12, w10, #0xf
	cmp	w22, #0
	csel	w12, w11, w12, eq
	mov	w13, #5
	orr	w11, w11, w13
	mov	w13, #80
	bfxil	w13, w10, #0, #4
	cmp	w22, #0
	csel	w10, w11, w13, eq
	cmp	x8, x9
	csel	w2, w12, w10, ne
	mov	w8, #33
	cmp	w27, #0
	csel	w8, w8, w27, eq
	mul	w9, w8, w26
	add	w9, w9, #999
	mov	w10, #19923
	movk	w10, #4194, lsl #16
	smull	x9, w9, w10
	lsr	x11, x9, #63
	asr	x9, x9, #38
	add	w9, w9, w11
	mul	w11, w8, w25
	add	w12, w11, #999
	smull	x12, w12, w10
	lsr	x13, x12, #63
	asr	x12, x12, #38
	add	w12, w12, w13
	mov	w13, #7000
	cmp	w11, w13
	csel	w25, wzr, w12, gt
	mul	w8, w8, w24
	add	w11, w8, #999
	smull	x10, w11, w10
	lsr	x11, x10, #63
	asr	x10, x10, #38
	add	w10, w10, w11
	cmp	w8, w13
	csel	w21, wzr, w10, gt
	add	w8, w25, w21
	subs	w10, w9, w8
	cmp	w10, #15
	csel	w10, wzr, w10, gt
	cmp	w9, w8
	csinc	w24, w10, wzr, ne
	mov	x0, x19
	mov	x1, x20
	bl	_pci_write_config_byte
	cmp	x23, #0
	mov	w8, #92
	mov	w9, #88
	csel	w20, w9, w8, eq
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_pci_write_config_byte
	orr	w8, w20, w22
	orr	w1, w8, #0x2
	orr	w2, w24, w25, lsl #4
	mov	x0, x19
	bl	_pci_write_config_byte
	bl	_local_irq_restore
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_XFER_PIO_0,4,2                 ; @XFER_PIO_0
	.comm	_ide_pci_clk,4,2                ; @ide_pci_clk
	.comm	_ide_disk,8,3                   ; @ide_disk
	.no_dead_strip	_ali_set_pio_mode
.subsections_via_symbols
