	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function at91_calc_twi_clock
_at91_calc_twi_clock:                   ## @at91_calc_twi_clock
	.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
	subq	$24, %rsp
	.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), %r13
	movl	(%r13), %r14d
	movl	4(%r13), %ebx
	movl	4(%rdi), %edi
	leaq	-56(%rbp), %rsi
	movl	$1, %edx
	callq	_i2c_parse_fw_timings
	movl	8(%r15), %edi
	callq	_clk_get_rate
	movl	-56(%rbp), %esi
	addl	%esi, %esi
	movl	%eax, %edi
	callq	_DIV_ROUND_UP
	subl	%r14d, %eax
	xorl	%r14d, %r14d
	xorl	%edi, %edi
	movl	%eax, %esi
	callq	_max
	movl	%eax, %r12d
	movl	%eax, %edi
	sarl	$8, %edi
	callq	_fls
	movl	%eax, %ecx
	sarl	%cl, %r12d
	cmpl	%ebx, %eax
	jle	LBB0_1
## %bb.2:
	movl	4(%r15), %edi
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edx
	movl	%ebx, %ecx
	callq	_dev_warn
	movl	$255, %r12d
	jmp	LBB0_3
LBB0_1:
	movl	%eax, %ebx
LBB0_3:
	cmpq	$0, 8(%r13)
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	je	LBB0_7
## %bb.4:
	movl	-52(%rbp), %ebx
	movl	8(%r15), %edi
	callq	_clk_get_rate
	cltq
	imulq	$274877907, %rax, %rdi          ## imm = 0x10624DD3
	movq	%rdi, %rax
	shrq	$63, %rax
	sarq	$38, %rdi
	addl	%eax, %edi
	imull	%ebx, %edi
                                        ## kill: def $edi killed $edi killed $rdi
	movl	$1000000, %esi                  ## imm = 0xF4240
	callq	_DIV_ROUND_UP
	cmpl	$4, %eax
	movl	$3, %r14d
	cmovgel	%eax, %r14d
	addl	$-3, %r14d
	movq	_AT91_TWI_CWGR_HOLD_MAX@GOTPCREL(%rip), %r13
	movl	(%r13), %edx
	cmpl	%edx, %r14d
	jle	LBB0_6
## %bb.5:
	movl	4(%r15), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%r14d, %ecx
	callq	_dev_warn
	movl	(%r13), %r14d
LBB0_6:
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
LBB0_7:
	movl	%ebx, %r13d
	shll	$16, %r13d
	movl	%r12d, %ebx
	shll	$8, %ebx
	movl	%r14d, %edi
	callq	_AT91_TWI_CWGR_HOLD
	orl	%r12d, %ebx
	orl	%r13d, %eax
	orl	%ebx, %eax
	movl	%eax, (%r15)
	movl	4(%r15), %edi
	movl	-52(%rbp), %r9d
	leaq	L_.str.2(%rip), %rsi
	movl	%r12d, %edx
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	movl	%r14d, %r8d
	callq	_dev_dbg
	addq	$24, %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	"%d exceeds ckdiv max value which is %d.\n"

	.comm	_AT91_TWI_CWGR_HOLD_MAX,4,2     ## @AT91_TWI_CWGR_HOLD_MAX
L_.str.1:                               ## @.str.1
	.asciz	"HOLD field set to its maximum value (%d instead of %d)\n"

L_.str.2:                               ## @.str.2
	.asciz	"cdiv %d ckdiv %d hold %d (%d ns)\n"

	.no_dead_strip	_at91_calc_twi_clock
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function at91_calc_twi_clock
_at91_calc_twi_clock:                   ; @at91_calc_twi_clock
	.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	x19, x0
	ldr	x23, [x0, #16]
	ldp	w20, w22, [x23]
	ldr	w0, [x0, #4]
	add	x1, sp, #8
	mov	w2, #1
	bl	_i2c_parse_fw_timings
	ldr	w0, [x19, #8]
	bl	_clk_get_rate
	ldr	w8, [sp, #8]
	lsl	w1, w8, #1
	bl	_DIV_ROUND_UP
	sub	w1, w0, w20
	mov	w0, #0
	bl	_max
	mov	x21, x0
	asr	w0, w0, #8
	bl	_fls
	mov	x20, x0
	cmp	w0, w22
	b.le	LBB0_4
; %bb.1:
	ldr	w0, [x19, #4]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x20
	mov	x3, x22
	bl	_dev_warn
	mov	w21, #255
	mov	x20, x22
	ldr	x8, [x23, #8]
	cbz	x8, LBB0_5
LBB0_2:
	ldr	w22, [sp, #12]
	ldr	w0, [x19, #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	w8, w8, w9
	mul	w0, w8, w22
	mov	w1, #16960
	movk	w1, #15, lsl #16
	bl	_DIV_ROUND_UP
	mov	w8, #3
	cmp	w0, #3
	csel	w8, w0, w8, gt
	sub	w22, w8, #3
Lloh2:
	adrp	x23, _AT91_TWI_CWGR_HOLD_MAX@GOTPAGE
Lloh3:
	ldr	x23, [x23, _AT91_TWI_CWGR_HOLD_MAX@GOTPAGEOFF]
	ldr	w2, [x23]
	cmp	w22, w2
	b.le	LBB0_6
; %bb.3:
	ldr	w0, [x19, #4]
Lloh4:
	adrp	x1, l_.str.1@PAGE
Lloh5:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x3, x22
	bl	_dev_warn
	ldr	w22, [x23]
	b	LBB0_6
LBB0_4:
	asr	w21, w21, w20
	ldr	x8, [x23, #8]
	cbnz	x8, LBB0_2
LBB0_5:
	mov	w22, #0
LBB0_6:
	mov	x0, x22
	bl	_AT91_TWI_CWGR_HOLD
	orr	w8, w21, w21, lsl #8
	orr	w8, w8, w20, lsl #16
	orr	w8, w8, w0
	str	w8, [x19]
	ldr	w0, [x19, #4]
	ldr	w5, [sp, #12]
Lloh6:
	adrp	x1, l_.str.2@PAGE
Lloh7:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x2, x21
	mov	x3, x20
	mov	x4, x22
	bl	_dev_dbg
	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 AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%d exceeds ckdiv max value which is %d.\n"

	.comm	_AT91_TWI_CWGR_HOLD_MAX,4,2     ; @AT91_TWI_CWGR_HOLD_MAX
l_.str.1:                               ; @.str.1
	.asciz	"HOLD field set to its maximum value (%d instead of %d)\n"

l_.str.2:                               ; @.str.2
	.asciz	"cdiv %d ckdiv %d hold %d (%d ns)\n"

	.no_dead_strip	_at91_calc_twi_clock
.subsections_via_symbols
