	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_emu_video_mode_change          ## -- Begin function emu_video_mode_change
	.p2align	4, 0x90
_emu_video_mode_change:                 ## @emu_video_mode_change
	.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
                                        ## kill: def $edi killed $edi def $rdi
	movq	_doing_bg_frame@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_1
## %bb.15:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_1:
	movl	%esi, %ebx
	movq	_OSD_FPS_X@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movq	_osd_fps_x@GOTPCREL(%rip), %r9
	movq	%rcx, (%r9)
	movq	_osd_y@GOTPCREL(%rip), %r8
	movl	$232, (%r8)
	movq	_POPT_DIS_32C_BORDER@GOTPCREL(%rip), %rax
	movl	(%rax), %r11d
	movl	%r11d, %esi
	notl	%esi
	movq	_PicoOpt@GOTPCREL(%rip), %r10
	movl	(%r10), %eax
	andl	%eax, %esi
	movl	%esi, (%r10)
	testl	%edx, %edx
	je	LBB0_2
## %bb.3:
	movq	_currentConfig@GOTPCREL(%rip), %rdx
	movq	(%rdx), %r14
	movq	_EOPT_SCALE_HW@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movl	$320, %esi                      ## imm = 0x140
	cmpq	%rdx, %r14
	jne	LBB0_5
## %bb.4:
	orl	%r11d, %eax
	movl	%eax, (%r10)
	addq	$-64, %rcx
	movq	%rcx, (%r9)
	movl	$256, %esi                      ## imm = 0x100
	movq	%r14, %rdx
	jmp	LBB0_5
LBB0_2:
	movq	_EOPT_SCALE_HW@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movl	$320, %esi                      ## imm = 0x140
LBB0_5:
	movq	_currentConfig@GOTPCREL(%rip), %r14
	cmpq	%rdx, 8(%r14)
	jne	LBB0_6
## %bb.7:
	leal	(%rdi,%rbx), %eax
	addl	$-8, %eax
	movl	%eax, (%r8)
	movl	%ebx, %edx
	jmp	LBB0_8
LBB0_6:
	xorl	%edi, %edi
	movl	$240, %edx
LBB0_8:
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_gp2x_video_RGB_setscaling
	cmpl	$239, %ebx
	jg	LBB0_11
## %bb.9:
	movq	_EOPT_SCALE_SW@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	%rax, 8(%r14)
	jne	LBB0_11
## %bb.10:
	movl	$240, %ecx
	subl	%ebx, %ecx
	movl	%ebx, %eax
	cltd
	idivl	%ecx
	movq	_ld_left@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movq	_ld_lines@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movq	_EmuScanBegin16_ld@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_EmuScanEnd16_ld@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_PicoDrawSetCallbacks
LBB0_11:
	xorl	%eax, %eax
	callq	_is_16bit_mode
	xorl	%edi, %edi
	testl	%eax, %eax
	je	LBB0_12
## %bb.14:
	xorl	%esi, %esi
	movl	$153600, %edx                   ## imm = 0x25800
	jmp	LBB0_13
LBB0_12:
	movl	$224, %esi
	movl	$76800, %edx                    ## imm = 0x12C00
LBB0_13:
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_gp2x_memset_all_buffers        ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_doing_bg_frame,8,3             ## @doing_bg_frame
	.comm	_OSD_FPS_X,8,3                  ## @OSD_FPS_X
	.comm	_osd_fps_x,8,3                  ## @osd_fps_x
	.comm	_osd_y,4,2                      ## @osd_y
	.comm	_POPT_DIS_32C_BORDER,4,2        ## @POPT_DIS_32C_BORDER
	.comm	_PicoOpt,4,2                    ## @PicoOpt
	.comm	_currentConfig,16,3             ## @currentConfig
	.comm	_EOPT_SCALE_HW,8,3              ## @EOPT_SCALE_HW
	.comm	_EOPT_SCALE_SW,8,3              ## @EOPT_SCALE_SW
	.comm	_ld_left,4,2                    ## @ld_left
	.comm	_ld_lines,4,2                   ## @ld_lines
	.comm	_EmuScanBegin16_ld,4,2          ## @EmuScanBegin16_ld
	.comm	_EmuScanEnd16_ld,4,2            ## @EmuScanEnd16_ld
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_emu_video_mode_change          ; -- Begin function emu_video_mode_change
	.p2align	2
_emu_video_mode_change:                 ; @emu_video_mode_change
	.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
Lloh0:
	adrp	x8, _doing_bg_frame@GOTPAGE
