	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_USBKeyboard_Scan               ## -- Begin function USBKeyboard_Scan
	.p2align	4, 0x90
_USBKeyboard_Scan:                      ## @USBKeyboard_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	__kbd@GOTPCREL(%rip), %r12
	cmpq	$0, (%r12)
	je	LBB0_1
## %bb.2:
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	__get_input_report
	testq	%rax, %rax
	js	LBB0_3
## %bb.4:
	movq	(%r12), %rax
	movq	(%rax), %rcx
	movl	(%rcx), %ecx
	movq	_KEY_ERROR@GOTPCREL(%rip), %rdx
	cmpl	(%rdx), %ecx
	je	LBB0_30
## %bb.5:
	movl	24(%rax), %ecx
	cmpl	%ecx, 8(%rax)
	je	LBB0_14
## %bb.6:
	movq	_MODMAPSIZE@GOTPCREL(%rip), %r15
	cmpl	$0, (%r15)
	jle	LBB0_14
## %bb.7:
	movl	$1, %ebx
	movq	__ukbd_mod_map@GOTPCREL(%rip), %r13
	movq	_USBKEYBOARD_RELEASED@GOTPCREL(%rip), %r14
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r13), %rdx
	movq	-8(%rdx,%rbx,8), %rdx
	movl	(%rdx), %esi
	movl	8(%rax), %eax
	testl	%ecx, %esi
	je	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	movq	%r14, %rcx
	testl	%esi, %eax
	jne	LBB0_12
LBB0_11:                                ##   in Loop: Header=BB0_8 Depth=1
	movl	(%rcx), %edi
	movl	4(%rdx), %esi
	callq	__submit
LBB0_12:                                ##   in Loop: Header=BB0_8 Depth=1
	movslq	(%r15), %rax
	cmpq	%rax, %rbx
	jge	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	(%r12), %rax
	movl	24(%rax), %ecx
	incq	%rbx
	jmp	LBB0_8
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_8 Depth=1
	movq	_USBKEYBOARD_PRESSED@GOTPCREL(%rip), %rcx
	testl	%esi, %eax
	jne	LBB0_11
	jmp	LBB0_12
LBB0_1:
	movl	$-1, %ebx
	jmp	LBB0_30
LBB0_3:
	movl	$-2, %ebx
	jmp	LBB0_30
LBB0_14:
	movq	_MAXKEYCODE@GOTPCREL(%rip), %r15
	movl	(%r15), %ecx
	testl	%ecx, %ecx
	jle	LBB0_29
## %bb.15:
	xorl	%ebx, %ebx
	movq	_USBKEYBOARD_RELEASED@GOTPCREL(%rip), %r14
	movq	_USBKEYBOARD_PRESSED@GOTPCREL(%rip), %r13
	jmp	LBB0_16
	.p2align	4, 0x90
LBB0_27:                                ##   in Loop: Header=BB0_16 Depth=1
	movl	(%r13), %edi
	callq	__submit
LBB0_28:                                ##   in Loop: Header=BB0_16 Depth=1
	incq	%rbx
	movslq	(%r15), %rcx
	cmpq	%rcx, %rbx
	jge	LBB0_29
LBB0_16:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_20 Depth 2
                                        ##     Child Loop BB0_26 Depth 2
	movq	(%r12), %rax
	movq	16(%rax), %rdx
	movl	(%rdx,%rbx,4), %esi
	cmpl	$4, %esi
	jl	LBB0_22
## %bb.17:                              ##   in Loop: Header=BB0_16 Depth=1
	testl	%ecx, %ecx
	jle	LBB0_21
## %bb.18:                              ##   in Loop: Header=BB0_16 Depth=1
	movq	(%rax), %rdx
	movl	%ecx, %ecx
	xorl	%edi, %edi
	.p2align	4, 0x90
LBB0_20:                                ##   Parent Loop BB0_16 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	cmpl	(%rdx,%rdi,4), %esi
	je	LBB0_22
## %bb.19:                              ##   in Loop: Header=BB0_20 Depth=2
	incq	%rdi
	cmpq	%rdi, %rcx
	jne	LBB0_20
LBB0_21:                                ##   in Loop: Header=BB0_16 Depth=1
	movl	(%r14), %edi
	callq	__submit
	movq	(%r12), %rax
LBB0_22:                                ##   in Loop: Header=BB0_16 Depth=1
	movq	(%rax), %rcx
	movl	(%rcx,%rbx,4), %esi
	cmpl	$4, %esi
	jl	LBB0_28
