	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function altr_i2c_init
_altr_i2c_init:                         ## @altr_i2c_init
	.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
	movl	20(%rdi), %edi
	callq	_clk_get_rate
	cltd
	idivl	(%r15)
	movl	%eax, %r14d
	movl	20(%r15), %edi
	callq	_clk_get_rate
	movq	_ALTR_I2C_THRESHOLD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	movq	_ALTR_I2C_CTRL_RXT_SHFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	movl	%edi, %edx
	shll	%cl, %edx
	movq	_ALTR_I2C_CTRL_TCT_SHFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %edi
	orl	%edx, %edi
	cmpl	$100000, (%r15)                 ## imm = 0x186A0
	movq	_ALTR_I2C_CTRL_BSPEED@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	jg	LBB0_2
## %bb.1:
	notl	%ecx
	andl	%ecx, %edi
	movl	%r14d, %r13d
	shrl	$31, %r13d
	addl	%r14d, %r13d
	sarl	%r13d
	movl	%r13d, %r12d
	jmp	LBB0_3
LBB0_2:
	orl	%ecx, %edi
	movslq	%r14d, %rcx
	imulq	$1431655766, %rcx, %r13         ## imm = 0x55555556
	movq	%r13, %rcx
	shrq	$63, %rcx
	shrq	$32, %r13
	addl	%ecx, %r13d
	movl	%r14d, %ecx
	addl	%r14d, %ecx
	movslq	%ecx, %rcx
	imulq	$1431655766, %rcx, %r12         ## imm = 0x55555556
	movq	%r12, %rcx
	shrq	$63, %rcx
	shrq	$32, %r12
	addl	%ecx, %r12d
LBB0_3:
	cltq
	imulq	$1125899907, %rax, %rbx         ## imm = 0x431BDE83
	movq	%rbx, %rax
	shrq	$63, %rax
	sarq	$50, %rbx
	addl	%eax, %ebx
	movq	_ALTR_I2C_CTRL@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r15), %rsi
	callq	_writel
	movl	(%r15), %edx
	movl	16(%r15), %edi
	leaq	L_.str(%rip), %rsi
	movl	%ebx, %ecx
	movl	%r14d, %r8d
	callq	_dev_dbg
	movq	%r15, %rdi
	callq	_altr_i2c_reset
	movq	_ALTR_I2C_SCL_HIGH@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r15), %rsi
	movl	%r13d, %edi
	callq	_writel
	movq	_ALTR_I2C_SCL_LOW@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r15), %rsi
	movl	%r12d, %edi
	callq	_writel
	imull	$300, %ebx, %edi                ## imm = 0x12C
	movl	$1000, %esi                     ## imm = 0x3E8
	callq	_div_u64
	movq	_ALTR_I2C_SDA_HOLD@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rsi
	addq	8(%r15), %rsi
	movl	%eax, %edi
	callq	_writel
	movq	_ALTR_I2C_ALL_IRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	xorl	%edx, %edx
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_altr_i2c_int_enable            ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_ALTR_I2C_THRESHOLD,4,2         ## @ALTR_I2C_THRESHOLD
	.comm	_ALTR_I2C_CTRL_RXT_SHFT,4,2     ## @ALTR_I2C_CTRL_RXT_SHFT
	.comm	_ALTR_I2C_CTRL_TCT_SHFT,4,2     ## @ALTR_I2C_CTRL_TCT_SHFT
	.comm	_ALTR_I2C_CTRL_BSPEED,4,2       ## @ALTR_I2C_CTRL_BSPEED
	.comm	_ALTR_I2C_CTRL,8,3              ## @ALTR_I2C_CTRL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"rate=%uHz per_clk=%uMHz -> ratio=1:%u\n"

	.comm	_ALTR_I2C_SCL_HIGH,8,3          ## @ALTR_I2C_SCL_HIGH
	.comm	_ALTR_I2C_SCL_LOW,8,3           ## @ALTR_I2C_SCL_LOW
	.comm	_ALTR_I2C_SDA_HOLD,8,3          ## @ALTR_I2C_SDA_HOLD
	.comm	_ALTR_I2C_ALL_IRQ,4,2           ## @ALTR_I2C_ALL_IRQ
	.no_dead_strip	_altr_i2c_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function altr_i2c_init
