	.file	"extr_adi.c_adi_read_packet.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	adi_read_packet, @function
adi_read_packet:
.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
	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, 56
	.cfi_def_cfa_offset 112
	mov	rbx, QWORD PTR 8[rdi]
	mov	r13, QWORD PTR [rdi]
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 40[rsp], rax
	xor	eax, eax
	mov	esi, DWORD PTR ADI_MAX_START[rip]
	lea	r14, 24[rsp]
	mov	DWORD PTR [rbx], -1
	mov	rdi, r13
	mov	QWORD PTR [rsp], rbx
	call	gameport_time@PLT
	mov	DWORD PTR 16[rbx], -1
	mov	esi, DWORD PTR ADI_MAX_START[rip]
	mov	rdi, r13
	mov	DWORD PTR 24[rsp], eax
	mov	ebp, eax
	call	gameport_time@PLT
	xor	edi, edi
	mov	QWORD PTR 32[rsp], 0
	mov	DWORD PTR 28[rsp], eax
	call	local_irq_save@PLT
	mov	rdi, r13
	call	gameport_trigger@PLT
	mov	rdi, r13
	call	gameport_read@PLT
	mov	ecx, eax
	.p2align 4,,10
	.p2align 3
.L18:
	mov	rdi, r13
	mov	r12d, ecx
	xor	ebx, ebx
	sub	ebp, 1
	call	gameport_read@PLT
	mov	DWORD PTR [r14+rbx], ebp
	mov	ecx, eax
	mov	r15d, eax
	xor	r12d, ecx
	mov	edx, r12d
	and	edx, 48
	je	.L2
.L26:
	mov	esi, DWORD PTR 32[rsp+rbx]
	test	esi, esi
	je	.L2
	cmp	dl, 48
	je	.L3
	mov	rax, QWORD PTR [rsp]
	mov	eax, DWORD PTR [rax+rbx*4]
	cmp	eax, DWORD PTR ADI_MAX_LENGTH[rip]
	jge	.L3
	test	ebp, ebp
	jg	.L25
.L3:
	mov	DWORD PTR [r14+rbx], 0
.L4:
	add	rbx, 4
	cmp	rbx, 8
	je	.L5
.L27:
	mov	ebp, DWORD PTR [r14+rbx]
	shr	r12b, 2
	shr	r15b, 2
	mov	edx, r12d
	sub	ebp, 1
	mov	DWORD PTR [r14+rbx], ebp
	and	edx, 48
	jne	.L26
.L2:
	test	r15b, 48
	jne	.L4
	mov	DWORD PTR 32[rsp+rbx], 1
	add	rbx, 4
	cmp	rbx, 8
	jne	.L27
