	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_load_cube_texture_from_dds     ## -- Begin function load_cube_texture_from_dds
	.p2align	4, 0x90
_load_cube_texture_from_dds:            ## @load_cube_texture_from_dds
	.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	%r13
	pushq	%r12
	pushq	%rbx
	subq	$88, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
                                        ## kill: def $r8d killed $r8d def $r8
	movq	%r8, -88(%rbp)                  ## 8-byte Spill
                                        ## kill: def $ecx killed $ecx def $rcx
	movq	%rcx, -80(%rbp)                 ## 8-byte Spill
	movq	%rdx, -72(%rbp)                 ## 8-byte Spill
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	movq	(%r9), %rax
	movq	_D3DRTYPE_CUBETEXTURE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_6
## %bb.1:
	movq	%rsi, %rbx
	movl	(%rsi), %eax
	movq	_DDS_CAPS2_CUBEMAP_ALL_FACES@GOTPCREL(%rip), %rcx
	notl	%eax
	testl	%eax, (%rcx)
	jne	LBB0_5
## %bb.2:
	movq	%r9, %r13
	movq	8(%r9), %r14
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_IDirect3DCubeTexture9_GetLevelCount
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_min
	movq	%rax, -96(%rbp)                 ## 8-byte Spill
	movq	_D3DCUBEMAP_FACE_POSITIVE_X@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	_D3DCUBEMAP_FACE_NEGATIVE_Z@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	cmpl	%eax, %ecx
	jle	LBB0_9
LBB0_3:
	movq	_D3D_OK@GOTPCREL(%rip), %rax
	jmp	LBB0_7
LBB0_5:
	leaq	L_.str(%rip), %rdi
	callq	_WARN
LBB0_6:
	movq	_D3DXERR_INVALIDDATA@GOTPCREL(%rip), %rax
LBB0_7:
	movl	(%rax), %r12d
LBB0_8:
	movl	%r12d, %eax
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	addq	$4, %rbx
	movq	8(%r13), %rcx
	jmp	LBB0_12
LBB0_10:                                ##   in Loop: Header=BB0_12 Depth=1
	movq	_D3DCUBEMAP_FACE_NEGATIVE_Z@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_11:                                ##   in Loop: Header=BB0_12 Depth=1
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	leal	1(%rsi), %edx
	cmpl	%eax, %esi
                                        ## kill: def $edx killed $edx def $rdx
	movq	%rdx, -48(%rbp)                 ## 8-byte Spill
	jge	LBB0_3
LBB0_12:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_15 Depth 2
	testq	%rcx, %rcx
	jle	LBB0_11
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	16(%r13), %r15
	xorl	%r14d, %r14d
	jmp	LBB0_15
	.p2align	4, 0x90
LBB0_14:                                ##   in Loop: Header=BB0_15 Depth=2
	movq	-104(%rbp), %rax
	leaq	(%rbx,%rax,4), %rbx
	movq	%r15, %rsi
	shrq	$63, %rsi
	addq	%r15, %rsi
	sarq	%rsi
	movl	$1, %edi
	callq	_max
	movq	%rax, %r15
	incq	%r14
	movq	8(%r13), %rcx
	cmpq	%rcx, %r14
	jge	LBB0_10
LBB0_15:                                ##   Parent Loop BB0_12 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	24(%r13), %edi
	movq	%r15, %rsi
	movq	%r15, %rdx
	leaq	-112(%rbp), %rcx
	leaq	-104(%rbp), %r8
	callq	_calculate_dds_surface_size
	movl	%eax, %r12d
	movl	%eax, %edi
	callq	_FAILED
	testq	%rax, %rax
	jne	LBB0_8
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=2
	cmpq	-96(%rbp), %r14                 ## 8-byte Folded Reload
	jge	LBB0_14
