	.file	"extr_emu.c_vid_reset_mode.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"bad renderer\n"
	.text
	.p2align 4
	.type	vid_reset_mode, @function
vid_reset_mode:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	xor	eax, eax
	push	rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	sub	rsp, 8
	.cfi_def_cfa_offset 32
	call	get_renderer@PLT
	mov	edx, DWORD PTR POPT_ALT_RENDERER[rip]
	mov	ecx, DWORD PTR PicoOpt[rip]
	mov	QWORD PTR emu_scan_begin[rip], 0
	mov	QWORD PTR emu_scan_end[rip], 0
	mov	ebx, eax
	mov	eax, edx
	not	eax
	and	eax, ecx
	mov	DWORD PTR PicoOpt[rip], eax
	cmp	ebx, 129
	je	.L2
	cmp	ebx, 130
	je	.L3
	cmp	ebx, 128
	je	.L38
	lea	rdi, .LC0[rip]
	call	printf@PLT
	mov	eax, DWORD PTR PicoAHW[rip]
	test	DWORD PTR PAHW_32X[rip], eax
	je	.L36
.L9:
	mov	edi, DWORD PTR PDF_NONE[rip]
	xor	esi, esi
	call	PicoDrawSetOutFormat@PLT
.L12:
	mov	eax, DWORD PTR g_screen_width[rip]
	mov	edi, DWORD PTR g_screen_ptr[rip]
	lea	esi, [rax+rax]
	call	PicoDrawSetOutBuf@PLT
.L36:
	mov	ebp, 16
.L7:
	mov	eax, DWORD PTR currentConfig[rip]
	test	DWORD PTR EOPT_WIZ_TEAR_FIX[rip], eax
	jne	.L13
	mov	rsi, QWORD PTR emu_scan_end[rip]
	mov	rdi, QWORD PTR emu_scan_begin[rip]
.L14:
	call	PicoDrawSetCallbacks@PLT
	xor	eax, eax
	call	is_16bit_mode@PLT
	test	rax, rax
	mov	eax, DWORD PTR currentConfig[rip]
	je	.L18
	test	DWORD PTR EOPT_WIZ_TEAR_FIX[rip], eax
	mov	eax, DWORD PTR osd_text16_rot[rip]
	cmove	eax, DWORD PTR emu_osd_text16[rip]
	mov	DWORD PTR osd_text[rip], eax
.L21:
	xor	eax, eax
	call	gp2x_video_wait_vsync@PLT
	xor	eax, eax
	call	is_16bit_mode@PLT
	test	rax, rax
	jne	.L24
	mov	rdi, QWORD PTR localPal[rip]
	mov	esi, 256
	mov	DWORD PTR 768[rdi], 49152
	mov	DWORD PTR 832[rdi], 12582912
	mov	DWORD PTR 896[rdi], 0
	mov	DWORD PTR 960[rdi], 16777215
	call	gp2x_video_setpalette@PLT
	mov	edx, 76800
	mov	esi, 224
	xor	edi, edi
	call	gp2x_memset_all_buffers@PLT
.L25:
	mov	eax, ebp
	mov	edx, DWORD PTR currentConfig[rip]
	mov	esi, DWORD PTR Pico[rip+4]
	neg	eax
	test	DWORD PTR EOPT_WIZ_TEAR_FIX[rip], edx
	cmovne	ebp, eax
	mov	edi, ebp
	call	gp2x_video_changemode@PLT
	mov	edx, DWORD PTR POPT_EN_SOFTSCALE[rip]
	mov	ecx, DWORD PTR PicoOpt[rip]
	mov	DWORD PTR Pico[rip], 1
	mov	eax, edx
	not	eax
	and	eax, ecx
	mov	DWORD PTR PicoOpt[rip], eax
	mov	rax, QWORD PTR EOPT_SCALE_SW[rip]
	cmp	QWORD PTR currentConfig[rip+8], rax
	jne	.L27
	or	edx, ecx
	mov	DWORD PTR PicoOpt[rip], edx
