	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rk3x_i2c_setup
_rk3x_i2c_setup:                        ## @rk3x_i2c_setup
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r12
	movq	%rdi, %r14
	movl	(%rsi), %eax
	addl	%eax, %eax
	movzbl	%al, %ebx
	cmpl	$2, %edx
	jl	LBB0_9
## %bb.1:
	cmpl	$3, 4(%r12)
	jg	LBB0_9
## %bb.2:
	movq	_I2C_M_RD@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 8(%r12)
	je	LBB0_3
LBB0_9:
	movq	_I2C_M_RD@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 8(%r12)
	je	LBB0_11
## %bb.10:
	movq	_REG_CON_MOD_REGISTER_TX@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 40(%r14)
	xorl	%edi, %edi
	callq	_REG_MRXADDR_VALID
	orl	%eax, %ebx
	orl	$1, %ebx
	movq	_REG_MRXADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_i2c_writel
	movq	_REG_MRXRADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_i2c_writel
	jmp	LBB0_12
LBB0_11:
	movq	_REG_CON_MOD_TX@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 40(%r14)
LBB0_12:
	movq	%r12, 32(%r14)
	movl	$1, %ebx
LBB0_13:
	movl	(%r12), %eax
	movl	%eax, (%r14)
	movl	$1, 4(%r14)
	movq	_STATE_START@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 24(%r14)
	xorps	%xmm0, %xmm0
	movups	%xmm0, 8(%r14)
	movq	%r14, %rdi
	callq	_rk3x_i2c_clean_ipd
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	testl	%eax, 32(%r12)
	je	LBB0_9
