	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function wiiu_gfx_load_texture
_wiiu_gfx_load_texture:                 ## @wiiu_gfx_load_texture
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	testq	%rdi, %rdi
	je	LBB0_1
## %bb.2:
	movq	%rsi, %r14
	movl	$1, %edi
	movl	$64, %esi
	callq	_calloc
	movq	%rax, %r12
	movl	(%r14), %eax
	leaq	8(%r12), %r15
	movl	%eax, 8(%r12)
	movl	4(%r14), %eax
	movl	%eax, 12(%r12)
	movl	$1, 16(%r12)
	movq	_GX2_SURFACE_DIM_TEXTURE_2D@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 52(%r12)
	movq	_GX2_TILE_MODE_LINEAR_ALIGNED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 48(%r12)
	movl	$1, (%r12)
	movq	_GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 44(%r12)
	movq	__G@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	__B@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	__A@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	__R@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	callq	_GX2_COMP_SEL
	movl	%eax, 56(%r12)
	movq	%r15, %rdi
	callq	_GX2CalcSurfaceSizeAndAlignment
	movq	%r12, %rdi
	callq	_GX2InitTextureRegs
	movl	24(%r12), %edi
	movl	40(%r12), %esi
	callq	_MEM2_alloc
	movq	%rax, 32(%r12)
	cmpl	$0, 4(%r14)
	jle	LBB0_7
## %bb.3:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	12(%r12), %ebx
	jge	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	movslq	20(%r12), %rax
	movslq	%ebx, %rdi
	imulq	%rax, %rdi
	shlq	$2, %rdi
	addq	32(%r12), %rdi
	movl	(%r14), %edx
	movl	%edx, %eax
	imull	%ebx, %eax
	movslq	%eax, %rsi
	addq	8(%r14), %rsi
	shll	$3, %edx
	callq	_memcpy
	incl	%ebx
	cmpl	4(%r14), %ebx
	jl	LBB0_4
LBB0_6:
	movq	32(%r12), %rax
LBB0_7:
	movq	_GX2_INVALIDATE_MODE_CPU_TEXTURE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	movl	24(%r12), %edx
	movq	%rax, %rsi
	callq	_GX2Invalidate
	jmp	LBB0_8
LBB0_1:
	xorl	%r12d, %r12d
LBB0_8:
	movq	%r12, %rax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GX2_SURFACE_DIM_TEXTURE_2D,4,2 ## @GX2_SURFACE_DIM_TEXTURE_2D
	.comm	_GX2_TILE_MODE_LINEAR_ALIGNED,4,2 ## @GX2_TILE_MODE_LINEAR_ALIGNED
	.comm	_GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8,4,2 ## @GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8
	.comm	__G,4,2                         ## @_G
	.comm	__B,4,2                         ## @_B
	.comm	__A,4,2                         ## @_A
	.comm	__R,4,2                         ## @_R
	.comm	_GX2_INVALIDATE_MODE_CPU_TEXTURE,4,2 ## @GX2_INVALIDATE_MODE_CPU_TEXTURE
	.no_dead_strip	_wiiu_gfx_load_texture
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function wiiu_gfx_load_texture
_wiiu_gfx_load_texture:                 ; @wiiu_gfx_load_texture
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	cbz	x0, LBB0_6
; %bb.1:
	mov	x20, x1
	mov	w22, #1
	mov	w0, #1
	mov	w1, #64
	bl	_calloc
	mov	x19, x0
	ldr	d0, [x20]
	mov	x21, x0
	str	d0, [x21, #8]!
Lloh0:
	adrp	x8, _GX2_SURFACE_DIM_TEXTURE_2D@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GX2_SURFACE_DIM_TEXTURE_2D@GOTPAGEOFF]
	str	w22, [x0, #16]
Lloh2:
	ldr	w8, [x8]
	str	w8, [x0, #52]
Lloh3:
	adrp	x8, _GX2_TILE_MODE_LINEAR_ALIGNED@GOTPAGE
Lloh4:
	ldr	x8, [x8, _GX2_TILE_MODE_LINEAR_ALIGNED@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	str	w22, [x0]
Lloh6:
	adrp	x9, _GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8@GOTPAGE
Lloh7:
	ldr	x9, [x9, _GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	stp	w9, w8, [x0, #44]
Lloh9:
	adrp	x8, __G@GOTPAGE
Lloh10:
	ldr	x8, [x8, __G@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x8]
Lloh12:
	adrp	x8, __B@GOTPAGE
Lloh13:
	ldr	x8, [x8, __B@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
Lloh15:
	adrp	x8, __A@GOTPAGE
Lloh16:
	ldr	x8, [x8, __A@GOTPAGEOFF]
Lloh17:
	ldr	w2, [x8]
Lloh18:
	adrp	x8, __R@GOTPAGE
Lloh19:
	ldr	x8, [x8, __R@GOTPAGEOFF]
Lloh20:
	ldr	w3, [x8]
	bl	_GX2_COMP_SEL
	str	w0, [x19, #56]
	mov	x0, x21
	bl	_GX2CalcSurfaceSizeAndAlignment
	mov	x0, x19
	bl	_GX2InitTextureRegs
	ldr	w0, [x19, #24]
	ldr	w1, [x19, #40]
	bl	_MEM2_alloc
	str	x0, [x19, #32]
	ldr	w8, [x20, #4]
	cmp	w8, #1
	b.lt	LBB0_7
; %bb.2:
	mov	w21, #0
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x19, #12]
	cmp	w21, w8
	b.ge	LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x8, [x19, #32]
	ldr	w9, [x19, #20]
	mul	w9, w9, w21
	add	x0, x8, w9, sxtw #2
	ldr	x8, [x20, #8]
	ldr	w9, [x20]
	mul	w10, w9, w21
	add	x1, x8, w10, sxtw
	lsl	w2, w9, #3
	bl	_memcpy
	add	w21, w21, #1
	ldr	w8, [x20, #4]
	cmp	w21, w8
	b.lt	LBB0_3
LBB0_5:
	ldr	x1, [x19, #32]
	b	LBB0_8
LBB0_6:
	mov	x19, #0
	b	LBB0_9
LBB0_7:
	mov	x1, x0
LBB0_8:
Lloh21:
	adrp	x8, _GX2_INVALIDATE_MODE_CPU_TEXTURE@GOTPAGE
Lloh22:
	ldr	x8, [x8, _GX2_INVALIDATE_MODE_CPU_TEXTURE@GOTPAGEOFF]
Lloh23:
	ldr	w0, [x8]
	ldr	w2, [x19, #24]
	bl	_GX2Invalidate
LBB0_9:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_GX2_SURFACE_DIM_TEXTURE_2D,4,2 ; @GX2_SURFACE_DIM_TEXTURE_2D
	.comm	_GX2_TILE_MODE_LINEAR_ALIGNED,4,2 ; @GX2_TILE_MODE_LINEAR_ALIGNED
	.comm	_GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8,4,2 ; @GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8
	.comm	__G,4,2                         ; @_G
	.comm	__B,4,2                         ; @_B
	.comm	__A,4,2                         ; @_A
	.comm	__R,4,2                         ; @_R
	.comm	_GX2_INVALIDATE_MODE_CPU_TEXTURE,4,2 ; @GX2_INVALIDATE_MODE_CPU_TEXTURE
	.no_dead_strip	_wiiu_gfx_load_texture
.subsections_via_symbols
