	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function stu300_set_clk
_stu300_set_clk:                        ## @stu300_set_clk
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r13
	movq	%rdi, %r14
	movq	_stu300_clktable@GOTPCREL(%rip), %r15
	movq	(%r15), %rdi
	callq	_ARRAY_SIZE
	testl	%eax, %eax
	jle	LBB0_1
## %bb.2:
	xorl	%ebx, %ebx
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r15), %rdi
	cmpq	%r13, (%rdi,%rbx)
	jae	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	incq	%r12
	callq	_ARRAY_SIZE
	cltq
	addq	$16, %rbx
	cmpq	%rax, %r12
	jl	LBB0_3
	jmp	LBB0_5
LBB0_1:
	xorl	%r12d, %r12d
LBB0_5:
	movq	(%r15), %rax
	movl	%r12d, %ecx
	shlq	$4, %rcx
	movl	8(%rax,%rcx), %edi
	cmpl	$255, %edi
	jne	LBB0_7
## %bb.6:
	movq	16(%r14), %rdi
	testl	%r12d, %r12d
	leaq	L_.str.2(%rip), %rax
	leaq	L_.str.1(%rip), %rdx
	cmoveq	%rax, %rdx
	leaq	L_.str(%rip), %rsi
	xorl	%r15d, %r15d
	movq	%r13, %rcx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_19
LBB0_7:
	movq	_I2C_OAR2@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r14), %rsi
	callq	_stu300_wr8
	movq	16(%r14), %rdi
	movl	(%r14), %ecx
	movq	8(%r14), %r8
	leaq	L_.str.3(%rip), %rsi
	movl	%r13d, %edx
	xorl	%eax, %eax
	callq	_dev_dbg
	movslq	(%r14), %rsi
	movl	%esi, %ecx
	movq	%r13, %rax
	cmpq	$100001, %rsi                   ## imm = 0x186A1
	jl	LBB0_12
## %bb.8:
	shrq	$32, %rax
	je	LBB0_9
## %bb.10:
	movq	%r13, %rax
	xorl	%edx, %edx
	divq	%rcx
	jmp	LBB0_11
LBB0_12:
	orq	%rsi, %rax
	shrq	$32, %rax
	je	LBB0_13
## %bb.14:
	movq	%r13, %rax
	xorl	%edx, %edx
	divq	%rsi
	jmp	LBB0_15
LBB0_9:
	movl	%r13d, %eax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $eax killed $eax def $rax
LBB0_11:
	addq	$-9, %rax
	movabsq	$-6148914691236517205, %rdx     ## imm = 0xAAAAAAAAAAAAAAAB
	mulq	%rdx
	movq	%rdx, %r12
	jmp	LBB0_16
LBB0_13:
	movl	%r13d, %eax
	xorl	%edx, %edx
	divl	%esi
                                        ## kill: def $eax killed $eax def $rax
LBB0_15:
	movabsq	$8589934585, %r12               ## imm = 0x1FFFFFFF9
	addq	%rax, %r12
LBB0_16:
	shrq	%r12
	incl	%r12d
	cmpl	$1, %r12d
	jg	LBB0_20
## %bb.17:
	movq	16(%r14), %rdi
	leaq	L_.str.4(%rip), %rsi
	jmp	LBB0_18
LBB0_20:
	cmpl	$4096, %r12d                    ## imm = 0x1000
	jae	LBB0_21
## %bb.22:
	movq	_I2C_CCR_CC_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	%r12d, %eax
	xorl	%r15d, %r15d
	cmpl	$100001, %ecx                   ## imm = 0x186A1
	movq	_I2C_CCR_FMSM@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	cmovll	%r15d, %edi
	leaq	L_.str.6(%rip), %rcx
	leaq	L_.str.7(%rip), %rbx
	cmovgeq	%rcx, %rbx
	orl	%eax, %edi
	movq	_I2C_CCR@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r14), %rsi
	callq	_stu300_wr8
	movq	16(%r14), %rdi
	movq	%rbx, %rsi
	movl	%r12d, %edx
	xorl	%eax, %eax
	callq	_dev_dbg
	shrl	$7, %r12d
	movq	_I2C_ECCR@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r14), %rsi
	movl	%r12d, %edi
	callq	_stu300_wr8
	jmp	LBB0_23
