	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nspire_keypad_irq
_nspire_keypad_irq:                     ## @nspire_keypad_irq
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	40(%rsi), %rax
	movq	%rax, -96(%rbp)                 ## 8-byte Spill
	movq	(%rax), %rax
	movq	%rax, -112(%rbp)                ## 8-byte Spill
	movq	_KEYPAD_INT@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	16(%rsi), %rdi
	callq	_readl
	testl	%eax, (%r14)
	je	LBB0_1
## %bb.2:
	movq	_KEYPAD_DATA@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	16(%r14), %rsi
	leaq	-80(%rbp), %rdi
	movl	$32, %edx
	callq	_memcpy_fromio
	movq	_KEYPAD_BITMASK_ROWS@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jle	LBB0_11
## %bb.3:
	xorl	%r12d, %r12d
	movq	%r14, -104(%rbp)                ## 8-byte Spill
	movq	-96(%rbp), %r15                 ## 8-byte Reload
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_4 Depth=1
	incq	%r12
	movq	_KEYPAD_BITMASK_ROWS@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	cmpq	%rax, %r12
	jge	LBB0_11
LBB0_4:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_7 Depth 2
	xorl	%eax, %eax
	cmpq	32(%r14), %rax
	movl	$0, %ecx
	sbbl	%ecx, %ecx
	xorl	-80(%rbp,%r12,4), %ecx
	movq	8(%r14), %rax
	movl	(%rax,%r12,4), %edx
	movl	%ecx, -84(%rbp)                 ## 4-byte Spill
	xorl	%ecx, %edx
	movl	%edx, -88(%rbp)                 ## 4-byte Spill
	je	LBB0_10
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	movl	-84(%rbp), %ecx                 ## 4-byte Reload
	movl	%ecx, (%rax,%r12,4)
	movq	_KEYPAD_BITMASK_COLS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jle	LBB0_10
## %bb.6:                               ##   in Loop: Header=BB0_4 Depth=1
	xorl	%ebx, %ebx
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_7 Depth=2
	incl	%ebx
	cmpl	%eax, %ebx
	jge	LBB0_10
LBB0_7:                                 ##   Parent Loop BB0_4 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	$1, %r13d
	movl	%ebx, %ecx
	shll	%cl, %r13d
	movl	-88(%rbp), %ecx                 ## 4-byte Reload
	btl	%ebx, %ecx
	jae	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=2
	movl	24(%r14), %edx
	movl	%r12d, %edi
	movl	%ebx, %esi
	callq	_MATRIX_SCAN_CODE
	movl	%eax, %r14d
	movq	_EV_MSC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_MSC_SCAN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movl	%r14d, %ecx
	callq	_input_event
	movl	%r14d, %eax
	movq	-104(%rbp), %r14                ## 8-byte Reload
	movq	-112(%rbp), %rcx                ## 8-byte Reload
	movzwl	(%rcx,%rax,2), %esi
	andl	-84(%rbp), %r13d                ## 4-byte Folded Reload
	movq	%r15, %rdi
	movl	%r13d, %edx
	callq	_input_report_key
	movq	_KEYPAD_BITMASK_COLS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	jmp	LBB0_9
LBB0_11:
	movq	-96(%rbp), %rdi                 ## 8-byte Reload
	callq	_input_sync
	movq	_KEYPAD_INT@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	16(%r14), %rsi
	movl	$3, %edi
	callq	_writel
	movq	_IRQ_HANDLED@GOTPCREL(%rip), %rax
	jmp	LBB0_12
LBB0_1:
	movq	_IRQ_NONE@GOTPCREL(%rip), %rax
