	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_i2c_do_transfer
_mtk_i2c_do_transfer:                   ## @mtk_i2c_do_transfer
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, -68(%rbp)                 ## 4-byte Spill
	movl	%edx, -48(%rbp)                 ## 4-byte Spill
	movq	%rsi, %r12
	movq	%rdi, %r13
	movl	$0, (%rdi)
	xorl	%r14d, %r14d
	cmpq	$0, 40(%rdi)
	movl	$0, -52(%rbp)                   ## 4-byte Folded Spill
	je	LBB0_2
## %bb.1:
	movq	_I2C_RS_TRANSFER@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
LBB0_2:
	leaq	32(%r13), %rdi
	movq	%rdi, -96(%rbp)                 ## 8-byte Spill
	callq	_reinit_completion
	movq	_OFFSET_CONTROL@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movq	%r13, %rdi
	callq	_mtk_i2c_readw
	movq	_I2C_CONTROL_DIR_CHANGE@GOTPCREL(%rip), %rcx
	movq	_I2C_CONTROL_RS@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	movl	(%rcx), %esi
	orl	%edx, %esi
	movl	%esi, %ecx
	notl	%ecx
	andl	%eax, %ecx
	movq	_MAX_FS_MODE_SPEED@GOTPCREL(%rip), %r8
	movq	8(%r13), %rbx
	movq	16(%r13), %rdi
	cmpq	(%r8), %rbx
	cmovgl	%edx, %r14d
	cmpl	$0, -68(%rbp)                   ## 4-byte Folded Reload
	cmovgl	%edx, %r14d
	orl	%ecx, %r14d
	movq	_I2C_MASTER_WRRD@GOTPCREL(%rip), %rcx
	orl	%eax, %esi
	cmpq	(%rcx), %rdi
	cmovnel	%r14d, %esi
	movl	(%r15), %edx
	movq	%r13, %rdi
	callq	_mtk_i2c_writew
	movq	8(%r13), %rax
	movq	_I2C_DEFAULT_SPEED@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jle	LBB0_3
## %bb.4:
	movq	_I2C_FS_START_CON@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_3:
	movq	_I2C_ST_START_CON@GOTPCREL(%rip), %rax
LBB0_5:
	movq	%r12, %rbx
	movl	(%rax), %esi
	movq	_OFFSET_EXT_CONF@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rdi
	callq	_mtk_i2c_writew
	movq	%r12, %rdi
	callq	_i2c_8bit_addr_from_msg
	movq	_OFFSET_SLAVE_ADDR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	%r13, %rdi
	movl	%eax, %esi
	callq	_mtk_i2c_writew
	movq	_I2C_HS_NACKERR@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movl	-52(%rbp), %r15d                ## 4-byte Reload
	orl	%r15d, %esi
	movq	_I2C_ACKERR@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	movq	_I2C_ARB_LOST@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	movq	_I2C_TRANSAC_COMP@GOTPCREL(%rip), %r14
	orl	(%r14), %esi
	movq	_OFFSET_INTR_STAT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rdi
	callq	_mtk_i2c_writew
	movq	_I2C_FIFO_ADDR_CLR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_OFFSET_FIFO_ADDR_CLR@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rdi
	callq	_mtk_i2c_writew
	movl	(%r12), %esi
	orl	%r15d, %esi
	movq	_I2C_ACKERR@GOTPCREL(%rip), %rcx
	orl	(%rcx), %esi
	movq	_I2C_ARB_LOST@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	orl	(%r14), %esi
	movq	_OFFSET_INTR_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rdi
	callq	_mtk_i2c_writew
	movq	16(%r13), %rax
	movq	_I2C_MASTER_WRRD@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_10
## %bb.6:
	movq	56(%r13), %rax
	cmpq	$0, 8(%rax)
	movl	(%rbx), %eax
	movq	%rbx, %r14
	je	LBB0_8
## %bb.7:
	movq	_OFFSET_TRANSFER_LEN@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	%r13, %rdi
	movl	%eax, %esi
	callq	_mtk_i2c_writew
	movl	8(%r14), %esi
	movq	_OFFSET_TRANSFER_LEN_AUX@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_10:
	movl	(%rbx), %esi
	movq	_OFFSET_TRANSFER_LEN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rdi
	callq	_mtk_i2c_writew
	movq	%rbx, %r14
	movl	-48(%rbp), %esi                 ## 4-byte Reload
	jmp	LBB0_11
LBB0_8:
	movl	8(%r14), %esi
	shll	$8, %esi
	orl	%eax, %esi
	movq	_OFFSET_TRANSFER_LEN@GOTPCREL(%rip), %rax
LBB0_9:
	movl	(%rax), %edx
	movq	%r13, %rdi
	callq	_mtk_i2c_writew
	movq	_I2C_WRRD_TRANAC_VALUE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
LBB0_11:
	movq	_OFFSET_TRANSAC_LEN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rdi
	callq	_mtk_i2c_writew
	movq	16(%r13), %rax
	movq	_I2C_MASTER_RD@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_21
## %bb.12:
	movq	_I2C_DMA_INT_FLAG_NONE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_OFFSET_INT_FLAG@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	48(%r13), %rsi
	callq	_writel
	movq	_I2C_DMA_CON_RX@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_OFFSET_CON@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	48(%r13), %rsi
	callq	_writel
	movq	%r14, %rdi
	movl	$1, %esi
	callq	_i2c_get_dma_safe_msg_buf
	testq	%rax, %rax
	je	LBB0_13
## %bb.14:
	movq	%rax, %r12
	movl	24(%r13), %edi
	movl	(%r14), %edx
	movq	_DMA_FROM_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r12, %rsi
	callq	_dma_map_single
	movq	%rax, %rbx
	movl	24(%r13), %edi
	movq	%rax, %rsi
	callq	_dma_mapping_error
	testq	%rax, %rax
	jne	LBB0_15
## %bb.18:
	movq	56(%r13), %rax
	cmpq	$0, (%rax)
	je	LBB0_20
## %bb.19:
	movq	%rbx, %rdi
	callq	_mtk_i2c_set_4g_mode
	movq	_OFFSET_RX_4G_MODE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rsi
	addq	48(%r13), %rsi
	movl	%eax, %edi
	callq	_writel
LBB0_20:
	movq	_OFFSET_RX_LEN@GOTPCREL(%rip), %r15
	movq	_OFFSET_RX_MEM_ADDR@GOTPCREL(%rip), %rax
	xorl	%ecx, %ecx
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rcx
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movl	%ebx, %edi
	movq	%r14, %rbx
	xorl	%ecx, %ecx
	movq	%rcx, -80(%rbp)                 ## 8-byte Spill
	jmp	LBB0_36
LBB0_21:
	movq	_I2C_MASTER_WR@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_27
## %bb.22:
	movq	_I2C_DMA_INT_FLAG_NONE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_OFFSET_INT_FLAG@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	48(%r13), %rsi
	callq	_writel
	movq	_I2C_DMA_CON_TX@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_OFFSET_CON@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	48(%r13), %rsi
	callq	_writel
	movq	%r14, %rdi
	movl	$1, %esi
	callq	_i2c_get_dma_safe_msg_buf
	testq	%rax, %rax
	je	LBB0_13
## %bb.23:
	movq	%rax, %r12
	movl	24(%r13), %edi
	movl	(%r14), %edx
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r12, %rsi
	callq	_dma_map_single
	movq	%rax, %rbx
	movl	24(%r13), %edi
	movq	%rax, %rsi
	callq	_dma_mapping_error
	testq	%rax, %rax
	jne	LBB0_15
