	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function jz4780_i2c_set_speed
_jz4780_i2c_set_speed:                  ## @jz4780_i2c_set_speed
	.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	%rdi, %r14
	movl	8(%rdi), %edi
	callq	_clk_get_rate
	cltq
	imulq	$274877907, %rax, %r12          ## imm = 0x10624DD3
	movq	%r12, %rax
	shrq	$63, %rax
	sarq	$38, %r12
	addl	%eax, %r12d
	movl	(%r14), %ebx
	movq	%r14, %rdi
	callq	_jz4780_i2c_disable
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	leaq	4(%r14), %rdi
	leaq	L_.str(%rip), %rsi
	callq	_dev_dbg
LBB0_2:
	movl	%r12d, %eax
	cltd
	idivl	%ebx
	movl	%eax, %r15d
	cmpl	$100, %ebx
	jg	LBB0_4
## %bb.3:
	imull	$4000, %r15d, %eax              ## imm = 0xFA0
	cltq
	imulq	$1011045175, %rax, %rbx         ## imm = 0x3C435337
	movq	%rbx, %rax
	shrq	$63, %rax
	sarq	$43, %rbx
	addl	%eax, %ebx
	subl	%ebx, %r15d
	movq	_JZ4780_I2C_CTRL_SPDS@GOTPCREL(%rip), %rax
	movq	_JZ4780_I2C_CTRL_REST@GOTPCREL(%rip), %rcx
	movzwl	(%rcx), %ecx
	orw	(%rax), %cx
	movzwl	%cx, %eax
	movq	_JZ4780_I2C_CTRL_SLVDIS@GOTPCREL(%rip), %rcx
	movzwl	(%rcx), %ecx
	movq	_JZ4780_I2C_CTRL_MD@GOTPCREL(%rip), %rdx
	movzwl	(%rdx), %edx
	orl	%ecx, %edx
	orl	%eax, %edx
	movq	_JZ4780_I2C_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_jz4780_i2c_writew
	movq	_JZ4780_I2C_SHCNT@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movl	%ebx, %edi
	callq	_JZ4780_I2CSHCNT_ADJUST
	movq	%r14, %rdi
	movl	%r13d, %esi
	movl	%eax, %edx
	callq	_jz4780_i2c_writew
	movq	_JZ4780_I2C_SLCNT@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movl	%r15d, %edi
	callq	_JZ4780_I2CSLCNT_ADJUST
	movq	%r14, %rdi
	movl	%ebx, %esi
	movl	%eax, %edx
	callq	_jz4780_i2c_writew
	movl	$300, %eax                      ## imm = 0x12C
	movl	$400, %r15d                     ## imm = 0x190
	jmp	LBB0_5
LBB0_4:
	imull	$600, %r15d, %eax               ## imm = 0x258
	cltq
	imulq	$1157380661, %rax, %rbx         ## imm = 0x44FC3A35
	movq	%rbx, %rax
	shrq	$63, %rax
	sarq	$41, %rbx
	addl	%eax, %ebx
	subl	%ebx, %r15d
	movq	_JZ4780_I2C_CTRL_SPDF@GOTPCREL(%rip), %rax
	movq	_JZ4780_I2C_CTRL_REST@GOTPCREL(%rip), %rcx
	movzwl	(%rcx), %ecx
	orw	(%rax), %cx
	movzwl	%cx, %eax
	movq	_JZ4780_I2C_CTRL_SLVDIS@GOTPCREL(%rip), %rcx
	movzwl	(%rcx), %ecx
	movq	_JZ4780_I2C_CTRL_MD@GOTPCREL(%rip), %rdx
	movzwl	(%rdx), %edx
	orl	%ecx, %edx
	orl	%eax, %edx
	movq	_JZ4780_I2C_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_jz4780_i2c_writew
	movq	_JZ4780_I2C_FHCNT@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movl	%ebx, %edi
	callq	_JZ4780_I2CFHCNT_ADJUST
	movq	%r14, %rdi
	movl	%r13d, %esi
	movl	%eax, %edx
	callq	_jz4780_i2c_writew
	movq	_JZ4780_I2C_FLCNT@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movl	%r15d, %edi
	callq	_JZ4780_I2CFLCNT_ADJUST
	movq	%r14, %rdi
	movl	%ebx, %esi
	movl	%eax, %edx
	callq	_jz4780_i2c_writew
	movl	$450, %r15d                     ## imm = 0x1C2
	movl	$450, %eax                      ## imm = 0x1C2
