	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function twl4030_kp_scan
_twl4030_kp_scan:                       ## @twl4030_kp_scan
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %r15
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	40(%rdi), %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	_TWL4030_MAX_ROWS@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	leaq	(,%rbx,4), %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r12
	testl	%r14d, %r14d
	je	LBB0_2
## %bb.1:
	shll	$2, %ebx
	movq	%r12, %rdi
	xorl	%esi, %esi
	movl	%ebx, %edx
	callq	_memset
LBB0_4:
	movl	(%r15), %ecx
	testl	%ecx, %ecx
	jle	LBB0_17
## %bb.5:
	movq	8(%r15), %rax
	xorl	%edx, %edx
	movq	%r12, -80(%rbp)                 ## 8-byte Spill
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_14:                                ##   in Loop: Header=BB0_6 Depth=1
	movl	(%r12,%rdx,4), %esi
	movq	8(%r15), %rax
LBB0_15:                                ##   in Loop: Header=BB0_6 Depth=1
	movl	%esi, (%rax,%rdx,4)
	movl	(%r15), %ecx
LBB0_16:                                ##   in Loop: Header=BB0_6 Depth=1
	incq	%rdx
	movslq	%ecx, %rsi
	cmpq	%rsi, %rdx
	jge	LBB0_17
LBB0_6:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_9 Depth 2
	movl	(%r12,%rdx,4), %esi
	movl	(%rax,%rdx,4), %edi
	xorl	%esi, %edi
	movl	%edi, -60(%rbp)                 ## 4-byte Spill
	je	LBB0_16
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	16(%r15), %edi
	testl	%edi, %edi
	js	LBB0_15
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	$-1, %r13d
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_9 Depth=2
	movl	32(%r15), %edi
	leaq	L_.str(%rip), %rsi
                                        ## kill: def $edx killed $edx killed $rdx
	movl	%r13d, %ecx
	callq	_dev_dbg
	movq	_TWL4030_ROW_SHIFT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
                                        ## kill: def $edi killed $edi killed $rdi
	movl	%r13d, %esi
	callq	_MATRIX_SCAN_CODE
	movq	%r15, %r12
	movl	%eax, %r15d
	movq	_EV_MSC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_MSC_SCAN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	movl	%r15d, %ecx
	callq	_input_event
	movq	24(%r12), %rax
	movslq	%r15d, %rcx
	movq	%r12, %r15
	movl	(%rax,%rcx,4), %esi
	movq	-80(%rbp), %r12                 ## 8-byte Reload
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	andl	(%r12,%rax,4), %r14d
	movq	%rbx, %rdi
	movl	%r14d, %edx
	callq	_input_report_key
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movl	16(%r15), %edi
LBB0_13:                                ##   in Loop: Header=BB0_9 Depth=2
	cmpl	%edi, %r13d
	jge	LBB0_14
LBB0_9:                                 ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	incl	%r13d
	movl	$1, %r14d
	movl	%r13d, %ecx
	shll	%cl, %r14d
	movl	-60(%rbp), %eax                 ## 4-byte Reload
	btl	%r13d, %eax
	jae	LBB0_13
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=2
	movl	(%r12,%rdx,4), %eax
	leaq	L_.str.2(%rip), %r8
	andl	%r14d, %eax
	je	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_9 Depth=2
	leaq	L_.str.1(%rip), %r8
	jmp	LBB0_12
LBB0_17:
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	callq	_input_sync
LBB0_18:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_20
## %bb.19:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_twl4030_read_kp_matrix_state
	testl	%eax, %eax
	js	LBB0_18
## %bb.3:
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_twl4030_is_in_ghost_state
	testq	%rax, %rax
	jne	LBB0_18
	jmp	LBB0_4
LBB0_20:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_TWL4030_MAX_ROWS,4,2           ## @TWL4030_MAX_ROWS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"key [%d:%d] %s\n"

L_.str.1:                               ## @.str.1
	.asciz	"press"

