	.file	"extr_mtk-quadspi.c_mtk_nor_do_tx_rx.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	mtk_nor_do_tx_rx, @function
mtk_nor_do_tx_rx:
.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
	lea	edi, 1[rcx+r9]
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 24
	.cfi_def_cfa_offset 80
	cmp	DWORD PTR MTK_NOR_MAX_SHIFT[rip], edi
	mov	DWORD PTR 8[rsp], ecx
	mov	QWORD PTR [rsp], r8
	mov	DWORD PTR 12[rsp], r9d
	jge	.L2
	mov	r13d, DWORD PTR EINVAL[rip]
	neg	r13d
.L1:
	add	rsp, 24
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	eax, r13d
	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
.L2:
	.cfi_restore_state
	mov	r15d, esi
	sal	edi, 3
	mov	rsi, QWORD PTR MTK_NOR_CNT_REG[rip]
	mov	rbp, rdx
	add	rsi, QWORD PTR [r12]
	call	writeb@PLT
	mov	r14d, DWORD PTR MTK_NOR_MAX_RX_TX_SHIFT[rip]
	mov	rbx, QWORD PTR [r12]
	lea	edi, -1[r14]
	sub	r14d, 2
	call	MTK_NOR_PRG_REG@PLT
	mov	edi, r15d
	lea	rsi, [rbx+rax]
	call	writeb@PLT
	mov	eax, DWORD PTR 8[rsp]
	test	eax, eax
	jle	.L4
	mov	r15d, r14d
	mov	r13d, r14d
	sub	r15d, eax
	.p2align 4,,10
	.p2align 3
.L5:
	mov	edi, r13d
	mov	rbx, QWORD PTR [r12]
	sub	r13d, 1
	add	rbp, 4
	call	MTK_NOR_PRG_REG@PLT
	mov	edi, DWORD PTR -4[rbp]
	lea	rsi, [rbx+rax]
	call	writeb@PLT
	cmp	r15d, r13d
	jne	.L5
	sub	r14d, DWORD PTR 8[rsp]
.L4:
	test	r14d, r14d
	js	.L6
	.p2align 4,,10
	.p2align 3
.L7:
	mov	edi, r14d
	mov	rbx, QWORD PTR [r12]
	sub	r14d, 1
	call	MTK_NOR_PRG_REG@PLT
	xor	edi, edi
	lea	rsi, [rbx+rax]
	call	writeb@PLT
	cmp	r14d, -1
	jne	.L7
.L6:
	mov	esi, DWORD PTR MTK_NOR_PRG_CMD[rip]
	mov	rdi, r12
	call	mtk_nor_execute_cmd@PLT
	mov	r13d, eax
	test	eax, eax
	jne	.L1
	mov	eax, DWORD PTR 12[rsp]
	mov	r15, QWORD PTR [rsp]
	lea	ebx, -1[rax]
	test	eax, eax
	jle	.L1
	.p2align 4,,10
	.p2align 3
.L9:
	mov	edi, ebx
	mov	rbp, QWORD PTR [r12]
	sub	ebx, 1
	add	r15, 4
	call	MTK_NOR_SHREG@PLT
	lea	rdi, 0[rbp+rax]
	call	readb@PLT
	mov	DWORD PTR -4[r15], eax
	cmp	ebx, -1
	jne	.L9
	jmp	.L1
	.cfi_endproc
.LFE0:
	.size	mtk_nor_do_tx_rx, .-mtk_nor_do_tx_rx
	.comm	MTK_NOR_PRG_CMD,4,4
	.comm	MTK_NOR_MAX_SHIFT,4,4
	.comm	MTK_NOR_MAX_RX_TX_SHIFT,4,4
	.comm	MTK_NOR_CNT_REG,8,8
	.comm	EINVAL,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_mtk-quadspi.c_mtk_nor_do_tx_rx.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	mtk_nor_do_tx_rx, %function
mtk_nor_do_tx_rx:
	@ args = 8, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	ldr	ip, .L16
	ldr	r7, [sp, #36]
	mov	r9, r3
	ldr	ip, [ip]
	add	r3, r3, #1
	add	r3, r3, r7
	cmp	ip, r3
	bge	.L2
	ldr	r3, .L16+4
	ldr	r8, [r3]
	rsb	r8, r8, #0
.L1:
	mov	r0, r8
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L2:
	mov	r6, r0
	mov	r8, r2
	ldr	r2, .L16+8
	mov	r4, r1
	ldr	r2, [r2]
	ldr	r1, [r0]
	lsl	r0, r3, #3
	add	r1, r1, r2
	bl	writeb
	ldr	r3, .L16+12
	ldr	r10, [r6]
	ldr	r5, [r3]
	sub	r0, r5, #1
	bl	MTK_NOR_PRG_REG
	mov	r1, r0
	mov	r0, r4
	add	r1, r10, r1
	bl	writeb
	cmp	r9, #0
	sub	r4, r5, #2
	ble	.L4
	mov	r5, r4
	sub	r8, r8, #4
	sub	r4, r4, r9
.L5:
	mov	r0, r5
	ldr	r9, [r8, #4]!
	ldr	r10, [r6]
	bl	MTK_NOR_PRG_REG
	sub	r5, r5, #1
	add	r1, r10, r0
	mov	r0, r9
	bl	writeb
	cmp	r5, r4
	bne	.L5
	mov	r4, r5
.L4:
	cmp	r4, #0
	blt	.L6
.L7:
	mov	r0, r4
	ldr	r5, [r6]
	bl	MTK_NOR_PRG_REG
	sub	r4, r4, #1
	add	r1, r5, r0
	mov	r0, #0
	bl	writeb
	cmn	r4, #1
	bne	.L7
.L6:
	ldr	r3, .L16+16
	mov	r0, r6
	ldr	r1, [r3]
	bl	mtk_nor_execute_cmd
	subs	r8, r0, #0
	bne	.L1
	cmp	r7, #0
	sub	r4, r7, #1
	ble	.L1
	ldr	r3, [sp, #32]
	sub	r5, r3, #4
.L9:
	mov	r0, r4
	ldr	r7, [r6]
	bl	MTK_NOR_SHREG
	add	r0, r7, r0
	bl	readb
	sub	r4, r4, #1
	cmn	r4, #1
	str	r0, [r5, #4]!
	bne	.L9
	mov	r0, r8
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L17:
	.align	2
.L16:
	.word	MTK_NOR_MAX_SHIFT
	.word	EINVAL
	.word	MTK_NOR_CNT_REG
	.word	MTK_NOR_MAX_RX_TX_SHIFT
	.word	MTK_NOR_PRG_CMD
	.size	mtk_nor_do_tx_rx, .-mtk_nor_do_tx_rx
	.comm	MTK_NOR_PRG_CMD,4,4
	.comm	MTK_NOR_MAX_SHIFT,4,4
	.comm	MTK_NOR_MAX_RX_TX_SHIFT,4,4
	.comm	MTK_NOR_CNT_REG,4,4
	.comm	EINVAL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
