	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function corgikbd_scankeyboard
_corgikbd_scankeyboard:                 ## @corgikbd_scankeyboard
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	cmpq	$0, 32(%rdi)
	je	LBB0_1
## %bb.15:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movq	%rdi, %r15
	addq	$8, %rdi
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	callq	_spin_lock_irqsave
	movq	_KB_COLS@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_2
## %bb.3:
	xorl	%r12d, %r12d
	xorl	%r14d, %r14d
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_4 Depth=1
	movl	%r12d, %edi
	callq	_corgikbd_reset_col
	incl	%r12d
	movq	_KB_COLS@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jae	LBB0_12
LBB0_4:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_6 Depth 2
	xorl	%eax, %eax
	callq	_corgikbd_discharge_all
	movq	_KB_DISCHARGE_DELAY@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_udelay
	movl	%r12d, %edi
	callq	_corgikbd_activate_col
	movq	_KB_ACTIVATE_DELAY@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_udelay
	movl	%r12d, %edi
	callq	_GET_ROWS_STATUS
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movq	_KB_ROWS@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_11
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	xorl	%ebx, %ebx
	movl	%r12d, -48(%rbp)                ## 4-byte Spill
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_6 Depth=2
	xorl	%ecx, %ecx
	movzbl	-41(%rbp), %eax                 ## 1-byte Folded Reload
	movb	%al, %cl
	movl	-56(%rbp), %eax                 ## 4-byte Reload
	addl	%ecx, %eax
	movl	%eax, %r14d
	incl	%ebx
	movq	_KB_ROWS@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	movl	-48(%rbp), %r12d                ## 4-byte Reload
	jae	LBB0_11
LBB0_6:                                 ##   Parent Loop BB0_4 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	%r14d, -56(%rbp)                ## 4-byte Spill
	movl	%ebx, %edi
	movl	%r12d, %esi
	callq	_SCANCODE
	movl	%eax, %r14d
	movl	%ebx, %edi
	callq	_KB_ROWMASK
	movq	%r15, %r12
	movl	%eax, %r15d
	movl	16(%r12), %edi
	movq	(%r12), %rax
	movl	%r14d, %r13d
	movq	(%rax,%r13,8), %rsi
	movl	%r15d, %edx
	movl	-52(%rbp), %r14d                ## 4-byte Reload
	andl	%r14d, %edx
	setne	-41(%rbp)                       ## 1-byte Folded Spill
	callq	_input_report_key
	andl	%r14d, %r15d
	movq	%r12, %r15
	je	LBB0_10
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=2
	movq	(%r15), %rax
	movq	(%rax,%r13,8), %rax
	movq	_CORGI_KEY_OFF@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_10
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=2
	movq	_jiffies@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movq	_HZ@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	24(%r15), %rsi
	callq	_time_after
	testq	%rax, %rax
	je	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_6 Depth=2
	movl	16(%r15), %edi
	movq	_EV_PWR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_CORGI_KEY_OFF@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movl	$1, %ecx
	callq	_input_event
	movq	_jiffies@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 24(%r15)
	jmp	LBB0_10
LBB0_2:
	xorl	%r14d, %r14d
LBB0_12:
	xorl	%eax, %eax
	callq	_corgikbd_activate_all
	movl	16(%r15), %edi
	callq	_input_sync
	testl	%r14d, %r14d
	je	LBB0_14
