	.file	"extr_gx_video.c_gxCopyScreenshot.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	gxCopyScreenshot
	.type	gxCopyScreenshot, @function
gxCopyScreenshot:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	rbx, rdi
	sub	rsp, 24
	.cfi_def_cfa_offset 80
	mov	ecx, DWORD PTR vheight[rip]
	mov	r9d, DWORD PTR GX_CLAMP[rip]
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 8[rsp], rax
	xor	eax, eax
	mov	eax, DWORD PTR GX_FALSE[rip]
	lea	r15, 4[rsp]
	mov	edx, DWORD PTR vwidth[rip]
	mov	r8d, DWORD PTR GX_TF_RGB565[rip]
	mov	esi, DWORD PTR texturemem[rip]
	mov	rdi, r15
	push	rax
	.cfi_def_cfa_offset 88
	push	r9
	.cfi_def_cfa_offset 96
	call	GX_InitTexObj@PLT
	mov	esi, DWORD PTR GX_TEXMAP0[rip]
	mov	rdi, r15
	call	GX_LoadTexObj@PLT
	xor	eax, eax
	call	GX_InvalidateTexAll@PLT
	mov	ecx, DWORD PTR bitmap[rip]
	mov	eax, DWORD PTR bitmap[rip+4]
	mov	ebp, DWORD PTR bitmap[rip+12]
	lea	eax, [rcx+rax*2]
	lea	eax, [rax+rax*4]
	sal	eax, 7
	cdq
	idiv	ecx
	mov	r14d, eax
	mov	eax, DWORD PTR bitmap[rip+8]
	lea	r13d, [rax+rbp*2]
	mov	eax, r14d
	add	ebp, 120
	neg	eax
	neg	ebp
	add	r13d, r13d
	mov	r12d, eax
	add	ebp, ebp
	shr	r12d, 31
	add	r12d, eax
	pop	rax
	.cfi_def_cfa_offset 88
	pop	rdx
	.cfi_def_cfa_offset 80
	sar	r12d
	cmp	r14d, 639
	jle	.L5
	cmp	r13d, 479
	jle	.L5
