	.file	"extr_dw-i3c-master.c_dw_i3c_master_i2c_xfers.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	dw_i3c_master_i2c_xfers, @function
dw_i3c_master_i2c_xfers:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	mov	r12, rdi
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	ebp, edx
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 40
	.cfi_def_cfa_offset 96
	mov	QWORD PTR 16[rsp], rsi
	call	i2c_dev_get_master_data@PLT
	mov	rdi, r12
	xor	r12d, r12d
	mov	QWORD PTR 8[rsp], rax
	call	i2c_dev_get_master@PLT
	mov	rdi, rax
	call	to_dw_i3c_master@PLT
	test	ebp, ebp
	je	.L1
	mov	r13, rax
	cmp	DWORD PTR [rax], ebp
	jl	.L32
	test	ebp, ebp
	jle	.L34
	mov	rcx, QWORD PTR 16[rsp]
	lea	eax, -1[rbp]
	xor	r12d, r12d
	xor	ebx, ebx
	mov	DWORD PTR 28[rsp], eax
	lea	rax, [rax+rax*2]
	mov	r14, rcx
	lea	r15, 12[rcx+rax*4]
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L36:
	call	DIV_ROUND_UP@PLT
	add	r14, 12
	add	ebx, eax
	cmp	r14, r15
	je	.L35
.L8:
	mov	edi, DWORD PTR 4[r14]
	mov	eax, DWORD PTR [r14]
	mov	esi, 4
	test	DWORD PTR I2C_M_RD[rip], eax
	jne	.L36
	call	DIV_ROUND_UP@PLT
	add	r14, 12
	add	r12d, eax
	cmp	r14, r15
	jne	.L8
.L35:
	cmp	ebx, r12d
	cmovb	ebx, r12d
	cmp	DWORD PTR 4[r13], ebx
	jnb	.L9
.L32:
	mov	r12d, DWORD PTR ENOTSUPP[rip]
	neg	r12d
.L1:
	add	rsp, 40
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	eax, r12d
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L9:
	.cfi_restore_state
	mov	esi, ebp
	mov	rdi, r13
	call	dw_i3c_master_alloc_xfer@PLT
	mov	rbp, rax
	test	rax, rax
	je	.L17
	mov	eax, DWORD PTR 28[rsp]
	mov	r15, QWORD PTR 16[rsp]
	xor	r12d, r12d
	mov	QWORD PTR 16[rsp], rax
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L38:
	or	eax, DWORD PTR COMMAND_PORT_READ_TRANSFER[rip]
	mov	DWORD PTR 4[r14], eax
	mov	eax, DWORD PTR 8[r15]
	mov	DWORD PTR 20[r14], eax
	mov	eax, DWORD PTR 4[r15]
	mov	DWORD PTR 16[r14], eax
	cmp	DWORD PTR 28[rsp], r12d
	je	.L37
.L14:
	lea	rax, 1[r12]
	add	r15, 12
	cmp	r12, QWORD PTR 16[rsp]
	je	.L16
.L20:
	mov	r12, rax
.L15:
	mov	rdx, QWORD PTR 8[rbp]
	mov	edi, DWORD PTR 4[r15]
	lea	rax, [r12+r12*2]
	lea	r14, [rdx+rax*8]
	call	COMMAND_PORT_ARG_DATA_LEN@PLT
	or	eax, DWORD PTR COMMAND_PORT_TRANSFER_ARG[rip]
	mov	edi, r12d
	mov	DWORD PTR [r14], eax
	call	COMMAND_PORT_TID@PLT
	mov	ebx, eax
	mov	rax, QWORD PTR 8[rsp]
	mov	edi, DWORD PTR [rax]
	call	COMMAND_PORT_DEV_INDEX@PLT
	or	eax, ebx
	or	eax, DWORD PTR COMMAND_PORT_ROC[rip]
	mov	DWORD PTR 4[r14], eax
	mov	ecx, DWORD PTR [r15]
	test	DWORD PTR I2C_M_RD[rip], ecx
	jne	.L38
	mov	eax, DWORD PTR 8[r15]
	mov	DWORD PTR 12[r14], eax
	mov	eax, DWORD PTR 4[r15]
	mov	DWORD PTR 8[r14], eax
	cmp	DWORD PTR 28[rsp], r12d
	jne	.L14
