	.file	"extr_ftdi-elan.c_ftdi_elan_synchronize.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	" %02X"
.LC1:
	.string	"retry limit reached\n"
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC2:
	.string	"TIMED OUT retry limit reached\n"
	.align 8
.LC3:
	.string	"empty packet retry limit reached\n"
	.section	.rodata.str1.1
.LC4:
	.string	"error = %d\n"
.LC5:
	.string	"failed to synchronize\n"
	.text
	.p2align 4
	.type	ftdi_elan_synchronize, @function
ftdi_elan_synchronize:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	mov	r13, rdi
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 168
	.cfi_def_cfa_offset 224
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 152[rsp], rax
	xor	eax, eax
	call	ftdi_elan_flush_input_fifo@PLT
	mov	r12d, eax
	test	eax, eax
	jne	.L1
	mov	QWORD PTR 32[r13], 0
	mov	r14, r13
	mov	DWORD PTR 0[r13], -1
	mov	DWORD PTR 8[rsp], 10
	mov	DWORD PTR [rsp], 10
	mov	DWORD PTR 4[rsp], 5
	.p2align 4,,10
	.p2align 3
.L24:
	mov	rdi, r14
	call	ftdi_elan_synchronize_flush@PLT
	mov	r12d, eax
	test	eax, eax
	jne	.L1
	mov	rdi, r14
	call	ftdi_elan_flush_input_fifo@PLT
	mov	r12d, eax
	test	eax, eax
	jne	.L1
.L3:
	mov	rdi, r14
	call	ftdi_elan_synchronize_reset@PLT
	mov	DWORD PTR 12[rsp], eax
	test	eax, eax
	jne	.L46
	mov	r15, QWORD PTR 8[r14]
	mov	rdi, QWORD PTR 16[r14]
	mov	r13d, 10
	mov	ebx, 100
	lea	rbp, 44[rsp]
.L4:
	mov	esi, DWORD PTR 28[r14]
	mov	r12d, DWORD PTR 24[r14]
	mov	DWORD PTR 44[rsp], 0
	call	usb_rcvbulkpipe@PLT
	mov	rdi, QWORD PTR 16[r14]
	mov	rdx, r15
	mov	r8, rbp
	mov	esi, eax
	mov	r9d, 500
	mov	ecx, r12d
	call	usb_bulk_msg@PLT
	mov	edx, DWORD PTR 44[rsp]
	cmp	edx, 2
	jg	.L53
	je	.L54
	mov	rdi, QWORD PTR 16[r14]
	cmp	edx, 1
	je	.L55
	mov	ecx, eax
	add	ecx, DWORD PTR ETIMEDOUT[rip]
	je	.L56
	test	eax, eax
	jne	.L21
	mov	eax, DWORD PTR [rsp]
	lea	ecx, -1[rax]
	test	eax, eax
	jle	.L22
	mov	DWORD PTR [rsp], ecx
	mov	r15, QWORD PTR 8[r14]
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L53:
	sub	edx, 1
	mov	BYTE PTR 48[rsp], 0
	mov	r8, QWORD PTR 8[r14]
	xor	r12d, r12d
	mov	DWORD PTR 44[rsp], edx
	lea	rcx, 48[rsp]
.L8:
	movzx	r15d, BYTE PTR [r8+r12]
	cmp	r12, 30
	jbe	.L57
	cmp	r12d, 31
	je	.L58
.L7:
	mov	eax, DWORD PTR 44[rsp]
	add	r12, 1
	lea	edx, -1[rax]
	mov	DWORD PTR 44[rsp], edx
	test	eax, eax
	jg	.L8
	cmp	r15b, 126
	je	.L46
	cmp	r15b, 85
	je	.L26
.L50:
	lea	eax, -1[rbx]
	test	ebx, ebx
	jle	.L23
.L48:
	mov	r15, QWORD PTR 8[r14]
	mov	rdi, QWORD PTR 16[r14]
	mov	ebx, eax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L54:
	mov	r15, QWORD PTR 8[r14]
	movzx	eax, BYTE PTR 1[r15]
	cmp	BYTE PTR [r15], 49
	sete	dl
	test	al, al
	jne	.L14
	test	dl, dl
	je	.L14
	lea	eax, -1[r13]
	test	r13d, r13d
	jle	.L3
	mov	rdi, QWORD PTR 16[r14]
	mov	r13d, eax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L55:
	lea	eax, -1[rbx]
	test	ebx, ebx
	jle	.L49
	mov	r15, QWORD PTR 8[r14]
	mov	ebx, eax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L23:
	mov	rdi, QWORD PTR 16[r14]
.L49:
	lea	rsi, .LC1[rip]
	xor	eax, eax
	call	dev_err@PLT