.L27:
	mov	eax, DWORD PTR PicoAHW[rip]
	test	DWORD PTR PAHW_SMS[rip], eax
	mov	eax, DWORD PTR make_local_pal_sms[rip]
	cmove	eax, DWORD PTR make_local_pal_md[rip]
	mov	DWORD PTR make_local_pal[rip], eax
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	pop	rbx
	.cfi_def_cfa_offset 16
	pop	rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L13:
	.cfi_restore_state
	mov	eax, DWORD PTR PicoAHW[rip]
	test	DWORD PTR PAHW_32X[rip], eax
	jne	.L30
	cmp	ebx, 130
	jne	.L15
.L30:
	mov	rdi, QWORD PTR EmuScanBegin16_rot[rip]
	mov	rsi, QWORD PTR EmuScanEnd16_rot[rip]
	mov	QWORD PTR emu_scan_begin[rip], rdi
	mov	QWORD PTR emu_scan_end[rip], rsi
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L18:
	test	DWORD PTR EOPT_WIZ_TEAR_FIX[rip], eax
	mov	eax, DWORD PTR osd_text8_rot[rip]
	cmove	eax, DWORD PTR osd_text8[rip]
	mov	DWORD PTR osd_text[rip], eax
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L24:
	mov	edx, 153600
	xor	esi, esi
	xor	edi, edi
	call	gp2x_memset_all_buffers@PLT
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L38:
	mov	edi, DWORD PTR PDF_NONE[rip]
	or	edx, ecx
	xor	esi, esi
	mov	DWORD PTR PicoOpt[rip], edx
	call	PicoDrawSetOutFormat@PLT
	mov	eax, DWORD PTR vidcpy_m2[rip]
	mov	DWORD PTR vidcpyM2[rip], eax
.L10:
	mov	eax, DWORD PTR PicoAHW[rip]
	mov	ebp, 8
	test	DWORD PTR PAHW_32X[rip], eax
	je	.L7
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L3:
	mov	edi, DWORD PTR PDF_RGB555[rip]
	xor	esi, esi
	call	PicoDrawSetOutFormat@PLT
	mov	eax, DWORD PTR g_screen_width[rip]
	mov	edi, DWORD PTR g_screen_ptr[rip]
	lea	esi, [rax+rax]
	call	PicoDrawSetOutBuf@PLT
	mov	eax, DWORD PTR PAHW_32X[rip]
	test	DWORD PTR PicoAHW[rip], eax
	je	.L36
	mov	eax, DWORD PTR currentConfig[rip]
	test	DWORD PTR EOPT_WIZ_TEAR_FIX[rip], eax
	je	.L9
	mov	edi, DWORD PTR PDF_RGB555[rip]
	mov	esi, 1
	call	PicoDrawSetOutFormat@PLT
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L2:
	mov	edi, DWORD PTR PDF_8BIT[rip]
	xor	esi, esi
	call	PicoDrawSetOutFormat@PLT
	mov	esi, DWORD PTR g_screen_width[rip]
	mov	edi, DWORD PTR g_screen_ptr[rip]
	call	PicoDrawSetOutBuf@PLT
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L15:
	cmp	ebx, 129
	je	.L39
	mov	rsi, QWORD PTR emu_scan_end[rip]
	mov	rdi, QWORD PTR emu_scan_begin[rip]
	cmp	ebx, 128
	jne	.L14
	mov	eax, DWORD PTR vidcpy_m2_rot[rip]
	mov	DWORD PTR vidcpyM2[rip], eax
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L39:
	mov	rdi, QWORD PTR EmuScanBegin8_rot[rip]
	mov	rsi, QWORD PTR EmuScanEnd8_rot[rip]
	mov	QWORD PTR emu_scan_begin[rip], rdi
	mov	QWORD PTR emu_scan_end[rip], rsi
	jmp	.L14
	.cfi_endproc