LBB0_21:
	movq	16(%r14), %rdi
	leaq	L_.str.5(%rip), %rsi
LBB0_18:
	xorl	%r15d, %r15d
	movq	%r13, %rdx
	xorl	%eax, %eax
	callq	_dev_err
LBB0_19:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
LBB0_23:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_stu300_clktable,8,3            ## @stu300_clktable
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"too %s clock rate requested (%lu Hz).\n"

L_.str.1:                               ## @.str.1
	.asciz	"high"

L_.str.2:                               ## @.str.2
	.asciz	"low"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_I2C_OAR2,8,3                   ## @I2C_OAR2
L_.str.3:                               ## @.str.3
	.asciz	"Clock rate %lu Hz, I2C bus speed %d Hz virtbase %p\n"

L_.str.4:                               ## @.str.4
	.asciz	"too low clock rate (%lu Hz).\n"

L_.str.5:                               ## @.str.5
	.asciz	"too high clock rate (%lu Hz).\n"

	.comm	_I2C_CCR_CC_MASK,4,2            ## @I2C_CCR_CC_MASK
	.comm	_I2C_CCR_FMSM,4,2               ## @I2C_CCR_FMSM
	.comm	_I2C_CCR,8,3                    ## @I2C_CCR
L_.str.6:                               ## @.str.6
	.asciz	"set clock divider to 0x%08x, Fast Mode I2C\n"

L_.str.7:                               ## @.str.7
	.asciz	"set clock divider to 0x%08x, Standard Mode I2C\n"

	.comm	_I2C_ECCR,8,3                   ## @I2C_ECCR
	.no_dead_strip	_stu300_set_clk
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function stu300_set_clk
_stu300_set_clk:                        ; @stu300_set_clk
	.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	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x21, _stu300_clktable@GOTPAGE
Lloh1:
	ldr	x21, [x21, _stu300_clktable@GOTPAGEOFF]
	ldr	x0, [x21]
	bl	_ARRAY_SIZE
	cmp	w0, #1
	b.lt	LBB0_4
; %bb.1:
	mov	x23, #0
	mov	x22, #0
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x0, [x21]
	ldr	x8, [x0, x23]
	cmp	x8, x20
	b.hs	LBB0_5
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	add	x22, x22, #1
	bl	_ARRAY_SIZE
	add	x23, x23, #16
	cmp	x22, w0, sxtw
	b.lt	LBB0_2
	b	LBB0_5
LBB0_4:
	mov	w22, #0
