	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_joy_read_hat                   ## -- Begin function joy_read_hat
	.p2align	4, 0x90
_joy_read_hat:                          ## @joy_read_hat
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movl	$-1, %eax
	cmpl	%esi, (%rdi)
	jle	LBB0_14
## %bb.1:
	movq	%rdi, %rbx
	movslq	%esi, %r14
	leaq	(,%r14,8), %rsi
	addq	8(%rdi), %rsi
	callq	_joy_read_element
                                        ## kill: def $eax killed $eax def $rax
	movq	8(%rbx), %rcx
	movl	(%rcx,%r14,8), %edx
	movl	4(%rcx,%r14,8), %ecx
	subl	%edx, %eax
	subl	%edx, %ecx
	cmpl	$3, %ecx
	sete	%cl
	shll	%cl, %eax
	cmpl	$7, %eax
	ja	LBB0_12
## %bb.2:
	leaq	LJTI0_0(%rip), %rcx
	movslq	(%rcx,%rax,4), %rax
	addq	%rcx, %rax
	jmpq	*%rax
LBB0_3:
	movq	_JOY_HAT_UP@GOTPCREL(%rip), %rax
	jmp	LBB0_13
LBB0_12:
	movq	_JOY_HAT_CENTER@GOTPCREL(%rip), %rax
	jmp	LBB0_13
LBB0_4:
	movq	_JOY_HAT_UP@GOTPCREL(%rip), %rcx
	movq	_JOY_HAT_RIGHT@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_6:
	movq	_JOY_HAT_RIGHT@GOTPCREL(%rip), %rax
	jmp	LBB0_13
LBB0_7:
	movq	_JOY_HAT_RIGHT@GOTPCREL(%rip), %rcx
	movq	_JOY_HAT_DOWN@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_8:
	movq	_JOY_HAT_DOWN@GOTPCREL(%rip), %rax
	jmp	LBB0_13
LBB0_9:
	movq	_JOY_HAT_DOWN@GOTPCREL(%rip), %rcx
	movq	_JOY_HAT_LEFT@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_10:
	movq	_JOY_HAT_LEFT@GOTPCREL(%rip), %rax
LBB0_13:
	movl	(%rax), %eax
	jmp	LBB0_14
LBB0_11:
	movq	_JOY_HAT_LEFT@GOTPCREL(%rip), %rcx
	movq	_JOY_HAT_UP@GOTPCREL(%rip), %rax
LBB0_5:
	movl	(%rax), %eax
	orl	(%rcx), %eax
LBB0_14:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
	.p2align	2, 0x90
	.data_region jt32
.set L0_0_set_3, LBB0_3-LJTI0_0
.set L0_0_set_4, LBB0_4-LJTI0_0
.set L0_0_set_6, LBB0_6-LJTI0_0
.set L0_0_set_7, LBB0_7-LJTI0_0
.set L0_0_set_8, LBB0_8-LJTI0_0
.set L0_0_set_9, LBB0_9-LJTI0_0
.set L0_0_set_10, LBB0_10-LJTI0_0
.set L0_0_set_11, LBB0_11-LJTI0_0
LJTI0_0:
	.long	L0_0_set_3
	.long	L0_0_set_4
	.long	L0_0_set_6
	.long	L0_0_set_7
	.long	L0_0_set_8
	.long	L0_0_set_9
	.long	L0_0_set_10
	.long	L0_0_set_11
	.end_data_region
                                        ## -- End function
	.comm	_JOY_HAT_UP,4,2                 ## @JOY_HAT_UP
	.comm	_JOY_HAT_RIGHT,4,2              ## @JOY_HAT_RIGHT
	.comm	_JOY_HAT_DOWN,4,2               ## @JOY_HAT_DOWN
	.comm	_JOY_HAT_LEFT,4,2               ## @JOY_HAT_LEFT
	.comm	_JOY_HAT_CENTER,4,2             ## @JOY_HAT_CENTER
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_joy_read_hat                   ; -- Begin function joy_read_hat
	.p2align	2
_joy_read_hat:                          ; @joy_read_hat
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
                                        ; kill: def $w1 killed $w1 def $x1
	ldr	w8, [x0]
	cmp	w8, w1
	b.le	LBB0_4