## %bb.17:                              ##   in Loop: Header=BB0_15 Depth=2
	leaq	-116(%rbp), %r12
	movq	%r12, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	movq	%r15, %rcx
	movq	%r15, %r8
	callq	_SetRect
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
                                        ## kill: def $esi killed $esi killed $rsi
	movq	%r14, %rdx
	leaq	-64(%rbp), %rcx
	callq	_IDirect3DCubeTexture9_GetCubeMapSurface
	movq	-64(%rbp), %rdi
	movl	24(%r13), %r8d
	movq	-112(%rbp), %r9
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	xorl	%edx, %edx
	movq	%rbx, %rcx
	pushq	-88(%rbp)                       ## 8-byte Folded Reload
	pushq	-80(%rbp)                       ## 8-byte Folded Reload
	pushq	%r12
	pushq	$0
	callq	_D3DXLoadSurfaceFromMemory
	addq	$32, %rsp
	movl	%eax, %r12d
	movq	-64(%rbp), %rdi
	callq	_IDirect3DSurface9_Release
	movl	%r12d, %edi
	callq	_FAILED
	testq	%rax, %rax
	je	LBB0_14
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.comm	_D3DRTYPE_CUBETEXTURE,8,3       ## @D3DRTYPE_CUBETEXTURE
	.comm	_D3DXERR_INVALIDDATA,4,2        ## @D3DXERR_INVALIDDATA
	.comm	_DDS_CAPS2_CUBEMAP_ALL_FACES,4,2 ## @DDS_CAPS2_CUBEMAP_ALL_FACES
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Only full cubemaps are supported\n"

	.comm	_D3DCUBEMAP_FACE_POSITIVE_X,4,2 ## @D3DCUBEMAP_FACE_POSITIVE_X
	.comm	_D3DCUBEMAP_FACE_NEGATIVE_Z,4,2 ## @D3DCUBEMAP_FACE_NEGATIVE_Z
	.comm	_D3D_OK,4,2                     ## @D3D_OK
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_load_cube_texture_from_dds     ; -- Begin function load_cube_texture_from_dds
	.p2align	2
