	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_plat_sdl_event_handler         ## -- Begin function plat_sdl_event_handler
	.p2align	4, 0x90
_plat_sdl_event_handler:                ## @plat_sdl_event_handler
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %rbx
	movl	(%rdi), %eax
	cmpl	$130, %eax
	je	LBB0_7
## %bb.1:
	cmpl	$129, %eax
	je	LBB0_17
## %bb.2:
	cmpl	$128, %eax
	jne	LBB0_16
## %bb.3:
	movq	_plat_target@GOTPCREL(%rip), %rax
	cmpl	$0, 4(%rax)
	je	LBB0_16
## %bb.4:
	cmpl	$0, (%rax)
	jne	LBB0_16
## %bb.5:
	movq	_old_fullscreen@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jne	LBB0_16
## %bb.6:
	movl	12(%rbx), %eax
	movq	_window_w@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movl	8(%rbx), %eax
	movq	_window_h@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	xorl	%edi, %edi
	xorl	%esi, %esi
	movl	$1, %edx
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_plat_sdl_change_video_mode     ## TAILCALL
LBB0_7:
	cmpl	$0, 4(%rbx)
	je	LBB0_15
## %bb.8:
	cmpl	$0, _plat_sdl_event_handler.was_active(%rip)
	jne	LBB0_15
## %bb.9:
	movq	_plat_sdl_overlay@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	testq	%rdi, %rdi
	je	LBB0_11
## %bb.10:
	movq	$0, -32(%rbp)
	movq	_plat_sdl_screen@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	4(%rax), %ecx
	movl	%ecx, -24(%rbp)
	movl	(%rax), %eax
	movl	%eax, -20(%rbp)
	leaq	-32(%rbp), %rsi
	callq	_SDL_DisplayYUVOverlay
	jmp	LBB0_15
LBB0_17:
	xorl	%eax, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_plat_sdl_quit_cb               ## TAILCALL
LBB0_11:
	movq	_plat_sdl_gl_active@GOTPCREL(%rip), %r14
	cmpl	$0, (%r14)
	je	LBB0_15
## %bb.12:
	movq	_gl_quirks@GOTPCREL(%rip), %rax
	movq	_GL_QUIRK_ACTIVATE_RECREATE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%rax)
	je	LBB0_14
## %bb.13:
	xorl	%eax, %eax
	callq	_gl_finish
	movq	_display@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_window@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_gl_quirks@GOTPCREL(%rip), %rdx
	callq	_gl_init
	xorl	%ecx, %ecx
	testl	%eax, %eax
	sete	%cl
	movl	%ecx, (%r14)
LBB0_14:
	xorl	%edi, %edi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_gl_flip
LBB0_15:
	movl	4(%rbx), %eax
	movl	%eax, _plat_sdl_event_handler.was_active(%rip)
LBB0_16:
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_plat_sdl_event_handler.was_active,4,2 ## @plat_sdl_event_handler.was_active
	.comm	_plat_target,8,2                ## @plat_target
	.comm	_old_fullscreen,4,2             ## @old_fullscreen
	.comm	_window_w,4,2                   ## @window_w
	.comm	_window_h,4,2                   ## @window_h
	.comm	_plat_sdl_overlay,8,3           ## @plat_sdl_overlay
	.comm	_plat_sdl_screen,8,3            ## @plat_sdl_screen
	.comm	_plat_sdl_gl_active,4,2         ## @plat_sdl_gl_active
	.comm	_gl_quirks,4,2                  ## @gl_quirks
	.comm	_GL_QUIRK_ACTIVATE_RECREATE,4,2 ## @GL_QUIRK_ACTIVATE_RECREATE
	.comm	_display,4,2                    ## @display
	.comm	_window,4,2                     ## @window
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_plat_sdl_event_handler         ; -- Begin function plat_sdl_event_handler
	.p2align	2
_plat_sdl_event_handler:                ; @plat_sdl_event_handler
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x19, x0
	ldr	w8, [x0]
	cmp	w8, #130
	b.eq	LBB0_5
; %bb.1:
	cmp	w8, #129
	b.eq	LBB0_8
; %bb.2:
	cmp	w8, #128
	b.ne	LBB0_14
; %bb.3:
Lloh0:
	adrp	x8, _plat_target@GOTPAGE
Lloh1:
	ldr	x8, [x8, _plat_target@GOTPAGEOFF]
	ldp	w8, w9, [x8]
Lloh2:
	adrp	x10, _old_fullscreen@GOTPAGE
Lloh3:
	ldr	x10, [x10, _old_fullscreen@GOTPAGEOFF]
Lloh4:
	ldr	w10, [x10]
	cmp	w9, #0
	ccmp	w8, #0, #0, ne
	ccmp	w10, #0, #0, eq
	b.ne	LBB0_14
