	.file	"extr_gx2_gfx.c_wiiu_gfx_load_texture.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	wiiu_gfx_load_texture, @function
wiiu_gfx_load_texture:
.LFB0:
	.cfi_startproc
	endbr64
	test	rdi, rdi
	je	.L11
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	mov	edi, 1
	mov	r12, rsi
	mov	esi, 64
	push	rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	push	rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	xor	ebx, ebx
	call	calloc@PLT
	mov	ecx, DWORD PTR _R[rip]
	mov	edx, DWORD PTR _A[rip]
	mov	rbp, rax
	mov	eax, DWORD PTR [r12]
	mov	esi, DWORD PTR _B[rip]
	mov	edi, DWORD PTR _G[rip]
	mov	DWORD PTR 8[rbp], eax
	mov	eax, DWORD PTR 4[r12]
	mov	DWORD PTR 16[rbp], 1
	mov	DWORD PTR 12[rbp], eax
	mov	eax, DWORD PTR GX2_SURFACE_DIM_TEXTURE_2D[rip]
	mov	DWORD PTR 52[rbp], eax
	mov	eax, DWORD PTR GX2_TILE_MODE_LINEAR_ALIGNED[rip]
	mov	DWORD PTR 0[rbp], 1
	mov	DWORD PTR 48[rbp], eax
	mov	eax, DWORD PTR GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8[rip]
	mov	DWORD PTR 44[rbp], eax
	call	GX2_COMP_SEL@PLT
	lea	rdi, 8[rbp]
	mov	DWORD PTR 56[rbp], eax
	call	GX2CalcSurfaceSizeAndAlignment@PLT
	mov	rdi, rbp
	call	GX2InitTextureRegs@PLT
	mov	esi, DWORD PTR 40[rbp]
	mov	edi, DWORD PTR 24[rbp]
	call	MEM2_alloc@PLT
	mov	QWORD PTR 32[rbp], rax
	mov	r8, rax
	mov	eax, DWORD PTR 4[r12]
	test	eax, eax
	jg	.L3
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L6:
	mov	edx, DWORD PTR 20[rbp]
	mov	esi, DWORD PTR [r12]
	imul	edx, ebx
	lea	r9d, 0[0+rsi*8]
	imul	esi, ebx
	add	ebx, 1
	movsx	rdx, edx
	lea	rdi, [r8+rdx*4]
	movsx	rsi, esi
	mov	edx, r9d
	add	rsi, QWORD PTR 8[r12]
	call	memcpy@PLT
	cmp	DWORD PTR 4[r12], ebx
	mov	r8, QWORD PTR 32[rbp]
	jle	.L4
.L3:
	cmp	DWORD PTR 12[rbp], ebx
	jg	.L6
.L4:
	mov	edx, DWORD PTR 24[rbp]
	mov	edi, DWORD PTR GX2_INVALIDATE_MODE_CPU_TEXTURE[rip]
	mov	rsi, r8
	call	GX2Invalidate@PLT
	mov	rax, rbp
	pop	rbx
	.cfi_def_cfa_offset 24
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	xor	eax, eax
	ret
	.cfi_endproc
.LFE0:
	.size	wiiu_gfx_load_texture, .-wiiu_gfx_load_texture
	.comm	_R,4,4
	.comm	_G,4,4
	.comm	_B,4,4
	.comm	_A,4,4
	.comm	GX2_TILE_MODE_LINEAR_ALIGNED,4,4
	.comm	GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8,4,4
	.comm	GX2_SURFACE_DIM_TEXTURE_2D,4,4
	.comm	GX2_INVALIDATE_MODE_CPU_TEXTURE,4,4
	.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_gx2_gfx.c_wiiu_gfx_load_texture.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	wiiu_gfx_load_texture, %function
wiiu_gfx_load_texture:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	cmp	r0, #0
	bxeq	lr
	push	{r4, r5, r6, lr}
	mov	r0, #1
	mov	r6, r1
	mov	r1, #48
	bl	calloc
	mov	r4, r0
	mov	ip, #1
	ldr	r2, [r6]
	ldr	r1, .L14
	ldr	r0, .L14+4
	ldr	r1, [r1]
	ldr	r0, [r0]
	ldr	r3, .L14+8
	str	r2, [r4, #4]
	ldr	r2, [r6, #4]
	ldr	lr, [r3]
	str	r2, [r4, #8]
	str	r1, [r4, #40]
	str	r0, [r4, #36]
	ldr	r3, .L14+12
	ldr	r2, .L14+16
	ldr	r1, .L14+20
	ldr	r0, .L14+24
	ldr	r2, [r2]
	ldr	r1, [r1]
	ldr	r3, [r3]
	ldr	r0, [r0]
	str	lr, [r4, #32]
	str	ip, [r4, #12]
	str	ip, [r4]
	bl	GX2_COMP_SEL
	mov	r3, r0
	add	r0, r4, #4
	str	r3, [r4, #44]
	bl	GX2CalcSurfaceSizeAndAlignment
	mov	r0, r4
	bl	GX2InitTextureRegs
	ldr	r1, [r4, #28]
	ldr	r0, [r4, #20]
	bl	MEM2_alloc
	ldr	r3, [r6, #4]
	str	r0, [r4, #24]
	cmp	r3, #0
	movgt	r5, #0
	bgt	.L3
	b	.L4
.L6:
	ldr	r3, [r4, #16]
	ldr	ip, [r6]
	mul	r3, r5, r3
	ldr	r1, [r6, #8]
	add	r0, r0, r3, lsl #2
	mla	r1, r5, ip, r1
	lsl	r2, ip, #2
	bl	memcpy
	ldr	r3, [r6, #4]
	add	r5, r5, #1
	cmp	r3, r5
	ldr	r0, [r4, #24]
	ble	.L4
.L3:
	ldr	r3, [r4, #8]
	cmp	r3, r5
	bgt	.L6
.L4:
	ldr	r3, .L14+28
	mov	r1, r0
	ldr	r2, [r4, #20]
	ldr	r0, [r3]
	bl	GX2Invalidate
	mov	r0, r4
	pop	{r4, r5, r6, pc}
.L15:
	.align	2
.L14:
	.word	GX2_SURFACE_DIM_TEXTURE_2D
	.word	GX2_TILE_MODE_LINEAR_ALIGNED
	.word	GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8
	.word	_R
	.word	_A
	.word	_B
	.word	_G
	.word	GX2_INVALIDATE_MODE_CPU_TEXTURE
	.size	wiiu_gfx_load_texture, .-wiiu_gfx_load_texture
	.comm	_R,4,4
	.comm	_G,4,4
	.comm	_B,4,4
	.comm	_A,4,4
	.comm	GX2_TILE_MODE_LINEAR_ALIGNED,4,4
	.comm	GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8,4,4
	.comm	GX2_SURFACE_DIM_TEXTURE_2D,4,4
	.comm	GX2_INVALIDATE_MODE_CPU_TEXTURE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