## %bb.24:
	movq	%r12, -48(%rbp)                 ## 8-byte Spill
	movq	56(%r13), %rax
	cmpq	$0, (%rax)
	je	LBB0_26
## %bb.25:
	movq	%rbx, %rdi
	callq	_mtk_i2c_set_4g_mode
	movq	_OFFSET_TX_4G_MODE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rsi
	addq	48(%r13), %rsi
	movl	%eax, %edi
	callq	_writel
LBB0_26:
	movq	_OFFSET_TX_LEN@GOTPCREL(%rip), %r15
	movq	_OFFSET_TX_MEM_ADDR@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	movq	%rbx, %rcx
	movq	%rbx, -80(%rbp)                 ## 8-byte Spill
	movl	%ebx, %edi
	movq	%r14, %rbx
	xorl	%ecx, %ecx
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
LBB0_36:
	movq	(%rax), %rsi
	addq	48(%r13), %rsi
	callq	_writel
	movl	(%rbx), %edi
	movq	(%r15), %rsi
	addq	48(%r13), %rsi
	callq	_writel
	movq	_I2C_DMA_START_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_OFFSET_EN@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	48(%r13), %rsi
	callq	_writel
	cmpq	$0, 40(%r13)
	movq	_I2C_TRANSAC_START@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	je	LBB0_37
## %bb.38:
	movq	_I2C_RS_MUL_TRIG@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	cmpl	$0, -68(%rbp)                   ## 4-byte Folded Reload
	movq	_I2C_MASTER_RD@GOTPCREL(%rip), %r15
	jle	LBB0_40
## %bb.39:
	movq	_I2C_RS_MUL_CNFG@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	jmp	LBB0_40
LBB0_27:
	movq	_I2C_DMA_CLR_FLAG@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	movq	_OFFSET_INT_FLAG@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	48(%r13), %rsi
	callq	_writel
	movl	(%rbx), %edi
	movq	_OFFSET_CON@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	48(%r13), %rsi
	callq	_writel
	movq	%r14, %rdi
	movl	$1, %esi
	callq	_i2c_get_dma_safe_msg_buf
	testq	%rax, %rax
	je	LBB0_13
## %bb.28:
	movq	%rax, %r12
	movl	24(%r13), %edi
	movl	(%r14), %edx
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r12, %rsi
	callq	_dma_map_single
	movq	%rax, %rbx
	movl	24(%r13), %edi
	movq	%rax, %rsi
	callq	_dma_mapping_error
	testq	%rax, %rax
	je	LBB0_29
LBB0_15:
	xorl	%ebx, %ebx
	movq	%r12, %rdi
LBB0_16:
	movq	%r14, %rsi
LBB0_17:
	xorl	%edx, %edx
	callq	_i2c_put_dma_safe_msg_buf
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_52
LBB0_13:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
LBB0_51:
	xorl	%ebx, %ebx
LBB0_52:
	subl	(%rax), %ebx
LBB0_53:
	movl	%ebx, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_37:
	movq	_I2C_MASTER_RD@GOTPCREL(%rip), %r15
LBB0_40:
	movq	_OFFSET_START@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rdi
	callq	_mtk_i2c_writew
	movl	28(%r13), %esi
	movq	-96(%rbp), %rdi                 ## 8-byte Reload
	callq	_wait_for_completion_timeout
	movl	%eax, %ebx
	movl	-52(%rbp), %esi                 ## 4-byte Reload
	movq	_I2C_HS_NACKERR@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	movq	_I2C_ACKERR@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	movq	_I2C_ARB_LOST@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	movq	_I2C_TRANSAC_COMP@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	notl	%esi
	movq	_OFFSET_INTR_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rdi
	callq	_mtk_i2c_writew
	movq	16(%r13), %rax
	movq	_I2C_MASTER_WR@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_42
## %bb.41:
	movl	24(%r13), %edi
	movl	(%r14), %edx
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	-80(%rbp), %rsi                 ## 8-byte Reload
	callq	_dma_unmap_single
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	%r14, %rsi
	jmp	LBB0_46
LBB0_42:
	movl	24(%r13), %edi
	movl	(%r14), %edx
	cmpq	(%r15), %rax
	jne	LBB0_45
## %bb.43:
	movq	_DMA_FROM_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	callq	_dma_unmap_single
	movq	%r12, %rdi
	movq	%r14, %rsi
	jmp	LBB0_46
LBB0_29:
	movq	%r12, -48(%rbp)                 ## 8-byte Spill
	leaq	8(%r14), %r15
	movq	%r15, %rdi
	movl	$1, %esi
	callq	_i2c_get_dma_safe_msg_buf
	movl	24(%r13), %edi
	testq	%rax, %rax
	je	LBB0_30
## %bb.31:
	movq	%rax, %r12
	movl	(%r15), %edx
	movq	_DMA_FROM_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r12, %rsi
	callq	_dma_map_single
	movl	24(%r13), %edi
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	%rax, %rsi
	callq	_dma_mapping_error
	testq	%rax, %rax
	je	LBB0_33
## %bb.32:
	movl	24(%r13), %edi
	movl	(%r14), %edx
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%rbx, %rsi
	callq	_dma_unmap_single
	xorl	%ebx, %ebx
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	%r14, %rsi
	xorl	%edx, %edx
	callq	_i2c_put_dma_safe_msg_buf
	movq	%r12, %rdi
	movq	%r15, %rsi
	jmp	LBB0_17
LBB0_45:
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	-80(%rbp), %rsi                 ## 8-byte Reload
	callq	_dma_unmap_single
	movl	24(%r13), %edi
	leaq	8(%r14), %r15
	movl	8(%r14), %edx
	movq	_DMA_FROM_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	callq	_dma_unmap_single
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	%r14, %rsi
	movl	$1, %edx
	callq	_i2c_put_dma_safe_msg_buf
	movq	%r12, %rdi
	movq	%r15, %rsi
LBB0_46:
	movl	$1, %edx
	callq	_i2c_put_dma_safe_msg_buf
	testl	%ebx, %ebx
	movq	_I2C_ACKERR@GOTPCREL(%rip), %rax
	je	LBB0_47
## %bb.48:
	movl	(%rax), %eax
	movq	_I2C_HS_NACKERR@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	testl	%eax, (%r13)
	je	LBB0_49
## %bb.50:
	movl	24(%r13), %edi
	movl	4(%r14), %edx
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_dbg
	movq	%r13, %rdi
	callq	_mtk_i2c_init_hw
	movq	_ENXIO@GOTPCREL(%rip), %rax
	jmp	LBB0_51
LBB0_47:
	movl	24(%r13), %edi
	movl	4(%r14), %edx
	leaq	L_.str(%rip), %rsi
	callq	_dev_dbg
	movq	%r13, %rdi
	callq	_mtk_i2c_init_hw
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	jmp	LBB0_51
LBB0_49:
	xorl	%ebx, %ebx
	jmp	LBB0_53
