	.file	"extr_switch.c_nvm_validate_and_write.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	nvm_validate_and_write, @function
nvm_validate_and_write:
.LFB0:
	.cfi_startproc
	endbr64
	push	r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	push	r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	push	r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	push	rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	push	rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	mov	rax, QWORD PTR 16[rdi]
	mov	r13, QWORD PTR 8[rax]
	test	r13, r13
	je	.L6
	mov	r12d, DWORD PTR [rax]
	cmp	DWORD PTR NVM_MIN_SIZE[rip], r12d
	ja	.L6
	cmp	DWORD PTR NVM_MAX_SIZE[rip], r12d
	jb	.L6
	mov	ebp, DWORD PTR 0[r13]
	mov	eax, DWORD PTR NVM_DEVID[rip]
	and	ebp, 16777215
	lea	eax, 2[rbp+rax]
	cmp	eax, r12d
	jb	.L12
	.p2align 4,,10
	.p2align 3
.L6:
	mov	eax, DWORD PTR EINVAL[rip]
	neg	eax
.L1:
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	pop	rbp
	.cfi_def_cfa_offset 32
	pop	r12
	.cfi_def_cfa_offset 24
	pop	r13
	.cfi_def_cfa_offset 16
	pop	r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L12:
	.cfi_restore_state
	mov	esi, DWORD PTR SZ_4K[rip]
	mov	rbx, rdi
	mov	edi, ebp
	call	IS_ALIGNED@PLT
	test	eax, eax
	je	.L6
	mov	eax, ebp
	lea	r14, 0[r13+rax*4]
	cmp	r12d, DWORD PTR [r14]
	jbe	.L6
	mov	edx, DWORD PTR 12[rbx]
	test	edx, edx
	jne	.L13
	mov	edx, DWORD PTR NVM_DEVID[rip]
	add	rax, rdx
	mov	eax, DWORD PTR 0[r13+rax*4]
	cmp	DWORD PTR 8[rbx], eax
	jne	.L6
	cmp	DWORD PTR [rbx], 2
	mov	edi, DWORD PTR 4[rbx]
	jle	.L14
.L9:
	sub	r12d, ebp
	mov	r13, r14
.L8:
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	mov	ecx, r12d
	pop	rbp
	.cfi_def_cfa_offset 32
	mov	rdx, r13
	pop	r12
	.cfi_def_cfa_offset 24
	xor	esi, esi
	pop	r13
	.cfi_def_cfa_offset 16
	pop	r14
	.cfi_def_cfa_offset 8
	jmp	dma_port_flash_write@PLT
	.p2align 4,,10
	.p2align 3
.L13:
	.cfi_restore_state
	mov	edi, DWORD PTR 4[rbx]
	jmp	.L8
.L14:
	movsx	rax, DWORD PTR NVM_CSS[rip]
	mov	ecx, DWORD PTR DMA_PORT_CSS_MAX_SIZE[rip]
	mov	esi, DWORD PTR DMA_PORT_CSS_ADDRESS[rip]
	lea	rdx, 0[r13+rax*4]
	call	dma_port_flash_write@PLT
	test	eax, eax
	jne	.L1
	mov	edi, DWORD PTR 4[rbx]
	jmp	.L9
	.cfi_endproc
.LFE0:
	.size	nvm_validate_and_write, .-nvm_validate_and_write
	.comm	SZ_4K,4,4
	.comm	NVM_MIN_SIZE,4,4
	.comm	NVM_MAX_SIZE,4,4
	.comm	NVM_DEVID,4,4
	.comm	NVM_CSS,4,4
	.comm	EINVAL,4,4
	.comm	DMA_PORT_CSS_MAX_SIZE,4,4
	.comm	DMA_PORT_CSS_ADDRESS,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_switch.c_nvm_validate_and_write.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	nvm_validate_and_write, %function
nvm_validate_and_write:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	ldr	r3, [r0, #16]
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	ldr	r6, [r3, #4]
	cmp	r6, #0
	beq	.L6
	ldr	r2, .L14
	ldr	r5, [r3]
	ldr	r3, [r2]
	cmp	r3, r5
	bhi	.L6
	ldr	r3, .L14+4
	ldr	r3, [r3]
	cmp	r3, r5
	bcc	.L6
	ldr	r8, .L14+8
	ldr	r7, [r6]
	ldr	r3, [r8]
	bic	r7, r7, #-16777216
	add	r3, r3, #2
	add	r3, r3, r7
	cmp	r3, r5
	bcc	.L12
.L6:
	ldr	r3, .L14+12
	ldr	r0, [r3]
	rsb	r0, r0, #0
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L12:
	ldr	r3, .L14+16
	mov	r4, r0
	ldr	r1, [r3]
	mov	r0, r7
	bl	IS_ALIGNED
	cmp	r0, #0
	beq	.L6
	ldr	r3, [r6, r7, lsl #2]
	add	r9, r6, r7, lsl #2
	cmp	r5, r3
	bls	.L6
	ldr	r3, [r4, #12]
	cmp	r3, #0
	ldrne	r0, [r4, #4]
	bne	.L8
	ldr	r3, [r8]
	ldr	r2, [r4, #8]
	add	r3, r7, r3
	ldr	r3, [r6, r3, lsl #2]
	cmp	r2, r3
	bne	.L6
	ldr	r3, [r4]
	ldr	r0, [r4, #4]
	cmp	r3, #2
	ble	.L13
.L9:
	mov	r6, r9
	sub	r5, r5, r7
.L8:
	mov	r3, r5
	mov	r2, r6
	pop	{r4, r5, r6, r7, r8, r9, r10, lr}
	mov	r1, #0
	b	dma_port_flash_write
.L13:
	ldr	r2, .L14+20
	ldr	r3, .L14+24
	ldr	r2, [r2]
	ldr	r1, .L14+28
	ldr	r3, [r3]
	ldr	r1, [r1]
	add	r2, r6, r2, lsl #2
	bl	dma_port_flash_write
	cmp	r0, #0
	popne	{r4, r5, r6, r7, r8, r9, r10, pc}
	ldr	r0, [r4, #4]
	b	.L9
.L15:
	.align	2
.L14:
	.word	NVM_MIN_SIZE
	.word	NVM_MAX_SIZE
	.word	NVM_DEVID
	.word	EINVAL
	.word	SZ_4K
	.word	NVM_CSS
	.word	DMA_PORT_CSS_MAX_SIZE
	.word	DMA_PORT_CSS_ADDRESS
	.size	nvm_validate_and_write, .-nvm_validate_and_write
	.comm	SZ_4K,4,4
	.comm	NVM_MIN_SIZE,4,4
	.comm	NVM_MAX_SIZE,4,4
	.comm	NVM_DEVID,4,4
	.comm	NVM_CSS,4,4
	.comm	EINVAL,4,4
	.comm	DMA_PORT_CSS_MAX_SIZE,4,4
	.comm	DMA_PORT_CSS_ADDRESS,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