.LFE0:
	.size	vid_reset_mode, .-vid_reset_mode
	.comm	vidcpy_m2_rot,4,4
	.comm	vidcpy_m2,4,4
	.comm	vidcpyM2,4,4
	.comm	osd_text8_rot,4,4
	.comm	osd_text8,4,4
	.comm	osd_text16_rot,4,4
	.comm	osd_text,4,4
	.comm	make_local_pal_sms,4,4
	.comm	make_local_pal_md,4,4
	.comm	make_local_pal,4,4
	.comm	localPal,8,8
	.comm	g_screen_width,4,4
	.comm	g_screen_ptr,4,4
	.comm	emu_scan_end,8,8
	.comm	emu_scan_begin,8,8
	.comm	emu_osd_text16,4,4
	.comm	currentConfig,16,16
	.comm	PicoOpt,4,4
	.comm	PicoAHW,4,4
	.comm	Pico,8,8
	.comm	POPT_EN_SOFTSCALE,4,4
	.comm	POPT_ALT_RENDERER,4,4
	.comm	PDF_RGB555,4,4
	.comm	PDF_NONE,4,4
	.comm	PDF_8BIT,4,4
	.comm	PAHW_SMS,4,4
	.comm	PAHW_32X,4,4
	.comm	EmuScanEnd8_rot,8,8
	.comm	EmuScanEnd16_rot,8,8
	.comm	EmuScanBegin8_rot,8,8
	.comm	EmuScanBegin16_rot,8,8
	.comm	EOPT_WIZ_TEAR_FIX,4,4
	.comm	EOPT_SCALE_SW,8,8
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_emu.c_vid_reset_mode.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"bad renderer\012\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	vid_reset_mode, %function
vid_reset_mode:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	sub	sp, sp, #12
	bl	get_renderer
	mov	r1, #0
	ldr	r5, .L43
	ldr	r3, .L43+4
	ldr	r2, [r5]
	ldr	r3, [r3]
	ldr	fp, .L43+8
	ldr	r10, .L43+12
	mov	r4, r0
	cmp	r0, #129
	bic	r0, r2, r3
	str	r0, [r5]
	str	r1, [fp]
	str	r1, [r10]
	beq	.L2
	cmp	r4, #130
	beq	.L3
	cmp	r4, #128
	beq	.L40
	ldr	r3, .L43+16
	ldr	r0, .L43+20
	str	r3, [sp]
	ldr	r8, .L43+24
	bl	printf
	ldr	r3, [sp]
	ldr	r1, [r8]
	ldr	r2, [r3]
	tst	r1, r2
	beq	.L11
.L38:
	ldr	r9, .L43+28
	ldr	r2, .L43+32
	ldr	r6, .L43+36
	ldr	r7, .L43+40
