	.file	"extr_cyapa_gen3.c_cyapa_gen3_write_buffer.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	cyapa_gen3_write_buffer, @function
cyapa_gen3_write_buffer:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	r15
	push	r14
	push	r13
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	mov	r13, rdi
	push	r12
	push	rbx
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	mov	rbx, rdx
	sub	rsp, 40
	mov	QWORD PTR -72[rbp], rsi
	mov	edx, DWORD PTR CYAPA_CMD_LEN[rip]
	mov	rdi, rsp
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -56[rbp], rax
	xor	eax, eax
	lea	eax, 1[rdx]
	cdqe
	add	rax, 15
	mov	rcx, rax
	and	rax, -4096
	sub	rdi, rax
	and	rcx, -16
	mov	rax, rdi
	cmp	rsp, rax
	je	.L3
.L17:
	sub	rsp, 4096
	or	QWORD PTR 4088[rsp], 0
	cmp	rsp, rax
	jne	.L17
.L3:
	and	ecx, 4095
	sub	rsp, rcx
	test	rcx, rcx
	jne	.L18
.L4:
	lea	rax, 1[rsp]
	mov	r12, rsp
	xor	r14d, r14d
	mov	QWORD PTR -80[rbp], rax
	movsx	rax, edx
	test	rbx, rbx
	jne	.L7
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L19:
	movsx	rax, DWORD PTR CYAPA_CMD_LEN[rip]
	add	r14, rax
	cmp	rbx, r14
	jbe	.L8
.L7:
	mov	rdx, rbx
	mov	rdi, QWORD PTR -80[rbp]
	mov	BYTE PTR [r12], r14b
	sub	rdx, r14
	cmp	rdx, rax
	cmovbe	rax, rdx
	mov	r15, rax
	mov	rax, QWORD PTR -72[rbp]
	mov	rdx, r15
	lea	rsi, [rax+r14*4]
	call	memcpy@PLT
	xor	esi, esi
	lea	rdx, 1[r15]
	mov	rcx, r12
	mov	rdi, r13
	call	cyapa_i2c_reg_write_block@PLT
	test	eax, eax
	je	.L19
.L1:
	mov	rcx, QWORD PTR -56[rbp]
	xor	rcx, QWORD PTR fs:40
	jne	.L20
	lea	rsp, -40[rbp]
	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
.L8:
	.cfi_restore_state
	xor	eax, eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L18:
	or	QWORD PTR -8[rsp+rcx], 0
	jmp	.L4
.L20:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	cyapa_gen3_write_buffer, .-cyapa_gen3_write_buffer
	.comm	CYAPA_CMD_LEN,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_cyapa_gen3.c_cyapa_gen3_write_buffer.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	cyapa_gen3_write_buffer, %function
cyapa_gen3_write_buffer:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	add	fp, sp, #32
	sub	sp, sp, #20
	ldr	r9, .L12
	subs	r5, r2, #0
	ldr	r3, [r9]
	str	r1, [fp, #-48]
	add	r2, r3, #8
	bic	r2, r2, #7
	sub	sp, sp, r2
	ldr	r2, .L12+4
	movne	r7, r0
	ldr	r2, [r2]
	str	r2, [fp, #-40]
	mov	r2,#0
	movne	r6, sp
	movne	r4, #0
	addne	r10, sp, #1
	bne	.L4
	b	.L5
.L10:
	ldr	r3, [r9]
	add	r4, r4, r3
	cmp	r5, r4
	bls	.L5
.L4:
	sub	r2, r5, r4
	cmp	r2, r3
	movcs	r8, r3
	movcc	r8, r2
	ldr	r3, [fp, #-48]
	mov	r2, r8
	add	r1, r3, r4, lsl #2
	mov	r0, r10
	strb	r4, [r6]
	bl	memcpy
	mov	r3, r6
	mov	r1, #0
	mov	r0, r7
	add	r2, r8, #1
	bl	cyapa_i2c_reg_write_block
	cmp	r0, #0
	beq	.L10
.L1:
	ldr	r3, .L12+4
	ldr	r2, [r3]
	ldr	r3, [fp, #-40]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L11
	sub	sp, fp, #32
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L5:
	mov	r0, #0
	b	.L1
.L11:
	bl	__stack_chk_fail
.L13:
	.align	2
.L12:
	.word	CYAPA_CMD_LEN
	.word	.LC0
	.size	cyapa_gen3_write_buffer, .-cyapa_gen3_write_buffer
	.comm	CYAPA_CMD_LEN,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