LBB0_30:
	movl	(%r14), %edx
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%rbx, %rsi
	callq	_dma_unmap_single
	xorl	%ebx, %ebx
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	jmp	LBB0_16
LBB0_33:
	movq	%r15, -88(%rbp)                 ## 8-byte Spill
	movq	56(%r13), %rax
	cmpq	$0, (%rax)
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	je	LBB0_35
## %bb.34:
	movq	%rbx, %rdi
	callq	_mtk_i2c_set_4g_mode
	movq	_OFFSET_TX_4G_MODE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rsi
	addq	48(%r13), %rsi
	movl	%eax, %edi
	callq	_writel
	movq	%r15, %rdi
	callq	_mtk_i2c_set_4g_mode
	movq	_OFFSET_RX_4G_MODE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rsi
	addq	48(%r13), %rsi
	movl	%eax, %edi
	callq	_writel
LBB0_35:
	movq	_OFFSET_TX_MEM_ADDR@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	48(%r13), %rsi
	movq	%rbx, -80(%rbp)                 ## 8-byte Spill
	movl	%ebx, %edi
	callq	_writel
	movq	_OFFSET_RX_MEM_ADDR@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	48(%r13), %rsi
	movl	%r15d, %edi
	callq	_writel
	movl	(%r14), %edi
	movq	_OFFSET_RX_LEN@GOTPCREL(%rip), %r15
	movq	_OFFSET_TX_LEN@GOTPCREL(%rip), %rax
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_36
	.cfi_endproc
                                        ## -- End function
	.comm	_I2C_RS_TRANSFER,4,2            ## @I2C_RS_TRANSFER
	.comm	_OFFSET_CONTROL,4,2             ## @OFFSET_CONTROL
	.comm	_I2C_CONTROL_DIR_CHANGE,4,2     ## @I2C_CONTROL_DIR_CHANGE
	.comm	_I2C_CONTROL_RS,4,2             ## @I2C_CONTROL_RS
	.comm	_MAX_FS_MODE_SPEED,8,3          ## @MAX_FS_MODE_SPEED
	.comm	_I2C_MASTER_WRRD,8,3            ## @I2C_MASTER_WRRD
	.comm	_I2C_DEFAULT_SPEED,8,3          ## @I2C_DEFAULT_SPEED
	.comm	_I2C_ST_START_CON,4,2           ## @I2C_ST_START_CON
	.comm	_OFFSET_EXT_CONF,4,2            ## @OFFSET_EXT_CONF
	.comm	_I2C_FS_START_CON,4,2           ## @I2C_FS_START_CON
	.comm	_OFFSET_SLAVE_ADDR,4,2          ## @OFFSET_SLAVE_ADDR
	.comm	_I2C_HS_NACKERR,4,2             ## @I2C_HS_NACKERR
	.comm	_I2C_ACKERR,4,2                 ## @I2C_ACKERR
	.comm	_I2C_ARB_LOST,4,2               ## @I2C_ARB_LOST
	.comm	_I2C_TRANSAC_COMP,4,2           ## @I2C_TRANSAC_COMP
	.comm	_OFFSET_INTR_STAT,4,2           ## @OFFSET_INTR_STAT
	.comm	_I2C_FIFO_ADDR_CLR,4,2          ## @I2C_FIFO_ADDR_CLR
	.comm	_OFFSET_FIFO_ADDR_CLR,4,2       ## @OFFSET_FIFO_ADDR_CLR
	.comm	_OFFSET_INTR_MASK,4,2           ## @OFFSET_INTR_MASK
	.comm	_OFFSET_TRANSFER_LEN,4,2        ## @OFFSET_TRANSFER_LEN
	.comm	_OFFSET_TRANSFER_LEN_AUX,4,2    ## @OFFSET_TRANSFER_LEN_AUX
	.comm	_I2C_WRRD_TRANAC_VALUE,4,2      ## @I2C_WRRD_TRANAC_VALUE
	.comm	_OFFSET_TRANSAC_LEN,4,2         ## @OFFSET_TRANSAC_LEN
	.comm	_I2C_MASTER_RD,8,3              ## @I2C_MASTER_RD
	.comm	_I2C_DMA_INT_FLAG_NONE,4,2      ## @I2C_DMA_INT_FLAG_NONE
	.comm	_OFFSET_INT_FLAG,8,3            ## @OFFSET_INT_FLAG
	.comm	_I2C_DMA_CON_RX,4,2             ## @I2C_DMA_CON_RX
	.comm	_OFFSET_CON,8,3                 ## @OFFSET_CON
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_DMA_FROM_DEVICE,4,2            ## @DMA_FROM_DEVICE
	.comm	_OFFSET_RX_4G_MODE,8,3          ## @OFFSET_RX_4G_MODE
	.comm	_OFFSET_RX_MEM_ADDR,8,3         ## @OFFSET_RX_MEM_ADDR
	.comm	_OFFSET_RX_LEN,8,3              ## @OFFSET_RX_LEN
	.comm	_I2C_MASTER_WR,8,3              ## @I2C_MASTER_WR
	.comm	_I2C_DMA_CON_TX,4,2             ## @I2C_DMA_CON_TX
	.comm	_DMA_TO_DEVICE,4,2              ## @DMA_TO_DEVICE
	.comm	_OFFSET_TX_4G_MODE,8,3          ## @OFFSET_TX_4G_MODE
	.comm	_OFFSET_TX_MEM_ADDR,8,3         ## @OFFSET_TX_MEM_ADDR
	.comm	_OFFSET_TX_LEN,8,3              ## @OFFSET_TX_LEN
	.comm	_I2C_DMA_CLR_FLAG,4,2           ## @I2C_DMA_CLR_FLAG
	.comm	_I2C_DMA_START_EN,4,2           ## @I2C_DMA_START_EN
	.comm	_OFFSET_EN,8,3                  ## @OFFSET_EN
	.comm	_I2C_TRANSAC_START,4,2          ## @I2C_TRANSAC_START
	.comm	_I2C_RS_MUL_TRIG,4,2            ## @I2C_RS_MUL_TRIG
	.comm	_I2C_RS_MUL_CNFG,4,2            ## @I2C_RS_MUL_CNFG
	.comm	_OFFSET_START,4,2               ## @OFFSET_START
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"addr: %x, transfer timeout\n"

	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
L_.str.1:                               ## @.str.1
	.asciz	"addr: %x, transfer ACK error\n"

	.comm	_ENXIO,4,2                      ## @ENXIO
	.no_dead_strip	_mtk_i2c_do_transfer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_i2c_do_transfer