L_.str.2:                               ## @.str.2
	.asciz	"release"

	.comm	_TWL4030_ROW_SHIFT,4,2          ## @TWL4030_ROW_SHIFT
	.comm	_EV_MSC,4,2                     ## @EV_MSC
	.comm	_MSC_SCAN,4,2                   ## @MSC_SCAN
	.no_dead_strip	_twl4030_kp_scan
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function twl4030_kp_scan
_twl4030_kp_scan:                       ; @twl4030_kp_scan
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	sub	sp, sp, #16
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-88]
	ldr	x20, [x0, #40]
Lloh3:
	adrp	x8, _TWL4030_MAX_ROWS@GOTPAGE
Lloh4:
	ldr	x8, [x8, _TWL4030_MAX_ROWS@GOTPAGEOFF]
Lloh5:
	ldr	w12, [x8]
	lsl	x8, x12, #2
	mov	x9, x8
Lloh6:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh7:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0x7fffffff0
	sub	x21, x9, x8
	mov	sp, x21
	cbz	w1, LBB0_16
; %bb.1:
	lsl	w2, w12, #2
	mov	x0, x21
	mov	w1, #0
	bl	_memset
LBB0_2:
	ldr	w9, [x19]
	cmp	w9, #1
	b.lt	LBB0_13
; %bb.3:
	mov	x22, #0
	ldr	x8, [x19, #8]
	mov	w26, #1
	b	LBB0_7
LBB0_4:                                 ;   in Loop: Header=BB0_7 Depth=1
	ldr	w10, [x21, x22, lsl #2]
	ldr	x8, [x19, #8]
LBB0_5:                                 ;   in Loop: Header=BB0_7 Depth=1
	str	w10, [x8, x22, lsl #2]
	ldr	w9, [x19]
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	add	x22, x22, #1
	cmp	x22, w9, sxtw
	b.ge	LBB0_13
LBB0_7:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_11 Depth 2
	lsl	x28, x22, #2
	ldr	w10, [x21, x28]
	ldr	w11, [x8, x28]
	eor	w27, w11, w10
	cbz	w27, LBB0_6
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	ldr	w9, [x19, #16]
	tbnz	w9, #31, LBB0_5
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=1
	mov	w24, #-1
	b	LBB0_11
LBB0_10:                                ;   in Loop: Header=BB0_11 Depth=2
	cmp	w24, w9
	b.ge	LBB0_4
LBB0_11:                                ;   Parent Loop BB0_7 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	add	w24, w24, #1
	lsl	w23, w26, w24
	tst	w23, w27
	b.eq	LBB0_10
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=2
	ldr	w0, [x19, #32]
	ldr	w8, [x21, x28]
	tst	w8, w23
Lloh8:
	adrp	x8, l_.str.1@PAGE
Lloh9:
	add	x8, x8, l_.str.1@PAGEOFF
Lloh10:
	adrp	x9, l_.str.2@PAGE
Lloh11:
	add	x9, x9, l_.str.2@PAGEOFF
	csel	x4, x9, x8, eq
Lloh12:
	adrp	x1, l_.str@PAGE
Lloh13:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x22
	mov	x3, x24
	bl	_dev_dbg
Lloh14:
	adrp	x8, _TWL4030_ROW_SHIFT@GOTPAGE
Lloh15:
	ldr	x8, [x8, _TWL4030_ROW_SHIFT@GOTPAGEOFF]
Lloh16:
	ldr	w2, [x8]
	mov	x0, x22
	mov	x1, x24
	bl	_MATRIX_SCAN_CODE
	mov	x25, x0
Lloh17:
	adrp	x8, _EV_MSC@GOTPAGE
Lloh18:
	ldr	x8, [x8, _EV_MSC@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
Lloh20:
	adrp	x8, _MSC_SCAN@GOTPAGE
Lloh21:
	ldr	x8, [x8, _MSC_SCAN@GOTPAGEOFF]
Lloh22:
	ldr	w2, [x8]
	mov	x0, x20
	mov	x3, x25
	bl	_input_event
	ldr	x8, [x19, #24]
	ldr	w1, [x8, w25, sxtw #2]
	ldr	w8, [x21, x28]
	and	w2, w8, w23
	mov	x0, x20
	bl	_input_report_key
	ldr	w9, [x19, #16]
	b	LBB0_10
LBB0_13:
	mov	x0, x20
	bl	_input_sync
LBB0_14:
	ldur	x8, [x29, #-88]
Lloh23:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh24:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh25:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_18
; %bb.15:
	sub	sp, x29, #80
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_16:
	mov	x0, x19
	mov	x1, x21
	bl	_twl4030_read_kp_matrix_state
	tbnz	w0, #31, LBB0_14
; %bb.17:
	mov	x0, x19
	mov	x1, x21
	bl	_twl4030_is_in_ghost_state
	cbnz	x0, LBB0_14
	b	LBB0_2
LBB0_18:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_TWL4030_MAX_ROWS,4,2           ; @TWL4030_MAX_ROWS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"key [%d:%d] %s\n"

l_.str.1:                               ; @.str.1
	.asciz	"press"

l_.str.2:                               ; @.str.2
	.asciz	"release"

	.comm	_TWL4030_ROW_SHIFT,4,2          ; @TWL4030_ROW_SHIFT
	.comm	_EV_MSC,4,2                     ; @EV_MSC
	.comm	_MSC_SCAN,4,2                   ; @MSC_SCAN
	.no_dead_strip	_twl4030_kp_scan
.subsections_via_symbols