_altr_i2c_init:                         ; @altr_i2c_init
	.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	w0, [x0, #20]
	bl	_clk_get_rate
	ldr	w9, [x19]
	ldr	w8, [x19, #20]
	sdiv	w20, w0, w9
	mov	x0, x8
	bl	_clk_get_rate
Lloh0:
	adrp	x8, _ALTR_I2C_THRESHOLD@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ALTR_I2C_THRESHOLD@GOTPAGEOFF]
Lloh2:
	adrp	x9, _ALTR_I2C_CTRL_RXT_SHFT@GOTPAGE
Lloh3:
	ldr	x9, [x9, _ALTR_I2C_CTRL_RXT_SHFT@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
Lloh5:
	ldr	w9, [x9]
	lsl	w9, w8, w9
Lloh6:
	adrp	x10, _ALTR_I2C_CTRL_TCT_SHFT@GOTPAGE
Lloh7:
	ldr	x10, [x10, _ALTR_I2C_CTRL_TCT_SHFT@GOTPAGEOFF]
Lloh8:
	ldr	w10, [x10]
	lsl	w8, w8, w10
	orr	w8, w8, w9
	ldr	w9, [x19]
Lloh9:
	adrp	x10, _ALTR_I2C_CTRL_BSPEED@GOTPAGE
Lloh10:
	ldr	x10, [x10, _ALTR_I2C_CTRL_BSPEED@GOTPAGEOFF]
Lloh11:
	ldr	w10, [x10]
	mov	w11, #34464
	movk	w11, #1, lsl #16
	orr	w12, w10, w8
	mov	w13, #21846
	movk	w13, #21845, lsl #16
	smull	x14, w20, w13
	lsr	x15, x14, #63
	lsr	x14, x14, #32
	add	w14, w14, w15
	lsl	w15, w20, #1
	smull	x13, w15, w13
	lsr	x15, x13, #63
	lsr	x13, x13, #32
	add	w13, w13, w15
	bic	w8, w8, w10
	cmp	w20, #0
	cinc	w10, w20, lt
	asr	w10, w10, #1
	cmp	w9, w11
	csel	w8, w12, w8, gt
	csel	w21, w14, w10, gt
	csel	w22, w13, w10, gt
	mov	w9, #56963
	movk	w9, #17179, lsl #16
	smull	x9, w0, w9
	lsr	x10, x9, #63
	asr	x9, x9, #50
	add	w23, w9, w10
	ldr	x9, [x19, #8]
Lloh12:
	adrp	x10, _ALTR_I2C_CTRL@GOTPAGE
Lloh13:
	ldr	x10, [x10, _ALTR_I2C_CTRL@GOTPAGEOFF]
Lloh14:
	ldr	x10, [x10]
	add	x1, x10, x9
	mov	x0, x8
	bl	_writel
	ldr	w0, [x19, #16]
	ldr	w2, [x19]
Lloh15:
	adrp	x1, l_.str@PAGE
Lloh16:
	add	x1, x1, l_.str@PAGEOFF
	mov	x3, x23
	mov	x4, x20
	bl	_dev_dbg
	mov	x0, x19
	bl	_altr_i2c_reset
	ldr	x8, [x19, #8]
Lloh17:
	adrp	x9, _ALTR_I2C_SCL_HIGH@GOTPAGE
Lloh18:
	ldr	x9, [x9, _ALTR_I2C_SCL_HIGH@GOTPAGEOFF]
Lloh19:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	x0, x21
	bl	_writel
	ldr	x8, [x19, #8]
Lloh20:
	adrp	x9, _ALTR_I2C_SCL_LOW@GOTPAGE
Lloh21:
	ldr	x9, [x9, _ALTR_I2C_SCL_LOW@GOTPAGEOFF]
Lloh22:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	x0, x22
	bl	_writel
	mov	w8, #300
	mul	w0, w23, w8
	mov	w1, #1000
	bl	_div_u64
	ldr	x8, [x19, #8]
Lloh23:
	adrp	x9, _ALTR_I2C_SDA_HOLD@GOTPAGE
Lloh24:
	ldr	x9, [x9, _ALTR_I2C_SDA_HOLD@GOTPAGEOFF]
Lloh25:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
Lloh26:
	adrp	x8, _ALTR_I2C_ALL_IRQ@GOTPAGE
Lloh27:
	ldr	x8, [x8, _ALTR_I2C_ALL_IRQ@GOTPAGEOFF]
Lloh28:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	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	_altr_i2c_int_enable
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh4
	.cfi_endproc
                                        ; -- End function
	.comm	_ALTR_I2C_THRESHOLD,4,2         ; @ALTR_I2C_THRESHOLD
	.comm	_ALTR_I2C_CTRL_RXT_SHFT,4,2     ; @ALTR_I2C_CTRL_RXT_SHFT
	.comm	_ALTR_I2C_CTRL_TCT_SHFT,4,2     ; @ALTR_I2C_CTRL_TCT_SHFT
	.comm	_ALTR_I2C_CTRL_BSPEED,4,2       ; @ALTR_I2C_CTRL_BSPEED
	.comm	_ALTR_I2C_CTRL,8,3              ; @ALTR_I2C_CTRL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"rate=%uHz per_clk=%uMHz -> ratio=1:%u\n"

	.comm	_ALTR_I2C_SCL_HIGH,8,3          ; @ALTR_I2C_SCL_HIGH
	.comm	_ALTR_I2C_SCL_LOW,8,3           ; @ALTR_I2C_SCL_LOW
	.comm	_ALTR_I2C_SDA_HOLD,8,3          ; @ALTR_I2C_SDA_HOLD
	.comm	_ALTR_I2C_ALL_IRQ,4,2           ; @ALTR_I2C_ALL_IRQ
	.no_dead_strip	_altr_i2c_init
.subsections_via_symbols
