	.file	"extr_matrix.c_matrix_scan.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"trying to reset mcp23018\n"
.LC1:
	.string	"left side not responding\n"
.LC2:
	.string	"left side attached\n"
.LC3:
	.string	"bounce!: "
.LC4:
	.string	"\n"
	.text
	.p2align 4
	.globl	matrix_scan
	.type	matrix_scan, @function
matrix_scan:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	push	rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	sub	rsp, 8
	.cfi_def_cfa_offset 32
	cmp	QWORD PTR mcp23018_status[rip], 0
	je	.L3
	add	QWORD PTR mcp23018_reset_loop[rip], 1
	je	.L23
.L3:
	cmp	QWORD PTR MATRIX_ROWS[rip], 0
	jle	.L6
	xor	ebx, ebx
	lea	rbp, .LC3[rip]
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L8:
	mov	rax, QWORD PTR DEBOUNCE[rip]
	mov	QWORD PTR debouncing[rip], rax
.L7:
	xor	eax, eax
	add	rbx, 1
	call	unselect_rows@PLT
	cmp	QWORD PTR MATRIX_ROWS[rip], rbx
	jle	.L6
.L9:
	mov	rdi, rbx
	call	select_row@PLT
	mov	edi, 30
	call	wait_us@PLT
	mov	rdi, rbx
	call	read_cols@PLT
	mov	rdx, QWORD PTR matrix_debouncing[rip]
	lea	rdx, [rdx+rbx*8]
	cmp	QWORD PTR [rdx], rax
	je	.L7
	mov	QWORD PTR [rdx], rax
	cmp	QWORD PTR debouncing[rip], 0
	je	.L8
	mov	rdi, rbp
	call	debug@PLT
	mov	rdi, QWORD PTR debouncing[rip]
	call	debug_hex@PLT
	lea	rdi, .LC4[rip]
	call	debug@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L6:
	mov	rax, QWORD PTR debouncing[rip]
	test	rax, rax
	je	.L13
	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	.L13
	.p2align 4,,10
	.p2align 3
.L14:
	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	.L14
.L13:
	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	rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	mov	edi, 1
	call	wait_us@PLT
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L23:
	lea	rdi, .LC0[rip]
	call	print@PLT
	xor	eax, eax
	call	init_mcp23018@PLT
	mov	QWORD PTR mcp23018_status[rip], rax
	test	rax, rax
	je	.L5
	lea	rdi, .LC1[rip]
	call	print@PLT
	jmp	.L3
.L5:
	lea	rdi, .LC2[rip]
	call	print@PLT
	xor	eax, eax
	call	frenchdev_blink_all_leds@PLT
	jmp	.L3
	.cfi_endproc
.LFE0:
	.size	matrix_scan, .-matrix_scan
	.comm	mcp23018_status,8,8
	.comm	mcp23018_reset_loop,8,8
	.comm	matrix_debouncing,8,8
	.comm	matrix,8,8
	.comm	debouncing,8,8
	.comm	MATRIX_ROWS,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
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"trying to reset mcp23018\012\000"
	.align	2
.LC1:
	.ascii	"left side not responding\012\000"
	.align	2
.LC2:
	.ascii	"left side attached\012\000"
	.align	2
.LC3:
	.ascii	"bounce!: \000"
	.align	2
.LC4:
	.ascii	"\012\000"
	.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	{r4, r5, r6, r7, r8, r9, r10, lr}
	ldr	r4, .L28
	ldr	r3, [r4]
	cmp	r3, #0
	beq	.L3
	ldr	r2, .L28+4
	ldr	r3, [r2]
	add	r3, r3, #1
	cmp	r3, #0
	str	r3, [r2]
	beq	.L27
.L3:
	ldr	r6, .L28+8
	ldr	r3, [r6]
	cmp	r3, #0
	ldrle	r5, .L28+12
	ble	.L6
	mov	r4, #0
	ldr	r7, .L28+16
	ldr	r5, .L28+12
	ldr	r8, .L28+20
	ldr	r10, .L28+24
	ldr	r9, .L28+28
	b	.L9
.L8:
	ldr	r3, [r8]
	str	r3, [r5]
.L7:
	bl	unselect_rows
	ldr	r3, [r6]
	add	r4, r4, #1
	cmp	r3, r4
	ble	.L6
.L9:
	mov	r0, r4
	bl	select_row
	mov	r0, #30
	bl	wait_us
	mov	r0, r4
	bl	read_cols
	ldr	r3, [r7]
	ldr	r2, [r3, r4, lsl #2]
	cmp	r2, r0
	beq	.L7
	str	r0, [r3, r4, lsl #2]
	ldr	r3, [r5]
	cmp	r3, #0
	beq	.L8
	mov	r0, r10
	bl	debug
	ldr	r0, [r5]
	bl	debug_hex
	mov	r0, r9
	bl	debug
	b	.L8
.L6:
	ldr	r3, [r5]
	cmp	r3, #0
	beq	.L13
	sub	r3, r3, #1
	cmp	r3, #0
	str	r3, [r5]
	bne	.L11
	ldr	r2, [r6]
	cmp	r2, #0
	ble	.L13
	ldr	r1, .L28+16
	ldr	r2, .L28+32
	ldr	r1, [r1]
	ldr	r2, [r2]
	sub	r1, r1, #4
	sub	r2, r2, #4
.L14:
	ldr	r0, [r1, #4]!
	add	r3, r3, #1
	str	r0, [r2, #4]!
	ldr	r0, [r6]
	cmp	r0, r3
	bgt	.L14
.L13:
	bl	matrix_scan_quantum
	mov	r0, #1
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L11:
	mov	r0, #1
	bl	wait_us
	b	.L13
.L27:
	ldr	r0, .L28+36
	bl	print
	bl	init_mcp23018
	cmp	r0, #0
	str	r0, [r4]
	beq	.L5
	ldr	r0, .L28+40
	bl	print
	b	.L3
.L5:
	ldr	r0, .L28+44
	bl	print
	bl	frenchdev_blink_all_leds
	b	.L3
.L29:
	.align	2
.L28:
	.word	mcp23018_status
	.word	mcp23018_reset_loop
	.word	MATRIX_ROWS
	.word	debouncing
	.word	matrix_debouncing
	.word	DEBOUNCE
	.word	.LC3
	.word	.LC4
	.word	matrix
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.size	matrix_scan, .-matrix_scan
	.comm	mcp23018_status,4,4
	.comm	mcp23018_reset_loop,4,4
	.comm	matrix_debouncing,4,4
	.comm	matrix,4,4
	.comm	debouncing,4,4
	.comm	MATRIX_ROWS,4,4
	.comm	DEBOUNCE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
