	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function handle_joy_event
_handle_joy_event:                      ## @handle_joy_event
	.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	%rcx, %r14
	movq	%rdx, %r15
	movq	%rsi, %rbx
	movq	%rdi, %r12
	movl	(%rsi), %ecx
	leal	-128(%rcx), %eax
	cmpl	$2, %eax
	jae	LBB0_1
## %bb.19:
	movl	24(%rbx), %ecx
	movl	$-2, %eax
	cmpl	12(%r12), %ecx
	jne	LBB0_26
## %bb.20:
	movq	_SDLK_WORLD_0@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	addl	16(%rbx), %r13d
	movl	8(%rbx), %eax
	movq	_SDL_PRESSED@GOTPCREL(%rip), %rcx
	xorl	%ebx, %ebx
	cmpl	(%rcx), %eax
	sete	%bl
LBB0_21:
	movl	8(%r12), %edi
	movl	%r13d, %esi
	movl	%ebx, %edx
	callq	_update_keystate
	movl	$1, %eax
	testq	%r15, %r15
	je	LBB0_24
LBB0_23:
	movl	%r13d, (%r15)
LBB0_24:
	testq	%r14, %r14
	je	LBB0_26
## %bb.25:
	movl	%ebx, (%r14)
	jmp	LBB0_26
LBB0_1:
	movl	$-1, %eax
	cmpl	$130, %ecx
	jne	LBB0_26
## %bb.2:
	movl	40(%rbx), %ecx
	movl	$-2, %eax
	cmpl	12(%r12), %ecx
	jne	LBB0_26
## %bb.3:
	movslq	32(%rbx), %rax
	cmpq	$1, %rax
	jle	LBB0_5
## %bb.4:
	xorl	%eax, %eax
	movl	$-1, %r13d
	xorl	%ebx, %ebx
	testq	%r15, %r15
	jne	LBB0_23
	jmp	LBB0_24
LBB0_26:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movl	36(%rbx), %edx
	leal	16384(%rdx), %ecx
	cmpl	$32768, %ecx                    ## imm = 0x8000
	ja	LBB0_7
## %bb.6:
	movq	(%r12), %rcx
	movl	(%rcx,%rax,4), %r13d
	movl	$0, (%rcx,%rax,4)
	xorl	%ebx, %ebx
	jmp	LBB0_21
LBB0_7:
	movq	(%r12), %rcx
	movl	(%rcx,%rax,4), %esi
	cmpl	$-16385, %edx                   ## imm = 0xBFFF
	jg	LBB0_14
## %bb.8:
	movl	%eax, %edx
	testl	%esi, %esi
	je	LBB0_10
## %bb.9:
	movl	8(%r12), %edi
	xorl	%edx, %edx
	callq	_update_keystate
	movl	32(%rbx), %edx
	movq	(%r12), %rcx
	movslq	%edx, %rax
LBB0_10:
	testl	%edx, %edx
	jne	LBB0_11
## %bb.12:
	movq	_SDLK_LEFT@GOTPCREL(%rip), %rdx
	jmp	LBB0_13
LBB0_14:
	movl	%eax, %edx
	testl	%esi, %esi
	je	LBB0_16
## %bb.15:
	movl	8(%r12), %edi
	xorl	%edx, %edx
	callq	_update_keystate
	movl	32(%rbx), %edx
	movq	(%r12), %rcx
	movslq	%edx, %rax
LBB0_16:
	testl	%edx, %edx
	jne	LBB0_17
## %bb.18:
	movq	_SDLK_RIGHT@GOTPCREL(%rip), %rdx
	jmp	LBB0_13
LBB0_11:
	movq	_SDLK_UP@GOTPCREL(%rip), %rdx
	jmp	LBB0_13
LBB0_17:
	movq	_SDLK_DOWN@GOTPCREL(%rip), %rdx
LBB0_13:
	movl	(%rdx), %r13d
	movl	%r13d, (%rcx,%rax,4)
	movl	$1, %ebx
	jmp	LBB0_21
	.cfi_endproc
                                        ## -- End function
	.comm	_SDLK_UP,4,2                    ## @SDLK_UP
	.comm	_SDLK_LEFT,4,2                  ## @SDLK_LEFT
	.comm	_SDLK_DOWN,4,2                  ## @SDLK_DOWN
	.comm	_SDLK_RIGHT,4,2                 ## @SDLK_RIGHT
	.comm	_SDLK_WORLD_0,4,2               ## @SDLK_WORLD_0
	.comm	_SDL_PRESSED,4,2                ## @SDL_PRESSED
	.no_dead_strip	_handle_joy_event
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function handle_joy_event
_handle_joy_event:                      ; @handle_joy_event
	.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, x3
	mov	x20, x2
	mov	x22, x1
	mov	x21, x0
	ldr	w8, [x1]
	sub	w9, w8, #128
	cmp	w9, #2
	b.hs	LBB0_7
