	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sprd_i2c_handle_msg
_sprd_i2c_handle_msg:                   ## @sprd_i2c_handle_msg
	.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
	movl	%edx, %r13d
	movq	%rsi, %r15
	movq	(%rdi), %rbx
	movq	%rsi, 16(%rbx)
	movl	8(%rsi), %eax
	movl	%eax, 12(%rbx)
	movl	4(%rsi), %eax
	movl	%eax, 8(%rbx)
	leaq	4(%rbx), %r14
	movq	%r14, %rdi
	callq	_reinit_completion
	movq	%rbx, %rdi
	callq	_sprd_i2c_reset_fifo
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_sprd_i2c_set_devaddr
	movl	4(%r15), %esi
	movq	%rbx, %rdi
	callq	_sprd_i2c_set_count
	movq	_I2C_M_RD@GOTPCREL(%rip), %r12
	movl	(%r12), %eax
	testl	%eax, (%r15)
	je	LBB0_2
## %bb.1:
	movl	$1, %r13d
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_sprd_i2c_opt_mode
	jmp	LBB0_3
LBB0_2:
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_sprd_i2c_opt_mode
	movl	%r13d, %eax
	xorl	%r13d, %r13d
	testl	%eax, %eax
	setne	%r13b
LBB0_3:
	movq	%rbx, %rdi
	movl	%r13d, %esi
	callq	_sprd_i2c_send_stop
	movl	(%r12), %eax
	testl	%eax, (%r15)
	je	LBB0_5
## %bb.4:
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_sprd_i2c_set_fifo_full_int
	jmp	LBB0_6
LBB0_5:
	movq	%rbx, %rdi
	callq	_sprd_i2c_data_transfer
LBB0_6:
	movq	%rbx, %rdi
	callq	_sprd_i2c_opt_start
	movq	%r14, %rdi
	callq	_wait_for_completion
	movl	(%rbx), %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_I2C_M_RD,4,2                   ## @I2C_M_RD
	.no_dead_strip	_sprd_i2c_handle_msg
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sprd_i2c_handle_msg
_sprd_i2c_handle_msg:                   ; @sprd_i2c_handle_msg
	.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	x22, x2
	mov	x21, x1
	ldr	x19, [x0]
	str	x1, [x19, #16]
	ldur	d0, [x1, #4]
	str	d0, [x19, #8]
	add	x20, x19, #4
	mov	x0, x20
	bl	_reinit_completion
	mov	x0, x19
	bl	_sprd_i2c_reset_fifo
	mov	x0, x19
	mov	x1, x21
	bl	_sprd_i2c_set_devaddr
	ldr	w1, [x21, #4]
	mov	x0, x19
	bl	_sprd_i2c_set_count
	ldr	w8, [x21]
Lloh0:
	adrp	x23, _I2C_M_RD@GOTPAGE
Lloh1:
	ldr	x23, [x23, _I2C_M_RD@GOTPAGEOFF]
	ldr	w9, [x23]
	tst	w9, w8
	b.eq	LBB0_2
; %bb.1:
	mov	w22, #1
	mov	x0, x19
	mov	w1, #1
	bl	_sprd_i2c_opt_mode
	b	LBB0_3
LBB0_2:
	mov	x0, x19
	mov	w1, #0
	bl	_sprd_i2c_opt_mode
	cmp	w22, #0
	cset	w22, ne
LBB0_3:
	mov	x0, x19
	mov	x1, x22
	bl	_sprd_i2c_send_stop
	ldr	w8, [x21]
	ldr	w9, [x23]
	mov	x0, x19
	tst	w9, w8
	b.eq	LBB0_5
; %bb.4:
	mov	w1, #1
	bl	_sprd_i2c_set_fifo_full_int
	b	LBB0_6
LBB0_5:
	bl	_sprd_i2c_data_transfer
LBB0_6:
	mov	x0, x19
	bl	_sprd_i2c_opt_start
	mov	x0, x20
	bl	_wait_for_completion
	ldr	w0, [x19]
	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
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_I2C_M_RD,4,2                   ; @I2C_M_RD
	.no_dead_strip	_sprd_i2c_handle_msg
.subsections_via_symbols
