	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function s3c24xx_i2c_clockrate
_s3c24xx_i2c_clockrate:                 ## @s3c24xx_i2c_clockrate
	.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, %r14
	movq	%rdi, %r15
	movq	16(%rdi), %rax
	movq	(%rax), %r13
	movl	24(%rdi), %edi
	callq	_clk_get_rate
	movq	%rax, (%r15)
	shrq	$3, %rax
	movabsq	$2361183241434822607, %rbx      ## imm = 0x20C49BA5E353F7CF
	mulq	%rbx
	movq	%rdx, %r12
	shrq	$4, %r12
	movq	16(%r15), %rdi
	movq	(%r13), %rdx
	leaq	L_.str(%rip), %rsi
	callq	_dev_dbg
	movq	(%r13), %rax
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	shrq	$3, %rax
	mulq	%rbx
	movq	%rdx, %rbx
	shrq	$4, %rbx
	jmp	LBB0_3
LBB0_1:
	movl	$100, %ebx
LBB0_3:
	leaq	-44(%rbp), %rdx
	leaq	-48(%rbp), %rcx
	movq	%r12, %rdi
	movq	%rbx, %rsi
	callq	_s3c24xx_i2c_calcdivisor
	movslq	%eax, %r12
	cmpq	%r12, %rbx
	jae	LBB0_5
## %bb.4:
	movq	16(%r15), %rdi
	leaq	L_.str.1(%rip), %rsi
	movq	%rbx, %rdx
	movl	%eax, %ecx
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_10
LBB0_5:
	movl	%eax, (%r14)
	movq	_S3C2410_IICCON@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdi
	addq	8(%r15), %rdi
	callq	_readl
	movq	_S3C2410_IICCON_SCALEMASK@GOTPCREL(%rip), %rcx
	movq	_S3C2410_IICCON_TXDIV_512@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edi
	movl	(%rcx), %ecx
	orl	%edi, %ecx
	notl	%ecx
	andl	%eax, %ecx
	movl	-48(%rbp), %eax
	decl	%eax
	xorl	%r14d, %r14d
	cmpl	$512, -44(%rbp)                 ## imm = 0x200
	cmovnel	%r14d, %edi
	orl	%eax, %edi
	orl	%ecx, %edi
	movq	(%rbx), %rsi
	addq	8(%r15), %rsi
	callq	_writel
	movq	%r15, %rdi
	callq	_s3c24xx_i2c_is2440
	testq	%rax, %rax
	je	LBB0_10
## %bb.6:
	movl	8(%r13), %eax
	xorl	%r14d, %r14d
	testl	%eax, %eax
	je	LBB0_7
## %bb.8:
	imulq	$274877907, %r12, %rcx          ## imm = 0x10624DD3
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$38, %rcx
	addl	%edx, %ecx
	imull	%ecx, %eax
	cltq
	movabsq	$4835703278458516699, %rcx      ## imm = 0x431BDE82D7B634DB
	mulq	%rcx
	movq	%rdx, %rdi
	shrq	$18, %rdi
	movl	$5, %esi
	callq	_DIV_ROUND_UP
	cmpq	$3, %rax
	movl	$3, %ebx
	cmovbq	%rax, %rbx
	movq	_S3C2410_IICLC_FILTER_ON@GOTPCREL(%rip), %rax
	orq	(%rax), %rbx
	jmp	LBB0_9
LBB0_7:
	xorl	%ebx, %ebx
LBB0_9:
	movq	16(%r15), %rdi
	leaq	L_.str.2(%rip), %rsi
	movq	%rbx, %rdx
	callq	_dev_dbg
	movq	_S3C2440_IICLC@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r15), %rsi
	movq	%rbx, %rdi
	callq	_writel
LBB0_10:
	movl	%r14d, %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	"pdata desired frequency %lu\n"

L_.str.1:                               ## @.str.1
	.asciz	"Unable to achieve desired frequency %luKHz. Lowest achievable %dKHz\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_S3C2410_IICCON,8,3             ## @S3C2410_IICCON
	.comm	_S3C2410_IICCON_SCALEMASK,4,2   ## @S3C2410_IICCON_SCALEMASK
	.comm	_S3C2410_IICCON_TXDIV_512,4,2   ## @S3C2410_IICCON_TXDIV_512
	.comm	_S3C2410_IICLC_FILTER_ON,8,3    ## @S3C2410_IICLC_FILTER_ON
