	.file	"extr_stub_flasher.c_stub_main1.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	stub_main1
	.type	stub_main1, @function
stub_main1:
.LFB0:
	.cfi_startproc
	endbr64
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xor	edi, edi
	push	rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	push	rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	sub	rsp, 16
	.cfi_def_cfa_offset 48
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 8[rsp], rax
	xor	eax, eax
	mov	rax, QWORD PTR params[rip]
	mov	rbp, QWORD PTR [rax]
	mov	r12, QWORD PTR 8[rax]
	call	ets_set_user_start@PLT
	mov	r8d, DWORD PTR FLASH_PAGE_SIZE[rip]
	mov	esi, 16777216
	xor	edi, edi
	mov	ecx, DWORD PTR FLASH_SECTOR_SIZE[rip]
	mov	edx, DWORD PTR FLASH_BLOCK_SIZE[rip]
	mov	r9d, 65535
	call	esp_rom_spiflash_config_param@PLT
	mov	QWORD PTR [rsp], 0
	test	r12, r12
	jle	.L2
	mov	edi, 10000
	call	ets_delay_us@PLT
	mov	rdx, r12
	mov	rsi, rbp
	xor	edi, edi
	call	set_baud_rate@PLT
	mov	QWORD PTR [rsp], rax
.L2:
	mov	edi, 50000
	call	ets_delay_us@PLT
	mov	rdi, rsp
	mov	esi, 4
	call	SLIP_send@PLT
	xor	eax, eax
	call	cmd_loop@PLT
	mov	edi, 10000
	mov	rbx, rax
	call	ets_delay_us@PLT
	cmp	QWORD PTR CMD_BOOT_FW[rip], rbx
	je	.L1
	xor	eax, eax
	call	software_reset@PLT
.L1:
	mov	rax, QWORD PTR 8[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L7
	add	rsp, 16
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	pop	rbx
	.cfi_def_cfa_offset 24
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
.L7:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	stub_main1, .-stub_main1
	.comm	params,8,8
	.comm	FLASH_SECTOR_SIZE,4,4
	.comm	FLASH_PAGE_SIZE,4,4
	.comm	FLASH_BLOCK_SIZE,4,4
	.comm	CMD_BOOT_FW,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_stub_flasher.c_stub_main1.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	stub_main1
	.syntax unified
	.arm
	.fpu softvfp
	.type	stub_main1, %function
stub_main1:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, lr}
	mov	r4, #0
	ldr	r3, .L8
	ldr	r2, .L8+4
	ldr	r3, [r3]
	sub	sp, sp, #16
	mov	r0, r4
	ldr	r5, [r3, #4]
	ldr	r2, [r2]
	str	r2, [sp, #12]
	mov	r2,#0
	ldr	r6, [r3]
	bl	ets_set_user_start
	ldr	r2, .L8+8
	ldr	r1, .L8+12
	ldr	r0, [r2]
	ldr	r3, .L8+16
	ldr	r2, .L8+20
	str	r0, [sp]
	ldr	r3, [r3]
	ldr	r2, [r2]
	mov	r0, r4
	str	r1, [sp, #4]
	mov	r1, #16777216
	bl	esp_rom_spiflash_config_param
	cmp	r5, r4
	str	r4, [sp, #8]
	ble	.L2
	ldr	r0, .L8+24
	bl	ets_delay_us
	mov	r2, r5
	mov	r1, r6
	mov	r0, r4
	bl	set_baud_rate
	str	r0, [sp, #8]
.L2:
	ldr	r0, .L8+28
	bl	ets_delay_us
	mov	r1, #4
	add	r0, sp, #8
	bl	SLIP_send
	bl	cmd_loop
	mov	r4, r0
	ldr	r0, .L8+24
	bl	ets_delay_us
	ldr	r3, .L8+32
	ldr	r3, [r3]
	cmp	r3, r4
	beq	.L1
	bl	software_reset
.L1:
	ldr	r3, .L8+4
	ldr	r2, [r3]
	ldr	r3, [sp, #12]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L7
	add	sp, sp, #16
	@ sp needed
	pop	{r4, r5, r6, pc}
.L7:
	bl	__stack_chk_fail
.L9:
	.align	2
.L8:
	.word	params
	.word	.LC0
	.word	FLASH_PAGE_SIZE
	.word	65535
	.word	FLASH_SECTOR_SIZE
	.word	FLASH_BLOCK_SIZE
	.word	10000
	.word	50000
	.word	CMD_BOOT_FW
	.size	stub_main1, .-stub_main1
	.comm	params,4,4
	.comm	FLASH_SECTOR_SIZE,4,4
	.comm	FLASH_PAGE_SIZE,4,4
	.comm	FLASH_BLOCK_SIZE,4,4
	.comm	CMD_BOOT_FW,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
