	.file	"extr_rt5677-spi.c_rt5677_spi_write.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Bad write align 0x%x(%zu)\n"
	.text
	.p2align 4
	.globl	rt5677_spi_write
	.type	rt5677_spi_write, @function
rt5677_spi_write:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	r11, rdx
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	r15
	push	r14
	push	r13
	push	r12
	push	rbx
	sub	rsp, 120
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	mov	DWORD PTR -112[rbp], edi
	movsx	r12, DWORD PTR RT5677_SPI_HEADER[rip]
	mov	QWORD PTR -120[rbp], rsi
	mov	rbx, rsp
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -56[rbp], rax
	xor	eax, eax
	mov	eax, DWORD PTR RT5677_SPI_BURST_LEN[rip]
	add	eax, r12d
	add	eax, 1
	cdqe
	lea	rax, 15[0+rax*4]
	mov	rdx, rax
	and	rax, -4096
	sub	rbx, rax
	and	rdx, -16
	mov	rax, rbx
	cmp	rsp, rax
	je	.L3
.L17:
	sub	rsp, 4096
	or	QWORD PTR 4088[rsp], 0
	cmp	rsp, rax
	jne	.L17
.L3:
	and	edx, 4095
	sub	rsp, rdx
	test	rdx, rdx
	jne	.L18
.L4:
	mov	rdi, QWORD PTR g_spi[rip]
	mov	r14, rsp
	test	rdi, rdi
	je	.L19
	mov	ebx, DWORD PTR -112[rbp]
	and	ebx, 3
	jne	.L20
	lea	r13, -80[rbp]
	mov	edx, 16
	xor	esi, esi
	mov	QWORD PTR -104[rbp], r11
	mov	rdi, r13
	call	memset@PLT
	mov	eax, DWORD PTR RT5677_SPI_FREQ[rip]
	mov	rsi, r13
	mov	QWORD PTR -80[rbp], r14
	mov	edx, 1
	mov	DWORD PTR -68[rbp], eax
	lea	rax, -84[rbp]
	mov	rdi, rax
	mov	QWORD PTR -136[rbp], rax
	call	spi_message_init_with_transfers@PLT
	mov	r11, QWORD PTR -104[rbp]
	test	r11, r11
	je	.L10
	lea	rax, [r14+r12*4]
	xor	r12d, r12d
	xor	r15d, r15d
	mov	QWORD PTR -144[rbp], rax
	lea	rax, -72[rbp]
	lea	r13, spi_mutex[rip]
	mov	QWORD PTR -152[rbp], rax
	mov	DWORD PTR -124[rbp], r12d
	.p2align 4,,10
	.p2align 3
.L8:
	mov	eax, DWORD PTR -112[rbp]
	mov	r12, QWORD PTR -104[rbp]
	xor	edi, edi
	mov	rcx, QWORD PTR -152[rbp]
	lea	r8d, [rax+rbx]
	sub	r12, r15
	mov	esi, r8d
	mov	rdx, r12
	mov	DWORD PTR -108[rbp], r8d
	and	esi, 7
	call	rt5677_spi_select_cmd@PLT
	mov	r8d, DWORD PTR -108[rbp]
	mov	esi, DWORD PTR -72[rbp]
	mov	rcx, r12
	mov	DWORD PTR [r14], eax
	mov	rdi, QWORD PTR -144[rbp]
	mov	eax, r8d
	shr	eax, 24
	mov	DWORD PTR 4[r14], eax
	mov	eax, r8d
	sar	eax, 16
	and	eax, 255
	mov	DWORD PTR 8[r14], eax
	mov	eax, r8d
	and	r8d, 255
	movzx	eax, ah
	mov	DWORD PTR 16[r14], r8d
	mov	DWORD PTR 12[r14], eax
	mov	rax, QWORD PTR -120[rbp]
	lea	rdx, [rax+r15*4]
	call	rt5677_spi_reverse@PLT
	mov	eax, DWORD PTR -72[rbp]
	mov	edx, DWORD PTR RT5677_SPI_HEADER[rip]
	mov	rdi, r13
	add	ebx, eax
	lea	eax, 1[rax+rdx]
	mov	DWORD PTR -72[rbp], eax
	movsx	r15, ebx
	call	mutex_lock@PLT
	mov	rsi, QWORD PTR -136[rbp]
	mov	rdi, QWORD PTR g_spi[rip]
	call	spi_sync@PLT
	mov	rdi, r13
	or	DWORD PTR -124[rbp], eax
	call	mutex_unlock@PLT
	cmp	r15, QWORD PTR -104[rbp]
	jb	.L8
	mov	r12d, DWORD PTR -124[rbp]
.L1:
	mov	rax, QWORD PTR -56[rbp]
	xor	rax, QWORD PTR fs:40
	jne	.L21
	lea	rsp, -40[rbp]
	mov	eax, r12d
	pop	rbx
	pop	r12
	pop	r13
	pop	r14
	pop	r15
	pop	rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L20:
	.cfi_restore_state
	mov	edx, DWORD PTR -112[rbp]
	mov	rcx, r11
	lea	rsi, .LC0[rip]
	call	dev_err@PLT
	mov	r12d, DWORD PTR EACCES[rip]
	neg	r12d
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L18:
	or	QWORD PTR -8[rsp+rdx], 0
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L19:
	mov	r12d, DWORD PTR ENODEV[rip]
	neg	r12d
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L10:
	xor	r12d, r12d
	jmp	.L1