LBB0_5:
	ldr	x8, [x21]
	add	x8, x8, w22, uxtw #4
	ldr	w0, [x8, #8]
	cmp	w0, #255
	b.ne	LBB0_7
; %bb.6:
	ldr	x0, [x19, #16]
Lloh2:
	adrp	x8, l_.str.1@PAGE
Lloh3:
	add	x8, x8, l_.str.1@PAGEOFF
Lloh4:
	adrp	x9, l_.str.2@PAGE
Lloh5:
	add	x9, x9, l_.str.2@PAGEOFF
	cmp	w22, #0
	csel	x8, x9, x8, eq
	stp	x8, x20, [sp]
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_12
LBB0_7:
	ldr	x8, [x19, #8]
Lloh8:
	adrp	x9, _I2C_OAR2@GOTPAGE
Lloh9:
	ldr	x9, [x9, _I2C_OAR2@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_stu300_wr8
	ldp	x8, x0, [x19, #8]
	ldr	w9, [x19]
	stp	x9, x8, [sp]
Lloh11:
	adrp	x1, l_.str.3@PAGE
Lloh12:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x2, x20
	bl	_dev_dbg
	ldr	w8, [x19]
	sxtw	x9, w8
	mov	w10, #34465
	movk	w10, #1, lsl #16
	udiv	x9, x20, x9
	mov	x11, #8589869056
	movk	x11, #65529
	add	x9, x9, x11
	lsr	x9, x9, #1
	udiv	x11, x20, x8
	sub	x11, x11, #9
	mov	x12, #-6148914691236517206
	movk	x12, #43691
	umulh	x11, x11, x12
	lsr	x11, x11, #1
	cmp	w8, w10
	csel	x9, x9, x11, lt
	add	w21, w9, #1
	cmp	w21, #1
	b.gt	LBB0_9
; %bb.8:
	ldr	x0, [x19, #16]
	str	x20, [sp]
Lloh13:
	adrp	x1, l_.str.4@PAGE
Lloh14:
	add	x1, x1, l_.str.4@PAGEOFF
	b	LBB0_12
LBB0_9:
	cmp	w21, #1, lsl #12                ; =4096
	b.hs	LBB0_11
; %bb.10:
Lloh15:
	adrp	x9, _I2C_CCR_CC_MASK@GOTPAGE
Lloh16:
	ldr	x9, [x9, _I2C_CCR_CC_MASK@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	and	w9, w9, w21
Lloh18:
	adrp	x10, _I2C_CCR_FMSM@GOTPAGE
Lloh19:
	ldr	x10, [x10, _I2C_CCR_FMSM@GOTPAGEOFF]
Lloh20:
	ldr	w10, [x10]
	mov	w11, #34464
	movk	w11, #1, lsl #16
	cmp	w8, w11
	csel	w8, w10, wzr, gt
	orr	w0, w9, w8
Lloh21:
	adrp	x8, l_.str.7@PAGE
Lloh22:
	add	x8, x8, l_.str.7@PAGEOFF
Lloh23:
	adrp	x9, l_.str.6@PAGE
Lloh24:
	add	x9, x9, l_.str.6@PAGEOFF
	csel	x20, x9, x8, gt
	ldr	x8, [x19, #8]
Lloh25:
	adrp	x9, _I2C_CCR@GOTPAGE
Lloh26:
	ldr	x9, [x9, _I2C_CCR@GOTPAGEOFF]
Lloh27:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_stu300_wr8
	ldr	x0, [x19, #16]
	mov	x1, x20
	mov	x2, x21
	bl	_dev_dbg
	lsr	w0, w21, #7
	ldr	x8, [x19, #8]
Lloh28:
	adrp	x9, _I2C_ECCR@GOTPAGE
Lloh29:
	ldr	x9, [x9, _I2C_ECCR@GOTPAGEOFF]
Lloh30:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_stu300_wr8
	mov	w0, #0
	b	LBB0_13
LBB0_11:
	ldr	x0, [x19, #16]
	str	x20, [sp]
Lloh31:
	adrp	x1, l_.str.5@PAGE
Lloh32:
	add	x1, x1, l_.str.5@PAGEOFF
LBB0_12:
	bl	_dev_err
Lloh33:
	adrp	x8, _EINVAL@GOTPAGE
Lloh34:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh35:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_13:
	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	Lloh0, Lloh1
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
	.comm	_stu300_clktable,8,3            ; @stu300_clktable
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"too %s clock rate requested (%lu Hz).\n"

l_.str.1:                               ; @.str.1
	.asciz	"high"

l_.str.2:                               ; @.str.2
	.asciz	"low"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_I2C_OAR2,8,3                   ; @I2C_OAR2
l_.str.3:                               ; @.str.3
	.asciz	"Clock rate %lu Hz, I2C bus speed %d Hz virtbase %p\n"

l_.str.4:                               ; @.str.4
	.asciz	"too low clock rate (%lu Hz).\n"

l_.str.5:                               ; @.str.5
	.asciz	"too high clock rate (%lu Hz).\n"

	.comm	_I2C_CCR_CC_MASK,4,2            ; @I2C_CCR_CC_MASK
	.comm	_I2C_CCR_FMSM,4,2               ; @I2C_CCR_FMSM
	.comm	_I2C_CCR,8,3                    ; @I2C_CCR
l_.str.6:                               ; @.str.6
	.asciz	"set clock divider to 0x%08x, Fast Mode I2C\n"

l_.str.7:                               ; @.str.7
	.asciz	"set clock divider to 0x%08x, Standard Mode I2C\n"

	.comm	_I2C_ECCR,8,3                   ; @I2C_ECCR
	.no_dead_strip	_stu300_set_clk
.subsections_via_symbols
