	.file	"extr_i2c-mt65xx.c_mtk_i2c_set_speed.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	mtk_i2c_set_speed, @function
mtk_i2c_set_speed:
.LFB0:
	.cfi_startproc
	endbr64
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xor	edx, edx
	push	rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	push	rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	mov	rbx, rdi
	sub	rsp, 32
	.cfi_def_cfa_offset 64
	mov	r12d, DWORD PTR 4[rdi]
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 24[rsp], rax
	xor	eax, eax
	mov	eax, esi
	div	DWORD PTR [rdi]
	mov	edx, DWORD PTR MAX_FS_MODE_SPEED[rip]
	mov	ebp, eax
	cmp	edx, r12d
	jnb	.L2
	lea	rcx, 16[rsp]
	lea	r8, 20[rsp]
	mov	esi, eax
	call	mtk_i2c_calculate_speed@PLT
	test	eax, eax
	js	.L1
	mov	eax, DWORD PTR 20[rsp]
	lea	rcx, 8[rsp]
	lea	r8, 12[rsp]
	mov	esi, ebp
	mov	edx, r12d
	mov	rdi, rbx
	sal	eax, 8
	or	eax, DWORD PTR 16[rsp]
	mov	DWORD PTR 8[rbx], eax
	call	mtk_i2c_calculate_speed@PLT
	test	eax, eax
	js	.L1
	mov	ecx, DWORD PTR 8[rsp]
	mov	edx, DWORD PTR 12[rsp]
	mov	eax, ecx
	sal	edx, 12
	sal	eax, 8
	or	eax, edx
	or	eax, DWORD PTR I2C_TIME_DEFAULT_VALUE[rip]
	mov	DWORD PTR 12[rbx], eax
	mov	rax, QWORD PTR 24[rbx]
	cmp	QWORD PTR [rax], 0
	je	.L8
	mov	eax, DWORD PTR 20[rsp]
	sal	ecx, 9
	sal	eax, 6
	or	eax, edx
	or	eax, DWORD PTR 16[rsp]
	or	eax, ecx
	mov	DWORD PTR 16[rbx], eax
	xor	eax, eax
	.p2align 4,,10
	.p2align 3
.L1:
	mov	rsi, QWORD PTR 24[rsp]
	xor	rsi, QWORD PTR fs:40
	jne	.L10
	add	rsp, 32
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	pop	rbx
	.cfi_def_cfa_offset 24
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	.cfi_restore_state
	lea	rcx, 8[rsp]
	lea	r8, 12[rsp]
	mov	edx, r12d
	mov	esi, eax
	call	mtk_i2c_calculate_speed@PLT
	test	eax, eax
	js	.L1
	mov	eax, DWORD PTR 12[rsp]
	mov	ecx, DWORD PTR 8[rsp]
	mov	edx, eax
	sal	edx, 8
	or	edx, ecx
	mov	DWORD PTR 8[rbx], edx
	mov	edx, DWORD PTR I2C_TIME_CLR_VALUE[rip]
	mov	DWORD PTR 12[rbx], edx
	mov	rdx, QWORD PTR 24[rbx]
	cmp	QWORD PTR [rdx], 0
	je	.L8
	sal	eax, 6
	or	eax, ecx
	mov	DWORD PTR 16[rbx], eax
.L8:
	xor	eax, eax
	jmp	.L1
.L10:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	mtk_i2c_set_speed, .-mtk_i2c_set_speed
	.comm	MAX_FS_MODE_SPEED,4,4
	.comm	I2C_TIME_DEFAULT_VALUE,4,4
	.comm	I2C_TIME_CLR_VALUE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_i2c-mt65xx.c_mtk_i2c_set_speed.c"
	.text
	.global	__aeabi_uidiv
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	mtk_i2c_set_speed, %function
mtk_i2c_set_speed:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, lr}
	mov	r4, r0
	ldr	r3, .L14
	mov	r0, r1
	sub	sp, sp, #32
	ldr	r1, [r4]
	ldr	r3, [r3]
	str	r3, [sp, #28]
	mov	r3,#0
	bl	__aeabi_uidiv
	ldr	r3, .L14+4
	ldr	r6, [r4, #4]
	ldr	r2, [r3]
	mov	r5, r0
	cmp	r2, r6
	bcs	.L2
	add	r3, sp, #24
	mov	r1, r0
	str	r3, [sp]
	mov	r0, r4
	add	r3, sp, #20
	bl	mtk_i2c_calculate_speed
	cmp	r0, #0
	blt	.L1
	ldr	r2, [sp, #24]
	ldr	r3, [sp, #20]
	add	r0, sp, #16
	orr	r3, r3, r2, lsl #8
	str	r3, [r4, #8]
	mov	r2, r6
	str	r0, [sp]
	mov	r1, r5
	mov	r0, r4
	add	r3, sp, #12
	bl	mtk_i2c_calculate_speed
	cmp	r0, #0
	blt	.L1
	ldr	r0, [r4, #20]
	ldr	r1, [sp, #12]
	ldr	ip, .L14+8
	ldr	r0, [r0]
	ldr	r3, [sp, #16]
	ldr	ip, [ip]
	lsl	r2, r1, #8
	cmp	r0, #0
	orr	r2, r2, r3, lsl #12
	orr	r2, r2, ip
	ldrne	r0, [sp, #24]
	lsl	r3, r3, #12
	str	r2, [r4, #12]
	ldrne	r2, [sp, #20]
	orrne	r3, r3, r0, lsl #6
	orrne	r3, r3, r2
	orrne	r3, r3, r1, lsl #9
	strne	r3, [r4, #16]
.L11:
	mov	r0, #0
.L1:
	ldr	r3, .L14
	ldr	r2, [r3]
	ldr	r3, [sp, #28]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L13
	add	sp, sp, #32
	@ sp needed
	pop	{r4, r5, r6, pc}
.L2:
	add	r3, sp, #16
	mov	r1, r0
	str	r3, [sp]
	mov	r2, r6
	mov	r0, r4
	add	r3, sp, #12
	bl	mtk_i2c_calculate_speed
	cmp	r0, #0
	blt	.L1
	ldr	r3, [r4, #20]
	ldr	r0, .L14+12
	ldr	r1, [r3]
	ldr	r2, [sp, #16]
	ldr	r3, [sp, #12]
	ldr	r0, [r0]
	cmp	r1, #0
	orr	r1, r3, r2, lsl #8
	str	r0, [r4, #12]
	str	r1, [r4, #8]
	beq	.L11
	orr	r3, r3, r2, lsl #6
	mov	r0, #0
	str	r3, [r4, #16]
	b	.L1
.L13:
	bl	__stack_chk_fail
.L15:
	.align	2
.L14:
	.word	.LC0
	.word	MAX_FS_MODE_SPEED
	.word	I2C_TIME_DEFAULT_VALUE
	.word	I2C_TIME_CLR_VALUE
	.size	mtk_i2c_set_speed, .-mtk_i2c_set_speed
	.comm	MAX_FS_MODE_SPEED,4,4
	.comm	I2C_TIME_DEFAULT_VALUE,4,4
	.comm	I2C_TIME_CLR_VALUE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
