	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function encoder_update
_encoder_update:                        ## @encoder_update
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
                                        ## kill: def $esi killed $esi def $rsi
	movq	%rdi, %rbx
	movq	_encoder_LUT@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	andl	$15, %esi
	movq	_encoder_pulses@GOTPCREL(%rip), %r14
	movq	(%r14), %rcx
	movl	(%rcx,%rdi,4), %eax
	addl	(%rdx,%rsi,8), %eax
	movl	%eax, (%rcx,%rdi,4)
	movq	_ENCODER_RESOLUTION@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	cmpl	%esi, %eax
	jl	LBB0_2
## %bb.1:
	movq	_encoder_value@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	incl	(%rax,%rbx,4)
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_encoder_update_kb
	movq	(%r14), %rcx
	movl	(%rcx,%rbx,4), %eax
	movl	(%r15), %esi
LBB0_2:
	movl	%esi, %edx
	negl	%edx
	cmpl	%edx, %eax
	jg	LBB0_4
## %bb.3:
	movq	_encoder_value@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	decl	(%rax,%rbx,4)
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_encoder_update_kb
	movl	(%r15), %esi
	movq	(%r14), %rcx
	movl	(%rcx,%rbx,4), %eax
LBB0_4:
	cltd
	idivl	%esi
	movl	%edx, (%rcx,%rbx,4)
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_encoder_LUT,8,3                ## @encoder_LUT
	.comm	_encoder_pulses,8,3             ## @encoder_pulses
	.comm	_ENCODER_RESOLUTION,4,2         ## @ENCODER_RESOLUTION
	.comm	_encoder_value,8,3              ## @encoder_value
	.no_dead_strip	_encoder_update
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function encoder_update
_encoder_update:                        ; @encoder_update
	.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
	mov	x19, x0
Lloh0:
	adrp	x8, _encoder_LUT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _encoder_LUT@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	and	w9, w1, #0xf
	ldr	x9, [x8, w9, uxtw #3]
Lloh3:
	adrp	x20, _encoder_pulses@GOTPAGE
Lloh4:
	ldr	x20, [x20, _encoder_pulses@GOTPAGEOFF]
	ldr	x8, [x20]
	lsl	x21, x0, #2
	ldr	w10, [x8, x21]
	add	w9, w10, w9
	str	w9, [x8, x21]
Lloh5:
	adrp	x22, _ENCODER_RESOLUTION@GOTPAGE
Lloh6:
	ldr	x22, [x22, _ENCODER_RESOLUTION@GOTPAGEOFF]
	ldr	w10, [x22]
	cmp	w9, w10
Lloh7:
	adrp	x23, _encoder_value@GOTPAGE
Lloh8:
	ldr	x23, [x23, _encoder_value@GOTPAGEOFF]
	b.lt	LBB0_2
; %bb.1:
	ldr	x8, [x23]
	ldr	w9, [x8, x21]
	add	w9, w9, #1
	str	w9, [x8, x21]
	mov	x0, x19
	mov	w1, #1
	bl	_encoder_update_kb
	ldr	x8, [x20]
	ldr	w9, [x8, x21]
	ldr	w10, [x22]
LBB0_2:
	neg	w11, w10
	cmp	w9, w11
	b.gt	LBB0_4
; %bb.3:
	ldr	x8, [x23]
	ldr	w9, [x8, x21]
	sub	w9, w9, #1
	str	w9, [x8, x21]
	mov	x0, x19
	mov	w1, #0
	bl	_encoder_update_kb
	ldr	w10, [x22]
	ldr	x8, [x20]
	ldr	w9, [x8, x21]
LBB0_4:
	sdiv	w11, w9, w10
	msub	w9, w11, w10, w9
	str	w9, [x8, x19, lsl #2]
	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
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_encoder_LUT,8,3                ; @encoder_LUT
	.comm	_encoder_pulses,8,3             ; @encoder_pulses
	.comm	_ENCODER_RESOLUTION,4,2         ; @ENCODER_RESOLUTION
	.comm	_encoder_value,8,3              ; @encoder_value
	.no_dead_strip	_encoder_update
.subsections_via_symbols