; %bb.1:
	mov	x19, x0
	ldr	x8, [x0, #8]
	sbfiz	x20, x1, #3, #32
	add	x1, x8, x20
	bl	_joy_read_element
	ldr	x8, [x19, #8]
	add	x8, x8, x20
	ldp	w9, w8, [x8]
	sub	w10, w0, w9
	sub	w8, w8, w9
	cmp	w8, #3
	cset	w8, eq
	lsl	w8, w10, w8
	cmp	w8, #7
	b.hi	LBB0_5
; %bb.2:
Lloh0:
	adrp	x9, lJTI0_0@PAGE
Lloh1:
	add	x9, x9, lJTI0_0@PAGEOFF
	adr	x10, LBB0_3
	ldrb	w11, [x9, x8]
	add	x10, x10, x11, lsl #2
	br	x10
LBB0_3:
Lloh2:
	adrp	x8, _JOY_HAT_UP@GOTPAGE
Lloh3:
	ldr	x8, [x8, _JOY_HAT_UP@GOTPAGEOFF]
	b	LBB0_12
LBB0_4:
	mov	w0, #-1
	b	LBB0_15
LBB0_5:
Lloh4:
	adrp	x8, _JOY_HAT_CENTER@GOTPAGE
Lloh5:
	ldr	x8, [x8, _JOY_HAT_CENTER@GOTPAGEOFF]
	b	LBB0_12
LBB0_6:
Lloh6:
	adrp	x8, _JOY_HAT_UP@GOTPAGE
Lloh7:
	ldr	x8, [x8, _JOY_HAT_UP@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
Lloh9:
	adrp	x9, _JOY_HAT_RIGHT@GOTPAGE
Lloh10:
	ldr	x9, [x9, _JOY_HAT_RIGHT@GOTPAGEOFF]
	b	LBB0_14
LBB0_7:
Lloh11:
	adrp	x8, _JOY_HAT_RIGHT@GOTPAGE
Lloh12:
	ldr	x8, [x8, _JOY_HAT_RIGHT@GOTPAGEOFF]
	b	LBB0_12
LBB0_8:
Lloh13:
	adrp	x8, _JOY_HAT_RIGHT@GOTPAGE
Lloh14:
	ldr	x8, [x8, _JOY_HAT_RIGHT@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
Lloh16:
	adrp	x9, _JOY_HAT_DOWN@GOTPAGE
Lloh17:
	ldr	x9, [x9, _JOY_HAT_DOWN@GOTPAGEOFF]
	b	LBB0_14
LBB0_9:
Lloh18:
	adrp	x8, _JOY_HAT_DOWN@GOTPAGE
Lloh19:
	ldr	x8, [x8, _JOY_HAT_DOWN@GOTPAGEOFF]
	b	LBB0_12
LBB0_10:
Lloh20:
	adrp	x8, _JOY_HAT_DOWN@GOTPAGE
Lloh21:
	ldr	x8, [x8, _JOY_HAT_DOWN@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
Lloh23:
	adrp	x9, _JOY_HAT_LEFT@GOTPAGE
Lloh24:
	ldr	x9, [x9, _JOY_HAT_LEFT@GOTPAGEOFF]
	b	LBB0_14
LBB0_11:
Lloh25:
	adrp	x8, _JOY_HAT_LEFT@GOTPAGE
Lloh26:
	ldr	x8, [x8, _JOY_HAT_LEFT@GOTPAGEOFF]
LBB0_12:
	ldr	w0, [x8]
	b	LBB0_15
LBB0_13:
Lloh27:
	adrp	x8, _JOY_HAT_LEFT@GOTPAGE
Lloh28:
	ldr	x8, [x8, _JOY_HAT_LEFT@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
Lloh30:
	adrp	x9, _JOY_HAT_UP@GOTPAGE
Lloh31:
	ldr	x9, [x9, _JOY_HAT_UP@GOTPAGEOFF]
LBB0_14:
	ldr	w9, [x9]
	orr	w0, w9, w8
LBB0_15:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.cfi_endproc
	.section	__TEXT,__const
lJTI0_0:
	.byte	(LBB0_3-LBB0_3)>>2
	.byte	(LBB0_6-LBB0_3)>>2
	.byte	(LBB0_7-LBB0_3)>>2
	.byte	(LBB0_8-LBB0_3)>>2
	.byte	(LBB0_9-LBB0_3)>>2
	.byte	(LBB0_10-LBB0_3)>>2
	.byte	(LBB0_11-LBB0_3)>>2
	.byte	(LBB0_13-LBB0_3)>>2
                                        ; -- End function
	.comm	_JOY_HAT_UP,4,2                 ; @JOY_HAT_UP
	.comm	_JOY_HAT_RIGHT,4,2              ; @JOY_HAT_RIGHT
	.comm	_JOY_HAT_DOWN,4,2               ; @JOY_HAT_DOWN
	.comm	_JOY_HAT_LEFT,4,2               ; @JOY_HAT_LEFT
	.comm	_JOY_HAT_CENTER,4,2             ; @JOY_HAT_CENTER
.subsections_via_symbols