Lloh1:
	ldr	x8, [x8, _doing_bg_frame@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cbz	x8, LBB0_2
; %bb.1:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_2:
	mov	x19, x1
Lloh3:
	adrp	x8, _OSD_FPS_X@GOTPAGE
Lloh4:
	ldr	x8, [x8, _OSD_FPS_X@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x8]
Lloh6:
	adrp	x10, _osd_fps_x@GOTPAGE
Lloh7:
	ldr	x10, [x10, _osd_fps_x@GOTPAGEOFF]
	str	x9, [x10]
Lloh8:
	adrp	x8, _osd_y@GOTPAGE
Lloh9:
	ldr	x8, [x8, _osd_y@GOTPAGEOFF]
	mov	w11, #232
	str	w11, [x8]
Lloh10:
	adrp	x11, _POPT_DIS_32C_BORDER@GOTPAGE
Lloh11:
	ldr	x11, [x11, _POPT_DIS_32C_BORDER@GOTPAGEOFF]
Lloh12:
	adrp	x12, _PicoOpt@GOTPAGE
Lloh13:
	ldr	x12, [x12, _PicoOpt@GOTPAGEOFF]
Lloh14:
	ldr	w13, [x11]
	ldr	w14, [x12]
	bic	w11, w14, w13
	str	w11, [x12]
Lloh15:
	adrp	x20, _currentConfig@GOTPAGE
Lloh16:
	ldr	x20, [x20, _currentConfig@GOTPAGEOFF]
	cbz	w2, LBB0_5
; %bb.3:
	ldr	x15, [x20]
Lloh17:
	adrp	x11, _EOPT_SCALE_HW@GOTPAGE
Lloh18:
	ldr	x11, [x11, _EOPT_SCALE_HW@GOTPAGEOFF]
Lloh19:
	ldr	x11, [x11]
	cmp	x15, x11
	b.ne	LBB0_6
; %bb.4:
	orr	w11, w14, w13
	str	w11, [x12]
	sub	x9, x9, #64
	str	x9, [x10]
	mov	w1, #256
	mov	x11, x15
	b	LBB0_7
LBB0_5:
Lloh20:
	adrp	x9, _EOPT_SCALE_HW@GOTPAGE
Lloh21:
	ldr	x9, [x9, _EOPT_SCALE_HW@GOTPAGEOFF]
Lloh22:
	ldr	x11, [x9]
LBB0_6:
	mov	w1, #320
LBB0_7:
	ldr	x9, [x20, #8]
	cmp	x9, x11
	b.ne	LBB0_9
; %bb.8:
	add	w9, w0, w19
	sub	w9, w9, #8
	str	w9, [x8]
	mov	x2, x19
	b	LBB0_10
LBB0_9:
	mov	w0, #0
	mov	w2, #240
LBB0_10:
	bl	_gp2x_video_RGB_setscaling
	cmp	w19, #239
	b.gt	LBB0_13
; %bb.11:
	ldr	x8, [x20, #8]
Lloh23:
	adrp	x9, _EOPT_SCALE_SW@GOTPAGE
Lloh24:
	ldr	x9, [x9, _EOPT_SCALE_SW@GOTPAGEOFF]
Lloh25:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_13
; %bb.12:
	mov	w8, #240
	sub	w8, w8, w19
	sdiv	w8, w19, w8
Lloh26:
	adrp	x9, _ld_left@GOTPAGE
Lloh27:
	ldr	x9, [x9, _ld_left@GOTPAGEOFF]
Lloh28:
	str	w8, [x9]
Lloh29:
	adrp	x9, _ld_lines@GOTPAGE
Lloh30:
	ldr	x9, [x9, _ld_lines@GOTPAGEOFF]
Lloh31:
	str	w8, [x9]
Lloh32:
	adrp	x8, _EmuScanBegin16_ld@GOTPAGE
Lloh33:
	ldr	x8, [x8, _EmuScanBegin16_ld@GOTPAGEOFF]
Lloh34:
	ldr	w0, [x8]
Lloh35:
	adrp	x8, _EmuScanEnd16_ld@GOTPAGE
Lloh36:
	ldr	x8, [x8, _EmuScanEnd16_ld@GOTPAGEOFF]
Lloh37:
	ldr	w1, [x8]
	bl	_PicoDrawSetCallbacks
LBB0_13:
	bl	_is_16bit_mode
	cbz	w0, LBB0_15
; %bb.14:
	mov	w0, #0
	mov	w1, #0
	mov	w2, #22528
	movk	w2, #2, lsl #16
	b	LBB0_16
LBB0_15:
	mov	w1, #224
	mov	w2, #11264
	movk	w2, #1, lsl #16
LBB0_16:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_gp2x_memset_all_buffers
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh14
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotStr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotStr	Lloh26, Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_doing_bg_frame,8,3             ; @doing_bg_frame
	.comm	_OSD_FPS_X,8,3                  ; @OSD_FPS_X
	.comm	_osd_fps_x,8,3                  ; @osd_fps_x
	.comm	_osd_y,4,2                      ; @osd_y
	.comm	_POPT_DIS_32C_BORDER,4,2        ; @POPT_DIS_32C_BORDER
	.comm	_PicoOpt,4,2                    ; @PicoOpt
	.comm	_currentConfig,16,3             ; @currentConfig
	.comm	_EOPT_SCALE_HW,8,3              ; @EOPT_SCALE_HW
	.comm	_EOPT_SCALE_SW,8,3              ; @EOPT_SCALE_SW
	.comm	_ld_left,4,2                    ; @ld_left
	.comm	_ld_lines,4,2                   ; @ld_lines
	.comm	_EmuScanBegin16_ld,4,2          ; @EmuScanBegin16_ld
	.comm	_EmuScanEnd16_ld,4,2            ; @EmuScanEnd16_ld
.subsections_via_symbols