## %bb.13:
	addq	$12, %r15
	movq	_jiffies@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	movq	_SCAN_INTERVAL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_msecs_to_jiffies
	addq	%rax, %rbx
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_mod_timer
LBB0_14:
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_spin_unlock_irqrestore         ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_KB_COLS,4,2                    ## @KB_COLS
	.comm	_KB_DISCHARGE_DELAY,4,2         ## @KB_DISCHARGE_DELAY
	.comm	_KB_ACTIVATE_DELAY,4,2          ## @KB_ACTIVATE_DELAY
	.comm	_KB_ROWS,4,2                    ## @KB_ROWS
	.comm	_CORGI_KEY_OFF,8,3              ## @CORGI_KEY_OFF
	.comm	_jiffies,8,3                    ## @jiffies
	.comm	_HZ,8,3                         ## @HZ
	.comm	_EV_PWR,4,2                     ## @EV_PWR
	.comm	_SCAN_INTERVAL,4,2              ## @SCAN_INTERVAL
	.no_dead_strip	_corgikbd_scankeyboard
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function corgikbd_scankeyboard
_corgikbd_scankeyboard:                 ; @corgikbd_scankeyboard
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	ldr	x8, [x0, #32]
	cbz	x8, LBB0_2
; %bb.1:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_2:
	mov	x20, x0
	add	x0, x0, #8
	str	x0, [sp, #8]                    ; 8-byte Folded Spill
	bl	_spin_lock_irqsave
Lloh0:
	adrp	x8, _KB_COLS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _KB_COLS@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x26, _jiffies@GOTPAGE
Lloh4:
	ldr	x26, [x26, _jiffies@GOTPAGEOFF]
	cbz	w8, LBB0_12
; %bb.3:
	mov	w21, #0
	mov	w27, #0
Lloh5:
	adrp	x19, _KB_ROWS@GOTPAGE
Lloh6:
	ldr	x19, [x19, _KB_ROWS@GOTPAGEOFF]
Lloh7:
	adrp	x28, _CORGI_KEY_OFF@GOTPAGE
Lloh8:
	ldr	x28, [x28, _CORGI_KEY_OFF@GOTPAGEOFF]
	b	LBB0_5
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x21
	bl	_corgikbd_reset_col
	add	w21, w21, #1
Lloh9:
	adrp	x8, _KB_COLS@GOTPAGE
Lloh10:
	ldr	x8, [x8, _KB_COLS@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	cmp	w21, w8
	b.hs	LBB0_13
LBB0_5:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_8 Depth 2
	bl	_corgikbd_discharge_all
Lloh12:
	adrp	x8, _KB_DISCHARGE_DELAY@GOTPAGE
Lloh13:
	ldr	x8, [x8, _KB_DISCHARGE_DELAY@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
	bl	_udelay
	mov	x0, x21
	bl	_corgikbd_activate_col
Lloh15:
	adrp	x8, _KB_ACTIVATE_DELAY@GOTPAGE
Lloh16:
	ldr	x8, [x8, _KB_ACTIVATE_DELAY@GOTPAGEOFF]
Lloh17:
	ldr	w0, [x8]
	bl	_udelay
	mov	x0, x21
	bl	_GET_ROWS_STATUS
	ldr	w8, [x19]
	cbz	w8, LBB0_4
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x22, x0
	mov	w23, #0
	b	LBB0_8
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=2
	add	w23, w23, #1
	ldr	w8, [x19]
	cmp	w23, w8
	b.hs	LBB0_4
LBB0_8:                                 ;   Parent Loop BB0_5 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	mov	x0, x23
	mov	x1, x21
	bl	_SCANCODE
	mov	x24, x0
	mov	x0, x23
	bl	_KB_ROWMASK
	ldr	w8, [x20, #16]
	ldr	x9, [x20]
	ldr	x1, [x9, w24, uxtw #3]
	ands	w25, w0, w22
	cinc	w27, w27, ne
	mov	x0, x8
	mov	x2, x25
	bl	_input_report_key
	cbz	w25, LBB0_7
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=2
	mov	w8, w24
	ldr	x9, [x20]
	ldr	x8, [x9, x8, lsl #3]
	ldr	x9, [x28]
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.10:                               ;   in Loop: Header=BB0_8 Depth=2
	ldr	x0, [x26]
	ldr	x8, [x20, #24]
Lloh18:
	adrp	x9, _HZ@GOTPAGE
Lloh19:
	ldr	x9, [x9, _HZ@GOTPAGEOFF]
Lloh20:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_time_after
	cbz	x0, LBB0_7
; %bb.11:                               ;   in Loop: Header=BB0_8 Depth=2
	ldr	w0, [x20, #16]
Lloh21:
	adrp	x8, _EV_PWR@GOTPAGE
Lloh22:
	ldr	x8, [x8, _EV_PWR@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x8]
	ldr	x2, [x28]
	mov	w3, #1
	bl	_input_event
	ldr	x8, [x26]
	str	x8, [x20, #24]
	b	LBB0_7
LBB0_12:
	mov	w27, #0
LBB0_13:
	bl	_corgikbd_activate_all
	ldr	w0, [x20, #16]
	bl	_input_sync
	cbz	w27, LBB0_15
; %bb.14:
	add	x20, x20, #12
	ldr	x19, [x26]
Lloh24:
	adrp	x8, _SCAN_INTERVAL@GOTPAGE
Lloh25:
	ldr	x8, [x8, _SCAN_INTERVAL@GOTPAGEOFF]
Lloh26:
	ldr	w0, [x8]
	bl	_msecs_to_jiffies
	add	x1, x0, x19
	mov	x0, x20
	bl	_mod_timer
LBB0_15:
	ldr	x0, [sp, #8]                    ; 8-byte Folded Reload
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	b	_spin_unlock_irqrestore
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_KB_COLS,4,2                    ; @KB_COLS
	.comm	_KB_DISCHARGE_DELAY,4,2         ; @KB_DISCHARGE_DELAY
	.comm	_KB_ACTIVATE_DELAY,4,2          ; @KB_ACTIVATE_DELAY
	.comm	_KB_ROWS,4,2                    ; @KB_ROWS
	.comm	_CORGI_KEY_OFF,8,3              ; @CORGI_KEY_OFF
	.comm	_jiffies,8,3                    ; @jiffies
	.comm	_HZ,8,3                         ; @HZ
	.comm	_EV_PWR,4,2                     ; @EV_PWR
	.comm	_SCAN_INTERVAL,4,2              ; @SCAN_INTERVAL
	.no_dead_strip	_corgikbd_scankeyboard
.subsections_via_symbols