## %bb.23:                              ##   in Loop: Header=BB0_16 Depth=1
	movl	(%r15), %ecx
	testl	%ecx, %ecx
	jle	LBB0_27
## %bb.24:                              ##   in Loop: Header=BB0_16 Depth=1
	movq	16(%rax), %rax
	xorl	%edx, %edx
	.p2align	4, 0x90
LBB0_26:                                ##   Parent Loop BB0_16 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	cmpl	(%rax,%rdx,4), %esi
	je	LBB0_28
## %bb.25:                              ##   in Loop: Header=BB0_26 Depth=2
	incq	%rdx
	cmpq	%rdx, %rcx
	jne	LBB0_26
	jmp	LBB0_27
LBB0_29:
	movq	(%r12), %rax
	movups	(%rax), %xmm0
	movups	%xmm0, 16(%rax)
	xorl	%ebx, %ebx
LBB0_30:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	__kbd,8,3                       ## @_kbd
	.comm	_KEY_ERROR,4,2                  ## @KEY_ERROR
	.comm	_MODMAPSIZE,4,2                 ## @MODMAPSIZE
	.comm	__ukbd_mod_map,8,3              ## @_ukbd_mod_map
	.comm	_USBKEYBOARD_RELEASED,4,2       ## @USBKEYBOARD_RELEASED
	.comm	_USBKEYBOARD_PRESSED,4,2        ## @USBKEYBOARD_PRESSED
	.comm	_MAXKEYCODE,4,2                 ## @MAXKEYCODE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_USBKeyboard_Scan               ; -- Begin function USBKeyboard_Scan
	.p2align	2
_USBKeyboard_Scan:                      ; @USBKeyboard_Scan
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
Lloh0:
	adrp	x19, __kbd@GOTPAGE
Lloh1:
	ldr	x19, [x19, __kbd@GOTPAGEOFF]
	ldr	x8, [x19]
	cbz	x8, LBB0_4
; %bb.1:
	bl	__get_input_report
	tbnz	x0, #63, LBB0_5
; %bb.2:
	ldr	x8, [x19]
	ldr	x9, [x8]
	ldr	w9, [x9]
Lloh2:
	adrp	x10, _KEY_ERROR@GOTPAGE
Lloh3:
	ldr	x10, [x10, _KEY_ERROR@GOTPAGEOFF]
Lloh4:
	ldr	w10, [x10]
	cmp	w9, w10
	b.ne	LBB0_6
; %bb.3:
	mov	w0, #0
	b	LBB0_23
LBB0_4:
	mov	w0, #-1
	b	LBB0_23
LBB0_5:
	mov	w0, #-2
	b	LBB0_23