_load_cube_texture_from_dds:            ; @load_cube_texture_from_dds
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	str	w4, [sp, #12]                   ; 4-byte Folded Spill
	ldr	x8, [x5]
Lloh0:
	adrp	x9, _D3DRTYPE_CUBETEXTURE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _D3DRTYPE_CUBETEXTURE@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_5
; %bb.1:
	mov	x20, x1
	ldr	w8, [x1]
Lloh3:
	adrp	x9, _DDS_CAPS2_CUBEMAP_ALL_FACES@GOTPAGE
Lloh4:
	ldr	x9, [x9, _DDS_CAPS2_CUBEMAP_ALL_FACES@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	bics	wzr, w9, w8
	b.ne	LBB0_4
; %bb.2:
	mov	x19, x5
	mov	x21, x3
	mov	x22, x2
	mov	x23, x0
	ldr	x24, [x5, #8]
	bl	_IDirect3DCubeTexture9_GetLevelCount
	mov	x1, x0
	mov	x0, x24
	bl	_min
Lloh6:
	adrp	x8, _D3DCUBEMAP_FACE_POSITIVE_X@GOTPAGE
Lloh7:
	ldr	x8, [x8, _D3DCUBEMAP_FACE_POSITIVE_X@GOTPAGEOFF]
Lloh8:
	ldr	w25, [x8]
Lloh9:
	adrp	x8, _D3DCUBEMAP_FACE_NEGATIVE_Z@GOTPAGE
Lloh10:
	ldr	x8, [x8, _D3DCUBEMAP_FACE_NEGATIVE_Z@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	cmp	w25, w8
	b.le	LBB0_8
LBB0_3:
Lloh12:
	adrp	x8, _D3D_OK@GOTPAGE
Lloh13:
	ldr	x8, [x8, _D3D_OK@GOTPAGEOFF]
	b	LBB0_6
LBB0_4:
Lloh14:
	adrp	x0, l_.str@PAGE
Lloh15:
	add	x0, x0, l_.str@PAGEOFF
	bl	_WARN
LBB0_5:
Lloh16:
	adrp	x8, _D3DXERR_INVALIDDATA@GOTPAGE
Lloh17:
	ldr	x8, [x8, _D3DXERR_INVALIDDATA@GOTPAGEOFF]
LBB0_6:
	ldr	w20, [x8]
LBB0_7:
	mov	x0, x20
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
LBB0_8:
	mov	x24, x0
	add	x26, x20, #4
	ldr	x9, [x19, #8]
	b	LBB0_11
LBB0_9:                                 ;   in Loop: Header=BB0_11 Depth=1
Lloh18:
	adrp	x8, _D3DCUBEMAP_FACE_NEGATIVE_Z@GOTPAGE
Lloh19:
	ldr	x8, [x8, _D3DCUBEMAP_FACE_NEGATIVE_Z@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
LBB0_10:                                ;   in Loop: Header=BB0_11 Depth=1
	add	w10, w25, #1
	cmp	w25, w8
	mov	x25, x10
	b.ge	LBB0_3
LBB0_11:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_14 Depth 2
	cmp	x9, #1
	b.lt	LBB0_10
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	mov	x27, #0
	ldr	x28, [x19, #16]
	b	LBB0_14
LBB0_13:                                ;   in Loop: Header=BB0_14 Depth=2
	ldr	x8, [sp, #24]
	add	x26, x26, x8, lsl #2
	cmp	x28, #0
	cinc	x8, x28, lt
	asr	x1, x8, #1
	mov	w0, #1
	bl	_max
	mov	x28, x0
	add	x27, x27, #1
	ldr	x9, [x19, #8]
	cmp	x27, x9
	b.ge	LBB0_9
LBB0_14:                                ;   Parent Loop BB0_11 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w0, [x19, #24]
	add	x3, sp, #32
	add	x4, sp, #24
	mov	x1, x28
	mov	x2, x28
	bl	_calculate_dds_surface_size
	mov	x20, x0
	bl	_FAILED
	cbnz	x0, LBB0_7
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=2
	cmp	x27, x24
	b.ge	LBB0_13
; %bb.16:                               ;   in Loop: Header=BB0_14 Depth=2
	add	x0, sp, #44
	mov	w1, #0
	mov	w2, #0
	mov	x3, x28
	mov	x4, x28
	bl	_SetRect
	add	x3, sp, #16
	mov	x0, x23
	mov	x1, x25
	mov	x2, x27
	bl	_IDirect3DCubeTexture9_GetCubeMapSurface
	ldr	x0, [sp, #16]
	ldr	w4, [x19, #24]
	ldr	x5, [sp, #32]
	ldr	w8, [sp, #12]                   ; 4-byte Folded Reload
	stp	w21, w8, [sp]
	add	x7, sp, #44
	mov	x1, x22
	mov	x2, #0
	mov	x3, x26
	mov	x6, #0
	bl	_D3DXLoadSurfaceFromMemory
	mov	x20, x0
	ldr	x0, [sp, #16]
	bl	_IDirect3DSurface9_Release
	mov	x0, x20
	bl	_FAILED
	cbz	x0, LBB0_13
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_D3DRTYPE_CUBETEXTURE,8,3       ; @D3DRTYPE_CUBETEXTURE
	.comm	_D3DXERR_INVALIDDATA,4,2        ; @D3DXERR_INVALIDDATA
	.comm	_DDS_CAPS2_CUBEMAP_ALL_FACES,4,2 ; @DDS_CAPS2_CUBEMAP_ALL_FACES
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Only full cubemaps are supported\n"

	.comm	_D3DCUBEMAP_FACE_POSITIVE_X,4,2 ; @D3DCUBEMAP_FACE_POSITIVE_X
	.comm	_D3DCUBEMAP_FACE_NEGATIVE_Z,4,2 ; @D3DCUBEMAP_FACE_NEGATIVE_Z
	.comm	_D3D_OK,4,2                     ; @D3D_OK
.subsections_via_symbols