LBB0_5:
	imull	%r12d, %r15d
	imull	%r12d, %eax
	cltq
	imulq	$1125899907, %rax, %rax         ## imm = 0x431BDE83
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$50, %rax
	addl	%ecx, %eax
	cmpl	$254, %eax
	movl	$254, %edx
	cmovll	%eax, %edx
	xorl	%ebx, %ebx
	testl	%edx, %edx
	cmovlel	%ebx, %edx
	incl	%edx
	movq	_JZ4780_I2C_SDASU@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_jz4780_i2c_writew
	cmpl	$1000000, %r15d                 ## imm = 0xF4240
	jl	LBB0_7
## %bb.6:
	movl	%r15d, %eax
	imulq	$1125899907, %rax, %rax         ## imm = 0x431BDE83
	shrq	$50, %rax
	cmpl	$256, %eax                      ## imm = 0x100
	movl	$256, %ebx                      ## imm = 0x100
	cmovll	%eax, %ebx
	decl	%ebx
	movq	_JZ4780_I2C_SDAHD_HDENB@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
LBB0_7:
	movq	_JZ4780_I2C_SDAHD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	%ebx, %edx
	callq	_jz4780_i2c_writew
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"i2c not disabled\n"

	.comm	_JZ4780_I2C_CTRL_SPDS,2,1       ## @JZ4780_I2C_CTRL_SPDS
	.comm	_JZ4780_I2C_CTRL_REST,2,1       ## @JZ4780_I2C_CTRL_REST
	.comm	_JZ4780_I2C_CTRL_SLVDIS,2,1     ## @JZ4780_I2C_CTRL_SLVDIS
	.comm	_JZ4780_I2C_CTRL_MD,2,1         ## @JZ4780_I2C_CTRL_MD
	.comm	_JZ4780_I2C_CTRL,4,2            ## @JZ4780_I2C_CTRL
	.comm	_JZ4780_I2C_SHCNT,4,2           ## @JZ4780_I2C_SHCNT
	.comm	_JZ4780_I2C_SLCNT,4,2           ## @JZ4780_I2C_SLCNT
	.comm	_JZ4780_I2C_CTRL_SPDF,2,1       ## @JZ4780_I2C_CTRL_SPDF
	.comm	_JZ4780_I2C_FHCNT,4,2           ## @JZ4780_I2C_FHCNT
	.comm	_JZ4780_I2C_FLCNT,4,2           ## @JZ4780_I2C_FLCNT
	.comm	_JZ4780_I2C_SDASU,4,2           ## @JZ4780_I2C_SDASU
	.comm	_JZ4780_I2C_SDAHD_HDENB,4,2     ## @JZ4780_I2C_SDAHD_HDENB
	.comm	_JZ4780_I2C_SDAHD,4,2           ## @JZ4780_I2C_SDAHD
	.no_dead_strip	_jz4780_i2c_set_speed
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function jz4780_i2c_set_speed
_jz4780_i2c_set_speed:                  ; @jz4780_i2c_set_speed
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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, x0
	ldr	w0, [x0, #8]
	bl	_clk_get_rate
	mov	w8, #19923
	movk	w8, #4194, lsl #16
	smull	x8, w0, w8
	lsr	x9, x8, #63
	asr	x8, x8, #38
	add	w23, w8, w9
	ldr	w20, [x19]
	mov	x0, x19
	bl	_jz4780_i2c_disable
	cbz	x0, LBB0_2
; %bb.1:
	add	x0, x19, #4
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
LBB0_2:
	sdiv	w8, w23, w20
	cmp	w20, #100
	b.gt	LBB0_4
; %bb.3:
	mov	w9, #4000
	mul	w9, w8, w9
	mov	w10, #21303
	movk	w10, #15427, lsl #16
	smull	x9, w9, w10
	lsr	x10, x9, #63
Lloh2:
	adrp	x11, _JZ4780_I2C_CTRL_SPDS@GOTPAGE
Lloh3:
	ldr	x11, [x11, _JZ4780_I2C_CTRL_SPDS@GOTPAGEOFF]
	ldrh	w11, [x11]
Lloh4:
	adrp	x12, _JZ4780_I2C_CTRL_REST@GOTPAGE
Lloh5:
	ldr	x12, [x12, _JZ4780_I2C_CTRL_REST@GOTPAGEOFF]
	ldrh	w12, [x12]
	orr	w11, w12, w11
Lloh6:
	adrp	x12, _JZ4780_I2C_CTRL_SLVDIS@GOTPAGE
Lloh7:
	ldr	x12, [x12, _JZ4780_I2C_CTRL_SLVDIS@GOTPAGEOFF]
	asr	x9, x9, #43
	ldrh	w12, [x12]
	orr	w11, w11, w12
Lloh8:
	adrp	x12, _JZ4780_I2C_CTRL_MD@GOTPAGE
Lloh9:
	ldr	x12, [x12, _JZ4780_I2C_CTRL_MD@GOTPAGEOFF]
	add	w20, w9, w10
	sub	w21, w8, w20
	ldrh	w8, [x12]
	orr	w2, w11, w8
Lloh10:
	adrp	x8, _JZ4780_I2C_CTRL@GOTPAGE
Lloh11:
	ldr	x8, [x8, _JZ4780_I2C_CTRL@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_jz4780_i2c_writew
Lloh13:
	adrp	x8, _JZ4780_I2C_SHCNT@GOTPAGE
Lloh14:
	ldr	x8, [x8, _JZ4780_I2C_SHCNT@GOTPAGEOFF]
Lloh15:
	ldr	w22, [x8]
	mov	x0, x20
	bl	_JZ4780_I2CSHCNT_ADJUST
	mov	x2, x0
	mov	x0, x19
	mov	x1, x22
	bl	_jz4780_i2c_writew
Lloh16:
	adrp	x8, _JZ4780_I2C_SLCNT@GOTPAGE
Lloh17:
	ldr	x8, [x8, _JZ4780_I2C_SLCNT@GOTPAGEOFF]
Lloh18:
	ldr	w20, [x8]
	mov	x0, x21
	bl	_JZ4780_I2CSLCNT_ADJUST
	mov	x2, x0
	mov	x0, x19
	mov	x1, x20
	bl	_jz4780_i2c_writew
	mov	w9, #300
	mov	w8, #400
	b	LBB0_5
LBB0_4:
	mov	w9, #600
	mul	w9, w8, w9
	mov	w10, #14901
	movk	w10, #17660, lsl #16
	smull	x9, w9, w10
	lsr	x10, x9, #63
Lloh19:
	adrp	x11, _JZ4780_I2C_CTRL_SPDF@GOTPAGE
Lloh20:
	ldr	x11, [x11, _JZ4780_I2C_CTRL_SPDF@GOTPAGEOFF]
	ldrh	w11, [x11]
Lloh21:
	adrp	x12, _JZ4780_I2C_CTRL_REST@GOTPAGE
Lloh22:
	ldr	x12, [x12, _JZ4780_I2C_CTRL_REST@GOTPAGEOFF]
	ldrh	w12, [x12]
	orr	w11, w12, w11
Lloh23:
	adrp	x12, _JZ4780_I2C_CTRL_SLVDIS@GOTPAGE
Lloh24:
	ldr	x12, [x12, _JZ4780_I2C_CTRL_SLVDIS@GOTPAGEOFF]
	asr	x9, x9, #41
	ldrh	w12, [x12]
	orr	w11, w11, w12
Lloh25:
	adrp	x12, _JZ4780_I2C_CTRL_MD@GOTPAGE
Lloh26:
	ldr	x12, [x12, _JZ4780_I2C_CTRL_MD@GOTPAGEOFF]
	add	w20, w9, w10
	sub	w21, w8, w20
	ldrh	w8, [x12]
	orr	w2, w11, w8
Lloh27:
	adrp	x8, _JZ4780_I2C_CTRL@GOTPAGE
Lloh28:
	ldr	x8, [x8, _JZ4780_I2C_CTRL@GOTPAGEOFF]
Lloh29:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_jz4780_i2c_writew
Lloh30:
	adrp	x8, _JZ4780_I2C_FHCNT@GOTPAGE
Lloh31:
	ldr	x8, [x8, _JZ4780_I2C_FHCNT@GOTPAGEOFF]
Lloh32:
	ldr	w22, [x8]
	mov	x0, x20
	bl	_JZ4780_I2CFHCNT_ADJUST
	mov	x2, x0
	mov	x0, x19
	mov	x1, x22
	bl	_jz4780_i2c_writew
Lloh33:
	adrp	x8, _JZ4780_I2C_FLCNT@GOTPAGE
Lloh34:
	ldr	x8, [x8, _JZ4780_I2C_FLCNT@GOTPAGEOFF]
Lloh35:
	ldr	w20, [x8]
	mov	x0, x21
	bl	_JZ4780_I2CFLCNT_ADJUST
	mov	x2, x0
	mov	x0, x19
	mov	x1, x20
	bl	_jz4780_i2c_writew
	mov	w8, #450
	mov	w9, #450
LBB0_5:
	mov	w20, #16960
	movk	w20, #15, lsl #16
	mul	w21, w8, w23
	mul	w8, w9, w23
	mov	w9, #56963
	movk	w9, #17179, lsl #16
	smull	x8, w8, w9
	lsr	x9, x8, #63
	asr	x8, x8, #50
	add	w8, w8, w9
	mov	w9, #254
	cmp	w8, #254
	csel	w8, w8, w9, lt
	cmp	w8, #0
	csel	w8, w8, wzr, gt
	add	w2, w8, #1
Lloh36:
	adrp	x8, _JZ4780_I2C_SDASU@GOTPAGE
Lloh37:
	ldr	x8, [x8, _JZ4780_I2C_SDASU@GOTPAGEOFF]
Lloh38:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_jz4780_i2c_writew
	mov	w2, #0
	sub	w8, w20, #1
	cmp	w21, w8
	b.le	LBB0_7
; %bb.6:
	udiv	w8, w21, w20
	mov	w9, #256
	cmp	w8, #256
	csel	w8, w8, w9, lt
	sub	w8, w8, #1
Lloh39:
	adrp	x9, _JZ4780_I2C_SDAHD_HDENB@GOTPAGE
Lloh40:
	ldr	x9, [x9, _JZ4780_I2C_SDAHD_HDENB@GOTPAGEOFF]
Lloh41:
	ldr	w9, [x9]
	orr	w2, w9, w8
LBB0_7:
Lloh42:
	adrp	x8, _JZ4780_I2C_SDAHD@GOTPAGE
Lloh43:
	ldr	x8, [x8, _JZ4780_I2C_SDAHD@GOTPAGEOFF]
Lloh44:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_jz4780_i2c_writew
	mov	w0, #0
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"i2c not disabled\n"

	.comm	_JZ4780_I2C_CTRL_SPDS,2,1       ; @JZ4780_I2C_CTRL_SPDS
	.comm	_JZ4780_I2C_CTRL_REST,2,1       ; @JZ4780_I2C_CTRL_REST
	.comm	_JZ4780_I2C_CTRL_SLVDIS,2,1     ; @JZ4780_I2C_CTRL_SLVDIS
	.comm	_JZ4780_I2C_CTRL_MD,2,1         ; @JZ4780_I2C_CTRL_MD
	.comm	_JZ4780_I2C_CTRL,4,2            ; @JZ4780_I2C_CTRL
	.comm	_JZ4780_I2C_SHCNT,4,2           ; @JZ4780_I2C_SHCNT
	.comm	_JZ4780_I2C_SLCNT,4,2           ; @JZ4780_I2C_SLCNT
	.comm	_JZ4780_I2C_CTRL_SPDF,2,1       ; @JZ4780_I2C_CTRL_SPDF
	.comm	_JZ4780_I2C_FHCNT,4,2           ; @JZ4780_I2C_FHCNT
	.comm	_JZ4780_I2C_FLCNT,4,2           ; @JZ4780_I2C_FLCNT
	.comm	_JZ4780_I2C_SDASU,4,2           ; @JZ4780_I2C_SDASU
	.comm	_JZ4780_I2C_SDAHD_HDENB,4,2     ; @JZ4780_I2C_SDAHD_HDENB
	.comm	_JZ4780_I2C_SDAHD,4,2           ; @JZ4780_I2C_SDAHD
	.no_dead_strip	_jz4780_i2c_set_speed
.subsections_via_symbols
