	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function collect_events
_collect_events:                        ## @collect_events
	.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
	subq	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, -112(%rbp)                ## 8-byte Spill
	movq	%rsi, -88(%rbp)                 ## 8-byte Spill
	movq	%rdi, %rbx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	cmpq	$0, (%rdi)
	je	LBB0_2
## %bb.1:
	movq	_JOY_EVENTS@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	jmp	LBB0_3
LBB0_2:
	movq	_SDL_ALLEVENTS@GOTPCREL(%rip), %rax
	movq	_JOY_EVENTS@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r13d
	notl	%r13d
	andl	(%rax), %r13d
LBB0_3:
	xorl	%r14d, %r14d
	cmpq	$0, -88(%rbp)                   ## 8-byte Folded Reload
	sete	%r15b
	xorl	%eax, %eax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	xorl	%eax, %eax
	callq	_SDL_PumpEvents
	movq	_SDL_PEEKEVENT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	xorl	%edi, %edi
	xorl	%esi, %esi
	movl	%r13d, %ecx
	callq	_SDL_PeepEvents
	movl	%eax, -100(%rbp)                ## 4-byte Spill
	testl	%eax, %eax
	jle	LBB0_22
## %bb.4:
	movb	%r15b, %r14b
	leal	(%r14,%r14,2), %r14d
	incl	%r14d
	xorl	%r15d, %r15d
	movq	_SDL_GETEVENT@GOTPCREL(%rip), %rcx
	leaq	-64(%rbp), %r12
	xorl	%eax, %eax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	movl	%r13d, -96(%rbp)                ## 4-byte Spill
	movl	%r14d, -92(%rbp)                ## 4-byte Spill
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_21:                                ##   in Loop: Header=BB0_5 Depth=1
	movl	-104(%rbp), %r15d               ## 4-byte Reload
	addl	-68(%rbp), %r15d                ## 4-byte Folded Reload
	cmpl	-100(%rbp), %r15d               ## 4-byte Folded Reload
	movl	-96(%rbp), %r13d                ## 4-byte Reload
	movl	-92(%rbp), %r14d                ## 4-byte Reload
	jge	LBB0_22
LBB0_5:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_7 Depth 2
	movl	(%rcx), %edx
	movq	%r12, %rdi
	movl	%r14d, %esi
	movl	%r13d, %ecx
	callq	_SDL_PeepEvents
	testl	%eax, %eax
	jle	LBB0_22
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	%r15d, -104(%rbp)               ## 4-byte Spill
	movl	%eax, -68(%rbp)                 ## 4-byte Spill
	movl	%eax, %eax
	movl	$1, %r14d
	subq	%rax, %r14
	movl	$1, %r15d
	movq	%r12, %r13
	jmp	LBB0_7
LBB0_18:                                ##   in Loop: Header=BB0_7 Depth=2
	callq	_ext_event_handler
LBB0_19:                                ##   in Loop: Header=BB0_7 Depth=2
	movq	_SDL_GETEVENT@GOTPCREL(%rip), %rcx
LBB0_20:                                ##   in Loop: Header=BB0_7 Depth=2
	incq	%r14
	addq	$4, %r13
	incl	%r15d
	cmpq	$1, %r14
	je	LBB0_21
LBB0_7:                                 ##   Parent Loop BB0_5 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	cmpq	$0, (%rbx)
	je	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=2
	movq	%rbx, %rdi
	movq	%r13, %rsi
	movq	-88(%rbp), %rdx                 ## 8-byte Reload
	movq	-112(%rbp), %rcx                ## 8-byte Reload
	callq	_handle_joy_event
	testl	%eax, %eax
	js	LBB0_11
LBB0_13:                                ##   in Loop: Header=BB0_7 Depth=2
	movq	-80(%rbp), %rcx                 ## 8-byte Reload
	orl	%eax, %ecx
	movq	%rcx, -80(%rbp)                 ## 8-byte Spill
	cmpq	$0, -88(%rbp)                   ## 8-byte Folded Reload
	je	LBB0_19
## %bb.14:                              ##   in Loop: Header=BB0_7 Depth=2
	testl	%eax, %eax
	movq	_SDL_GETEVENT@GOTPCREL(%rip), %rcx
	je	LBB0_20
	jmp	LBB0_15
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_7 Depth=2
	movq	%rbx, %rdi
	movq	%r13, %rsi
	movq	-88(%rbp), %rdx                 ## 8-byte Reload
	movq	-112(%rbp), %rcx                ## 8-byte Reload
	callq	_handle_event
	testl	%eax, %eax
	jns	LBB0_13
LBB0_11:                                ##   in Loop: Header=BB0_7 Depth=2
	movq	%r13, %rdi
	cmpl	$-2, %eax
	jne	LBB0_18
## %bb.12:                              ##   in Loop: Header=BB0_7 Depth=2
	callq	_SDL_PushEvent
	jmp	LBB0_19
LBB0_15:
	cmpl	-68(%rbp), %r15d                ## 4-byte Folded Reload
	jge	LBB0_22
## %bb.16:
	negq	%r14
	addq	$4, %r13
	.p2align	4, 0x90
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	callq	_SDL_PushEvent
	addq	$4, %r13
	decq	%r14
	jne	LBB0_17
