	.file	"extr_matrix.c_matrix_scan.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	matrix_scan
	.type	matrix_scan, @function
matrix_scan:
.LFB0:
	.cfi_startproc
	endbr64
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xor	r12d, r12d
	push	rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	mov	ebx, 1
	sub	rsp, 8
	.cfi_def_cfa_offset 32
	cmp	QWORD PTR MATRIX_COLS[rip], 0
	jle	.L6
	.p2align 4,,10
	.p2align 3
.L2:
	mov	rdi, r12
	call	select_col@PLT
	mov	edi, 3
	call	_delay_us@PLT
	xor	eax, eax
	call	scan_col@PLT
	cmp	QWORD PTR MATRIX_ROWS[rip], 0
	jle	.L9
	mov	ecx, r12d
	mov	r10, rbx
	mov	r8, QWORD PTR matrix_debouncing[rip]
	mov	r11d, 1
	sal	r10, cl
	xor	ecx, ecx
	mov	r9d, r10d
	.p2align 4,,10
	.p2align 3
.L8:
	mov	rsi, QWORD PTR [r8+rcx*8]
	mov	edx, r11d
	mov	edi, r9d
	sal	edx, cl
	and	edi, esi
	and	edx, eax
	cmp	edi, edx
	je	.L7
	xor	rsi, r10
	mov	QWORD PTR [r8+rcx*8], rsi
	mov	rdx, QWORD PTR DEBOUNCE[rip]
	mov	QWORD PTR debouncing[rip], rdx
.L7:
	add	rcx, 1
	cmp	QWORD PTR MATRIX_ROWS[rip], rcx
	jg	.L8
.L9:
	add	r12, 1
	cmp	QWORD PTR MATRIX_COLS[rip], r12
	jg	.L2
.L6:
	mov	rax, QWORD PTR debouncing[rip]
	test	rax, rax
	je	.L10
	sub	rax, 1
	mov	QWORD PTR debouncing[rip], rax
	jne	.L11
	cmp	QWORD PTR MATRIX_ROWS[rip], 0
	mov	rsi, QWORD PTR matrix_debouncing[rip]
	mov	rcx, QWORD PTR matrix[rip]
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L13:
	mov	rdx, QWORD PTR [rsi+rax*8]
	mov	QWORD PTR [rcx+rax*8], rdx
	add	rax, 1
	cmp	QWORD PTR MATRIX_ROWS[rip], rax
	jg	.L13
.L10:
	xor	eax, eax
	call	matrix_scan_quantum@PLT
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	mov	eax, 1
	pop	rbx
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
.L11:
	.cfi_restore_state
	mov	edi, 1
	call	_delay_ms@PLT
	jmp	.L10
	.cfi_endproc
.LFE0:
	.size	matrix_scan, .-matrix_scan
	.comm	matrix_debouncing,8,8
	.comm	matrix,8,8
	.comm	debouncing,8,8
	.comm	MATRIX_ROWS,8,8
	.comm	MATRIX_COLS,8,8
	.comm	DEBOUNCE,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_matrix.c_matrix_scan.c"
	.text
	.align	2
	.global	matrix_scan
	.syntax unified
	.arm
	.fpu softvfp
	.type	matrix_scan, %function
matrix_scan:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r3, r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	r9, .L22
	ldr	r3, [r9]
	cmp	r3, #0
	ldrle	r5, .L22+4
	ble	.L2
	mov	r8, #0
	ldr	r4, .L22+8
	ldr	r5, .L22+4
	ldr	r6, .L22+12
	ldr	r7, .L22+16
.L6:
	mov	r0, r8
	bl	select_col
	mov	r0, #3
	bl	_delay_us
	bl	scan_col
	ldr	r3, [r4]
	cmp	r3, #0
	ble	.L3
	mov	lr, #1
	mov	r3, #0
	ldr	ip, [r6]
	mov	fp, lr
	sub	ip, ip, #4
	lsl	lr, lr, r8
.L5:
	ldr	r1, [ip, #4]!
	and	r2, r0, fp, lsl r3
	and	r10, r1, lr
	cmp	r10, r2
	eorne	r1, r1, lr
	strne	r1, [ip]
	ldrne	r2, [r7]
	add	r3, r3, #1
	strne	r2, [r5]
	ldr	r2, [r4]
	cmp	r2, r3
	bgt	.L5
.L3:
	ldr	r3, [r9]
	add	r8, r8, #1
	cmp	r3, r8
	bgt	.L6
.L2:
	ldr	r3, [r5]
	cmp	r3, #0
	beq	.L10
	sub	r3, r3, #1
	cmp	r3, #0
	str	r3, [r5]
	bne	.L8
	ldr	r4, .L22+8
	ldr	r2, [r4]
	cmp	r2, #0
	ble	.L10
	ldr	r1, .L22+12
	ldr	r2, .L22+20
	ldr	r1, [r1]
	ldr	r2, [r2]
	sub	r1, r1, #4
	sub	r2, r2, #4
.L11:
	ldr	r0, [r1, #4]!
	add	r3, r3, #1
	str	r0, [r2, #4]!
	ldr	r0, [r4]
	cmp	r0, r3
	bgt	.L11
.L10:
	bl	matrix_scan_quantum
	mov	r0, #1
	pop	{r3, r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L8:
	mov	r0, #1
	bl	_delay_ms
	b	.L10
.L23:
	.align	2
.L22:
	.word	MATRIX_COLS
	.word	debouncing
	.word	MATRIX_ROWS
	.word	matrix_debouncing
	.word	DEBOUNCE
	.word	matrix
	.size	matrix_scan, .-matrix_scan
	.comm	matrix_debouncing,4,4
	.comm	matrix,4,4
	.comm	debouncing,4,4
	.comm	MATRIX_ROWS,4,4
	.comm	MATRIX_COLS,4,4
	.comm	DEBOUNCE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
