	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_save_dds_texture_to_memory     ## -- Begin function save_dds_texture_to_memory
	.p2align	4, 0x90
_save_dds_texture_to_memory:            ## @save_dds_texture_to_memory
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r12
	movq	%rsi, %r15
	movq	%rdi, %r14
	movq	%rsi, %rdi
	callq	_IDirect3DBaseTexture9_GetType
	movq	%rax, %rbx
	movq	_D3DRTYPE_TEXTURE@GOTPCREL(%rip), %rdx
	movq	_D3DRTYPE_CUBETEXTURE@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movq	_D3DRTYPE_VOLUMETEXTURE@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	(%rdx), %rbx
	je	LBB0_4
## %bb.1:
	cmpq	%rcx, %rbx
	je	LBB0_4
## %bb.2:
	cmpq	%rax, %rbx
	je	LBB0_4
## %bb.3:
	movq	_D3DERR_INVALIDCALL@GOTPCREL(%rip), %rax
	jmp	LBB0_13
LBB0_4:
	cmpq	%rcx, %rbx
	jne	LBB0_6
## %bb.5:
	leaq	L_.str(%rip), %rdi
	jmp	LBB0_12
LBB0_6:
	cmpq	%rax, %rbx
	jne	LBB0_8
## %bb.7:
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_12
LBB0_8:
	movq	%r15, %rdi
	callq	_IDirect3DTexture9_GetLevelCount
	cmpl	$2, %eax
	jl	LBB0_10
## %bb.9:
	leaq	L_.str.2(%rip), %rdi
	jmp	LBB0_12
LBB0_10:
	testq	%r12, %r12
	je	LBB0_15
## %bb.11:
	leaq	L_.str.3(%rip), %rdi
LBB0_12:
	callq	_FIXME
	movq	_E_NOTIMPL@GOTPCREL(%rip), %rax
LBB0_13:
	movl	(%rax), %ebx
LBB0_14:
	movl	%ebx, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_15:
	movq	_D3DCUBEMAP_FACE_POSITIVE_X@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	-40(%rbp), %r8
	movq	%rbx, %rdi
	movq	%r15, %rsi
	xorl	%ecx, %ecx
	callq	_get_surface
	movl	%eax, %ebx
	movl	%eax, %edi
	callq	_SUCCEEDED
	testq	%rax, %rax
	je	LBB0_14
## %bb.16:
	movq	-40(%rbp), %rsi
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_save_dds_surface_to_memory
	movl	%eax, %ebx
	movq	-40(%rbp), %rdi
	callq	_IDirect3DSurface9_Release
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_D3DRTYPE_TEXTURE,8,3           ## @D3DRTYPE_TEXTURE
	.comm	_D3DRTYPE_CUBETEXTURE,8,3       ## @D3DRTYPE_CUBETEXTURE
	.comm	_D3DRTYPE_VOLUMETEXTURE,8,3     ## @D3DRTYPE_VOLUMETEXTURE
	.comm	_D3DERR_INVALIDCALL,4,2         ## @D3DERR_INVALIDCALL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Cube texture not supported yet\n"

	.comm	_E_NOTIMPL,4,2                  ## @E_NOTIMPL
L_.str.1:                               ## @.str.1
	.asciz	"Volume texture not supported yet\n"

L_.str.2:                               ## @.str.2
	.asciz	"Mipmap not supported yet\n"

L_.str.3:                               ## @.str.3
	.asciz	"Saving surfaces with palettized pixel formats not implemented yet\n"

	.comm	_D3DCUBEMAP_FACE_POSITIVE_X,4,2 ## @D3DCUBEMAP_FACE_POSITIVE_X
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_save_dds_texture_to_memory     ; -- Begin function save_dds_texture_to_memory
	.p2align	2
_save_dds_texture_to_memory:            ; @save_dds_texture_to_memory
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x22, x2
	mov	x20, x1
	mov	x19, x0
	mov	x0, x1
	bl	_IDirect3DBaseTexture9_GetType
Lloh0:
	adrp	x8, _D3DRTYPE_TEXTURE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _D3DRTYPE_TEXTURE@GOTPAGEOFF]