LBB0_12:
	movl	(%rax), %eax
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_14
## %bb.13:
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_14:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_KEYPAD_INT,8,3                 ## @KEYPAD_INT
	.comm	_IRQ_NONE,4,2                   ## @IRQ_NONE
	.comm	_KEYPAD_DATA,8,3                ## @KEYPAD_DATA
	.comm	_KEYPAD_BITMASK_ROWS,4,2        ## @KEYPAD_BITMASK_ROWS
	.comm	_KEYPAD_BITMASK_COLS,4,2        ## @KEYPAD_BITMASK_COLS
	.comm	_EV_MSC,4,2                     ## @EV_MSC
	.comm	_MSC_SCAN,4,2                   ## @MSC_SCAN
	.comm	_IRQ_HANDLED,4,2                ## @IRQ_HANDLED
	.no_dead_strip	_nspire_keypad_irq
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nspire_keypad_irq
_nspire_keypad_irq:                     ; @nspire_keypad_irq
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x1
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #40]
	ldr	x20, [x1, #40]
	ldr	x25, [x20]
	ldr	x8, [x1, #16]
Lloh3:
	adrp	x9, _KEYPAD_INT@GOTPAGE
Lloh4:
	ldr	x9, [x9, _KEYPAD_INT@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	add	x0, x9, x8
	bl	_readl
	ldr	w8, [x19]
	tst	w8, w0
	b.eq	LBB0_11
; %bb.1:
	ldr	x8, [x19, #16]
Lloh6:
	adrp	x9, _KEYPAD_DATA@GOTPAGE
Lloh7:
	ldr	x9, [x9, _KEYPAD_DATA@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	add	x1, x9, x8
	add	x0, sp, #8
	mov	w2, #32
	bl	_memcpy_fromio
Lloh9:
	adrp	x8, _KEYPAD_BITMASK_ROWS@GOTPAGE
Lloh10:
	ldr	x8, [x8, _KEYPAD_BITMASK_ROWS@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	cmp	w8, #1
	b.lt	LBB0_10
; %bb.2:
	mov	x21, #0
	mov	w24, #1
	b	LBB0_4
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	x21, x21, #1
Lloh12:
	adrp	x8, _KEYPAD_BITMASK_ROWS@GOTPAGE
Lloh13:
	ldr	x8, [x8, _KEYPAD_BITMASK_ROWS@GOTPAGEOFF]
Lloh14:
	ldrsw	x8, [x8]
	cmp	x21, x8
	b.ge	LBB0_10
LBB0_4:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_8 Depth 2
	lsl	x9, x21, #2
	add	x8, sp, #8
	ldr	w8, [x8, x9]
	ldr	x10, [x19, #32]
	cmp	x10, #0
	cinv	w26, w8, ne
	ldr	x8, [x19, #8]
	ldr	w9, [x8, x9]
	eor	w27, w26, w9
	cbz	w27, LBB0_3
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	str	w26, [x8, x21, lsl #2]
Lloh15:
	adrp	x8, _KEYPAD_BITMASK_COLS@GOTPAGE
Lloh16:
	ldr	x8, [x8, _KEYPAD_BITMASK_COLS@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	cmp	w8, #1
	b.lt	LBB0_3
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	w22, #0
	b	LBB0_8
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=2
	add	w22, w22, #1
	cmp	w22, w8
	b.ge	LBB0_3
LBB0_8:                                 ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	lsl	w28, w24, w22
	tst	w28, w27
	b.eq	LBB0_7
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=2
	ldr	w2, [x19, #24]
	mov	x0, x21
	mov	x1, x22
	bl	_MATRIX_SCAN_CODE
	mov	x23, x0
Lloh18:
	adrp	x8, _EV_MSC@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EV_MSC@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
Lloh21:
	adrp	x8, _MSC_SCAN@GOTPAGE
Lloh22:
	ldr	x8, [x8, _MSC_SCAN@GOTPAGEOFF]
Lloh23:
	ldr	w2, [x8]
	mov	x0, x20
	mov	x3, x23
	bl	_input_event
	ldrh	w1, [x25, w23, uxtw #1]
	and	w2, w28, w26
	mov	x0, x20
	bl	_input_report_key
Lloh24:
	adrp	x8, _KEYPAD_BITMASK_COLS@GOTPAGE
Lloh25:
	ldr	x8, [x8, _KEYPAD_BITMASK_COLS@GOTPAGEOFF]
Lloh26:
	ldr	w8, [x8]
	b	LBB0_7
LBB0_10:
	mov	x0, x20
	bl	_input_sync
	ldr	x8, [x19, #16]
Lloh27:
	adrp	x9, _KEYPAD_INT@GOTPAGE
Lloh28:
	ldr	x9, [x9, _KEYPAD_INT@GOTPAGEOFF]
Lloh29:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	w0, #3
	bl	_writel
Lloh30:
	adrp	x8, _IRQ_HANDLED@GOTPAGE
Lloh31:
	ldr	x8, [x8, _IRQ_HANDLED@GOTPAGEOFF]
	b	LBB0_12
LBB0_11:
Lloh32:
	adrp	x8, _IRQ_NONE@GOTPAGE
Lloh33:
	ldr	x8, [x8, _IRQ_NONE@GOTPAGEOFF]
LBB0_12:
	ldr	w0, [x8]
	ldr	x8, [sp, #40]
Lloh34:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh35:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh36:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_14
; %bb.13:
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
LBB0_14:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.cfi_endproc
                                        ; -- End function
	.comm	_KEYPAD_INT,8,3                 ; @KEYPAD_INT
	.comm	_IRQ_NONE,4,2                   ; @IRQ_NONE
	.comm	_KEYPAD_DATA,8,3                ; @KEYPAD_DATA
	.comm	_KEYPAD_BITMASK_ROWS,4,2        ; @KEYPAD_BITMASK_ROWS
	.comm	_KEYPAD_BITMASK_COLS,4,2        ; @KEYPAD_BITMASK_COLS
	.comm	_EV_MSC,4,2                     ; @EV_MSC
	.comm	_MSC_SCAN,4,2                   ; @MSC_SCAN
	.comm	_IRQ_HANDLED,4,2                ; @IRQ_HANDLED
	.no_dead_strip	_nspire_keypad_irq
.subsections_via_symbols
