	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_i2c_set_speed
_mtk_i2c_set_speed:                     ## @mtk_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	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %eax
	movq	%rdi, %rbx
	xorl	%edx, %edx
	divl	(%rdi)
	movl	%eax, %r14d
	movl	4(%rdi), %r15d
	movq	_MAX_FS_MODE_SPEED@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	cmpl	%edx, %r15d
	jbe	LBB0_5
## %bb.1:
	leaq	-40(%rbp), %rcx
	leaq	-36(%rbp), %r8
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_mtk_i2c_calculate_speed
	testl	%eax, %eax
	js	LBB0_10
## %bb.2:
	movl	-36(%rbp), %eax
	shll	$8, %eax
	orl	-40(%rbp), %eax
	movl	%eax, 8(%rbx)
	leaq	-32(%rbp), %rcx
	leaq	-28(%rbp), %r8
	movq	%rbx, %rdi
	movl	%r14d, %esi
	movl	%r15d, %edx
	callq	_mtk_i2c_calculate_speed
	testl	%eax, %eax
	js	LBB0_10
## %bb.3:
	movq	_I2C_TIME_DEFAULT_VALUE@GOTPCREL(%rip), %rax
	movl	-28(%rbp), %ecx
	shll	$12, %ecx
	movl	(%rax), %edx
	orl	%ecx, %edx
	movl	-32(%rbp), %eax
	movl	%eax, %esi
	shll	$8, %esi
	orl	%edx, %esi
	movl	%esi, 12(%rbx)
	movq	24(%rbx), %rdx
	cmpq	$0, (%rdx)
	je	LBB0_9
## %bb.4:
	movl	-36(%rbp), %edx
	shll	$6, %edx
	shll	$9, %eax
	orl	%ecx, %eax
	orl	-40(%rbp), %eax
	orl	%edx, %eax
	jmp	LBB0_8
LBB0_5:
	leaq	-32(%rbp), %rcx
	leaq	-28(%rbp), %r8
	movq	%rbx, %rdi
	movl	%r14d, %esi
	movl	%r15d, %edx
	callq	_mtk_i2c_calculate_speed
	testl	%eax, %eax
	js	LBB0_10
## %bb.6:
	movl	-28(%rbp), %eax
	movl	%eax, %edx
	shll	$8, %edx
	movl	-32(%rbp), %ecx
	orl	%ecx, %edx
	movl	%edx, 8(%rbx)
	movq	_I2C_TIME_CLR_VALUE@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	movl	%edx, 12(%rbx)
	movq	24(%rbx), %rdx
	cmpq	$0, (%rdx)
	je	LBB0_9
## %bb.7:
	shll	$6, %eax
	orl	%ecx, %eax
LBB0_8:
	movl	%eax, 16(%rbx)
LBB0_9:
	xorl	%eax, %eax
LBB0_10:
	addq	$24, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_FS_MODE_SPEED,4,2          ## @MAX_FS_MODE_SPEED
	.comm	_I2C_TIME_DEFAULT_VALUE,4,2     ## @I2C_TIME_DEFAULT_VALUE
	.comm	_I2C_TIME_CLR_VALUE,4,2         ## @I2C_TIME_CLR_VALUE
	.no_dead_strip	_mtk_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 mtk_i2c_set_speed
_mtk_i2c_set_speed:                     ; @mtk_i2c_set_speed
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x19, x0
	ldp	w8, w20, [x0]
	udiv	w21, w1, w8
Lloh0:
	adrp	x8, _MAX_FS_MODE_SPEED@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MAX_FS_MODE_SPEED@GOTPAGEOFF]
Lloh2:
	ldr	w2, [x8]
	cmp	w20, w2
	b.ls	LBB0_5
; %bb.1:
	add	x3, sp, #4
	mov	x4, sp
	mov	x0, x19
	mov	x1, x21
	bl	_mtk_i2c_calculate_speed
	tbnz	w0, #31, LBB0_10
; %bb.2:
	ldp	w8, w9, [sp]
	orr	w8, w9, w8, lsl #8
	str	w8, [x19, #8]
	add	x3, sp, #12
	add	x4, sp, #8
	mov	x0, x19
	mov	x1, x21
	mov	x2, x20
	bl	_mtk_i2c_calculate_speed
	tbnz	w0, #31, LBB0_10
; %bb.3:
Lloh3:
	adrp	x8, _I2C_TIME_DEFAULT_VALUE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _I2C_TIME_DEFAULT_VALUE@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x8]
	ldr	w8, [sp, #8]
	lsl	w8, w8, #12
	orr	w10, w8, w9
	ldr	w9, [sp, #12]
	orr	w10, w10, w9, lsl #8
	str	w10, [x19, #12]
	ldr	x10, [x19, #24]
	ldr	x10, [x10]
	cbz	x10, LBB0_9
; %bb.4:
	ldp	w10, w11, [sp]
	orr	w8, w8, w9, lsl #9
	orr	w8, w8, w11
	orr	w8, w8, w10, lsl #6
	b	LBB0_8
LBB0_5:
	add	x3, sp, #12
	add	x4, sp, #8
	mov	x0, x19
	mov	x1, x21
	mov	x2, x20
	bl	_mtk_i2c_calculate_speed
	tbnz	w0, #31, LBB0_10
; %bb.6:
	ldp	w8, w9, [sp, #8]
Lloh6:
	adrp	x10, _I2C_TIME_CLR_VALUE@GOTPAGE
Lloh7:
	ldr	x10, [x10, _I2C_TIME_CLR_VALUE@GOTPAGEOFF]
	orr	w11, w9, w8, lsl #8
Lloh8:
	ldr	w10, [x10]
	stp	w11, w10, [x19, #8]
	ldr	x10, [x19, #24]
	ldr	x10, [x10]
	cbz	x10, LBB0_9
; %bb.7:
	orr	w8, w9, w8, lsl #6
LBB0_8:
	mov	w0, #0
	str	w8, [x19, #16]
	b	LBB0_10
LBB0_9:
	mov	w0, #0
LBB0_10:
	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
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_FS_MODE_SPEED,4,2          ; @MAX_FS_MODE_SPEED
	.comm	_I2C_TIME_DEFAULT_VALUE,4,2     ; @I2C_TIME_DEFAULT_VALUE
	.comm	_I2C_TIME_CLR_VALUE,4,2         ; @I2C_TIME_CLR_VALUE
	.no_dead_strip	_mtk_i2c_set_speed
.subsections_via_symbols