_mtk_i2c_do_transfer:                   ; @mtk_i2c_do_transfer
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x22, x3
	mov	x23, x2
	mov	x19, x1
	mov	x20, x0
	str	wzr, [x0]
	ldr	x8, [x0, #40]
Lloh0:
	adrp	x9, _I2C_RS_TRANSFER@GOTPAGE
Lloh1:
	ldr	x9, [x9, _I2C_RS_TRANSFER@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	cmp	x8, #0
	csel	w28, wzr, w9, eq
	add	x21, x0, #32
	mov	x0, x21
	bl	_reinit_completion
Lloh3:
	adrp	x25, _OFFSET_CONTROL@GOTPAGE
Lloh4:
	ldr	x25, [x25, _OFFSET_CONTROL@GOTPAGEOFF]
	ldr	w1, [x25]
	mov	x0, x20
	bl	_mtk_i2c_readw
Lloh5:
	adrp	x8, _I2C_CONTROL_DIR_CHANGE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _I2C_CONTROL_DIR_CHANGE@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
Lloh8:
	adrp	x9, _I2C_CONTROL_RS@GOTPAGE
Lloh9:
	ldr	x9, [x9, _I2C_CONTROL_RS@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh11:
	adrp	x10, _MAX_FS_MODE_SPEED@GOTPAGE
Lloh12:
	ldr	x10, [x10, _MAX_FS_MODE_SPEED@GOTPAGEOFF]
Lloh13:
	ldr	x10, [x10]
	ldp	x11, x12, [x20, #8]
	cmp	x11, x10
	bic	w10, w0, w8
	str	w22, [sp, #28]                  ; 4-byte Folded Spill
	ccmp	w22, #0, #0, le
	csel	w9, w9, wzr, gt
Lloh14:
	adrp	x24, _I2C_MASTER_WRRD@GOTPAGE
Lloh15:
	ldr	x24, [x24, _I2C_MASTER_WRRD@GOTPAGEOFF]
	orr	w9, w9, w10
	ldr	x10, [x24]
	orr	w8, w8, w0
	cmp	x12, x10
	csel	w1, w8, w9, eq
	ldr	w2, [x25]
	mov	x0, x20
	bl	_mtk_i2c_writew
Lloh16:
	adrp	x8, _I2C_DEFAULT_SPEED@GOTPAGE
Lloh17:
	ldr	x8, [x8, _I2C_DEFAULT_SPEED@GOTPAGEOFF]
	ldr	x9, [x20, #8]
Lloh18:
	ldr	x8, [x8]
Lloh19:
	adrp	x10, _I2C_FS_START_CON@GOTPAGE
Lloh20:
	ldr	x10, [x10, _I2C_FS_START_CON@GOTPAGEOFF]
Lloh21:
	adrp	x11, _I2C_ST_START_CON@GOTPAGE
Lloh22:
	ldr	x11, [x11, _I2C_ST_START_CON@GOTPAGEOFF]
	cmp	x9, x8
	csel	x8, x10, x11, gt
	ldr	w1, [x8]
Lloh23:
	adrp	x8, _OFFSET_EXT_CONF@GOTPAGE
Lloh24:
	ldr	x8, [x8, _OFFSET_EXT_CONF@GOTPAGEOFF]
Lloh25:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_mtk_i2c_writew
	mov	x0, x19
	bl	_i2c_8bit_addr_from_msg
	mov	x1, x0
Lloh26:
	adrp	x8, _OFFSET_SLAVE_ADDR@GOTPAGE
Lloh27:
	ldr	x8, [x8, _OFFSET_SLAVE_ADDR@GOTPAGEOFF]
Lloh28:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_mtk_i2c_writew
Lloh29:
	adrp	x25, _I2C_HS_NACKERR@GOTPAGE
Lloh30:
	ldr	x25, [x25, _I2C_HS_NACKERR@GOTPAGEOFF]
	ldr	w8, [x25]
	orr	w8, w8, w28
Lloh31:
	adrp	x26, _I2C_ACKERR@GOTPAGE
Lloh32:
	ldr	x26, [x26, _I2C_ACKERR@GOTPAGEOFF]
	ldr	w9, [x26]
	orr	w8, w8, w9
Lloh33:
	adrp	x27, _I2C_ARB_LOST@GOTPAGE
Lloh34:
	ldr	x27, [x27, _I2C_ARB_LOST@GOTPAGEOFF]
	ldr	w9, [x27]
Lloh35:
	adrp	x22, _I2C_TRANSAC_COMP@GOTPAGE
Lloh36:
	ldr	x22, [x22, _I2C_TRANSAC_COMP@GOTPAGEOFF]
	orr	w8, w8, w9
	ldr	w9, [x22]
	orr	w1, w8, w9
Lloh37:
	adrp	x8, _OFFSET_INTR_STAT@GOTPAGE
Lloh38:
	ldr	x8, [x8, _OFFSET_INTR_STAT@GOTPAGEOFF]
Lloh39:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_mtk_i2c_writew
Lloh40:
	adrp	x8, _I2C_FIFO_ADDR_CLR@GOTPAGE
Lloh41:
	ldr	x8, [x8, _I2C_FIFO_ADDR_CLR@GOTPAGEOFF]
Lloh42:
	ldr	w1, [x8]
Lloh43:
	adrp	x8, _OFFSET_FIFO_ADDR_CLR@GOTPAGE
Lloh44:
	ldr	x8, [x8, _OFFSET_FIFO_ADDR_CLR@GOTPAGEOFF]
Lloh45:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_mtk_i2c_writew
	ldr	w8, [x25]
	orr	w8, w8, w28
	ldr	w9, [x26]
	orr	w8, w8, w9
	ldr	w9, [x27]
	orr	w8, w8, w9
	ldr	w9, [x22]
	orr	w1, w8, w9
Lloh46:
	adrp	x8, _OFFSET_INTR_MASK@GOTPAGE
Lloh47:
	ldr	x8, [x8, _OFFSET_INTR_MASK@GOTPAGEOFF]
Lloh48:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_mtk_i2c_writew
	ldr	x8, [x20, #16]
	ldr	x9, [x24]
	cmp	x8, x9
	b.ne	LBB0_3
; %bb.1:
	ldr	x8, [x20, #56]
	ldr	x8, [x8, #8]
	ldr	w1, [x19]
	cbz	x8, LBB0_4
; %bb.2:
Lloh49:
	adrp	x8, _OFFSET_TRANSFER_LEN@GOTPAGE
Lloh50:
	ldr	x8, [x8, _OFFSET_TRANSFER_LEN@GOTPAGEOFF]
Lloh51:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_mtk_i2c_writew
	ldr	w1, [x19, #8]
Lloh52:
	adrp	x8, _OFFSET_TRANSFER_LEN_AUX@GOTPAGE
Lloh53:
	ldr	x8, [x8, _OFFSET_TRANSFER_LEN_AUX@GOTPAGEOFF]
	b	LBB0_5
LBB0_3:
	ldr	w1, [x19]
Lloh54:
	adrp	x8, _OFFSET_TRANSFER_LEN@GOTPAGE
Lloh55:
	ldr	x8, [x8, _OFFSET_TRANSFER_LEN@GOTPAGEOFF]
Lloh56:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_mtk_i2c_writew
	b	LBB0_6
LBB0_4:
	ldr	w8, [x19, #8]
	orr	w1, w1, w8, lsl #8
Lloh57:
	adrp	x8, _OFFSET_TRANSFER_LEN@GOTPAGE
Lloh58:
	ldr	x8, [x8, _OFFSET_TRANSFER_LEN@GOTPAGEOFF]
LBB0_5:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_mtk_i2c_writew
Lloh59:
	adrp	x8, _I2C_WRRD_TRANAC_VALUE@GOTPAGE
Lloh60:
	ldr	x8, [x8, _I2C_WRRD_TRANAC_VALUE@GOTPAGEOFF]
Lloh61:
	ldr	w23, [x8]
LBB0_6:
Lloh62:
	adrp	x8, _OFFSET_TRANSAC_LEN@GOTPAGE
Lloh63:
	ldr	x8, [x8, _OFFSET_TRANSAC_LEN@GOTPAGEOFF]
Lloh64:
	ldr	w2, [x8]
	mov	x0, x20
	mov	x1, x23
	bl	_mtk_i2c_writew
	ldr	x8, [x20, #16]
Lloh65:
	adrp	x25, _I2C_MASTER_RD@GOTPAGE
Lloh66:
	ldr	x25, [x25, _I2C_MASTER_RD@GOTPAGEOFF]
	ldr	x9, [x25]
	cmp	x8, x9
	b.ne	LBB0_10
; %bb.7:
Lloh67:
	adrp	x8, _I2C_DMA_INT_FLAG_NONE@GOTPAGE
Lloh68:
	ldr	x8, [x8, _I2C_DMA_INT_FLAG_NONE@GOTPAGEOFF]
Lloh69:
	ldr	w0, [x8]
	ldr	x8, [x20, #48]
Lloh70:
	adrp	x9, _OFFSET_INT_FLAG@GOTPAGE
Lloh71:
	ldr	x9, [x9, _OFFSET_INT_FLAG@GOTPAGEOFF]
Lloh72:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
Lloh73:
	adrp	x8, _I2C_DMA_CON_RX@GOTPAGE
Lloh74:
	ldr	x8, [x8, _I2C_DMA_CON_RX@GOTPAGEOFF]
Lloh75:
	ldr	w0, [x8]
	ldr	x8, [x20, #48]
Lloh76:
	adrp	x9, _OFFSET_CON@GOTPAGE
Lloh77:
	ldr	x9, [x9, _OFFSET_CON@GOTPAGEOFF]
Lloh78:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	mov	x0, x19
	mov	w1, #1
	bl	_i2c_get_dma_safe_msg_buf
	cbz	x0, LBB0_21
; %bb.8:
	mov	x24, x0
	ldr	w0, [x20, #24]
	ldr	w2, [x19]
Lloh79:
	adrp	x8, _DMA_FROM_DEVICE@GOTPAGE
Lloh80:
	ldr	x8, [x8, _DMA_FROM_DEVICE@GOTPAGEOFF]
Lloh81:
	ldr	w3, [x8]
	mov	x1, x24
	bl	_dma_map_single
	mov	x27, x0
	ldr	w0, [x20, #24]
	mov	x1, x27
	bl	_dma_mapping_error
	cbz	x0, LBB0_24
; %bb.9:
	mov	x0, x24
	b	LBB0_19
LBB0_10:
Lloh82:
	adrp	x9, _I2C_MASTER_WR@GOTPAGE
Lloh83:
	ldr	x9, [x9, _I2C_MASTER_WR@GOTPAGEOFF]
Lloh84:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_16
; %bb.11:
Lloh85:
	adrp	x8, _I2C_DMA_INT_FLAG_NONE@GOTPAGE
Lloh86:
	ldr	x8, [x8, _I2C_DMA_INT_FLAG_NONE@GOTPAGEOFF]
Lloh87:
	ldr	w0, [x8]
	ldr	x8, [x20, #48]
Lloh88:
	adrp	x9, _OFFSET_INT_FLAG@GOTPAGE
Lloh89:
	ldr	x9, [x9, _OFFSET_INT_FLAG@GOTPAGEOFF]
Lloh90:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
Lloh91:
	adrp	x8, _I2C_DMA_CON_TX@GOTPAGE
Lloh92:
	ldr	x8, [x8, _I2C_DMA_CON_TX@GOTPAGEOFF]
Lloh93:
	ldr	w0, [x8]
	ldr	x8, [x20, #48]
Lloh94:
	adrp	x9, _OFFSET_CON@GOTPAGE
Lloh95:
	ldr	x9, [x9, _OFFSET_CON@GOTPAGEOFF]
Lloh96:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	mov	x0, x19
	mov	w1, #1
	bl	_i2c_get_dma_safe_msg_buf
	cbz	x0, LBB0_21
; %bb.12:
	mov	x23, x0
	ldr	w0, [x20, #24]
	ldr	w2, [x19]
Lloh97:
	adrp	x8, _DMA_TO_DEVICE@GOTPAGE
Lloh98:
	ldr	x8, [x8, _DMA_TO_DEVICE@GOTPAGEOFF]
Lloh99:
	ldr	w3, [x8]
	mov	x1, x23
	bl	_dma_map_single
	mov	x26, x0
	ldr	w0, [x20, #24]
	mov	x1, x26
	bl	_dma_mapping_error
	cbnz	x0, LBB0_18
; %bb.13:
	ldr	x8, [x20, #56]
	ldr	x8, [x8]
	cbz	x8, LBB0_15
; %bb.14:
	mov	x0, x26
	bl	_mtk_i2c_set_4g_mode
	ldr	x8, [x20, #48]
Lloh100:
	adrp	x9, _OFFSET_TX_4G_MODE@GOTPAGE
Lloh101:
	ldr	x9, [x9, _OFFSET_TX_4G_MODE@GOTPAGEOFF]
Lloh102:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
LBB0_15:
	mov	x24, #0
	str	xzr, [sp, #8]                   ; 8-byte Folded Spill
Lloh103:
	adrp	x27, _OFFSET_TX_LEN@GOTPAGE
Lloh104:
	ldr	x27, [x27, _OFFSET_TX_LEN@GOTPAGEOFF]
Lloh105:
	adrp	x8, _OFFSET_TX_MEM_ADDR@GOTPAGE
Lloh106:
	ldr	x8, [x8, _OFFSET_TX_MEM_ADDR@GOTPAGEOFF]
	mov	x0, x26
	b	LBB0_27
LBB0_16:
Lloh107:
	adrp	x23, _I2C_DMA_CLR_FLAG@GOTPAGE
Lloh108:
	ldr	x23, [x23, _I2C_DMA_CLR_FLAG@GOTPAGEOFF]
	ldr	w0, [x23]
	ldr	x8, [x20, #48]
Lloh109:
	adrp	x9, _OFFSET_INT_FLAG@GOTPAGE
Lloh110:
	ldr	x9, [x9, _OFFSET_INT_FLAG@GOTPAGEOFF]
Lloh111:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	ldr	w0, [x23]
	ldr	x8, [x20, #48]
Lloh112:
	adrp	x9, _OFFSET_CON@GOTPAGE
Lloh113:
	ldr	x9, [x9, _OFFSET_CON@GOTPAGEOFF]
Lloh114:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	mov	x0, x19
	mov	w1, #1
	bl	_i2c_get_dma_safe_msg_buf
	cbz	x0, LBB0_21
; %bb.17:
	mov	x23, x0
	ldr	w0, [x20, #24]
	ldr	w2, [x19]
Lloh115:
	adrp	x27, _DMA_TO_DEVICE@GOTPAGE
Lloh116:
	ldr	x27, [x27, _DMA_TO_DEVICE@GOTPAGEOFF]
	ldr	w3, [x27]
	mov	x1, x23
	bl	_dma_map_single
	mov	x26, x0
	ldr	w0, [x20, #24]
	mov	x1, x26
	bl	_dma_mapping_error
	cbz	x0, LBB0_36
LBB0_18:
	mov	x0, x23
LBB0_19:
	mov	x1, x19
LBB0_20:
	mov	w2, #0
	bl	_i2c_put_dma_safe_msg_buf
LBB0_21:
Lloh117:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh118:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_22:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_23:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_24:
	ldr	x8, [x20, #56]
	ldr	x8, [x8]
	cbz	x8, LBB0_26
; %bb.25:
	mov	x0, x27
	bl	_mtk_i2c_set_4g_mode
	ldr	x8, [x20, #48]
Lloh119:
	adrp	x9, _OFFSET_RX_4G_MODE@GOTPAGE
Lloh120:
	ldr	x9, [x9, _OFFSET_RX_4G_MODE@GOTPAGEOFF]
Lloh121:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
LBB0_26:
	mov	x23, #0
	mov	x26, #0
	mov	x9, x27
Lloh122:
	adrp	x27, _OFFSET_RX_LEN@GOTPAGE
Lloh123:
	ldr	x27, [x27, _OFFSET_RX_LEN@GOTPAGEOFF]
Lloh124:
	adrp	x8, _OFFSET_RX_MEM_ADDR@GOTPAGE
Lloh125:
	ldr	x8, [x8, _OFFSET_RX_MEM_ADDR@GOTPAGEOFF]
	str	x9, [sp, #8]                    ; 8-byte Folded Spill
	mov	x0, x9
LBB0_27:
	mov	x22, x19
LBB0_28:
	ldr	x9, [x20, #48]
	ldr	x8, [x8]
	add	x1, x8, x9
	bl	_writel
	ldr	w0, [x22]
	ldr	x8, [x20, #48]
	ldr	x9, [x27]
	add	x1, x9, x8
	bl	_writel
Lloh126:
	adrp	x8, _I2C_DMA_START_EN@GOTPAGE
Lloh127:
	ldr	x8, [x8, _I2C_DMA_START_EN@GOTPAGEOFF]
Lloh128:
	ldr	w0, [x8]
	ldr	x8, [x20, #48]
Lloh129:
	adrp	x9, _OFFSET_EN@GOTPAGE
Lloh130:
	ldr	x9, [x9, _OFFSET_EN@GOTPAGEOFF]
Lloh131:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	ldr	x8, [x20, #40]
Lloh132:
	adrp	x9, _I2C_TRANSAC_START@GOTPAGE
Lloh133:
	ldr	x9, [x9, _I2C_TRANSAC_START@GOTPAGEOFF]
Lloh134:
	ldr	w1, [x9]
	str	x26, [sp, #16]                  ; 8-byte Folded Spill
	cbz	x8, LBB0_31
; %bb.29:
Lloh135:
	adrp	x8, _I2C_RS_MUL_TRIG@GOTPAGE
Lloh136:
	ldr	x8, [x8, _I2C_RS_MUL_TRIG@GOTPAGEOFF]
Lloh137:
	ldr	w8, [x8]
	orr	w1, w8, w1
	ldr	w8, [sp, #28]                   ; 4-byte Folded Reload
	cmp	w8, #1
Lloh138:
	adrp	x27, _I2C_HS_NACKERR@GOTPAGE
Lloh139:
	ldr	x27, [x27, _I2C_HS_NACKERR@GOTPAGEOFF]
Lloh140:
	adrp	x8, _OFFSET_INTR_MASK@GOTPAGE
Lloh141:
	ldr	x8, [x8, _OFFSET_INTR_MASK@GOTPAGEOFF]
	mov	x26, x25
	mov	x25, x8
	b.lt	LBB0_32
; %bb.30:
Lloh142:
	adrp	x8, _I2C_RS_MUL_CNFG@GOTPAGE
Lloh143:
	ldr	x8, [x8, _I2C_RS_MUL_CNFG@GOTPAGEOFF]
Lloh144:
	ldr	w8, [x8]
	orr	w1, w8, w1
	b	LBB0_32
LBB0_31:
	mov	x26, x25
Lloh145:
	adrp	x25, _OFFSET_INTR_MASK@GOTPAGE
Lloh146:
	ldr	x25, [x25, _OFFSET_INTR_MASK@GOTPAGEOFF]
Lloh147:
	adrp	x27, _I2C_HS_NACKERR@GOTPAGE
Lloh148:
	ldr	x27, [x27, _I2C_HS_NACKERR@GOTPAGEOFF]
LBB0_32:
Lloh149:
	adrp	x22, _I2C_TRANSAC_COMP@GOTPAGE
Lloh150:
	ldr	x22, [x22, _I2C_TRANSAC_COMP@GOTPAGEOFF]
Lloh151:
	adrp	x8, _OFFSET_START@GOTPAGE
Lloh152:
	ldr	x8, [x8, _OFFSET_START@GOTPAGEOFF]
Lloh153:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_mtk_i2c_writew
	ldr	w1, [x20, #28]
	mov	x0, x21
	bl	_wait_for_completion_timeout
	mov	x21, x0
	ldr	w8, [x27]
	orr	w8, w8, w28
Lloh154:
	adrp	x9, _I2C_ACKERR@GOTPAGE
Lloh155:
	ldr	x9, [x9, _I2C_ACKERR@GOTPAGEOFF]
Lloh156:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh157:
	adrp	x9, _I2C_ARB_LOST@GOTPAGE
Lloh158:
	ldr	x9, [x9, _I2C_ARB_LOST@GOTPAGEOFF]
Lloh159:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh160:
	ldr	w9, [x22]
	orr	w8, w8, w9
	mvn	w1, w8
	ldr	w2, [x25]
	mov	x0, x20
	bl	_mtk_i2c_writew
	ldr	x8, [x20, #16]
Lloh161:
	adrp	x9, _I2C_MASTER_WR@GOTPAGE
Lloh162:
	ldr	x9, [x9, _I2C_MASTER_WR@GOTPAGEOFF]
Lloh163:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_34
; %bb.33:
	ldr	w0, [x20, #24]
	ldr	w2, [x19]
Lloh164:
	adrp	x8, _DMA_TO_DEVICE@GOTPAGE
Lloh165:
	ldr	x8, [x8, _DMA_TO_DEVICE@GOTPAGEOFF]
Lloh166:
	ldr	w3, [x8]
	ldr	x1, [sp, #16]                   ; 8-byte Folded Reload
	bl	_dma_unmap_single
	mov	x0, x23
	mov	x1, x19
	b	LBB0_40
LBB0_34:
	ldr	x9, [x26]
	ldr	w0, [x20, #24]
	ldr	w2, [x19]
	cmp	x8, x9
	b.ne	LBB0_39
; %bb.35:
Lloh167:
	adrp	x8, _DMA_FROM_DEVICE@GOTPAGE
Lloh168:
	ldr	x8, [x8, _DMA_FROM_DEVICE@GOTPAGEOFF]
Lloh169:
	ldr	w3, [x8]
	ldr	x1, [sp, #8]                    ; 8-byte Folded Reload
	bl	_dma_unmap_single
	mov	x0, x24
	mov	x1, x19
	b	LBB0_40
LBB0_36:
	add	x22, x19, #8
	mov	x0, x22
	mov	w1, #1
	bl	_i2c_get_dma_safe_msg_buf
	mov	x24, x0
	ldr	w0, [x20, #24]
	cbz	x24, LBB0_45
; %bb.37:
	ldr	w2, [x22]
Lloh170:
	adrp	x8, _DMA_FROM_DEVICE@GOTPAGE
Lloh171:
	ldr	x8, [x8, _DMA_FROM_DEVICE@GOTPAGEOFF]
Lloh172:
	ldr	w3, [x8]
	mov	x1, x24
	bl	_dma_map_single
	mov	x27, x0
	ldr	w0, [x20, #24]
	mov	x1, x27
	bl	_dma_mapping_error
	cbz	x0, LBB0_46
; %bb.38:
	ldr	w0, [x20, #24]
	ldr	w2, [x19]
Lloh173:
	adrp	x8, _DMA_TO_DEVICE@GOTPAGE
Lloh174:
	ldr	x8, [x8, _DMA_TO_DEVICE@GOTPAGEOFF]
Lloh175:
	ldr	w3, [x8]
	mov	x1, x26
	bl	_dma_unmap_single
	mov	x0, x23
	mov	x1, x19
	mov	w2, #0
	bl	_i2c_put_dma_safe_msg_buf
	mov	x0, x24
	mov	x1, x22
	b	LBB0_20
LBB0_39:
Lloh176:
	adrp	x8, _DMA_TO_DEVICE@GOTPAGE
Lloh177:
	ldr	x8, [x8, _DMA_TO_DEVICE@GOTPAGEOFF]
Lloh178:
	ldr	w3, [x8]
	ldr	x1, [sp, #16]                   ; 8-byte Folded Reload
	bl	_dma_unmap_single
	ldr	w0, [x20, #24]
	mov	x22, x19
	ldr	w2, [x22, #8]!
Lloh179:
	adrp	x8, _DMA_FROM_DEVICE@GOTPAGE
Lloh180:
	ldr	x8, [x8, _DMA_FROM_DEVICE@GOTPAGEOFF]
Lloh181:
	ldr	w3, [x8]
	ldr	x1, [sp, #8]                    ; 8-byte Folded Reload
	bl	_dma_unmap_single
	mov	x0, x23
	mov	x1, x19
	mov	w2, #1
	bl	_i2c_put_dma_safe_msg_buf
	mov	x0, x24
	mov	x1, x22
LBB0_40:
	mov	w2, #1
	bl	_i2c_put_dma_safe_msg_buf
	cbz	w21, LBB0_43
; %bb.41:
	ldr	w8, [x20]
	ldr	w9, [x27]
Lloh182:
	adrp	x10, _I2C_ACKERR@GOTPAGE
Lloh183:
	ldr	x10, [x10, _I2C_ACKERR@GOTPAGEOFF]
Lloh184:
	ldr	w10, [x10]
	orr	w9, w10, w9
	tst	w9, w8
	b.eq	LBB0_44
; %bb.42:
	ldr	w0, [x20, #24]
	ldr	w2, [x19, #4]
Lloh185:
	adrp	x1, l_.str.1@PAGE
Lloh186:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_dbg
	mov	x0, x20
	bl	_mtk_i2c_init_hw
Lloh187:
	adrp	x8, _ENXIO@GOTPAGE
Lloh188:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
	b	LBB0_22
LBB0_43:
	ldr	w0, [x20, #24]
	ldr	w2, [x19, #4]
Lloh189:
	adrp	x1, l_.str@PAGE
Lloh190:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
	mov	x0, x20
	bl	_mtk_i2c_init_hw
Lloh191:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh192:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
	b	LBB0_22
LBB0_44:
	mov	w0, #0
	b	LBB0_23
LBB0_45:
	ldr	w2, [x19]
	ldr	w3, [x27]
	mov	x1, x26
	bl	_dma_unmap_single
	b	LBB0_18
LBB0_46:
	ldr	x8, [x20, #56]
	ldr	x8, [x8]
	cbz	x8, LBB0_48
; %bb.47:
	mov	x0, x26
	bl	_mtk_i2c_set_4g_mode
	ldr	x8, [x20, #48]
Lloh193:
	adrp	x9, _OFFSET_TX_4G_MODE@GOTPAGE
Lloh194:
	ldr	x9, [x9, _OFFSET_TX_4G_MODE@GOTPAGEOFF]
Lloh195:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	mov	x0, x27
	bl	_mtk_i2c_set_4g_mode
	ldr	x8, [x20, #48]
Lloh196:
	adrp	x9, _OFFSET_RX_4G_MODE@GOTPAGE
Lloh197:
	ldr	x9, [x9, _OFFSET_RX_4G_MODE@GOTPAGEOFF]
Lloh198:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
LBB0_48:
	ldr	x8, [x20, #48]
Lloh199:
	adrp	x9, _OFFSET_TX_MEM_ADDR@GOTPAGE
Lloh200:
	ldr	x9, [x9, _OFFSET_TX_MEM_ADDR@GOTPAGEOFF]
Lloh201:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	x0, x26
	bl	_writel
	ldr	x8, [x20, #48]
Lloh202:
	adrp	x9, _OFFSET_RX_MEM_ADDR@GOTPAGE
Lloh203:
	ldr	x9, [x9, _OFFSET_RX_MEM_ADDR@GOTPAGEOFF]
Lloh204:
	ldr	x9, [x9]
	add	x1, x9, x8
	str	x27, [sp, #8]                   ; 8-byte Folded Spill
	mov	x0, x27
	bl	_writel
	ldr	w0, [x19]
Lloh205:
	adrp	x27, _OFFSET_RX_LEN@GOTPAGE
Lloh206:
	ldr	x27, [x27, _OFFSET_RX_LEN@GOTPAGEOFF]
Lloh207:
	adrp	x8, _OFFSET_TX_LEN@GOTPAGE
Lloh208:
	ldr	x8, [x8, _OFFSET_TX_LEN@GOTPAGEOFF]
	b	LBB0_28
	.loh AdrpLdrGotLdr	Lloh46, Lloh47, Lloh48
	.loh AdrpLdrGotLdr	Lloh43, Lloh44, Lloh45
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGot	Lloh35, Lloh36
	.loh AdrpLdrGot	Lloh33, Lloh34
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh52, Lloh53
	.loh AdrpLdrGotLdr	Lloh49, Lloh50, Lloh51
	.loh AdrpLdrGotLdr	Lloh54, Lloh55, Lloh56
	.loh AdrpLdrGot	Lloh57, Lloh58
	.loh AdrpLdrGotLdr	Lloh59, Lloh60, Lloh61
	.loh AdrpLdrGot	Lloh65, Lloh66
	.loh AdrpLdrGotLdr	Lloh62, Lloh63, Lloh64
	.loh AdrpLdrGotLdr	Lloh76, Lloh77, Lloh78
	.loh AdrpLdrGotLdr	Lloh73, Lloh74, Lloh75
	.loh AdrpLdrGotLdr	Lloh70, Lloh71, Lloh72
	.loh AdrpLdrGotLdr	Lloh67, Lloh68, Lloh69
	.loh AdrpLdrGotLdr	Lloh79, Lloh80, Lloh81
	.loh AdrpLdrGotLdr	Lloh82, Lloh83, Lloh84
	.loh AdrpLdrGotLdr	Lloh94, Lloh95, Lloh96
	.loh AdrpLdrGotLdr	Lloh91, Lloh92, Lloh93
	.loh AdrpLdrGotLdr	Lloh88, Lloh89, Lloh90
	.loh AdrpLdrGotLdr	Lloh85, Lloh86, Lloh87
	.loh AdrpLdrGotLdr	Lloh97, Lloh98, Lloh99
	.loh AdrpLdrGotLdr	Lloh100, Lloh101, Lloh102
	.loh AdrpLdrGot	Lloh105, Lloh106
	.loh AdrpLdrGot	Lloh103, Lloh104
	.loh AdrpLdrGotLdr	Lloh112, Lloh113, Lloh114
	.loh AdrpLdrGotLdr	Lloh109, Lloh110, Lloh111
	.loh AdrpLdrGot	Lloh107, Lloh108
	.loh AdrpLdrGot	Lloh115, Lloh116
	.loh AdrpLdrGot	Lloh117, Lloh118
	.loh AdrpLdrGotLdr	Lloh119, Lloh120, Lloh121
	.loh AdrpLdrGot	Lloh124, Lloh125
	.loh AdrpLdrGot	Lloh122, Lloh123
	.loh AdrpLdrGotLdr	Lloh132, Lloh133, Lloh134
	.loh AdrpLdrGotLdr	Lloh129, Lloh130, Lloh131
	.loh AdrpLdrGotLdr	Lloh126, Lloh127, Lloh128
	.loh AdrpLdrGot	Lloh140, Lloh141
	.loh AdrpLdrGot	Lloh138, Lloh139
	.loh AdrpLdrGotLdr	Lloh135, Lloh136, Lloh137
	.loh AdrpLdrGotLdr	Lloh142, Lloh143, Lloh144
	.loh AdrpLdrGot	Lloh147, Lloh148
	.loh AdrpLdrGot	Lloh145, Lloh146
	.loh AdrpLdrGotLdr	Lloh161, Lloh162, Lloh163
	.loh AdrpLdrGotLdr	Lloh157, Lloh158, Lloh159
	.loh AdrpLdrGotLdr	Lloh154, Lloh155, Lloh156
	.loh AdrpLdrGotLdr	Lloh151, Lloh152, Lloh153
	.loh AdrpLdrGotLdr	Lloh149, Lloh150, Lloh160
	.loh AdrpLdrGotLdr	Lloh164, Lloh165, Lloh166
	.loh AdrpLdrGotLdr	Lloh167, Lloh168, Lloh169
	.loh AdrpLdrGotLdr	Lloh170, Lloh171, Lloh172
	.loh AdrpLdrGotLdr	Lloh173, Lloh174, Lloh175
	.loh AdrpLdrGotLdr	Lloh179, Lloh180, Lloh181
	.loh AdrpLdrGotLdr	Lloh176, Lloh177, Lloh178
	.loh AdrpLdrGotLdr	Lloh182, Lloh183, Lloh184
	.loh AdrpLdrGot	Lloh187, Lloh188
	.loh AdrpAdd	Lloh185, Lloh186
	.loh AdrpLdrGot	Lloh191, Lloh192
	.loh AdrpAdd	Lloh189, Lloh190
	.loh AdrpLdrGotLdr	Lloh196, Lloh197, Lloh198
	.loh AdrpLdrGotLdr	Lloh193, Lloh194, Lloh195
	.loh AdrpLdrGot	Lloh207, Lloh208
	.loh AdrpLdrGot	Lloh205, Lloh206
	.loh AdrpLdrGotLdr	Lloh202, Lloh203, Lloh204
	.loh AdrpLdrGotLdr	Lloh199, Lloh200, Lloh201
	.cfi_endproc
                                        ; -- End function
	.comm	_I2C_RS_TRANSFER,4,2            ; @I2C_RS_TRANSFER
	.comm	_OFFSET_CONTROL,4,2             ; @OFFSET_CONTROL
	.comm	_I2C_CONTROL_DIR_CHANGE,4,2     ; @I2C_CONTROL_DIR_CHANGE
	.comm	_I2C_CONTROL_RS,4,2             ; @I2C_CONTROL_RS
	.comm	_MAX_FS_MODE_SPEED,8,3          ; @MAX_FS_MODE_SPEED
	.comm	_I2C_MASTER_WRRD,8,3            ; @I2C_MASTER_WRRD
	.comm	_I2C_DEFAULT_SPEED,8,3          ; @I2C_DEFAULT_SPEED
	.comm	_I2C_ST_START_CON,4,2           ; @I2C_ST_START_CON
	.comm	_OFFSET_EXT_CONF,4,2            ; @OFFSET_EXT_CONF
	.comm	_I2C_FS_START_CON,4,2           ; @I2C_FS_START_CON
	.comm	_OFFSET_SLAVE_ADDR,4,2          ; @OFFSET_SLAVE_ADDR
	.comm	_I2C_HS_NACKERR,4,2             ; @I2C_HS_NACKERR
	.comm	_I2C_ACKERR,4,2                 ; @I2C_ACKERR
	.comm	_I2C_ARB_LOST,4,2               ; @I2C_ARB_LOST
	.comm	_I2C_TRANSAC_COMP,4,2           ; @I2C_TRANSAC_COMP
	.comm	_OFFSET_INTR_STAT,4,2           ; @OFFSET_INTR_STAT
	.comm	_I2C_FIFO_ADDR_CLR,4,2          ; @I2C_FIFO_ADDR_CLR
	.comm	_OFFSET_FIFO_ADDR_CLR,4,2       ; @OFFSET_FIFO_ADDR_CLR
	.comm	_OFFSET_INTR_MASK,4,2           ; @OFFSET_INTR_MASK
	.comm	_OFFSET_TRANSFER_LEN,4,2        ; @OFFSET_TRANSFER_LEN
	.comm	_OFFSET_TRANSFER_LEN_AUX,4,2    ; @OFFSET_TRANSFER_LEN_AUX
	.comm	_I2C_WRRD_TRANAC_VALUE,4,2      ; @I2C_WRRD_TRANAC_VALUE
	.comm	_OFFSET_TRANSAC_LEN,4,2         ; @OFFSET_TRANSAC_LEN
	.comm	_I2C_MASTER_RD,8,3              ; @I2C_MASTER_RD
	.comm	_I2C_DMA_INT_FLAG_NONE,4,2      ; @I2C_DMA_INT_FLAG_NONE
	.comm	_OFFSET_INT_FLAG,8,3            ; @OFFSET_INT_FLAG
	.comm	_I2C_DMA_CON_RX,4,2             ; @I2C_DMA_CON_RX
	.comm	_OFFSET_CON,8,3                 ; @OFFSET_CON
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_DMA_FROM_DEVICE,4,2            ; @DMA_FROM_DEVICE
	.comm	_OFFSET_RX_4G_MODE,8,3          ; @OFFSET_RX_4G_MODE
	.comm	_OFFSET_RX_MEM_ADDR,8,3         ; @OFFSET_RX_MEM_ADDR
	.comm	_OFFSET_RX_LEN,8,3              ; @OFFSET_RX_LEN
	.comm	_I2C_MASTER_WR,8,3              ; @I2C_MASTER_WR
	.comm	_I2C_DMA_CON_TX,4,2             ; @I2C_DMA_CON_TX
	.comm	_DMA_TO_DEVICE,4,2              ; @DMA_TO_DEVICE
	.comm	_OFFSET_TX_4G_MODE,8,3          ; @OFFSET_TX_4G_MODE
	.comm	_OFFSET_TX_MEM_ADDR,8,3         ; @OFFSET_TX_MEM_ADDR
	.comm	_OFFSET_TX_LEN,8,3              ; @OFFSET_TX_LEN
	.comm	_I2C_DMA_CLR_FLAG,4,2           ; @I2C_DMA_CLR_FLAG
	.comm	_I2C_DMA_START_EN,4,2           ; @I2C_DMA_START_EN
	.comm	_OFFSET_EN,8,3                  ; @OFFSET_EN
	.comm	_I2C_TRANSAC_START,4,2          ; @I2C_TRANSAC_START
	.comm	_I2C_RS_MUL_TRIG,4,2            ; @I2C_RS_MUL_TRIG
	.comm	_I2C_RS_MUL_CNFG,4,2            ; @I2C_RS_MUL_CNFG
	.comm	_OFFSET_START,4,2               ; @OFFSET_START
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"addr: %x, transfer timeout\n"

	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
l_.str.1:                               ; @.str.1
	.asciz	"addr: %x, transfer ACK error\n"

	.comm	_ENXIO,4,2                      ; @ENXIO
	.no_dead_strip	_mtk_i2c_do_transfer
.subsections_via_symbols