.L21:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	rt5677_spi_write, .-rt5677_spi_write
	.comm	spi_mutex,4,4
	.comm	g_spi,8,8
	.comm	RT5677_SPI_HEADER,4,4
	.comm	RT5677_SPI_FREQ,4,4
	.comm	RT5677_SPI_BURST_LEN,4,4
	.comm	ENODEV,4,4
	.comm	EACCES,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_rt5677-spi.c_rt5677_spi_write.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"Bad write align 0x%x(%zu)\012\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC1:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	rt5677_spi_write
	.syntax unified
	.arm
	.fpu softvfp
	.type	rt5677_spi_write, %function
rt5677_spi_write:
	@ args = 0, pretend = 0, frame = 40
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	add	fp, sp, #32
	sub	sp, sp, #44
	ldr	ip, .L14
	ldr	r3, .L14+4
	ldr	r4, [ip]
	ldr	r3, [r3]
	ldr	ip, .L14+8
	add	r3, r4, r3
	lsl	r3, r3, #2
	add	r3, r3, #11
	bic	r3, r3, #7
	ldr	ip, [ip]
	sub	sp, sp, r3
	ldr	r3, .L14+12
	str	r0, [fp, #-64]
	str	r1, [fp, #-68]
	cmp	ip, #0
	ldr	r3, [r3]
	str	r3, [fp, #-40]
	mov	r3,#0
	beq	.L11
	ldr	r3, [fp, #-64]
	mov	r7, r2
	ands	r5, r3, #3
	bne	.L12
	mov	r6, sp
	ldr	r3, .L14+16
	mov	r2, #1
	ldr	r3, [r3]
	sub	r0, fp, #56
	sub	r1, fp, #52
	str	r5, [fp, #-48]
	str	r6, [fp, #-52]
	str	r3, [fp, #-44]
	bl	spi_message_init_with_transfers
	cmp	r7, #0
	beq	.L7
	mov	r8, r5
	add	r3, r6, r4, lsl #2
	ldr	r9, .L14+20
	str	r3, [fp, #-72]
.L5:
	ldr	r3, [fp, #-64]
	sub	r10, r7, r5
	add	r4, r3, r5
	mov	r2, r10
	and	r1, r4, #7
	sub	r3, fp, #48
	mov	r0, #0
	bl	rt5677_spi_select_cmd
	ldr	r2, [fp, #-68]
	asr	lr, r4, #16
	asr	ip, r4, #8
	and	lr, lr, #255
	and	ip, ip, #255
	mov	r3, r10
	ldr	r1, [fp, #-48]
	add	r2, r2, r5, lsl #2
	lsr	r10, r4, #24
	str	r0, [r6]
	and	r4, r4, #255
	ldr	r0, [fp, #-72]
	str	lr, [r6, #8]
	str	ip, [r6, #12]
	str	r10, [r6, #4]
	str	r4, [r6, #16]
	bl	rt5677_spi_reverse
	ldr	r3, .L14
	ldr	r2, [fp, #-48]
	ldr	r3, [r3]
	mov	r0, r9
	add	r3, r3, #1
	add	r3, r3, r2
	add	r5, r5, r2
	str	r3, [fp, #-48]
	bl	mutex_lock
	ldr	r3, .L14+8
	sub	r1, fp, #56
	ldr	r0, [r3]
	bl	spi_sync
	mov	r3, r0
	mov	r0, r9
	orr	r8, r8, r3
	bl	mutex_unlock
	cmp	r5, r7
	bcc	.L5
.L1:
	ldr	r3, .L14+12
	ldr	r2, [r3]
	ldr	r3, [fp, #-40]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L13
	mov	r0, r8
	sub	sp, fp, #32
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L12:
	mov	r3, r2
	mov	r0, ip
	ldr	r2, [fp, #-64]
	ldr	r1, .L14+24
	bl	dev_err
	ldr	r3, .L14+28
	ldr	r8, [r3]
	rsb	r8, r8, #0
	b	.L1
.L7:
	mov	r8, r7
	b	.L1
.L11:
	ldr	r3, .L14+32
	ldr	r8, [r3]
	rsb	r8, r8, #0
	b	.L1
.L13:
	bl	__stack_chk_fail
.L15:
	.align	2
.L14:
	.word	RT5677_SPI_HEADER
	.word	RT5677_SPI_BURST_LEN
	.word	g_spi
	.word	.LC1
	.word	RT5677_SPI_FREQ
	.word	spi_mutex
	.word	.LC0
	.word	EACCES
	.word	ENODEV
	.size	rt5677_spi_write, .-rt5677_spi_write
	.comm	spi_mutex,4,4
	.comm	g_spi,4,4
	.comm	RT5677_SPI_HEADER,4,4
	.comm	RT5677_SPI_FREQ,4,4
	.comm	RT5677_SPI_BURST_LEN,4,4
	.comm	ENODEV,4,4
	.comm	EACCES,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