L_.str.2:                               ## @.str.2
	.asciz	"IICLC=%08lx\n"

	.comm	_S3C2440_IICLC,8,3              ## @S3C2440_IICLC
	.no_dead_strip	_s3c24xx_i2c_clockrate
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function s3c24xx_i2c_clockrate
_s3c24xx_i2c_clockrate:                 ; @s3c24xx_i2c_clockrate
	.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	x21, x1
	mov	x19, x0
	ldr	x8, [x0, #16]
	ldr	x23, [x8]
	ldr	w0, [x0, #24]
	bl	_clk_get_rate
	str	x0, [x19]
	lsr	x8, x0, #3
	mov	x22, #63439
	movk	x22, #58195, lsl #16
	movk	x22, #39845, lsl #32
	movk	x22, #8388, lsl #48
	umulh	x8, x8, x22
	lsr	x20, x8, #4
	ldr	x0, [x19, #16]
	ldr	x2, [x23]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
	ldr	x8, [x23]
	lsr	x9, x8, #3
	umulh	x9, x9, x22
	lsr	x9, x9, #4
	mov	w10, #100
	cmp	x8, #0
	csel	x22, x10, x9, eq
	add	x2, sp, #8
	add	x3, sp, #12
	mov	x0, x20
	mov	x1, x22
	bl	_s3c24xx_i2c_calcdivisor
	mov	x20, x0
	cmp	x22, w0, sxtw
	b.hs	LBB0_2
; %bb.1:
	ldr	x0, [x19, #16]
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x22
	mov	x3, x20
	bl	_dev_err
Lloh4:
	adrp	x8, _EINVAL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_7
LBB0_2:
	str	w20, [x21]
	ldr	x8, [x19, #8]
Lloh7:
	adrp	x21, _S3C2410_IICCON@GOTPAGE
Lloh8:
	ldr	x21, [x21, _S3C2410_IICCON@GOTPAGEOFF]
	ldr	x9, [x21]
	add	x0, x9, x8
	bl	_readl
Lloh9:
	adrp	x8, _S3C2410_IICCON_SCALEMASK@GOTPAGE
Lloh10:
	ldr	x8, [x8, _S3C2410_IICCON_SCALEMASK@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
Lloh12:
	adrp	x9, _S3C2410_IICCON_TXDIV_512@GOTPAGE
Lloh13:
	ldr	x9, [x9, _S3C2410_IICCON_TXDIV_512@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	orr	w8, w9, w8
	bic	w8, w0, w8
	ldr	w10, [sp, #12]
	sub	w10, w10, #1
	orr	w8, w8, w10
	ldr	w10, [sp, #8]
	cmp	w10, #512
	csel	w9, w9, wzr, eq
	orr	w0, w8, w9
	ldr	x8, [x19, #8]
	ldr	x9, [x21]
	add	x1, x9, x8
	bl	_writel
	mov	x0, x19
	bl	_s3c24xx_i2c_is2440
	cbz	x0, LBB0_7
; %bb.3:
	ldr	w8, [x23, #8]
	cbz	w8, LBB0_5
; %bb.4:
	mov	w9, #19923
	movk	w9, #4194, lsl #16
	smull	x9, w20, w9
	lsr	x10, x9, #63
	asr	x9, x9, #38
	add	w9, w9, w10
	mul	w8, w8, w9
	sxtw	x8, w8
	mov	x9, #13531
	movk	x9, #55222, lsl #16
	movk	x9, #56962, lsl #32
	movk	x9, #17179, lsl #48
	umulh	x8, x8, x9
	lsr	x0, x8, #18
	mov	w1, #5
	bl	_DIV_ROUND_UP
	mov	w8, #3
	cmp	x0, #3
	csel	x8, x0, x8, lo
Lloh15:
	adrp	x9, _S3C2410_IICLC_FILTER_ON@GOTPAGE
Lloh16:
	ldr	x9, [x9, _S3C2410_IICLC_FILTER_ON@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	orr	x20, x8, x9
	b	LBB0_6
LBB0_5:
	mov	x20, #0
LBB0_6:
	ldr	x0, [x19, #16]
Lloh18:
	adrp	x1, l_.str.2@PAGE
Lloh19:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x2, x20
	bl	_dev_dbg
	ldr	x8, [x19, #8]
Lloh20:
	adrp	x9, _S3C2440_IICLC@GOTPAGE
Lloh21:
	ldr	x9, [x9, _S3C2440_IICLC@GOTPAGEOFF]
Lloh22:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	x0, x20
	bl	_writel
	mov	w0, #0
LBB0_7:
	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 AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpAdd	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"pdata desired frequency %lu\n"

l_.str.1:                               ; @.str.1
	.asciz	"Unable to achieve desired frequency %luKHz. Lowest achievable %dKHz\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_S3C2410_IICCON,8,3             ; @S3C2410_IICCON
	.comm	_S3C2410_IICCON_SCALEMASK,4,2   ; @S3C2410_IICCON_SCALEMASK
	.comm	_S3C2410_IICCON_TXDIV_512,4,2   ; @S3C2410_IICCON_TXDIV_512
	.comm	_S3C2410_IICLC_FILTER_ON,8,3    ; @S3C2410_IICLC_FILTER_ON
l_.str.2:                               ; @.str.2
	.asciz	"IICLC=%08lx\n"

	.comm	_S3C2440_IICLC,8,3              ; @S3C2440_IICLC
	.no_dead_strip	_s3c24xx_i2c_clockrate
.subsections_via_symbols