.L9:
	ldr	r0, .L43+44
	mov	r1, #0
	ldr	r0, [r0]
	str	r2, [sp, #4]
	str	r3, [sp]
	bl	PicoDrawSetOutFormat
	ldr	r2, [sp, #4]
	ldr	r3, [sp]
.L12:
	ldr	r1, [r9]
	mov	r9, #16
	ldr	r0, [r2]
	lsl	r1, r1, #1
	str	r3, [sp]
	bl	PicoDrawSetOutBuf
	ldr	r3, [sp]
.L7:
	ldr	r1, [r6]
	ldr	r2, [r7]
	tst	r1, r2
	bne	.L13
.L41:
	ldr	r0, [fp]
	ldr	r1, [r10]
.L14:
	bl	PicoDrawSetCallbacks
	bl	is_16bit_mode
	cmp	r0, #0
	ldr	r2, [r6]
	ldr	r3, [r7]
	beq	.L17
	tst	r2, r3
	ldrne	r3, .L43+48
	ldreq	r3, .L43+52
	ldr	r2, [r3]
.L22:
	ldr	r3, .L43+56
	str	r2, [r3]
	bl	gp2x_video_wait_vsync
	bl	is_16bit_mode
	subs	r4, r0, #0
	bne	.L23
	mov	r2, #12582912
	mov	r1, #49152
	mvn	r3, #-16777216
	ldr	r0, .L43+60
	ldr	r0, [r0]
	str	r1, [r0, #768]
	str	r2, [r0, #832]
	mov	r1, #256
	str	r4, [r0, #896]
	str	r3, [r0, #960]
	bl	gp2x_video_setpalette
	mov	r0, r4
	mov	r2, #76800
	mov	r1, #224
	bl	gp2x_memset_all_buffers
.L24:
	ldr	r3, [r7]
	ldr	r2, [r6]
	ldr	r4, .L43+64
	tst	r2, r3
	rsbne	r9, r9, #0
	ldr	r1, [r4, #4]
	mov	r0, r9
	bl	gp2x_video_changemode
	mov	r1, #1
	ldr	r2, .L43+68
	ldr	r0, [r6, #4]
	ldr	r2, [r2]
	ldr	r3, .L43+72
	cmp	r0, r2
	ldr	r3, [r3]
	ldr	r2, [r5]
	str	r1, [r4]
	bic	r1, r2, r3
	orreq	r3, r3, r2
	str	r1, [r5]
	streq	r3, [r5]
	ldr	r3, .L43+76
	ldr	r2, [r8]
	ldr	r3, [r3]
	tst	r2, r3
	ldrne	r3, .L43+80
	ldreq	r3, .L43+84
	ldr	r2, [r3]
	ldr	r3, .L43+88
	str	r2, [r3]
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L3:
	ldr	r3, .L43+92
	ldr	r9, .L43+28
	ldr	r0, [r3]
	bl	PicoDrawSetOutFormat
	ldr	r2, .L43+32
	ldr	r1, [r9]
	ldr	r3, .L43+16
	ldr	r0, [r2]
	lsl	r1, r1, #1
	str	r3, [sp, #4]
	str	r2, [sp]
	ldr	r8, .L43+24
	bl	PicoDrawSetOutBuf
	ldr	r3, [sp, #4]
	ldr	r1, [r8]
	ldr	r0, [r3]
	ldr	r2, [sp]
	tst	r0, r1
	bne	.L6
.L11:
	ldr	r6, .L43+36
	ldr	r7, .L43+40
	ldr	r1, [r6]
	ldr	r2, [r7]
	mov	r9, #16
	tst	r1, r2
	beq	.L41
.L13:
	ldr	r3, [r3]
	ldr	r2, [r8]
	tst	r2, r3
	movne	r3, #1
	moveq	r3, #0
	cmp	r4, #130
	orreq	r3, r3, #1
	cmp	r3, #0
	beq	.L15
	ldr	r2, .L43+96
	ldr	r3, .L43+100
	ldr	r0, [r2]
	ldr	r1, [r3]
	str	r0, [fp]
	str	r1, [r10]
	b	.L14
.L23:
	mov	r1, #0
	mov	r2, #153600
	mov	r0, r1
	bl	gp2x_memset_all_buffers
	b	.L24
.L17:
	tst	r2, r3
	ldrne	r3, .L43+104
	ldreq	r3, .L43+108
	ldr	r2, [r3]
	b	.L22
.L2:
	ldr	r3, .L43+112
	ldr	r9, .L43+28
	ldr	r0, [r3]
	bl	PicoDrawSetOutFormat
	ldr	r2, .L43+32
	ldr	r1, [r9]
	ldr	r0, [r2]
	bl	PicoDrawSetOutBuf
.L10:
	ldr	r8, .L43+24
	ldr	r3, .L43+16
	ldr	r1, [r8]
	ldr	r2, [r3]
	tst	r1, r2
	bne	.L38
	mov	r9, #8
	ldr	r6, .L43+36
	ldr	r7, .L43+40
	b	.L7
.L40:
	ldr	r0, .L43+44
	orr	r3, r3, r2
	ldr	r0, [r0]
	str	r3, [r5]
	bl	PicoDrawSetOutFormat
	ldr	r2, .L43+116
	ldr	r3, .L43+120
	ldr	r2, [r2]
	str	r2, [r3]
	b	.L10
.L6:
	ldr	r6, .L43+36
	ldr	r7, .L43+40
	ldr	r0, [r6]
	ldr	r1, [r7]
	tst	r0, r1
	beq	.L9
	str	r3, [sp]
	ldr	r3, .L43+92
	mov	r1, #1
	ldr	r0, [r3]
	str	r2, [sp, #4]
	bl	PicoDrawSetOutFormat
	ldr	r3, [sp]
	ldr	r2, [sp, #4]
	b	.L12
.L15:
	cmp	r4, #129
	beq	.L42
	cmp	r4, #128
	ldreq	r2, .L43+124
	ldreq	r3, .L43+120
	ldreq	r2, [r2]
	ldr	r0, [fp]
	ldr	r1, [r10]
	streq	r2, [r3]
	b	.L14
.L42:
	ldr	r2, .L43+128
	ldr	r3, .L43+132
	ldr	r0, [r2]
	ldr	r1, [r3]
	str	r0, [fp]
	str	r1, [r10]
	b	.L14
.L44:
	.align	2
.L43:
	.word	PicoOpt
	.word	POPT_ALT_RENDERER
	.word	emu_scan_begin
	.word	emu_scan_end
	.word	PAHW_32X
	.word	.LC0
	.word	PicoAHW
	.word	g_screen_width
	.word	g_screen_ptr
	.word	currentConfig
	.word	EOPT_WIZ_TEAR_FIX
	.word	PDF_NONE
	.word	osd_text16_rot
	.word	emu_osd_text16
	.word	osd_text
	.word	localPal
	.word	Pico
	.word	EOPT_SCALE_SW
	.word	POPT_EN_SOFTSCALE
	.word	PAHW_SMS
	.word	make_local_pal_sms
	.word	make_local_pal_md
	.word	make_local_pal
	.word	PDF_RGB555
	.word	EmuScanBegin16_rot
	.word	EmuScanEnd16_rot
	.word	osd_text8_rot
	.word	osd_text8
	.word	PDF_8BIT
	.word	vidcpy_m2
	.word	vidcpyM2
	.word	vidcpy_m2_rot
	.word	EmuScanBegin8_rot
	.word	EmuScanEnd8_rot
	.size	vid_reset_mode, .-vid_reset_mode
	.comm	vidcpy_m2_rot,4,4
	.comm	vidcpy_m2,4,4
	.comm	vidcpyM2,4,4
	.comm	osd_text8_rot,4,4
	.comm	osd_text8,4,4
	.comm	osd_text16_rot,4,4
	.comm	osd_text,4,4
	.comm	make_local_pal_sms,4,4
	.comm	make_local_pal_md,4,4
	.comm	make_local_pal,4,4
	.comm	localPal,4,4
	.comm	g_screen_width,4,4
	.comm	g_screen_ptr,4,4
	.comm	emu_scan_end,4,4
	.comm	emu_scan_begin,4,4
	.comm	emu_osd_text16,4,4
	.comm	currentConfig,8,4
	.comm	PicoOpt,4,4
	.comm	PicoAHW,4,4
	.comm	Pico,8,4
	.comm	POPT_EN_SOFTSCALE,4,4
	.comm	POPT_ALT_RENDERER,4,4
	.comm	PDF_RGB555,4,4
	.comm	PDF_NONE,4,4
	.comm	PDF_8BIT,4,4
	.comm	PAHW_SMS,4,4
	.comm	PAHW_32X,4,4
	.comm	EmuScanEnd8_rot,4,4
	.comm	EmuScanEnd16_rot,4,4
	.comm	EmuScanBegin8_rot,4,4
	.comm	EmuScanBegin16_rot,4,4
	.comm	EOPT_WIZ_TEAR_FIX,4,4
	.comm	EOPT_SCALE_SW,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