; %bb.1:
	ldr	w8, [x22, #24]
	ldr	w9, [x21, #12]
	cmp	w8, w9
	b.ne	LBB0_11
; %bb.2:
	ldr	w8, [x22, #16]
Lloh0:
	adrp	x9, _SDLK_WORLD_0@GOTPAGE
Lloh1:
	ldr	x9, [x9, _SDLK_WORLD_0@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	add	w23, w9, w8
	ldr	w8, [x22, #8]
Lloh3:
	adrp	x9, _SDL_PRESSED@GOTPAGE
Lloh4:
	ldr	x9, [x9, _SDL_PRESSED@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	cmp	w8, w9
	cset	w22, eq
LBB0_3:
	ldr	w0, [x21, #8]
	mov	x1, x23
	mov	x2, x22
	bl	_update_keystate
	mov	w0, #1
	cbz	x20, LBB0_5
LBB0_4:
	str	w23, [x20]
LBB0_5:
	cbz	x19, LBB0_13
; %bb.6:
	str	w22, [x19]
	b	LBB0_13
LBB0_7:
	cmp	w8, #130
	b.ne	LBB0_12
; %bb.8:
	ldr	w8, [x22, #40]
	ldr	w9, [x21, #12]
	cmp	w8, w9
	b.ne	LBB0_11
; %bb.9:
	ldr	w10, [x22, #32]
	cmp	w10, #1
	b.le	LBB0_14
; %bb.10:
	mov	w0, #0
	mov	w22, #0
	mov	w23, #-1
	cbnz	x20, LBB0_4
	b	LBB0_5
LBB0_11:
	mov	w0, #-2
	b	LBB0_13
LBB0_12:
	mov	w0, #-1
LBB0_13:
	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_14:
	sxtw	x8, w10
	ldr	w11, [x22, #36]
	add	w9, w11, #4, lsl #12            ; =16384
	cmp	w9, #8, lsl #12                 ; =32768
	b.hi	LBB0_16
; %bb.15:
	mov	w22, #0
	ldr	x9, [x21]
	lsl	x8, x8, #2
	ldr	w23, [x9, x8]
	str	wzr, [x9, x8]
	b	LBB0_3
LBB0_16:
	ldr	x9, [x21]
	ldr	w1, [x9, x8, lsl #2]
	mov	w12, #-16385
	cmp	w11, w12
	b.gt	LBB0_20
; %bb.17:
	cbz	w1, LBB0_19
; %bb.18:
	ldr	w0, [x21, #8]
	mov	w2, #0
	bl	_update_keystate
	ldr	w10, [x22, #32]
	ldr	x9, [x21]
	sxtw	x8, w10
                                        ; kill: def $w10 killed $w10 killed $x10 def $x10
LBB0_19:
Lloh6:
	adrp	x11, _SDLK_UP@GOTPAGE
Lloh7:
	ldr	x11, [x11, _SDLK_UP@GOTPAGEOFF]
Lloh8:
	adrp	x12, _SDLK_LEFT@GOTPAGE
Lloh9:
	ldr	x12, [x12, _SDLK_LEFT@GOTPAGEOFF]
	b	LBB0_23
LBB0_20:
	cbz	w1, LBB0_22
; %bb.21:
	ldr	w0, [x21, #8]
	mov	w2, #0
	bl	_update_keystate
	ldr	w10, [x22, #32]
	ldr	x9, [x21]
	sxtw	x8, w10
                                        ; kill: def $w10 killed $w10 killed $x10 def $x10
LBB0_22:
Lloh10:
	adrp	x11, _SDLK_DOWN@GOTPAGE
Lloh11:
	ldr	x11, [x11, _SDLK_DOWN@GOTPAGEOFF]
Lloh12:
	adrp	x12, _SDLK_RIGHT@GOTPAGE
Lloh13:
	ldr	x12, [x12, _SDLK_RIGHT@GOTPAGEOFF]
LBB0_23:
	cmp	w10, #0
	csel	x10, x12, x11, eq
	ldr	w23, [x10]
	str	w23, [x9, x8, lsl #2]
	mov	w22, #1
	b	LBB0_3
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_SDLK_UP,4,2                    ; @SDLK_UP
	.comm	_SDLK_LEFT,4,2                  ; @SDLK_LEFT
	.comm	_SDLK_DOWN,4,2                  ; @SDLK_DOWN
	.comm	_SDLK_RIGHT,4,2                 ; @SDLK_RIGHT
	.comm	_SDLK_WORLD_0,4,2               ; @SDLK_WORLD_0
	.comm	_SDL_PRESSED,4,2                ; @SDL_PRESSED
	.no_dead_strip	_handle_joy_event
.subsections_via_symbols
