	.file	"extr_adb_kbd.c_akbd_read_char.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	akbd_read_char, @function
akbd_read_char:
.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
	lea	r12, 32[rdi]
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	mov	ebp, esi
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	mov	rbx, rdi
	mov	rdi, r12
	sub	rsp, 8
	.cfi_def_cfa_offset 48
	call	mtx_lock@PLT
	mov	edx, DWORD PTR 16[rbx]
	test	ebp, ebp
	je	.L2
	test	edx, edx
	je	.L16
.L3:
	mov	rcx, QWORD PTR 24[rbx]
	mov	r13d, DWORD PTR [rcx]
	cmp	edx, 1
	jle	.L5
	mov	eax, 1
	.p2align 4,,10
	.p2align 3
.L6:
	mov	edx, DWORD PTR [rcx+rax*4]
	mov	DWORD PTR -4[rcx+rax*4], edx
	mov	edx, DWORD PTR 16[rbx]
	add	rax, 1
	cmp	edx, eax
	jg	.L6
.L5:
	sub	edx, 1
	mov	rdi, r12
	mov	DWORD PTR 16[rbx], edx
	call	mtx_unlock@PLT
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	mov	eax, r13d
	pop	rbx
	.cfi_def_cfa_offset 32
	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
.L16:
	.cfi_restore_state
	lea	rdi, 36[rbx]
	mov	rsi, r12
	call	cv_wait@PLT
	mov	edx, DWORD PTR 16[rbx]
.L2:
	test	edx, edx
	jne	.L3
	mov	rdi, r12
	call	mtx_unlock@PLT
	mov	r13d, DWORD PTR NOKEY[rip]
	add	rsp, 8
	.cfi_def_cfa_offset 40
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	mov	eax, r13d
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	akbd_read_char, .-akbd_read_char
	.comm	adb_to_at_scancode_map,8,8
	.comm	SCAN_RELEASE,4,4
	.comm	SCAN_PREFIX_SHIFT,4,4
	.comm	SCAN_PREFIX_E0,4,4
	.comm	SCAN_PREFIX_CTL,4,4
	.comm	SCAN_PREFIX,4,4
	.comm	NOKEY,4,4
	.comm	K_RAW,8,8
	.comm	K_CODE,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_adb_kbd.c_akbd_read_char.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	akbd_read_char, %function
akbd_read_char:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, lr}
	mov	r4, r0
	add	r6, r0, #16
	mov	r0, r6
	mov	r5, r1
	bl	mtx_lock
	ldr	ip, [r4, #8]
	cmp	r5, #0
	clz	r3, ip
	lsr	r3, r3, #5
	moveq	r3, #0
	cmp	r3, #0
	bne	.L13
.L2:
	cmp	ip, #0
	beq	.L14
	ldr	r3, [r4, #12]
	cmp	ip, #1
	ldr	r5, [r3]
	ble	.L5
	mov	r2, #1
.L6:
	ldr	r0, [r3, #4]
	add	r2, r2, #1
	str	r0, [r3], #4
	ldr	ip, [r4, #8]
	cmp	ip, r2
	bgt	.L6
.L5:
	sub	ip, ip, #1
	mov	r0, r6
	str	ip, [r4, #8]
	bl	mtx_unlock
	mov	r0, r5
	pop	{r4, r5, r6, pc}
.L14:
	mov	r0, r6
	bl	mtx_unlock
	ldr	r3, .L15
	ldr	r5, [r3]
	mov	r0, r5
	pop	{r4, r5, r6, pc}
.L13:
	mov	r1, r6
	add	r0, r4, #20
	bl	cv_wait
	ldr	ip, [r4, #8]
	b	.L2
.L16:
	.align	2
.L15:
	.word	NOKEY
	.size	akbd_read_char, .-akbd_read_char
	.comm	adb_to_at_scancode_map,4,4
	.comm	SCAN_RELEASE,4,4
	.comm	SCAN_PREFIX_SHIFT,4,4
	.comm	SCAN_PREFIX_E0,4,4
	.comm	SCAN_PREFIX_CTL,4,4
	.comm	SCAN_PREFIX,4,4
	.comm	NOKEY,4,4
	.comm	K_RAW,4,4
	.comm	K_CODE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
