	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cb710_mmc_select_clock_divider
_cb710_mmc_select_clock_divider:        ## @cb710_mmc_select_clock_divider
	.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
	movl	%esi, %r15d
	callq	_cb710_mmc_to_slot
	movq	%rax, %r14
	movq	%rax, %rdi
	callq	_cb710_slot_to_chip
	movq	(%rax), %r12
	leaq	-44(%rbp), %rdx
	movq	%r12, %rdi
	movl	$72, %esi
	callq	_pci_read_config_dword
	movzwl	-42(%rbp), %eax
	andl	$15, %eax
	movl	%eax, -44(%rbp)
	movq	_cb710_src_freq_mhz@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	imull	$1000000, (%rcx,%rax,4), %r13d  ## imm = 0xF4240
	movq	_CB710_MAX_DIVIDER_IDX@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	testl	%esi, %esi
	jle	LBB0_1
## %bb.3:
	movq	_cb710_clock_divider_log2@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rdi
	xorl	%edx, %edx
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movzbl	(%rdi,%rdx,4), %ecx
	movl	%r13d, %ebx
	sarl	%cl, %ebx
	cmpl	%r15d, %ebx
	jle	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	incq	%rdx
	cmpq	%rdx, %rsi
	jne	LBB0_4
## %bb.6:
	movl	%esi, %edx
LBB0_7:
	testl	%eax, %eax
	sete	%al
	testl	%edx, %edx
	je	LBB0_2
## %bb.8:
	movl	%edx, %ebx
	orl	$8, %ebx
	jmp	LBB0_9
LBB0_1:
	testl	%eax, %eax
	sete	%al
LBB0_2:
	movl	$1, %edx
	movl	$8, %ebx
LBB0_9:
	testb	%al, %al
	cmovnel	%edx, %ebx
	movl	%ebx, %ecx
	shll	$28, %ecx
	movq	%r12, %rdi
	movl	$64, %esi
	movl	$268435455, %edx                ## imm = 0xFFFFFFF
	callq	_cb710_pci_update_config_reg
	movq	%r14, %rdi
	callq	_cb710_slot_dev
	movq	_cb710_clock_divider_log2@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	%ebx, %r9d
	andl	$7, %r9d
	movb	(%rcx,%r9,4), %cl
	sarl	%cl, %r13d
	movl	-44(%rbp), %r8d
	andl	$8, %ebx
	movl	%ebx, (%rsp)
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edi
	movl	%r13d, %edx
	movl	%r15d, %ecx
                                        ## kill: def $r9d killed $r9d killed $r9
	callq	_dev_dbg
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_cb710_src_freq_mhz,8,3         ## @cb710_src_freq_mhz
	.comm	_CB710_MAX_DIVIDER_IDX,4,2      ## @CB710_MAX_DIVIDER_IDX
	.comm	_cb710_clock_divider_log2,8,3   ## @cb710_clock_divider_log2
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"clock set to %d Hz, wanted %d Hz; src_freq_idx = %d, divider_idx = %d|%d\n"

	.no_dead_strip	_cb710_mmc_select_clock_divider
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cb710_mmc_select_clock_divider
_cb710_mmc_select_clock_divider:        ; @cb710_mmc_select_clock_divider
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x19, x1
	bl	_cb710_mmc_to_slot
	mov	x20, x0
	bl	_cb710_slot_to_chip
	ldr	x21, [x0]
	add	x2, sp, #12
	mov	x0, x21
	mov	w1, #72
	bl	_pci_read_config_dword
	ldrh	w8, [sp, #14]
	and	x9, x8, #0xf
Lloh0:
	adrp	x8, _cb710_src_freq_mhz@GOTPAGE
Lloh1:
	ldr	x8, [x8, _cb710_src_freq_mhz@GOTPAGEOFF]
	str	w9, [sp, #12]
Lloh2:
	ldr	x8, [x8]
	ldr	w8, [x8, x9, lsl #2]
	mov	w10, #16960
	movk	w10, #15, lsl #16
	mul	w22, w8, w10
Lloh3:
	adrp	x8, _CB710_MAX_DIVIDER_IDX@GOTPAGE
Lloh4:
	ldr	x8, [x8, _CB710_MAX_DIVIDER_IDX@GOTPAGEOFF]
Lloh5:
	ldr	w10, [x8]
Lloh6:
	adrp	x23, _cb710_clock_divider_log2@GOTPAGE
Lloh7:
	ldr	x23, [x23, _cb710_clock_divider_log2@GOTPAGEOFF]
	cmp	w10, #0
	b.le	LBB0_7
; %bb.1:
	mov	x8, #0
	ldr	x11, [x23]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w12, [x11, x8, lsl #2]
	asr	w12, w22, w12
	cmp	w12, w19
	b.le	LBB0_5
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	add	x8, x8, #1
	cmp	x10, x8
	b.ne	LBB0_2
; %bb.4:
	mov	x8, x10
LBB0_5:
	cmp	w9, #0
	cset	w9, eq
	cbz	w8, LBB0_8
; %bb.6:
	orr	w10, w8, #0x8
	b	LBB0_9
LBB0_7:
	cmp	w9, #0
	cset	w9, eq
LBB0_8:
	mov	w8, #1
	mov	w10, #8
LBB0_9:
	cmp	w9, #0
	csel	w24, w8, w10, ne
	lsl	w3, w24, #28
	mov	x0, x21
	mov	w1, #64
	mov	w2, #268435455
	bl	_cb710_pci_update_config_reg
	mov	x0, x20
	bl	_cb710_slot_dev
	ldr	x8, [x23]
	and	w5, w24, #0x7
	ldr	w8, [x8, w5, uxtw #2]
	asr	w2, w22, w8
	ldr	w4, [sp, #12]
	and	w6, w24, #0x8
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	mov	x3, x19
	bl	_dev_dbg
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_cb710_src_freq_mhz,8,3         ; @cb710_src_freq_mhz
	.comm	_CB710_MAX_DIVIDER_IDX,4,2      ; @CB710_MAX_DIVIDER_IDX
	.comm	_cb710_clock_divider_log2,8,3   ; @cb710_clock_divider_log2
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"clock set to %d Hz, wanted %d Hz; src_freq_idx = %d, divider_idx = %d|%d\n"

	.no_dead_strip	_cb710_mmc_select_clock_divider
.subsections_via_symbols
