	.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"
	.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	.L11
.L3:
	cmp	QWORD PTR MATRIX_ROWS_PER_SIDE[rip], 0
	je	.L6
	xor	ebx, ebx
	.p2align 4,,10
	.p2align 3
.L7:
	mov	rdi, rbx
	call	select_row@PLT
	mov	rdi, QWORD PTR MATRIX_ROWS_PER_SIDE[rip]
	add	rdi, rbx
	call	select_row@PLT
	mov	rax, QWORD PTR matrix[rip]
	mov	rdi, rbx
	lea	rbp, [rax+rbx*4]
	call	debounce_read_cols@PLT
	mov	rdi, QWORD PTR MATRIX_ROWS_PER_SIDE[rip]
	mov	DWORD PTR 0[rbp], eax
	mov	rax, QWORD PTR matrix[rip]
	add	rdi, rbx
	add	rbx, 1
	lea	rbp, [rax+rdi*4]
	call	debounce_read_cols@PLT
	mov	DWORD PTR 0[rbp], eax
	xor	eax, eax
	call	unselect_rows@PLT
	cmp	QWORD PTR MATRIX_ROWS_PER_SIDE[rip], rbx
	ja	.L7
.L6:
	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
	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
	jmp	.L3
	.cfi_endproc
.LFE0:
	.size	matrix_scan, .-matrix_scan
	.comm	mcp23018_status,8,8
	.comm	mcp23018_reset_loop,8,8
	.comm	matrix,8,8
	.comm	MATRIX_ROWS_PER_SIDE,8,8
	.comm	MATRIX_ROWS,8,8
	.comm	MATRIX_COLS,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"
	.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, lr}
	ldr	r4, .L15
	ldr	r3, [r4]
	cmp	r3, #0
	beq	.L3
	ldr	r2, .L15+4
	ldr	r3, [r2]
	add	r3, r3, #1
	cmp	r3, #0
	str	r3, [r2]
	beq	.L14
.L3:
	ldr	r6, .L15+8
	ldr	r3, [r6]
	cmp	r3, #0
	beq	.L6
	mov	r4, #0
	ldr	r7, .L15+12
.L7:
	mov	r0, r4
	bl	select_row
	ldr	r0, [r6]
	add	r0, r4, r0
	bl	select_row
	mov	r0, r4
	ldr	r8, [r7]
	bl	debounce_read_cols
	ldr	r5, [r6]
	str	r0, [r8, r4, lsl #2]
	add	r5, r4, r5
	mov	r0, r5
	ldr	r8, [r7]
	bl	debounce_read_cols
	str	r0, [r8, r5, lsl #2]
	bl	unselect_rows
	ldr	r3, [r6]
	add	r4, r4, #1
	cmp	r3, r4
	bhi	.L7
.L6:
	bl	matrix_scan_quantum
	mov	r0, #1
	pop	{r4, r5, r6, r7, r8, pc}
.L14:
	ldr	r0, .L15+16
	bl	print
	bl	init_mcp23018
	cmp	r0, #0
	str	r0, [r4]
	ldrne	r0, .L15+20
	ldreq	r0, .L15+24
	bl	print
	b	.L3
.L16:
	.align	2
.L15:
	.word	mcp23018_status
	.word	mcp23018_reset_loop
	.word	MATRIX_ROWS_PER_SIDE
	.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,4,4
	.comm	MATRIX_ROWS_PER_SIDE,4,4
	.comm	MATRIX_ROWS,4,4
	.comm	MATRIX_COLS,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