.L2:
	mov	esi, DWORD PTR GX_VTXFMT0[rip]
	mov	edi, DWORD PTR GX_QUADS[rip]
	add	r13d, ebp
	add	r14d, r12d
	mov	edx, 4
	call	GX_Begin@PLT
	mov	esi, r13d
	mov	edi, r12d
	call	GX_Position2s16@PLT
	mov	ecx, 255
	mov	edx, 255
	mov	esi, 255
	mov	edi, 255
	call	GX_Color4u8@PLT
	movsd	xmm2, QWORD PTR .LC0[rip]
	pxor	xmm0, xmm0
	movapd	xmm1, xmm2
	call	GX_TexCoord2f32@PLT
	mov	esi, r13d
	mov	edi, r14d
	call	GX_Position2s16@PLT
	mov	ecx, 255
	mov	edx, 255
	mov	esi, 255
	mov	edi, 255
	call	GX_Color4u8@PLT
	mov	rax, QWORD PTR .LC0[rip]
	movq	xmm1, rax
	movq	xmm0, rax
	call	GX_TexCoord2f32@PLT
	mov	esi, ebp
	mov	edi, r14d
	call	GX_Position2s16@PLT
	mov	ecx, 255
	mov	edx, 255
	mov	esi, 255
	mov	edi, 255
	call	GX_Color4u8@PLT
	mov	rax, QWORD PTR .LC0[rip]
	pxor	xmm1, xmm1
	movq	xmm0, rax
	call	GX_TexCoord2f32@PLT
	mov	esi, ebp
	mov	edi, r12d
	call	GX_Position2s16@PLT
	mov	ecx, 255
	mov	edx, 255
	mov	esi, 255
	mov	edi, 255
	call	GX_Color4u8@PLT
	pxor	xmm1, xmm1
	movapd	xmm0, xmm1
	call	GX_TexCoord2f32@PLT
	xor	eax, eax
	call	GX_End@PLT
	mov	eax, DWORD PTR GX_TF_RGBA8[rip]
	xor	esi, esi
	xor	edi, edi
	mov	ecx, DWORD PTR bitmap[rip+8]
	mov	DWORD PTR [rbx], 320
	mov	edx, 640
	mov	DWORD PTR 12[rbx], eax
	mov	eax, DWORD PTR screenshot[rip]
	mov	DWORD PTR 4[rbx], ecx
	add	ecx, ecx
	mov	DWORD PTR 8[rbx], eax
	call	GX_SetTexCopySrc@PLT
	mov	edx, DWORD PTR 12[rbx]
	mov	ecx, DWORD PTR GX_TRUE[rip]
	mov	esi, DWORD PTR 4[rbx]
	mov	edi, DWORD PTR [rbx]
	call	GX_SetTexCopyDst@PLT
	xor	eax, eax
	call	GX_DrawDone@PLT
	mov	edi, DWORD PTR 8[rbx]
	mov	esi, DWORD PTR GX_TRUE[rip]
	call	GX_CopyTex@PLT
	xor	eax, eax
	call	GX_Flush@PLT
	xor	eax, eax
	call	GX_PixModeSync@PLT
	mov	esi, DWORD PTR GX_TEXMAP0[rip]
	mov	rdi, r15
	call	GX_LoadTexObj@PLT
	xor	eax, eax
	call	GX_InvalidateTexAll@PLT
	xor	eax, eax
	call	GX_Flush@PLT
	mov	esi, DWORD PTR [rbx]
	imul	esi, DWORD PTR 4[rbx]
	mov	edi, DWORD PTR 8[rbx]
	sal	esi, 2
	call	DCFlushRange@PLT
	mov	rax, QWORD PTR 8[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L11
	add	rsp, 24
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	.cfi_restore_state
	mov	r9d, DWORD PTR BLACK[rip]
	mov	ecx, 480
	xor	esi, esi
	xor	edi, edi
	mov	r8d, 255
	mov	edx, 640
	call	gxDrawRectangle@PLT
	jmp	.L2
.L11:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	gxCopyScreenshot, .-gxCopyScreenshot
	.comm	vwidth,4,4
	.comm	vheight,4,4
	.comm	texturemem,4,4
	.comm	screenshot,4,4
	.comm	bitmap,16,16
	.comm	GX_VTXFMT0,4,4
	.comm	GX_TRUE,4,4
	.comm	GX_TF_RGBA8,4,4
	.comm	GX_TF_RGB565,4,4
	.comm	GX_TEXMAP0,4,4
	.comm	GX_QUADS,4,4
	.comm	GX_FALSE,4,4
	.comm	GX_CLAMP,4,4
	.comm	BLACK,8,8
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	0
	.long	1072693248
	.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_gx_video.c_gxCopyScreenshot.c"
	.text
	.global	__aeabi_idiv
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	gxCopyScreenshot
	.syntax unified
	.arm
	.fpu softvfp
	.type	gxCopyScreenshot, %function
gxCopyScreenshot:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	ldr	r1, .L11
	ldr	r2, .L11+4
	ldr	r3, .L11+8
	ldr	lr, [r1]
	ldr	ip, [r2]
	ldr	r3, [r3]
	sub	sp, sp, #24
	mov	r4, r0
	ldr	r2, .L11+12
	ldr	r0, .L11+16
	ldr	r1, .L11+20
	str	lr, [sp, #12]
	str	ip, [sp]
	str	r3, [sp, #8]
	ldr	ip, .L11+24
	str	r3, [sp, #4]
	ldr	r9, .L11+28
	ldr	r3, [r0]
	ldr	r2, [r2]
	ldr	r8, .L11+32
	ldr	r1, [r1]
	add	r0, sp, #16
	ldr	ip, [ip]
	str	ip, [sp, #20]
	mov	ip,#0
	bl	GX_InitTexObj
	ldr	r1, [r9]
	add	r0, sp, #16
	bl	GX_LoadTexObj
	bl	GX_InvalidateTexAll
	ldr	r1, [r8]
	ldr	r0, [r8, #4]
	add	r0, r1, r0, lsl #1
	add	r0, r0, r0, lsl #2
	lsl	r0, r0, #7
	bl	__aeabi_idiv
	ldr	r3, [r8, #12]
	ldr	r5, [r8, #8]
	rsb	r6, r0, #0
	add	r5, r5, r3, lsl #1
	lsl	r5, r5, #1
	cmp	r5, #480
	cmpge	r0, #640
	add	r7, r3, #120
	add	r6, r6, r6, lsr #31
	rsb	r7, r7, r3, lsl #31
	mov	r10, r0
	asr	r6, r6, #1
	lsl	r7, r7, #1
	blt	.L9
.L2:
	ldr	r3, .L11+36
	ldr	r2, .L11+40
	ldr	r0, [r3]
	ldr	r1, [r2]
	add	r5, r5, r7
	mov	r2, #4
	bl	GX_Begin
	mov	r1, r5
	mov	r0, r6
	bl	GX_Position2s16
	mov	r3, #255
	mov	r2, r3
	mov	r1, r3
	mov	r0, r3
	bl	GX_Color4u8
	add	r10, r10, r6
	mov	r2, #0
	ldr	r3, .L11+44
	mov	r1, #0
	mov	r0, #0
	bl	GX_TexCoord2f32
	mov	r1, r5
	mov	r0, r10
	bl	GX_Position2s16
	mov	r3, #255
	mov	r2, r3
	mov	r1, r3
	mov	r0, r3
	bl	GX_Color4u8
	mov	r2, #0
	ldr	r3, .L11+44
	mov	r0, r2
	mov	r1, r3
	bl	GX_TexCoord2f32
	mov	r1, r7
	mov	r0, r10
	bl	GX_Position2s16
	mov	r3, #255
	mov	r2, r3
	mov	r1, r3
	mov	r0, r3
	bl	GX_Color4u8
	mov	r2, #0
	mov	r3, #0
	ldr	r1, .L11+44
	mov	r0, #0
	bl	GX_TexCoord2f32
	mov	r1, r7
	mov	r0, r6
	bl	GX_Position2s16
	mov	r3, #255
	mov	r2, r3
	mov	r1, r3
	mov	r0, r3
	bl	GX_Color4u8
	mov	r2, #0
	mov	r3, #0
	mov	r0, r2
	mov	r1, r3
	bl	GX_TexCoord2f32
	bl	GX_End
	mov	r1, #0
	mov	r2, #320
	ldr	ip, .L11+48
	ldr	r0, .L11+52
	ldr	ip, [ip]
	ldr	r3, [r8, #8]
	ldr	r0, [r0]
	ldr	r5, .L11+56
	str	ip, [r4, #12]
	str	r3, [r4, #4]
	str	r0, [r4, #8]
	lsl	r3, r3, #1
	mov	r0, r1
	str	r2, [r4]
	mov	r2, #640
	bl	GX_SetTexCopySrc
	ldm	r4, {r0, r1}
	ldr	r2, [r4, #12]
	ldr	r3, [r5]
	bl	GX_SetTexCopyDst
	bl	GX_DrawDone
	ldr	r1, [r5]
	ldr	r0, [r4, #8]
	bl	GX_CopyTex
	bl	GX_Flush
	bl	GX_PixModeSync
	ldr	r1, [r9]
	add	r0, sp, #16
	bl	GX_LoadTexObj
	bl	GX_InvalidateTexAll
	bl	GX_Flush
	ldm	r4, {r1, r3}
	mul	r1, r3, r1
	ldr	r0, [r4, #8]
	lsl	r1, r1, #2
	bl	DCFlushRange
	ldr	r3, .L11+24
	ldr	r2, [r3]
	ldr	r3, [sp, #20]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L10
	add	sp, sp, #24
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L9:
	mov	r2, #255
	mov	r1, #0
	ldr	r3, .L11+60
	str	r2, [sp]
	ldr	r3, [r3]
	mov	r0, r1
	str	r3, [sp, #4]
	mov	r2, #640
	mov	r3, #480
	bl	gxDrawRectangle
	b	.L2
.L10:
	bl	__stack_chk_fail
.L12:
	.align	2
.L11:
	.word	GX_FALSE
	.word	GX_TF_RGB565
	.word	GX_CLAMP
	.word	vwidth
	.word	vheight
	.word	texturemem
	.word	.LC0
	.word	GX_TEXMAP0
	.word	bitmap
	.word	GX_QUADS
	.word	GX_VTXFMT0
	.word	1072693248
	.word	GX_TF_RGBA8
	.word	screenshot
	.word	GX_TRUE
	.word	BLACK
	.size	gxCopyScreenshot, .-gxCopyScreenshot
	.comm	vwidth,4,4
	.comm	vheight,4,4
	.comm	texturemem,4,4
	.comm	screenshot,4,4
	.comm	bitmap,16,4
	.comm	GX_VTXFMT0,4,4
	.comm	GX_TRUE,4,4
	.comm	GX_TF_RGBA8,4,4
	.comm	GX_TF_RGB565,4,4
	.comm	GX_TEXMAP0,4,4
	.comm	GX_QUADS,4,4
	.comm	GX_FALSE,4,4
	.comm	GX_CLAMP,4,4
	.comm	BLACK,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
