	.file	"extr_elan_i2c_i2c.c_elan_i2c_prepare_fw_update.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"wrong mode: %d\n"
.LC1:
	.string	"cannot read iap password: %d\n"
.LC2:
	.string	"wrong iap password: 0x%X\n"
	.text
	.p2align 4
	.type	elan_i2c_prepare_fw_update, @function
elan_i2c_prepare_fw_update:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	mov	rbp, rdi
	sub	rsp, 32
	.cfi_def_cfa_offset 64
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 24[rsp], rax
	xor	eax, eax
	lea	r13, 8[rsp]
	mov	rsi, r13
	call	elan_i2c_iap_get_mode@PLT
	mov	r12d, eax
	test	eax, eax
	jne	.L1
	mov	eax, DWORD PTR IAP_MODE[rip]
	cmp	DWORD PTR 8[rsp], eax
	je	.L11
	mov	rdi, rbp
	call	elan_i2c_set_flash_key@PLT
	mov	r12d, eax
	test	eax, eax
	jne	.L1
.L16:
	mov	eax, DWORD PTR MAIN_MODE[rip]
	mov	edi, 100
	cmp	DWORD PTR 8[rsp], eax
	mov	eax, 30
	cmovne	edi, eax
	call	msleep@PLT
	mov	rsi, r13
	mov	rdi, rbp
	call	elan_i2c_iap_get_mode@PLT
	mov	r12d, eax
	test	eax, eax
	jne	.L1
	mov	edx, DWORD PTR 8[rsp]
	cmp	edx, DWORD PTR MAIN_MODE[rip]
	je	.L12
	mov	rdi, rbp
	call	elan_i2c_set_flash_key@PLT
	mov	r12d, eax
	test	eax, eax
	jne	.L1
	mov	edi, 30
	lea	r13, 12[rsp]
	call	msleep@PLT
	mov	esi, DWORD PTR ETP_I2C_IAP_CMD[rip]
	mov	rdx, r13
	mov	rdi, rbp
	call	elan_i2c_read_cmd@PLT
	mov	r12d, eax
	test	eax, eax
	jne	.L13
	mov	rdi, r13
	call	le16_to_cpup@PLT
	cmp	DWORD PTR ETP_I2C_IAP_PASSWORD[rip], eax
	jne	.L14
	.p2align 4,,10
	.p2align 3
.L1:
	mov	rax, QWORD PTR 24[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L15
	add	rsp, 32
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	mov	eax, r12d
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	mov	rdi, rbp
	call	elan_i2c_iap_reset@PLT
	mov	r12d, eax
	test	eax, eax
	jne	.L1
	mov	edi, 30
	call	msleep@PLT
	mov	rdi, rbp
	call	elan_i2c_set_flash_key@PLT
	mov	r12d, eax
	test	eax, eax
	je	.L16
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L12:
	lea	rsi, .LC0[rip]
	mov	rdi, rbp
	call	dev_err@PLT
	mov	r12d, DWORD PTR EIO[rip]
	neg	r12d
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L14:
	mov	edx, eax
	lea	rsi, .LC2[rip]
	mov	rdi, rbp
	call	dev_err@PLT
	mov	r12d, DWORD PTR EIO[rip]
	neg	r12d
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L13:
	mov	edx, eax
	lea	rsi, .LC1[rip]
	mov	rdi, rbp
	call	dev_err@PLT
	jmp	.L1
.L15:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	elan_i2c_prepare_fw_update, .-elan_i2c_prepare_fw_update
	.comm	MAIN_MODE,4,4
	.comm	IAP_MODE,4,4
	.comm	ETP_I2C_IAP_PASSWORD,4,4
	.comm	ETP_I2C_IAP_CMD,4,4
	.comm	EIO,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_elan_i2c_i2c.c_elan_i2c_prepare_fw_update.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"wrong mode: %d\012\000"
	.align	2
.LC1:
	.ascii	"cannot read iap password: %d\012\000"
	.align	2
.LC2:
	.ascii	"wrong iap password: 0x%X\012\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC3:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	elan_i2c_prepare_fw_update, %function
elan_i2c_prepare_fw_update:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, lr}
	ldr	r3, .L17
	sub	sp, sp, #24
	add	r1, sp, #4
	ldr	r3, [r3]
	str	r3, [sp, #20]
	mov	r3,#0
	mov	r5, r0
	bl	elan_i2c_iap_get_mode
	subs	r4, r0, #0
	bne	.L1
	ldr	r3, .L17+4
	ldr	r2, [sp, #4]
	ldr	r3, [r3]
	cmp	r2, r3
	beq	.L11
	mov	r0, r5
	bl	elan_i2c_set_flash_key
	subs	r4, r0, #0
	bne	.L1
.L16:
	ldr	r6, .L17+8
	ldr	r0, [sp, #4]
	ldr	r3, [r6]
	cmp	r0, r3
	moveq	r0, #100
	movne	r0, #30
	bl	msleep
	mov	r0, r5
	add	r1, sp, #4
	bl	elan_i2c_iap_get_mode
	subs	r4, r0, #0
	bne	.L1
	ldr	r3, [r6]
	ldr	r2, [sp, #4]
	mov	r0, r5
	cmp	r2, r3
	beq	.L12
	bl	elan_i2c_set_flash_key
	subs	r4, r0, #0
	bne	.L1
	mov	r0, #30
	bl	msleep
	ldr	r3, .L17+12
	mov	r0, r5
	ldr	r1, [r3]
	add	r2, sp, #8
	bl	elan_i2c_read_cmd
	subs	r4, r0, #0
	bne	.L13
	add	r0, sp, #8
	bl	le16_to_cpup
	ldr	r3, .L17+16
	ldr	r3, [r3]
	cmp	r3, r0
	bne	.L14
.L1:
	ldr	r3, .L17
	ldr	r2, [r3]
	ldr	r3, [sp, #20]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L15
	mov	r0, r4
	add	sp, sp, #24
	@ sp needed
	pop	{r4, r5, r6, pc}
.L11:
	mov	r0, r5
	bl	elan_i2c_iap_reset
	subs	r4, r0, #0
	bne	.L1
	mov	r0, #30
	bl	msleep
	mov	r0, r5
	bl	elan_i2c_set_flash_key
	subs	r4, r0, #0
	beq	.L16
	b	.L1
.L12:
	ldr	r1, .L17+20
	bl	dev_err
	ldr	r3, .L17+24
	ldr	r0, [r3]
	rsb	r4, r0, #0
	b	.L1
.L14:
	mov	r2, r0
	ldr	r1, .L17+28
	mov	r0, r5
	bl	dev_err
	ldr	r3, .L17+24
	ldr	r0, [r3]
	rsb	r4, r0, #0
	b	.L1
.L13:
	mov	r0, r5
	mov	r2, r4
	ldr	r1, .L17+32
	bl	dev_err
	b	.L1
.L15:
	bl	__stack_chk_fail
.L18:
	.align	2
.L17:
	.word	.LC3
	.word	IAP_MODE
	.word	MAIN_MODE
	.word	ETP_I2C_IAP_CMD
	.word	ETP_I2C_IAP_PASSWORD
	.word	.LC0
	.word	EIO
	.word	.LC2
	.word	.LC1
	.size	elan_i2c_prepare_fw_update, .-elan_i2c_prepare_fw_update
	.comm	MAIN_MODE,4,4
	.comm	IAP_MODE,4,4
	.comm	ETP_I2C_IAP_PASSWORD,4,4
	.comm	ETP_I2C_IAP_CMD,4,4
	.comm	EIO,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