## %bb.4:
	leaq	24(%r12), %r15
	movl	48(%r14), %edi
	movl	%ebx, %edx
	shrl	%edx
	leaq	L_.str(%rip), %rsi
	callq	_dev_dbg
	cmpl	$0, 4(%r12)
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	jle	LBB0_5
## %bb.6:
	xorl	%r13d, %r13d
	xorl	%r15d, %r15d
	xorl	%r14d, %r14d
	movq	%r12, -72(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	16(%r12), %rax
	movl	(%rax,%r15,4), %r12d
	movl	%r13d, %ecx
	shll	%cl, %r12d
	movl	%r15d, %edi
	callq	_REG_MRXADDR_VALID
	movl	%eax, %ebx
	orl	%r14d, %ebx
	orl	%r12d, %ebx
	movq	-72(%rbp), %r12                 ## 8-byte Reload
	incq	%r15
	movslq	4(%r12), %rax
	addl	$8, %r13d
	movl	%ebx, %r14d
	cmpq	%rax, %r15
	jl	LBB0_7
	jmp	LBB0_8
LBB0_5:
	xorl	%ebx, %ebx
LBB0_8:
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, 32(%r14)
	movq	_REG_CON_MOD_REGISTER_TX@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 40(%r14)
	xorl	%edi, %edi
	callq	_REG_MRXADDR_VALID
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	orl	%eax, %esi
	movq	_REG_MRXADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	callq	_i2c_writel
	movq	_REG_MRXRADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_i2c_writel
	movl	$2, %ebx
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.comm	_I2C_M_RD,4,2                   ## @I2C_M_RD
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Combined write/read from addr 0x%x\n"

	.comm	_REG_CON_MOD_REGISTER_TX,8,3    ## @REG_CON_MOD_REGISTER_TX
	.comm	_REG_MRXADDR,4,2                ## @REG_MRXADDR
	.comm	_REG_MRXRADDR,4,2               ## @REG_MRXRADDR
	.comm	_REG_CON_MOD_TX,8,3             ## @REG_CON_MOD_TX
	.comm	_STATE_START,4,2                ## @STATE_START
	.no_dead_strip	_rk3x_i2c_setup
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rk3x_i2c_setup
_rk3x_i2c_setup:                        ; @rk3x_i2c_setup
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x20, x1
	mov	x19, x0
	ldr	w8, [x1]
	ubfiz	w23, w8, #1, #7
Lloh0:
	adrp	x8, _I2C_M_RD@GOTPAGE
Lloh1:
	ldr	x8, [x8, _I2C_M_RD@GOTPAGEOFF]
	cmp	w2, #2
	b.lt	LBB0_3
; %bb.1:
	ldr	w9, [x20, #4]
	cmp	w9, #3
	b.gt	LBB0_3
; %bb.2:
	ldr	w10, [x20, #8]
	ldr	w9, [x8]
	tst	w9, w10
	b.eq	LBB0_8
LBB0_3:
	ldr	w9, [x20, #8]
	ldr	w8, [x8]
	tst	w8, w9
	b.eq	LBB0_5
; %bb.4:
Lloh2:
	adrp	x8, _REG_CON_MOD_REGISTER_TX@GOTPAGE
Lloh3:
	ldr	x8, [x8, _REG_CON_MOD_REGISTER_TX@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	str	x8, [x19, #40]
	mov	w0, #0
	bl	_REG_MRXADDR_VALID
	orr	w8, w23, w0
	orr	w1, w8, #0x1
Lloh5:
	adrp	x8, _REG_MRXADDR@GOTPAGE
Lloh6:
	ldr	x8, [x8, _REG_MRXADDR@GOTPAGEOFF]
Lloh7:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_i2c_writel
Lloh8:
	adrp	x8, _REG_MRXRADDR@GOTPAGE
Lloh9:
	ldr	x8, [x8, _REG_MRXRADDR@GOTPAGEOFF]
Lloh10:
	ldr	w2, [x8]
	mov	x0, x19
	mov	w1, #0
	bl	_i2c_writel
	b	LBB0_6
LBB0_5:
Lloh11:
	adrp	x8, _REG_CON_MOD_TX@GOTPAGE
Lloh12:
	ldr	x8, [x8, _REG_CON_MOD_TX@GOTPAGEOFF]
Lloh13:
	ldr	x8, [x8]
	str	x8, [x19, #40]
LBB0_6:
	str	x20, [x19, #32]
	mov	w21, #1
LBB0_7:
	ldr	w8, [x20]
	mov	w9, #1
	stp	w8, w9, [x19]
Lloh14:
	adrp	x8, _STATE_START@GOTPAGE
Lloh15:
	ldr	x8, [x8, _STATE_START@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	str	w8, [x19, #24]
	stp	xzr, xzr, [x19, #8]
	mov	x0, x19
	bl	_rk3x_i2c_clean_ipd
	mov	x0, x21
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_8:
	ldr	w10, [x20, #32]
	tst	w10, w9
	b.eq	LBB0_3
; %bb.9:
	add	x24, x20, #24
	ldr	w0, [x19, #48]
	lsr	w2, w23, #1
Lloh17:
	adrp	x1, l_.str@PAGE
Lloh18:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
	ldr	w8, [x20, #4]
	cmp	w8, #1
	b.lt	LBB0_12
; %bb.10:
	mov	w25, #0
	mov	x22, #0
	mov	w21, #0
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20, #16]
	ldr	w8, [x8, x22, lsl #2]
	lsl	w8, w8, w25
	orr	w21, w8, w21
	mov	x0, x22
	bl	_REG_MRXADDR_VALID
	orr	w21, w21, w0
	add	x22, x22, #1
	ldrsw	x8, [x20, #4]
	add	w25, w25, #8
	cmp	x22, x8
	b.lt	LBB0_11
	b	LBB0_13
LBB0_12:
	mov	w21, #0
LBB0_13:
Lloh19:
	adrp	x8, _REG_CON_MOD_REGISTER_TX@GOTPAGE
Lloh20:
	ldr	x8, [x8, _REG_CON_MOD_REGISTER_TX@GOTPAGEOFF]
Lloh21:
	ldr	x8, [x8]
	stp	x24, x8, [x19, #32]
	mov	w0, #0
	bl	_REG_MRXADDR_VALID
	orr	w1, w0, w23
Lloh22:
	adrp	x8, _REG_MRXADDR@GOTPAGE
Lloh23:
	ldr	x8, [x8, _REG_MRXADDR@GOTPAGEOFF]
Lloh24:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_i2c_writel
Lloh25:
	adrp	x8, _REG_MRXRADDR@GOTPAGE
Lloh26:
	ldr	x8, [x8, _REG_MRXRADDR@GOTPAGEOFF]
Lloh27:
	ldr	w2, [x8]
	mov	x0, x19
	mov	x1, x21
	bl	_i2c_writel
	mov	w21, #2
	b	LBB0_7
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_I2C_M_RD,4,2                   ; @I2C_M_RD
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Combined write/read from addr 0x%x\n"

	.comm	_REG_CON_MOD_REGISTER_TX,8,3    ; @REG_CON_MOD_REGISTER_TX
	.comm	_REG_MRXADDR,4,2                ; @REG_MRXADDR
	.comm	_REG_MRXRADDR,4,2               ; @REG_MRXRADDR
	.comm	_REG_CON_MOD_TX,8,3             ; @REG_CON_MOD_TX
	.comm	_STATE_START,4,2                ; @STATE_START
	.no_dead_strip	_rk3x_i2c_setup
.subsections_via_symbols
