	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function i2c_davinci_calc_clk_dividers
_i2c_davinci_calc_clk_dividers:         ## @i2c_davinci_calc_clk_dividers
	.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, %r15
	movq	16(%rdi), %r12
	movl	8(%rdi), %edi
	callq	_clk_get_rate
	movl	%eax, %ebx
	movq	(%r15), %rax
	movq	(%rax), %rdi
	movslq	%ebx, %rax
	imulq	$375299969, %rax, %r13          ## imm = 0x165E9F81
	movq	%r13, %rcx
	shrq	$63, %rcx
	sarq	$52, %r13
	addl	%ecx, %r13d
                                        ## kill: def $eax killed $eax killed $rax
	cltd
	idivl	%r13d
	xorl	%ecx, %ecx
	cmpl	$12000001, %eax                 ## imm = 0xB71B01
	setl	%cl
	subl	%ecx, %r13d
	movl	$7, %eax
	subl	%r13d, %eax
	cmpl	$2, %r13d
	movl	$5, %r14d
	cmovll	%eax, %r14d
	testq	%rdi, %rdi
	je	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rsi
	callq	_of_device_is_compatible
	testq	%rax, %rax
	movl	$6, %eax
	cmovnel	%eax, %r14d
LBB0_2:
	leal	1(%r13), %ecx
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	movl	%ebx, %eax
	cltd
	idivl	%ecx
	movl	%eax, %ecx
	movl	(%r12), %edi
	imull	$1000, %edi, %ebx               ## imm = 0x3E8
	cltd
	idivl	%ebx
	movl	%eax, %esi
	movl	%ecx, %eax
	cltd
	idivl	%esi
	xorl	%r12d, %r12d
	cmpl	%ebx, %eax
	setg	%r12b
	addl	%esi, %r12d
	cmpl	$101, %edi
	jl	LBB0_4
## %bb.3:
	leal	(%r12,%r12), %eax
	cltq
	imulq	$1431655766, %rax, %rax         ## imm = 0x55555556
	movq	%rax, %rcx
	shrq	$63, %rcx
	shrq	$32, %rax
	addl	%ecx, %eax
	jmp	LBB0_5
LBB0_4:
	movl	%r12d, %eax
	sarl	%eax
LBB0_5:
	leal	(%rax,%r14), %ecx
	subl	%r14d, %eax
	addl	%r14d, %r14d
	movl	%r12d, %ebx
	subl	%r14d, %ebx
	movl	%r12d, %edx
	subl	%ecx, %edx
	movl	$1, %r14d
	cmovgl	%edx, %r14d
	cmovgl	%eax, %ebx
	movq	_DAVINCI_I2C_PSC_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movl	%r13d, %edx
	callq	_davinci_i2c_write_reg
	movq	_DAVINCI_I2C_CLKH_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movl	%r14d, %edx
	callq	_davinci_i2c_write_reg
	movq	_DAVINCI_I2C_CLKL_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movl	%ebx, %edx
	callq	_davinci_i2c_write_reg
	movq	(%r15), %rdi
	leaq	L_.str.1(%rip), %rsi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	movl	%r12d, %ecx
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_dev_dbg                        ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ti,keystone-i2c"

	.comm	_DAVINCI_I2C_PSC_REG,4,2        ## @DAVINCI_I2C_PSC_REG
	.comm	_DAVINCI_I2C_CLKH_REG,4,2       ## @DAVINCI_I2C_CLKH_REG
	.comm	_DAVINCI_I2C_CLKL_REG,4,2       ## @DAVINCI_I2C_CLKL_REG
L_.str.1:                               ## @.str.1
	.asciz	"input_clock = %d, CLK = %d\n"

	.no_dead_strip	_i2c_davinci_calc_clk_dividers
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function i2c_davinci_calc_clk_dividers
_i2c_davinci_calc_clk_dividers:         ; @i2c_davinci_calc_clk_dividers
	.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	x22, [x0, #16]
	ldr	w0, [x0, #8]
	bl	_clk_get_rate
	mov	x20, x0
	ldr	x8, [x19]
	ldr	x0, [x8]
	mov	w8, #40833
	movk	w8, #5726, lsl #16
	smull	x8, w20, w8
	lsr	x9, x8, #63
	asr	x8, x8, #52
	add	w8, w8, w9
	sdiv	w9, w20, w8
	mov	w10, #6912
	movk	w10, #183, lsl #16
	orr	w10, w10, #0x1
	cmp	w9, w10
	cset	w9, lt
	sub	w21, w8, w9
	mov	w8, #7
	sub	w8, w8, w21
	mov	w9, #5
	cmp	w21, #1
	csel	w23, w9, w8, gt
	cbz	x0, LBB0_2
; %bb.1:
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_of_device_is_compatible
	cmp	x0, #0
	mov	w8, #6
	csel	w23, w23, w8, eq
LBB0_2:
	add	w8, w21, #1
	sdiv	w8, w20, w8
	ldr	w9, [x22]
	mov	w10, #1000
	mul	w10, w9, w10
	sdiv	w11, w8, w10
	sdiv	w8, w8, w11
	cmp	w8, w10
	cinc	w22, w11, gt
	lsl	w8, w22, #1
	mov	w10, #21846
	movk	w10, #21845, lsl #16
	smull	x8, w8, w10
	lsr	x10, x8, #63
	lsr	x8, x8, #32
	add	w8, w8, w10
	asr	w10, w22, #1
	cmp	w9, #101
	csel	w8, w10, w8, lt
	sub	w9, w8, w23
	sub	w10, w22, w23, lsl #1
	add	w8, w8, w23
	subs	w8, w22, w8
	csinc	w23, w8, wzr, gt
	csel	w24, w9, w10, gt
Lloh2:
	adrp	x8, _DAVINCI_I2C_PSC_REG@GOTPAGE
Lloh3:
	ldr	x8, [x8, _DAVINCI_I2C_PSC_REG@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x21
	bl	_davinci_i2c_write_reg
Lloh5:
	adrp	x8, _DAVINCI_I2C_CLKH_REG@GOTPAGE
Lloh6:
	ldr	x8, [x8, _DAVINCI_I2C_CLKH_REG@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x23
	bl	_davinci_i2c_write_reg
Lloh8:
	adrp	x8, _DAVINCI_I2C_CLKL_REG@GOTPAGE
Lloh9:
	ldr	x8, [x8, _DAVINCI_I2C_CLKL_REG@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x24
	bl	_davinci_i2c_write_reg
	ldr	x0, [x19]
Lloh11:
	adrp	x1, l_.str.1@PAGE
Lloh12:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x20
	mov	x3, x22
	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
	b	_dev_dbg
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ti,keystone-i2c"

	.comm	_DAVINCI_I2C_PSC_REG,4,2        ; @DAVINCI_I2C_PSC_REG
	.comm	_DAVINCI_I2C_CLKH_REG,4,2       ; @DAVINCI_I2C_CLKH_REG
	.comm	_DAVINCI_I2C_CLKL_REG,4,2       ; @DAVINCI_I2C_CLKL_REG
l_.str.1:                               ; @.str.1
	.asciz	"input_clock = %d, CLK = %d\n"

	.no_dead_strip	_i2c_davinci_calc_clk_dividers
.subsections_via_symbols
