	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function it821x_clock_strategy
_it821x_clock_strategy:                 ## @it821x_clock_strategy
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	8(%rdi), %r12
	movl	4(%r12), %edi
	callq	_to_pci_dev
	movq	%rax, %r15
	movq	%r12, %rdi
	callq	_ide_get_hwifdata
	movq	%rax, %r13
	movq	%r14, %rdi
	callq	_ide_get_pair_dev
	movq	(%r13), %rdx
	movq	(%rdx), %rcx
	movq	8(%rdx), %rdx
	movl	(%rcx), %r8d
	movl	(%rdx), %ebx
	cmpl	%ebx, %r8d
	movq	%rdx, %rdi
	cmovgq	%rcx, %rdi
	movl	4(%rdi), %esi
	movq	_ATA_ANY@GOTPCREL(%rip), %rdi
	movl	(%rdi), %edi
	cmpl	%edi, %esi
	jne	LBB0_2
## %bb.1:
	cmpl	%ebx, %r8d
	cmovgq	%rdx, %rcx
	movl	4(%rcx), %esi
LBB0_2:
	cmpl	%edi, %esi
	je	LBB0_11
## %bb.3:
	cmpl	8(%r13), %esi
	je	LBB0_11
## %bb.4:
	movq	%r15, %rbx
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movl	(%r14), %eax
	andl	$1, %eax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	_ATA_66@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	xorl	%r15d, %r15d
	cmpl	%ecx, %esi
	setne	%al
	je	LBB0_6
## %bb.5:
	movq	_ATA_50@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
LBB0_6:
	movb	%al, %r15b
	movl	%ecx, 8(%r13)
	leaq	-44(%rbp), %rdx
	movq	%rbx, %rdi
	movl	$80, %esi
	callq	_pci_read_config_byte
	movb	(%r12), %cl
	incb	%cl
	shll	%cl, %r15d
	movl	-44(%rbp), %eax
	btrl	%ecx, %eax
	orl	%eax, %r15d
	movl	%r15d, -44(%rbp)
	movq	%rbx, %rdi
	movl	$80, %esi
	movl	%r15d, %edx
	callq	_pci_write_config_byte
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	testq	%r15, %r15
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	je	LBB0_9
## %bb.7:
	movq	16(%r13), %rax
	movq	%r12, %rbx
	xorq	$1, %rbx
	movq	(%rax,%rbx,8), %rsi
	movq	_UDMA_OFF@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rsi
	je	LBB0_9
## %bb.8:
	movq	%r15, %rdi
	callq	_it821x_program_udma
	movq	24(%r13), %rax
	movl	(%rax,%rbx,4), %esi
	movq	%r15, %rdi
	callq	_it821x_program
LBB0_9:
	movq	16(%r13), %rax
	movl	%r12d, %ebx
	movq	(%rax,%rbx,8), %rsi
	movq	_UDMA_OFF@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rsi
	je	LBB0_11
## %bb.10:
	movq	%r14, %rdi
	callq	_it821x_program_udma
	movq	24(%r13), %rax
	movl	(%rax,%rbx,4), %esi
	movq	%r14, %rdi
	callq	_it821x_program
LBB0_11:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ATA_ANY,4,2                    ## @ATA_ANY
	.comm	_ATA_66,4,2                     ## @ATA_66
	.comm	_ATA_50,4,2                     ## @ATA_50
	.comm	_UDMA_OFF,8,3                   ## @UDMA_OFF
	.no_dead_strip	_it821x_clock_strategy
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function it821x_clock_strategy
_it821x_clock_strategy:                 ; @it821x_clock_strategy
	.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	x19, x0
	ldr	x23, [x0, #8]
	ldr	w0, [x23, #4]
	bl	_to_pci_dev
	mov	x22, x0
	mov	x0, x23
	bl	_ide_get_hwifdata
	mov	x20, x0
	mov	x0, x19
	bl	_ide_get_pair_dev
	mov	x21, x0
	ldr	x8, [x20]
	ldp	x9, x10, [x8]
	ldr	w12, [x9]
	ldr	w13, [x10]
	cmp	w12, w13
	csel	x8, x9, x10, gt
	ldr	w8, [x8, #4]
Lloh0:
	adrp	x11, _ATA_ANY@GOTPAGE
Lloh1:
	ldr	x11, [x11, _ATA_ANY@GOTPAGEOFF]
Lloh2:
	ldr	w11, [x11]
	cmp	w8, w11
	b.ne	LBB0_2
; %bb.1:
	cmp	w12, w13
	csel	x8, x10, x9, gt
	ldr	w8, [x8, #4]
LBB0_2:
	cmp	w8, w11
	b.eq	LBB0_9
; %bb.3:
	ldr	w9, [x20, #8]
	cmp	w8, w9
	b.eq	LBB0_9
; %bb.4:
	ldr	w9, [x19]
	and	x24, x9, #0x1
Lloh3:
	adrp	x9, _ATA_66@GOTPAGE
Lloh4:
	ldr	x9, [x9, _ATA_66@GOTPAGEOFF]
Lloh5:
	adrp	x10, _ATA_50@GOTPAGE
Lloh6:
	ldr	x10, [x10, _ATA_50@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
Lloh8:
	ldr	w10, [x10]
	cmp	w8, w9
	csel	w8, w9, w10, eq
	cset	w25, ne
	str	w8, [x20, #8]
	add	x2, sp, #12
	mov	x0, x22
	mov	w1, #80
	bl	_pci_read_config_byte
	ldr	w8, [x23]
	add	w8, w8, #1
	mov	w9, #1
	lsl	w9, w9, w8
	ldr	w10, [sp, #12]
	bic	w9, w10, w9
	lsl	w8, w25, w8
	orr	w2, w8, w9
	str	w2, [sp, #12]
	mov	x0, x22
	mov	w1, #80
	bl	_pci_write_config_byte
Lloh9:
	adrp	x22, _UDMA_OFF@GOTPAGE
Lloh10:
	ldr	x22, [x22, _UDMA_OFF@GOTPAGEOFF]
	cbz	x21, LBB0_7
; %bb.5:
	ldr	x8, [x20, #16]
	eor	x23, x24, #0x1
	ldr	x1, [x8, x23, lsl #3]
	ldr	x8, [x22]
	cmp	x1, x8
	b.eq	LBB0_7
; %bb.6:
	mov	x0, x21
	bl	_it821x_program_udma
	ldr	x8, [x20, #24]
	ldr	w1, [x8, x23, lsl #2]
	mov	x0, x21
	bl	_it821x_program
LBB0_7:
	ldr	x8, [x20, #16]
	ldr	x1, [x8, w24, uxtw #3]
	ldr	x8, [x22]
	cmp	x1, x8
	b.eq	LBB0_9
; %bb.8:
	mov	w21, w24
	mov	x0, x19
	bl	_it821x_program_udma
	ldr	x8, [x20, #24]
	ldr	w1, [x8, x21, lsl #2]
	mov	x0, x19
	bl	_it821x_program
LBB0_9:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_ATA_ANY,4,2                    ; @ATA_ANY
	.comm	_ATA_66,4,2                     ; @ATA_66
	.comm	_ATA_50,4,2                     ; @ATA_50
	.comm	_UDMA_OFF,8,3                   ; @UDMA_OFF
	.no_dead_strip	_it821x_clock_strategy
.subsections_via_symbols