.L5:
	mov	ebp, DWORD PTR 24[rsp]
	test	ebp, ebp
	jg	.L18
	mov	eax, DWORD PTR 28[rsp]
	test	eax, eax
	jg	.L18
	mov	rax, QWORD PTR 40[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L28
	add	rsp, 56
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xor	edi, edi
	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
	jmp	local_irq_restore@PLT
	.p2align 4,,10
	.p2align 3
.L25:
	.cfi_restore_state
	mov	rsi, QWORD PTR [rsp]
	add	eax, 1
	mov	rdi, r13
	mov	BYTE PTR 15[rsp], cl
	mov	rdx, QWORD PTR 8[rsi+rbx*4]
	mov	DWORD PTR [rsi+rbx*4], eax
	cdqe
	mov	BYTE PTR [rdx+rax], r12b
	mov	esi, DWORD PTR ADI_MAX_STROBE[rip]
	call	gameport_time@PLT
	movzx	ecx, BYTE PTR 15[rsp]
	mov	DWORD PTR [r14+rbx], eax
	jmp	.L4
.L28:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	adi_read_packet, .-adi_read_packet
	.comm	ADI_MAX_STROBE,4,4
	.comm	ADI_MAX_START,4,4
	.comm	ADI_MAX_LENGTH,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_adi.c_adi_read_packet.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	adi_read_packet, %function
adi_read_packet:
	@ args = 0, pretend = 0, frame = 32
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	mvn	r7, #0
	ldr	r8, [r0, #4]
	sub	sp, sp, #36
	ldr	r10, [r0]
	ldr	r3, .L29
	ldr	r6, .L29+4
	str	r8, [sp, #4]
	ldr	r3, [r3]
	str	r3, [sp, #28]
	mov	r3,#0
	ldr	r1, [r6]
	mov	r0, r10
	str	r7, [r8]
	bl	gameport_time
	mov	r4, #0
	mov	r5, r0
	ldr	r1, [r6]
	mov	r0, r10
	str	r7, [r8, #8]
	str	r5, [sp, #12]
	str	r4, [sp, #20]
	bl	gameport_time
	mov	r3, r0
	mov	r0, r4
	str	r3, [sp, #16]
	str	r4, [sp, #24]
	bl	local_irq_save
	mov	r0, r10
	bl	gameport_trigger
	mov	r0, r10
	bl	gameport_read
	mov	r9, r0
	add	fp, sp, #12
.L18:
	mov	r0, r10
	bl	gameport_read
	mov	r4, r9
	mov	r6, #0
	eor	r4, r4, r0
	and	r4, r4, #255
	sub	r5, r5, #1
	ands	r2, r4, #48
	mov	r9, r0
	mov	r7, r0
	ldr	r8, [sp, #4]
	add	r3, sp, #20
	str	r5, [fp, r6, lsl #2]
	beq	.L2
.L26:
	ldr	r1, [r3, r6, lsl #2]
	cmp	r1, #0
	beq	.L2
	cmp	r2, #48
	beq	.L3
	ldr	r2, .L29+8
	ldr	r1, [r8]
	ldr	r2, [r2]
	cmp	r1, r2
	movge	r2, #0
	movlt	r2, #1
	cmp	r5, #0
	movle	r2, #0
	cmp	r2, #0
	bne	.L25
.L3:
	mov	r2, #0
	str	r2, [fp, r6, lsl #2]
.L4:
	cmp	r6, #1
	add	r8, r8, #8
	beq	.L5
.L27:
	mov	r6, #1
	ldr	r5, [sp, #16]
	lsr	r4, r4, #2
	lsr	r7, r7, #2
	sub	r5, r5, #1
	ands	r2, r4, #48
	and	r7, r7, #255
	str	r5, [fp, r6, lsl #2]
	bne	.L26
.L2:
	tst	r7, #48
	moveq	r2, #1
	streq	r2, [r3, r6, lsl #2]
	cmp	r6, #1
	add	r8, r8, #8
	bne	.L27
.L5:
	ldr	r5, [sp, #12]
	cmp	r5, #0
	bgt	.L18
	ldr	r3, [sp, #16]
	cmp	r3, #0
	bgt	.L18
	ldr	r3, .L29
	ldr	r2, [r3]
	ldr	r3, [sp, #28]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L28
	mov	r0, #0
	add	sp, sp, #36
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	b	local_irq_restore
.L25:
	ldr	r2, [r8, #4]
	ldr	r3, .L29+12
	add	r1, r1, #1
	str	r1, [r8]
	strb	r4, [r2, r1]
	ldr	r1, [r3]
	mov	r0, r10
	bl	gameport_time
	add	r3, sp, #20
	str	r0, [fp, r6, lsl #2]
	b	.L4
.L28:
	bl	__stack_chk_fail
.L30:
	.align	2
.L29:
	.word	.LC0
	.word	ADI_MAX_START
	.word	ADI_MAX_LENGTH
	.word	ADI_MAX_STROBE
	.size	adi_read_packet, .-adi_read_packet
	.comm	ADI_MAX_STROBE,4,4
	.comm	ADI_MAX_START,4,4
	.comm	ADI_MAX_LENGTH,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