LBB0_22:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_24
## %bb.23:
	movq	-80(%rbp), %rax                 ## 8-byte Reload
                                        ## kill: def $eax killed $eax killed $rax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_24:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_JOY_EVENTS,4,2                 ## @JOY_EVENTS
	.comm	_SDL_ALLEVENTS,4,2              ## @SDL_ALLEVENTS
	.comm	_SDL_PEEKEVENT,4,2              ## @SDL_PEEKEVENT
	.comm	_SDL_GETEVENT,4,2               ## @SDL_GETEVENT
	.no_dead_strip	_collect_events
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function collect_events
_collect_events:                        ; @collect_events
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x2
	mov	x21, x1
	mov	x22, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #24]
	ldr	x8, [x0]
	cbz	x8, LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _JOY_EVENTS@GOTPAGE
Lloh4:
	ldr	x8, [x8, _JOY_EVENTS@GOTPAGEOFF]
Lloh5:
	ldr	w23, [x8]
	b	LBB0_3
LBB0_2:
Lloh6:
	adrp	x8, _SDL_ALLEVENTS@GOTPAGE
Lloh7:
	ldr	x8, [x8, _SDL_ALLEVENTS@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
Lloh9:
	adrp	x9, _JOY_EVENTS@GOTPAGE
Lloh10:
	ldr	x9, [x9, _JOY_EVENTS@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	bic	w23, w8, w9
LBB0_3:
	cmp	x21, #0
	mov	w8, #4
	csinc	w24, w8, wzr, eq
	bl	_SDL_PumpEvents
Lloh12:
	adrp	x8, _SDL_PEEKEVENT@GOTPAGE
Lloh13:
	ldr	x8, [x8, _SDL_PEEKEVENT@GOTPAGEOFF]
Lloh14:
	ldr	w2, [x8]
	mov	x0, #0
	mov	w1, #0
	mov	x3, x23
	bl	_SDL_PeepEvents
	str	w0, [sp, #4]                    ; 4-byte Folded Spill
	cmp	w0, #1
	b.lt	LBB0_20
; %bb.4:
	mov	w28, #0
	mov	w19, #0
Lloh15:
	adrp	x8, _SDL_GETEVENT@GOTPAGE
Lloh16:
	ldr	x8, [x8, _SDL_GETEVENT@GOTPAGEOFF]
	str	w24, [sp]                       ; 4-byte Folded Spill
	b	LBB0_6
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	add	w28, w26, w28
	ldp	w24, w8, [sp]                   ; 8-byte Folded Reload
	cmp	w28, w8
Lloh17:
	adrp	x8, _SDL_GETEVENT@GOTPAGE
Lloh18:
	ldr	x8, [x8, _SDL_GETEVENT@GOTPAGEOFF]
	b.ge	LBB0_21
LBB0_6:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_10 Depth 2
	ldr	w2, [x8]
	add	x0, sp, #8
	mov	x1, x24
	mov	x3, x23
	bl	_SDL_PeepEvents
	cmp	w0, #1
	b.lt	LBB0_21
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	x26, x0
	mov	x24, #0
	mov	w25, w0
	add	x27, sp, #8
	b	LBB0_10
LBB0_8:                                 ;   in Loop: Header=BB0_10 Depth=2
	mov	x0, x27
	bl	_ext_event_handler
LBB0_9:                                 ;   in Loop: Header=BB0_10 Depth=2
	add	x24, x24, #1
	add	x27, x27, #4
	cmp	x25, x24
	b.eq	LBB0_5
LBB0_10:                                ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x8, [x22]
	cbz	x8, LBB0_14
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=2
	mov	x0, x22
	mov	x1, x27
	mov	x2, x21
	mov	x3, x20
	bl	_handle_joy_event
	tbnz	w0, #31, LBB0_15
LBB0_12:                                ;   in Loop: Header=BB0_10 Depth=2
	orr	w19, w0, w19
	cbz	x21, LBB0_9
; %bb.13:                               ;   in Loop: Header=BB0_10 Depth=2
	cbz	w0, LBB0_9
	b	LBB0_17
LBB0_14:                                ;   in Loop: Header=BB0_10 Depth=2
	mov	x0, x22
	mov	x1, x27
	mov	x2, x21
	mov	x3, x20
	bl	_handle_event
	tbz	w0, #31, LBB0_12
LBB0_15:                                ;   in Loop: Header=BB0_10 Depth=2
	cmn	w0, #2
	b.ne	LBB0_8
; %bb.16:                               ;   in Loop: Header=BB0_10 Depth=2
	mov	x0, x27
	bl	_SDL_PushEvent
	b	LBB0_9
LBB0_17:
	add	w8, w24, #1
	cmp	w8, w26
	b.ge	LBB0_21
; %bb.18:
	mvn	x8, x24
	add	x21, x8, w26, uxtw
	add	x20, x27, #4
LBB0_19:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	bl	_SDL_PushEvent
	add	x20, x20, #4
	subs	x21, x21, #1
	b.ne	LBB0_19
	b	LBB0_21
LBB0_20:
	mov	w19, #0
LBB0_21:
	ldr	x8, [sp, #24]
Lloh19:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh20:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh21:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_23
; %bb.22:
	mov	x0, x19
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_23:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_JOY_EVENTS,4,2                 ; @JOY_EVENTS
	.comm	_SDL_ALLEVENTS,4,2              ; @SDL_ALLEVENTS
	.comm	_SDL_PEEKEVENT,4,2              ; @SDL_PEEKEVENT
	.comm	_SDL_GETEVENT,4,2               ; @SDL_GETEVENT
	.no_dead_strip	_collect_events
.subsections_via_symbols