LBB0_6:
	ldr	w10, [x8, #8]
	ldr	w9, [x8, #24]
Lloh5:
	adrp	x20, _MODMAPSIZE@GOTPAGE
Lloh6:
	ldr	x20, [x20, _MODMAPSIZE@GOTPAGEOFF]
	ldr	w11, [x20]
	cmp	w10, w9
	ccmp	w11, #1, #8, ne
	b.ge	LBB0_24
LBB0_7:
Lloh7:
	adrp	x20, _MAXKEYCODE@GOTPAGE
Lloh8:
	ldr	x20, [x20, _MAXKEYCODE@GOTPAGEOFF]
	ldr	w9, [x20]
	cmp	w9, #1
	b.lt	LBB0_22
; %bb.8:
	mov	x21, #0
Lloh9:
	adrp	x22, _USBKEYBOARD_RELEASED@GOTPAGE
Lloh10:
	ldr	x22, [x22, _USBKEYBOARD_RELEASED@GOTPAGEOFF]
Lloh11:
	adrp	x23, _USBKEYBOARD_PRESSED@GOTPAGE
Lloh12:
	ldr	x23, [x23, _USBKEYBOARD_PRESSED@GOTPAGEOFF]
	b	LBB0_11
LBB0_9:                                 ;   in Loop: Header=BB0_11 Depth=1
	ldr	w0, [x23]
	bl	__submit
LBB0_10:                                ;   in Loop: Header=BB0_11 Depth=1
	add	x21, x21, #1
	ldrsw	x9, [x20]
	cmp	x21, x9
	b.ge	LBB0_22
LBB0_11:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_14 Depth 2
                                        ;     Child Loop BB0_20 Depth 2
	ldr	x8, [x19]
	ldr	x10, [x8, #16]
	ldr	w1, [x10, x21, lsl #2]
	cmp	w1, #4
	b.lt	LBB0_17
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	cmp	w9, #1
	b.lt	LBB0_16
; %bb.13:                               ;   in Loop: Header=BB0_11 Depth=1
	ldr	x10, [x8]
	mov	w9, w9
LBB0_14:                                ;   Parent Loop BB0_11 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w11, [x10]
	cmp	w1, w11
	b.eq	LBB0_17
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=2
	add	x10, x10, #4
	subs	x9, x9, #1
	b.ne	LBB0_14
LBB0_16:                                ;   in Loop: Header=BB0_11 Depth=1
	ldr	w0, [x22]
	bl	__submit
	ldr	x8, [x19]
LBB0_17:                                ;   in Loop: Header=BB0_11 Depth=1
	ldr	x9, [x8]
	ldr	w1, [x9, x21, lsl #2]
	cmp	w1, #4
	b.lt	LBB0_10
; %bb.18:                               ;   in Loop: Header=BB0_11 Depth=1
	ldr	w9, [x20]
	cmp	w9, #1
	b.lt	LBB0_9
; %bb.19:                               ;   in Loop: Header=BB0_11 Depth=1
	ldr	x8, [x8, #16]
LBB0_20:                                ;   Parent Loop BB0_11 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w10, [x8]
	cmp	w1, w10
	b.eq	LBB0_10
; %bb.21:                               ;   in Loop: Header=BB0_20 Depth=2
	add	x8, x8, #4
	subs	x9, x9, #1
	b.ne	LBB0_20
	b	LBB0_9
LBB0_22:
	mov	w0, #0
	ldr	x8, [x19]
	ldr	q0, [x8]
	str	q0, [x8, #16]
LBB0_23:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_24:
	mov	x21, #0
Lloh13:
	adrp	x22, __ukbd_mod_map@GOTPAGE
Lloh14:
	ldr	x22, [x22, __ukbd_mod_map@GOTPAGEOFF]
Lloh15:
	adrp	x23, _USBKEYBOARD_PRESSED@GOTPAGE
Lloh16:
	ldr	x23, [x23, _USBKEYBOARD_PRESSED@GOTPAGEOFF]
Lloh17:
	adrp	x24, _USBKEYBOARD_RELEASED@GOTPAGE
Lloh18:
	ldr	x24, [x24, _USBKEYBOARD_RELEASED@GOTPAGEOFF]
LBB0_25:                                ; =>This Inner Loop Header: Depth=1
	ldr	x10, [x22]
	ldr	x10, [x10, x21, lsl #3]
	ldr	w12, [x10]
	ldr	w8, [x8, #8]
	and	w11, w8, w12
	tst	w12, w9
	b.eq	LBB0_28
; %bb.26:                               ;   in Loop: Header=BB0_25 Depth=1
	cbnz	w11, LBB0_30
; %bb.27:                               ;   in Loop: Header=BB0_25 Depth=1
	mov	x8, x24
	b	LBB0_29
LBB0_28:                                ;   in Loop: Header=BB0_25 Depth=1
	mov	x8, x23
	cbz	w11, LBB0_30
LBB0_29:                                ;   in Loop: Header=BB0_25 Depth=1
	ldr	w0, [x8]
	ldr	w1, [x10, #4]
	bl	__submit
LBB0_30:                                ;   in Loop: Header=BB0_25 Depth=1
	add	x21, x21, #1
	ldrsw	x8, [x20]
	cmp	x21, x8
	b.ge	LBB0_7
; %bb.31:                               ;   in Loop: Header=BB0_25 Depth=1
	ldr	x8, [x19]
	ldr	w9, [x8, #24]
	b	LBB0_25
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	__kbd,8,3                       ; @_kbd
	.comm	_KEY_ERROR,4,2                  ; @KEY_ERROR
	.comm	_MODMAPSIZE,4,2                 ; @MODMAPSIZE
	.comm	__ukbd_mod_map,8,3              ; @_ukbd_mod_map
	.comm	_USBKEYBOARD_RELEASED,4,2       ; @USBKEYBOARD_RELEASED
	.comm	_USBKEYBOARD_PRESSED,4,2        ; @USBKEYBOARD_PRESSED
	.comm	_MAXKEYCODE,4,2                 ; @MAXKEYCODE
.subsections_via_symbols