.L11:
	sub	DWORD PTR 8[rsp], 1
	jne	.L24
	mov	rdi, QWORD PTR 16[r14]
	lea	rsi, .LC5[rip]
	xor	eax, eax
	call	dev_err@PLT
	mov	r12d, DWORD PTR EFAULT[rip]
	neg	r12d
.L1:
	mov	rax, QWORD PTR 152[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L59
	add	rsp, 168
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	eax, r12d
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L14:
	.cfi_restore_state
	mov	rdi, QWORD PTR 16[r14]
	lea	ecx, -1[rbx]
	test	ebx, ebx
	jle	.L49
	mov	ebx, ecx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L56:
	mov	eax, DWORD PTR 4[rsp]
	lea	ecx, -1[rax]
	test	eax, eax
	jle	.L20
	mov	DWORD PTR 4[rsp], ecx
	mov	r15, QWORD PTR 8[r14]
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L21:
	mov	edx, eax
	lea	rsi, .LC4[rip]
	xor	eax, eax
	call	dev_err@PLT
	jmp	.L50
	.p2align 4,,10
	.p2align 3
.L57:
	mov	rdi, rcx
	movzx	edx, r15b
	lea	rsi, .LC0[rip]
	xor	eax, eax
	mov	QWORD PTR 24[rsp], r8
	mov	QWORD PTR 16[rsp], rcx
	call	sprintf@PLT
	mov	rcx, QWORD PTR 16[rsp]
	mov	r8, QWORD PTR 24[rsp]
	add	rcx, 3
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L26:
	mov	eax, ebx
	jmp	.L48
	.p2align 4,,10
	.p2align 3
.L22:
	lea	rsi, .LC3[rip]
	xor	eax, eax
	mov	DWORD PTR [rsp], ecx
	call	dev_err@PLT
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L20:
	lea	rsi, .LC2[rip]
	xor	eax, eax
	mov	DWORD PTR 4[rsp], ecx
	call	dev_err@PLT
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L58:
	mov	DWORD PTR [rcx], 3026464
	add	rcx, 3
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L46:
	mov	r12d, DWORD PTR 12[rsp]
	jmp	.L1
.L59:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	ftdi_elan_synchronize, .-ftdi_elan_synchronize
	.comm	ETIMEDOUT,4,4
	.comm	EFAULT,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_ftdi-elan.c_ftdi_elan_synchronize.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	" %02X\000"
	.align	2
.LC1:
	.ascii	" ..\000"
	.align	2
.LC2:
	.ascii	"retry limit reached\012\000"
	.align	2
.LC3:
	.ascii	"TIMED OUT retry limit reached\012\000"
	.align	2
.LC4:
	.ascii	"empty packet retry limit reached\012\000"
	.align	2
.LC5:
	.ascii	"error = %d\012\000"
	.align	2
.LC6:
	.ascii	"failed to synchronize\012\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC7:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	ftdi_elan_synchronize, %function
ftdi_elan_synchronize:
	@ args = 0, pretend = 0, frame = 128
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	r3, .L53
	sub	sp, sp, #140
	ldr	r3, [r3]
	str	r3, [sp, #132]
	mov	r3,#0
	mov	r10, r0
	bl	ftdi_elan_flush_input_fifo
	subs	r9, r0, #0
	bne	.L1
	mov	r3, #10
	mov	r2, r3
	str	r3, [sp, #12]
	str	r2, [sp, #16]
	mvn	r3, #0
	mov	r2, #5
	str	r9, [r10, #20]
	str	r2, [sp, #20]
	str	r3, [r10]
.L21:
	mov	r0, r10
	bl	ftdi_elan_synchronize_flush
	subs	fp, r0, #0
	bne	.L32
	mov	r0, r10
	bl	ftdi_elan_flush_input_fifo
	subs	fp, r0, #0
	bne	.L32
.L3:
	mov	r0, r10
	bl	ftdi_elan_synchronize_reset
	subs	r5, r0, #0
	str	r5, [sp, #24]
	bne	.L34
	mov	r3, #10
	mov	r4, #100
	mov	r7, #500
	ldr	r8, [r10, #8]
	str	r3, [sp, #8]
	add	r6, sp, #32
.L4:
	ldr	r1, [r10, #16]
	mov	r0, r8
	str	r5, [sp, #32]
	bl	usb_rcvbulkpipe
	stm	sp, {r6, r7}
	mov	r1, r0
	ldr	r3, [r10, #12]
	mov	r0, r8
	ldr	r2, [r10, #4]
	bl	usb_bulk_msg
	ldr	r3, [sp, #32]
	cmp	r3, #2
	bgt	.L44
	beq	.L45
	cmp	r3, #1
	ldr	r8, [r10, #8]
	beq	.L46
	ldr	r3, .L53+4
	ldr	r3, [r3]
	cmn	r0, r3
	beq	.L47
	cmp	r0, #0
	bne	.L19
	ldr	r3, [sp, #16]
	cmp	r3, #0
	sub	r3, r3, #1
	ble	.L48
	str	r3, [sp, #16]
	b	.L4
.L44:
	sub	r3, r3, #1
	str	r3, [sp, #32]
	add	r3, sp, #36
	mov	fp, r3
	ldr	r9, [r10, #4]
	mov	r3, r10
	mov	r8, #0
	mov	r10, r4
	strb	r5, [sp, #36]
.L8:
	cmp	r8, #30
	ldrb	r4, [r9], #1	@ zero_extendqisi2
	ble	.L49
	cmp	r8, #31
	beq	.L50
.L7:
	ldr	r2, [sp, #32]
	add	r8, r8, #1
	cmp	r2, #0
	sub	r2, r2, #1
	str	r2, [sp, #32]
	bgt	.L8
	mov	fp, r4
	cmp	fp, #126
	mov	r4, r10
	mov	r10, r3
	beq	.L34
	cmp	fp, #85
	beq	.L37
	cmp	r4, #0
	sub	r4, r4, #1
	ble	.L20
.L37:
	ldr	r8, [r10, #8]
	b	.L4
.L45:
	ldr	r2, [r10, #4]
	ldrb	r3, [r2]	@ zero_extendqisi2
	ldrb	r1, [r2, #1]	@ zero_extendqisi2
	cmp	r1, #0
	cmpeq	r3, #49
	bne	.L14
	ldr	r3, [sp, #8]
	cmp	r3, #0
	sub	r3, r3, #1
	ble	.L3
	str	r3, [sp, #8]
	b	.L37
.L46:
	cmp	r4, #0
	sub	r4, r4, #1
	bgt	.L4
.L39:
	mov	r0, r8
	ldr	r1, .L53+8
	bl	dev_err
.L11:
	ldr	r3, [sp, #12]
	subs	r3, r3, #1
	str	r3, [sp, #12]
	bne	.L21
	ldr	r0, [r10, #8]
	ldr	r1, .L53+12
	bl	dev_err
	ldr	r3, .L53+16
	ldr	r0, [r3]
	rsb	r9, r0, #0
.L1:
	ldr	r3, .L53
	ldr	r2, [r3]
	ldr	r3, [sp, #132]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L51
	mov	r0, r9
	add	sp, sp, #140
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L14:
	cmp	r4, #0
	ldr	r8, [r10, #8]
	sub	r3, r4, #1
	ble	.L39
	mov	r4, r3
	b	.L4
.L47:
	ldr	r3, [sp, #20]
	cmp	r3, #0
	sub	r3, r3, #1
	ble	.L52
	str	r3, [sp, #20]
	b	.L4
.L19:
	mov	r2, r0
	ldr	r1, .L53+20
	mov	r0, r8
	bl	dev_err
	cmp	r4, #0
	sub	r4, r4, #1
	bgt	.L37
.L20:
	ldr	r1, .L53+8
	ldr	r0, [r10, #8]
	bl	dev_err
	b	.L11
.L49:
	mov	r0, fp
	mov	r2, r4
	ldr	r1, .L53+24
	str	r3, [sp, #28]
	add	fp, fp, #3
	bl	sprintf
	ldr	r3, [sp, #28]
	b	.L7
.L48:
	mov	r0, r8
	ldr	r1, .L53+28
	str	r3, [sp, #16]
	bl	dev_err
	b	.L11
.L52:
	mov	r0, r8
	ldr	r1, .L53+32
	str	r3, [sp, #20]
	bl	dev_err
	b	.L11
.L50:
	mov	r0, fp
	mov	r2, #4
	ldr	r1, .L53+36
	str	r3, [sp, #28]
	add	fp, fp, #3
	bl	memcpy
	ldr	r3, [sp, #28]
	b	.L7
.L34:
	ldr	r9, [sp, #24]
	b	.L1
.L32:
	mov	r9, fp
	b	.L1
.L51:
	bl	__stack_chk_fail
.L54:
	.align	2
.L53:
	.word	.LC7
	.word	ETIMEDOUT
	.word	.LC2
	.word	.LC6
	.word	EFAULT
	.word	.LC5
	.word	.LC0
	.word	.LC4
	.word	.LC3
	.word	.LC1
	.size	ftdi_elan_synchronize, .-ftdi_elan_synchronize
	.comm	ETIMEDOUT,4,4
	.comm	EFAULT,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