.L37:
	mov	eax, DWORD PTR COMMAND_PORT_TOC[rip]
	add	r15, 12
	or	DWORD PTR 4[r14], eax
	lea	rax, 1[r12]
	cmp	r12, QWORD PTR 16[rsp]
	jne	.L20
	.p2align 4,,10
	.p2align 3
.L16:
	mov	rsi, rbp
	mov	rdi, r13
	call	dw_i3c_master_enqueue_xfer@PLT
	mov	esi, DWORD PTR XFER_TIMEOUT[rip]
	lea	rdi, 4[rbp]
	call	wait_for_completion_timeout@PLT
	test	eax, eax
	je	.L39
.L11:
	mov	rdi, rbp
	mov	r12d, DWORD PTR 0[rbp]
	call	dw_i3c_master_free_xfer@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L34:
	mov	esi, ebp
	mov	rdi, rax
	call	dw_i3c_master_alloc_xfer@PLT
	mov	rbp, rax
	test	rax, rax
	jne	.L16
.L17:
	mov	r12d, DWORD PTR ENOMEM[rip]
	neg	r12d
	jmp	.L1
.L39:
	mov	rsi, rbp
	mov	rdi, r13
	call	dw_i3c_master_dequeue_xfer@PLT
	jmp	.L11
	.cfi_endproc
.LFE0:
	.size	dw_i3c_master_i2c_xfers, .-dw_i3c_master_i2c_xfers
	.comm	XFER_TIMEOUT,4,4
	.comm	I2C_M_RD,4,4
	.comm	ENOTSUPP,4,4
	.comm	ENOMEM,4,4
	.comm	COMMAND_PORT_TRANSFER_ARG,4,4
	.comm	COMMAND_PORT_TOC,4,4
	.comm	COMMAND_PORT_ROC,4,4
	.comm	COMMAND_PORT_READ_TRANSFER,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_dw-i3c-master.c_dw_i3c_master_i2c_xfers.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	dw_i3c_master_i2c_xfers, %function
dw_i3c_master_i2c_xfers:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	sub	sp, sp, #20
	mov	r4, r2
	mov	r5, r1
	mov	r6, r0
	bl	i2c_dev_get_master_data
	mov	r10, r0
	mov	r0, r6
	str	r10, [sp]
	bl	i2c_dev_get_master
	bl	to_dw_i3c_master
	cmp	r4, #0
	beq	.L1
	ldr	r3, [r0]
	mov	r9, r0
	cmp	r3, r4
	blt	.L31
	cmp	r4, #0
	ble	.L33
	mov	r8, #0
	add	r7, r4, r4, lsl #1
	mov	fp, r5
	mov	r6, r8
	ldr	r10, .L39
	add	r7, r5, r7, lsl #2
	b	.L8
.L35:
	bl	DIV_ROUND_UP
	add	fp, fp, #12
	cmp	fp, r7
	add	r6, r6, r0
	beq	.L34
