	.file	"extr_core.c___c2port_write_flash_erase.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	__c2port_write_flash_erase, @function
__c2port_write_flash_erase:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rdi
	sub	rsp, 16
	.cfi_def_cfa_offset 32
	mov	esi, DWORD PTR C2PORT_FPDAT[rip]
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 8[rsp], rax
	xor	eax, eax
	call	c2port_write_ar@PLT
	mov	esi, DWORD PTR C2PORT_DEVICE_ERASE[rip]
	mov	rdi, rbp
	call	c2port_write_dr@PLT
	mov	rdi, rbp
	call	c2port_poll_in_busy@PLT
	test	eax, eax
	js	.L1
	mov	rdi, rbp
	call	c2port_poll_out_ready@PLT
	test	eax, eax
	js	.L1
	mov	rsi, rsp
	mov	rdi, rbp
	call	c2port_read_dr@PLT
	test	eax, eax
	js	.L1
	mov	rax, QWORD PTR C2PORT_COMMAND_OK[rip]
	cmp	QWORD PTR [rsp], rax
	je	.L3
	mov	eax, DWORD PTR EBUSY[rip]
	neg	eax
	.p2align 4,,10
	.p2align 3
.L1:
	mov	rcx, QWORD PTR 8[rsp]
	xor	rcx, QWORD PTR fs:40
	jne	.L7
	add	rsp, 16
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	pop	rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L3:
	.cfi_restore_state
	mov	rdi, rbp
	mov	esi, 222
	call	c2port_write_dr@PLT
	mov	rdi, rbp
	call	c2port_poll_in_busy@PLT
	test	eax, eax
	js	.L1
	mov	rdi, rbp
	mov	esi, 173
	call	c2port_write_dr@PLT
	mov	rdi, rbp
	call	c2port_poll_in_busy@PLT
	test	eax, eax
	js	.L1
	mov	rdi, rbp
	mov	esi, 165
	call	c2port_write_dr@PLT
	mov	rdi, rbp
	call	c2port_poll_in_busy@PLT
	test	eax, eax
	js	.L1
	mov	rdi, rbp
	call	c2port_poll_out_ready@PLT
	mov	edx, 0
	test	eax, eax
	cmovg	eax, edx
	jmp	.L1
.L7:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	__c2port_write_flash_erase, .-__c2port_write_flash_erase
	.comm	EBUSY,4,4
	.comm	C2PORT_FPDAT,4,4
	.comm	C2PORT_DEVICE_ERASE,4,4
	.comm	C2PORT_COMMAND_OK,8,8
	.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_core.c___c2port_write_flash_erase.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	__c2port_write_flash_erase, %function
__c2port_write_flash_erase:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, lr}
	mov	r4, r0
	ldr	r3, .L8
	ldr	r2, .L8+4
	sub	sp, sp, #8
	ldr	r1, [r3]
	ldr	r2, [r2]
	str	r2, [sp, #4]
	mov	r2,#0
	bl	c2port_write_ar
	ldr	r3, .L8+8
	mov	r0, r4
	ldr	r1, [r3]
	bl	c2port_write_dr
	mov	r0, r4
	bl	c2port_poll_in_busy
	cmp	r0, #0
	blt	.L1
	mov	r0, r4
	bl	c2port_poll_out_ready
	cmp	r0, #0
	blt	.L1
	mov	r1, sp
	mov	r0, r4
	bl	c2port_read_dr
	cmp	r0, #0
	blt	.L1
	ldr	r3, .L8+12
	ldr	r2, [sp]
	ldr	r3, [r3]
	cmp	r2, r3
	beq	.L3
	ldr	r3, .L8+16
	ldr	r0, [r3]
	rsb	r0, r0, #0
.L1:
	ldr	r3, .L8+4
	ldr	r2, [r3]
	ldr	r3, [sp, #4]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L7
	add	sp, sp, #8
	@ sp needed
	pop	{r4, pc}
.L3:
	mov	r1, #222
	mov	r0, r4
	bl	c2port_write_dr
	mov	r0, r4
	bl	c2port_poll_in_busy
	cmp	r0, #0
	blt	.L1
	mov	r1, #173
	mov	r0, r4
	bl	c2port_write_dr
	mov	r0, r4
	bl	c2port_poll_in_busy
	cmp	r0, #0
	blt	.L1
	mov	r1, #165
	mov	r0, r4
	bl	c2port_write_dr
	mov	r0, r4
	bl	c2port_poll_in_busy
	cmp	r0, #0
	blt	.L1
	mov	r0, r4
	bl	c2port_poll_out_ready
	and	r0, r0, r0, asr #31
	b	.L1
.L7:
	bl	__stack_chk_fail
.L9:
	.align	2
.L8:
	.word	C2PORT_FPDAT
	.word	.LC0
	.word	C2PORT_DEVICE_ERASE
	.word	C2PORT_COMMAND_OK
	.word	EBUSY
	.size	__c2port_write_flash_erase, .-__c2port_write_flash_erase
	.comm	EBUSY,4,4
	.comm	C2PORT_FPDAT,4,4
	.comm	C2PORT_DEVICE_ERASE,4,4
	.comm	C2PORT_COMMAND_OK,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