Lloh2:
	ldr	x10, [x8]
Lloh3:
	adrp	x8, _D3DRTYPE_CUBETEXTURE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _D3DRTYPE_CUBETEXTURE@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x8]
Lloh6:
	adrp	x8, _D3DRTYPE_VOLUMETEXTURE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _D3DRTYPE_VOLUMETEXTURE@GOTPAGEOFF]
Lloh8:
	ldr	x8, [x8]
	cmp	x0, x10
	ccmp	x0, x9, #4, ne
	ccmp	x0, x8, #4, ne
	b.ne	LBB0_3
; %bb.1:
	mov	x21, x0
	cmp	x0, x9
	b.ne	LBB0_4
; %bb.2:
Lloh9:
	adrp	x0, l_.str@PAGE
Lloh10:
	add	x0, x0, l_.str@PAGEOFF
	b	LBB0_10
LBB0_3:
Lloh11:
	adrp	x8, _D3DERR_INVALIDCALL@GOTPAGE
Lloh12:
	ldr	x8, [x8, _D3DERR_INVALIDCALL@GOTPAGEOFF]
	b	LBB0_11
LBB0_4:
	cmp	x21, x8
	b.ne	LBB0_6
; %bb.5:
Lloh13:
	adrp	x0, l_.str.1@PAGE
Lloh14:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_10
LBB0_6:
	mov	x0, x20
	bl	_IDirect3DTexture9_GetLevelCount
	cmp	w0, #2
	b.lt	LBB0_8
; %bb.7:
Lloh15:
	adrp	x0, l_.str.2@PAGE
Lloh16:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_10
LBB0_8:
	cbz	x22, LBB0_13
; %bb.9:
Lloh17:
	adrp	x0, l_.str.3@PAGE
Lloh18:
	add	x0, x0, l_.str.3@PAGEOFF
LBB0_10:
	bl	_FIXME
Lloh19:
	adrp	x8, _E_NOTIMPL@GOTPAGE
Lloh20:
	ldr	x8, [x8, _E_NOTIMPL@GOTPAGEOFF]
LBB0_11:
	ldr	w20, [x8]
LBB0_12:
	mov	x0, x20
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
LBB0_13:
Lloh21:
	adrp	x8, _D3DCUBEMAP_FACE_POSITIVE_X@GOTPAGE
Lloh22:
	ldr	x8, [x8, _D3DCUBEMAP_FACE_POSITIVE_X@GOTPAGEOFF]
Lloh23:
	ldr	w2, [x8]
	add	x4, sp, #8
	mov	x0, x21
	mov	x1, x20
	mov	w3, #0
	bl	_get_surface
	mov	x20, x0
	bl	_SUCCEEDED
	cbz	x0, LBB0_12
; %bb.14:
	ldr	x1, [sp, #8]
	mov	x0, x19
	mov	x2, #0
	bl	_save_dds_surface_to_memory
	mov	x20, x0
	ldr	x0, [sp, #8]
	bl	_IDirect3DSurface9_Release
	b	LBB0_12
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_D3DRTYPE_TEXTURE,8,3           ; @D3DRTYPE_TEXTURE
	.comm	_D3DRTYPE_CUBETEXTURE,8,3       ; @D3DRTYPE_CUBETEXTURE
	.comm	_D3DRTYPE_VOLUMETEXTURE,8,3     ; @D3DRTYPE_VOLUMETEXTURE
	.comm	_D3DERR_INVALIDCALL,4,2         ; @D3DERR_INVALIDCALL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Cube texture not supported yet\n"

	.comm	_E_NOTIMPL,4,2                  ; @E_NOTIMPL
l_.str.1:                               ; @.str.1
	.asciz	"Volume texture not supported yet\n"

l_.str.2:                               ; @.str.2
	.asciz	"Mipmap not supported yet\n"

l_.str.3:                               ; @.str.3
	.asciz	"Saving surfaces with palettized pixel formats not implemented yet\n"

	.comm	_D3DCUBEMAP_FACE_POSITIVE_X,4,2 ; @D3DCUBEMAP_FACE_POSITIVE_X
.subsections_via_symbols
