	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_calculate_keystroke_distance   ## -- Begin function calculate_keystroke_distance
	.p2align	4, 0x90
_calculate_keystroke_distance:          ## @calculate_keystroke_distance
	.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	_KEY_LED_COUNT@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_DISTANCE_FROM_LAST_KEYSTROKE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rdi
	leaq	4(,%rax,4), %rsi
	callq	___bzero
	movq	_KEY_STROKES_LENGTH@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	je	LBB0_10
## %bb.1:
	movq	_KEY_STROKES@GOTPCREL(%rip), %rcx
	movq	(%rcx), %r8
	xorl	%r12d, %r12d
	movq	_USER_CONFIG@GOTPCREL(%rip), %r14
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_2 Depth=1
	xorl	%r9d, %r9d
LBB0_8:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	%r9d, (%r8,%r15,8)
	movq	_KEY_STROKES_LENGTH@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
LBB0_9:                                 ##   in Loop: Header=BB0_2 Depth=1
	incq	%r12
	cmpq	%rax, %r12
	jae	LBB0_10
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_12 Depth 2
	leaq	(%r12,%r12,2), %r15
	cmpl	$0, (%r8,%r15,8)
	je	LBB0_9
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	16(%r8,%r15,8), %edi
	callq	_timer_elapsed32
	movq	_KEY_STROKES@GOTPCREL(%rip), %rcx
	movq	(%rcx), %r8
	movq	(%r14), %rcx
	movq	%rax, %rdx
	orq	%rcx, %rdx
	shrq	$32, %rdx
	je	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	xorl	%edx, %edx
	divq	%rcx
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $eax killed $eax def $rax
LBB0_6:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	_KEY_LED_COUNT@GOTPCREL(%rip), %rcx
	movq	(%rcx), %r11
	testq	%r11, %r11
	je	LBB0_7
## %bb.11:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	8(%r8,%r15,8), %rcx
	movq	_DISTANCE_MAP@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movq	(%rdx,%rcx,8), %rsi
	movq	8(%r14), %rdi
	movq	_DISTANCE_FROM_LAST_KEYSTROKE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %r10
	xorl	%ebx, %ebx
	xorl	%r9d, %r9d
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_16:                                ##   in Loop: Header=BB0_12 Depth=2
	movl	%edx, 4(%r10,%rbx,4)
LBB0_17:                                ##   in Loop: Header=BB0_12 Depth=2
	incq	%rbx
	cmpq	%rbx, %r11
	je	LBB0_8
LBB0_12:                                ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	8(%rsi,%rbx,8), %rdx
	movq	%rax, %rcx
	subq	%rdx, %rcx
	cmpq	%rdi, %rcx
	jae	LBB0_17
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=2
	cmpq	16(%r14), %rdx
	jg	LBB0_17
## %bb.14:                              ##   in Loop: Header=BB0_12 Depth=2
	movl	24(%r14), %r13d
	addl	$-3, %r13d
	movl	$1, %r9d
	movl	$1, %edx
	cmpl	$3, %r13d
	ja	LBB0_16
## %bb.15:                              ##   in Loop: Header=BB0_12 Depth=2
	addl	4(%r10,%rbx,4), %ecx
	movl	%ecx, %edx
	jmp	LBB0_16
LBB0_10:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_KEY_LED_COUNT,8,3              ## @KEY_LED_COUNT
	.comm	_DISTANCE_FROM_LAST_KEYSTROKE,8,3 ## @DISTANCE_FROM_LAST_KEYSTROKE
	.comm	_KEY_STROKES_LENGTH,8,3         ## @KEY_STROKES_LENGTH
	.comm	_KEY_STROKES,8,3                ## @KEY_STROKES
	.comm	_USER_CONFIG,32,3               ## @USER_CONFIG
	.comm	_DISTANCE_MAP,8,3               ## @DISTANCE_MAP
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_calculate_keystroke_distance   ; -- Begin function calculate_keystroke_distance
	.p2align	2
_calculate_keystroke_distance:          ; @calculate_keystroke_distance
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
Lloh0:
	adrp	x19, _KEY_LED_COUNT@GOTPAGE
Lloh1:
	ldr	x19, [x19, _KEY_LED_COUNT@GOTPAGEOFF]
	ldr	x8, [x19]