; %bb.4:
Lloh5:
	adrp	x8, _window_w@GOTPAGE
Lloh6:
	ldr	x8, [x8, _window_w@GOTPAGEOFF]
	ldp	w10, w9, [x19, #8]
Lloh7:
	str	w9, [x8]
Lloh8:
	adrp	x8, _window_h@GOTPAGE
Lloh9:
	ldr	x8, [x8, _window_h@GOTPAGEOFF]
Lloh10:
	str	w10, [x8]
	mov	w0, #0
	mov	w1, #0
	mov	w2, #1
	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
	add	sp, sp, #64
	b	_plat_sdl_change_video_mode
LBB0_5:
	ldr	w8, [x19, #4]
	adrp	x20, _plat_sdl_event_handler.was_active@PAGE
	ldr	w9, [x20, _plat_sdl_event_handler.was_active@PAGEOFF]
	cmp	w8, #0
	ccmp	w9, #0, #0, ne
	b.ne	LBB0_13
; %bb.6:
Lloh11:
	adrp	x8, _plat_sdl_overlay@GOTPAGE
Lloh12:
	ldr	x8, [x8, _plat_sdl_overlay@GOTPAGEOFF]
Lloh13:
	ldr	x0, [x8]
	cbz	x0, LBB0_9
; %bb.7:
	str	xzr, [sp]
Lloh14:
	adrp	x8, _plat_sdl_screen@GOTPAGE
Lloh15:
	ldr	x8, [x8, _plat_sdl_screen@GOTPAGEOFF]
Lloh16:
	ldr	x8, [x8]
	ldr	d0, [x8]
	rev64.2s	v0, v0
	str	d0, [sp, #8]
	mov	x1, sp
	bl	_SDL_DisplayYUVOverlay
	b	LBB0_13
LBB0_8:
	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
	add	sp, sp, #64
	b	_plat_sdl_quit_cb
LBB0_9:
Lloh17:
	adrp	x21, _plat_sdl_gl_active@GOTPAGE
Lloh18:
	ldr	x21, [x21, _plat_sdl_gl_active@GOTPAGEOFF]
	ldr	w8, [x21]
	cbz	w8, LBB0_13
; %bb.10:
Lloh19:
	adrp	x8, _gl_quirks@GOTPAGE
Lloh20:
	ldr	x8, [x8, _gl_quirks@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
Lloh22:
	adrp	x9, _GL_QUIRK_ACTIVATE_RECREATE@GOTPAGE
Lloh23:
	ldr	x9, [x9, _GL_QUIRK_ACTIVATE_RECREATE@GOTPAGEOFF]
Lloh24:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_12
; %bb.11:
	bl	_gl_finish
Lloh25:
	adrp	x8, _display@GOTPAGE
Lloh26:
	ldr	x8, [x8, _display@GOTPAGEOFF]
Lloh27:
	ldr	w0, [x8]
Lloh28:
	adrp	x8, _window@GOTPAGE
Lloh29:
	ldr	x8, [x8, _window@GOTPAGEOFF]
Lloh30:
	ldr	w1, [x8]
Lloh31:
	adrp	x2, _gl_quirks@GOTPAGE
Lloh32:
	ldr	x2, [x2, _gl_quirks@GOTPAGEOFF]
	bl	_gl_init
	cmp	w0, #0
	cset	w8, eq
	str	w8, [x21]
LBB0_12:
	mov	x0, #0
	mov	w1, #0
	mov	w2, #0
	bl	_gl_flip
LBB0_13:
	ldr	w8, [x19, #4]
	str	w8, [x20, _plat_sdl_event_handler.was_active@PAGEOFF]
LBB0_14:
	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
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotStr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotStr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_plat_sdl_event_handler.was_active,4,2 ; @plat_sdl_event_handler.was_active
	.comm	_plat_target,8,2                ; @plat_target
	.comm	_old_fullscreen,4,2             ; @old_fullscreen
	.comm	_window_w,4,2                   ; @window_w
	.comm	_window_h,4,2                   ; @window_h
	.comm	_plat_sdl_overlay,8,3           ; @plat_sdl_overlay
	.comm	_plat_sdl_screen,8,3            ; @plat_sdl_screen
	.comm	_plat_sdl_gl_active,4,2         ; @plat_sdl_gl_active
	.comm	_gl_quirks,4,2                  ; @gl_quirks
	.comm	_GL_QUIRK_ACTIVATE_RECREATE,4,2 ; @GL_QUIRK_ACTIVATE_RECREATE
	.comm	_display,4,2                    ; @display
	.comm	_window,4,2                     ; @window
.subsections_via_symbols
