	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function opti82c611a_set_piomode
_opti82c611a_set_piomode:               ## @opti82c611a_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, %r14
	movq	%rdi, %r15
	movq	%rsi, %rdi
	callq	_ata_dev_pair
	movq	%rax, %r12
	movl	16(%r15), %edi
	callq	_ioread16
	movl	16(%r15), %edi
	callq	_ioread16
	movl	(%r15), %esi
	movl	$3, %edi
	callq	_iowrite8
	movl	20(%r15), %edi
	callq	_ioread8
	movl	%eax, %ecx
	andl	$3, %ecx
	leaq	L___const.opti82c611a_set_piomode.khz(%rip), %rsi
	movl	$1000000000, %eax               ## imm = 0x3B9ACA00
	xorl	%edx, %edx
	idivl	(%rsi,%rcx,4)
	movl	%eax, %ebx
	movl	4(%r14), %esi
	leaq	-56(%rbp), %rdx
	movq	%r14, %rdi
	movl	%eax, %ecx
	movl	$1000, %r8d                     ## imm = 0x3E8
	callq	_ata_timing_compute
	testq	%r12, %r12
	je	LBB0_2
## %bb.1:
	movl	4(%r12), %esi
	leaq	-72(%rbp), %r13
	movq	%r12, %rdi
	movq	%r13, %rdx
	movl	%ebx, %ecx
	movl	$1000, %r8d                     ## imm = 0x3E8
	callq	_ata_timing_compute
	movq	_ATA_TIMING_SETUP@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	-56(%rbp), %rdi
	movq	%r13, %rsi
	movq	%rdi, %rdx
	callq	_ata_timing_merge
LBB0_2:
	movl	-48(%rbp), %edi
	movl	$2, %esi
	movl	$17, %edx
	callq	_clamp_val
	movl	%eax, %r12d
	movl	-52(%rbp), %edi
	movl	$1, %esi
	movl	$16, %edx
	callq	_clamp_val
                                        ## kill: def $eax killed $eax def $rax
	leal	-1(%rax), %r13d
	movl	-56(%rbp), %edi
	movl	$1, %esi
	movl	$4, %edx
	callq	_clamp_val
	movl	%eax, %ebx
	movl	4(%r15), %edi
	callq	_ioread8
	andl	$127, %eax
	movl	(%r14), %edi
	shll	$7, %edi
	orl	%eax, %edi
	movl	4(%r15), %esi
	callq	_iowrite8
	shll	$4, %r12d
	addl	$-32, %r12d
	orl	%r13d, %r12d
	movl	16(%r15), %esi
	movl	%r12d, %edi
	callq	_iowrite8
	movl	12(%r15), %edi
	callq	_ioread8
	andl	$192, %eax
	shll	$4, %ebx
	addl	$-12, %ebx
	orl	(%r14), %ebx
	orl	%eax, %ebx
	movl	12(%r15), %esi
	movl	%ebx, %edi
	callq	_iowrite8
	movl	8(%r15), %esi
	movl	%r12d, %edi
	callq	_iowrite8
	movl	4(%r15), %edi
	callq	_ioread8
                                        ## kill: def $eax killed $eax def $rax
	andl	$115, %eax
	leal	132(%rax), %edi
	movl	4(%r15), %esi
	callq	_iowrite8
	movl	(%r15), %esi
	movl	$131, %edi
	callq	_iowrite8
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## @__const.opti82c611a_set_piomode.khz
L___const.opti82c611a_set_piomode.khz:
	.long	50000                           ## 0xc350
	.long	40000                           ## 0x9c40
	.long	33000                           ## 0x80e8
	.long	25000                           ## 0x61a8

	.comm	_ATA_TIMING_SETUP,4,2           ## @ATA_TIMING_SETUP
	.no_dead_strip	_opti82c611a_set_piomode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function opti82c611a_set_piomode
_opti82c611a_set_piomode:               ; @opti82c611a_set_piomode
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	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
	mov	x20, x1
	mov	x19, x0
	mov	x0, x1
	bl	_ata_dev_pair
	mov	x21, x0
	ldr	w0, [x19, #16]
	bl	_ioread16
	ldr	w0, [x19, #16]
	bl	_ioread16
	ldr	w1, [x19]
	mov	w0, #3
	bl	_iowrite8
	ldr	w0, [x19, #20]
	bl	_ioread8
Lloh0:
	adrp	x8, l___const.opti82c611a_set_piomode.khz@PAGE
Lloh1:
	add	x8, x8, l___const.opti82c611a_set_piomode.khz@PAGEOFF
	and	w9, w0, #0x3
	ldr	w8, [x8, w9, uxtw #2]
	mov	w9, #51712
	movk	w9, #15258, lsl #16
	ldr	w1, [x20, #4]
	sdiv	w22, w9, w8
	add	x2, sp, #16
	mov	x0, x20
	mov	x3, x22
	mov	w4, #1000
	bl	_ata_timing_compute
	cbz	x21, LBB0_2
; %bb.1:
	ldr	w1, [x21, #4]
	mov	x2, sp
	mov	x0, x21
	mov	x3, x22
	mov	w4, #1000
	bl	_ata_timing_compute
Lloh2:
	adrp	x8, _ATA_TIMING_SETUP@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ATA_TIMING_SETUP@GOTPAGEOFF]
Lloh4:
	ldr	w3, [x8]
	add	x0, sp, #16
	mov	x1, sp
	add	x2, sp, #16
	bl	_ata_timing_merge
LBB0_2:
	ldr	w0, [sp, #24]
	mov	w1, #2
	mov	w2, #17
	bl	_clamp_val
	mov	x21, x0
	ldr	w0, [sp, #20]
	mov	w1, #1
	mov	w2, #16
	bl	_clamp_val
	sub	w23, w0, #1
	ldr	w0, [sp, #16]
	mov	w1, #1
	mov	w2, #4
	bl	_clamp_val
	mov	x22, x0
	ldr	w0, [x19, #4]
	bl	_ioread8
	ldr	w8, [x20]
	bfi	w0, w8, #7, #25
	ldr	w1, [x19, #4]
	bl	_iowrite8
	lsl	w8, w21, #4
	sub	w8, w8, #32
	orr	w21, w23, w8
	ldr	w1, [x19, #16]
	mov	x0, x21
	bl	_iowrite8
	ldr	w0, [x19, #12]
	bl	_ioread8
	and	w8, w0, #0xc0
	ldr	w9, [x20]
	lsl	w10, w22, #4
	sub	w10, w10, #12
	orr	w9, w9, w10
	orr	w0, w9, w8
	ldr	w1, [x19, #12]
	bl	_iowrite8
	ldr	w1, [x19, #8]
	mov	x0, x21
	bl	_iowrite8
	ldr	w0, [x19, #4]
	bl	_ioread8
	mov	w8, #115
	and	w8, w0, w8
	mov	w9, #132
	orr	w0, w8, w9
	ldr	w1, [x19, #4]
	bl	_iowrite8
	ldr	w1, [x19]
	mov	w0, #131
	bl	_iowrite8
	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
	add	sp, sp, #96
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__literal16,16byte_literals
	.p2align	2                               ; @__const.opti82c611a_set_piomode.khz
l___const.opti82c611a_set_piomode.khz:
	.long	50000                           ; 0xc350
	.long	40000                           ; 0x9c40
	.long	33000                           ; 0x80e8
	.long	25000                           ; 0x61a8

	.comm	_ATA_TIMING_SETUP,4,2           ; @ATA_TIMING_SETUP
	.no_dead_strip	_opti82c611a_set_piomode
.subsections_via_symbols