Lloh2:
	adrp	x20, _DISTANCE_FROM_LAST_KEYSTROKE@GOTPAGE
Lloh3:
	ldr	x20, [x20, _DISTANCE_FROM_LAST_KEYSTROKE@GOTPAGEOFF]
	ldr	x0, [x20]
	lsl	x8, x8, #2
	add	x1, x8, #4
	bl	_bzero
Lloh4:
	adrp	x21, _KEY_STROKES_LENGTH@GOTPAGE
Lloh5:
	ldr	x21, [x21, _KEY_STROKES_LENGTH@GOTPAGEOFF]
	ldr	x9, [x21]
	cbz	x9, LBB0_14
; %bb.1:
	mov	x22, #0
Lloh6:
	adrp	x23, _KEY_STROKES@GOTPAGE
Lloh7:
	ldr	x23, [x23, _KEY_STROKES@GOTPAGEOFF]
	ldr	x8, [x23]
	mov	w24, #24
Lloh8:
	adrp	x25, _USER_CONFIG@GOTPAGE
Lloh9:
	ldr	x25, [x25, _USER_CONFIG@GOTPAGEOFF]
Lloh10:
	adrp	x26, _DISTANCE_MAP@GOTPAGE
Lloh11:
	ldr	x26, [x26, _DISTANCE_MAP@GOTPAGEOFF]
	b	LBB0_5
LBB0_2:                                 ;   in Loop: Header=BB0_5 Depth=1
	mov	w14, #0
LBB0_3:                                 ;   in Loop: Header=BB0_5 Depth=1
	mul	x9, x22, x24
	str	w14, [x8, x9]
	ldr	x9, [x21]
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	x22, x22, #1
	cmp	x22, x9
	b.hs	LBB0_14
LBB0_5:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_11 Depth 2
	mul	x10, x22, x24
	ldr	w10, [x8, x10]
	cbz	w10, LBB0_4
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	madd	x8, x22, x24, x8
	ldr	w0, [x8, #16]
	bl	_timer_elapsed32
	ldr	x8, [x23]
	ldr	x9, [x19]
	cbz	x9, LBB0_2
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	w14, #0
	ldp	x11, x10, [x25]
	udiv	x11, x0, x11
	madd	x12, x22, x24, x8
	ldr	x12, [x12, #8]
	ldr	x13, [x26]
	ldr	x13, [x13, x12, lsl #3]
	ldr	x12, [x20]
	add	x12, x12, #4
	add	x13, x13, #8
	b	LBB0_11
LBB0_8:                                 ;   in Loop: Header=BB0_11 Depth=2
	ldr	w14, [x12]
	add	w14, w14, w15
LBB0_9:                                 ;   in Loop: Header=BB0_11 Depth=2
	str	w14, [x12]
	mov	w14, #1
LBB0_10:                                ;   in Loop: Header=BB0_11 Depth=2
	add	x12, x12, #4
	add	x13, x13, #8
	subs	x9, x9, #1
	b.eq	LBB0_3
LBB0_11:                                ;   Parent Loop BB0_5 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x16, [x13]
	ldr	x17, [x25, #16]
	sub	x15, x11, x16
	cmp	x15, x10
	ccmp	x16, x17, #0, lo
	b.gt	LBB0_10
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=2
	ldr	w14, [x25, #24]
	sub	w14, w14, #3
	cmp	w14, #3
	b.ls	LBB0_8
; %bb.13:                               ;   in Loop: Header=BB0_11 Depth=2
	mov	w14, #1
	b	LBB0_9
LBB0_14:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_KEY_LED_COUNT,8,3              ; @KEY_LED_COUNT
	.comm	_DISTANCE_FROM_LAST_KEYSTROKE,8,3 ; @DISTANCE_FROM_LAST_KEYSTROKE
	.comm	_KEY_STROKES_LENGTH,8,3         ; @KEY_STROKES_LENGTH
	.comm	_KEY_STROKES,8,3                ; @KEY_STROKES
	.comm	_USER_CONFIG,32,3               ; @USER_CONFIG
	.comm	_DISTANCE_MAP,8,3               ; @DISTANCE_MAP
.subsections_via_symbols