.L8:
	ldr	r2, [fp]
	ldr	r3, [r10]
	mov	r1, #4
	tst	r2, r3
	ldr	r0, [fp, #4]
	bne	.L35
	bl	DIV_ROUND_UP
	add	fp, fp, #12
	cmp	fp, r7
	add	r8, r8, r0
	bne	.L8
.L34:
	cmp	r6, r8
	movcc	r6, r8
	ldr	r2, [r9, #4]
	cmp	r2, r6
	bcs	.L9
.L31:
	ldr	r3, .L39+4
	ldr	r4, [r3]
	rsb	r4, r4, #0
.L1:
	mov	r0, r4
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L9:
	mov	r1, r4
	mov	r0, r9
	bl	dw_i3c_master_alloc_xfer
	subs	r3, r0, #0
	str	r3, [sp, #4]
	beq	.L17
	sub	r3, r4, #1
	mov	r8, #0
	str	r3, [sp, #8]
	mov	r3, r4
	ldr	fp, .L39+8
	mov	r4, r8
	str	r9, [sp, #12]
	mov	r8, r3
	b	.L15
.L37:
	ldr	r3, .L39+12
	ldr	r0, [r3]
	orr	r6, r0, r6
	str	r6, [r7, #4]
	ldr	r0, [r5, #8]
	str	r0, [r7, #20]
	ldr	r0, [r5, #4]
	str	r0, [r7, #16]
.L13:
	ldr	r3, [sp, #8]
	add	r5, r5, #12
	cmp	r4, r3
	ldreq	r3, .L39+16
	ldreq	r0, [r7, #4]
	ldreq	ip, [r3]
	add	r4, r4, #1
	orreq	r0, r0, ip
	streq	r0, [r7, #4]
	cmp	r8, r4
	beq	.L36
.L15:
	ldr	r3, [sp, #4]
	ldr	r0, [r5, #4]
	ldr	r9, [r3, #8]
	bl	COMMAND_PORT_ARG_DATA_LEN
	ldr	ip, [fp]
	add	r7, r4, r4, lsl #1
	orr	ip, ip, r0
	str	ip, [r9, r7, lsl #3]
	mov	r0, r4
	bl	COMMAND_PORT_TID
	ldr	r3, [sp]
	mov	r6, r0
	ldr	r0, [r3]
	bl	COMMAND_PORT_DEV_INDEX
	ldr	r1, .L39+20
	orr	r6, r6, r0
	ldr	ip, [r1]
	add	r7, r9, r7, lsl #3
	orr	r6, r6, ip
	str	r6, [r7, #4]
	ldr	ip, [r5]
	ldr	r0, [r10]
	tst	ip, r0
	bne	.L37
	ldr	r0, [r5, #8]
	str	r0, [r7, #12]
	ldr	r0, [r5, #4]
	str	r0, [r7, #8]
	b	.L13
.L36:
	ldr	r9, [sp, #12]
.L16:
	ldr	r4, [sp, #4]
	mov	r0, r9
	mov	r1, r4
	bl	dw_i3c_master_enqueue_xfer
	ldr	r3, .L39+24
	add	r0, r4, #4
	ldr	r1, [r3]
	bl	wait_for_completion_timeout
	cmp	r0, #0
	beq	.L38
.L11:
	ldr	r3, [sp, #4]
	ldr	r4, [r3]
	mov	r0, r3
	bl	dw_i3c_master_free_xfer
	mov	r0, r4
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L33:
	mov	r1, r4
	bl	dw_i3c_master_alloc_xfer
	subs	r3, r0, #0
	str	r3, [sp, #4]
	bne	.L16
.L17:
	ldr	r3, .L39+28
	ldr	r4, [r3]
	rsb	r4, r4, #0
	b	.L1
.L38:
	mov	r0, r9
	ldr	r1, [sp, #4]
	bl	dw_i3c_master_dequeue_xfer
	b	.L11
.L40:
	.align	2
.L39:
	.word	I2C_M_RD
	.word	ENOTSUPP
	.word	COMMAND_PORT_TRANSFER_ARG
	.word	COMMAND_PORT_READ_TRANSFER
	.word	COMMAND_PORT_TOC
	.word	COMMAND_PORT_ROC
	.word	XFER_TIMEOUT
	.word	ENOMEM
	.size	dw_i3c_master_i2c_xfers, .-dw_i3c_master_i2c_xfers
	.comm	XFER_TIMEOUT,4,4
	.comm	I2C_M_RD,4,4
	.comm	ENOTSUPP,4,4
	.comm	ENOMEM,4,4
	.comm	COMMAND_PORT_TRANSFER_ARG,4,4
	.comm	COMMAND_PORT_TOC,4,4
	.comm	COMMAND_PORT_ROC,4,4
	.comm	COMMAND_PORT_READ_TRANSFER,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
