	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_WriteTGA                       ## -- Begin function WriteTGA
	.p2align	4, 0x90
_WriteTGA:                              ## @WriteTGA
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r13d
	movl	%edx, %r15d
	movq	%rsi, %r12
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	movl	%edx, %eax
	imull	%ecx, %eax
	leal	18(,%rax,4), %edi
	movl	%edi, -44(%rbp)                 ## 4-byte Spill
	movl	%eax, %r14d
	shll	$2, %r14d
	callq	_malloc
	movq	%rax, %rbx
	movq	%rax, %rdi
	xorl	%esi, %esi
	movl	$18, %edx
	callq	_memset
	movl	$2, 8(%rbx)
	movzbl	%r15b, %eax
	movl	%eax, 48(%rbx)
	sarl	$8, %r15d
	movl	%r15d, 52(%rbx)
	movzbl	%r13b, %eax
	movl	%eax, 56(%rbx)
	sarl	$8, %r13d
	movl	%r13d, 60(%rbx)
	movl	$32, 64(%rbx)
	testl	%r14d, %r14d
	movl	-44(%rbp), %r14d                ## 4-byte Reload
	jle	LBB0_3
## %bb.1:
	movl	%r14d, %eax
	movl	$18, %ecx
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movl	-64(%r12,%rcx,4), %edx
	movl	%edx, (%rbx,%rcx,4)
	movl	-68(%r12,%rcx,4), %edx
	movl	%edx, 4(%rbx,%rcx,4)
	movl	-72(%r12,%rcx,4), %edx
	movl	%edx, 8(%rbx,%rcx,4)
	movl	-60(%r12,%rcx,4), %edx
	movl	%edx, 12(%rbx,%rcx,4)
	addq	$4, %rcx
	cmpq	%rax, %rcx
	jb	LBB0_2
LBB0_3:
	leaq	L_.str(%rip), %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_fopen
	movq	%rax, %r15
	movq	%rbx, %rdi
	movl	$1, %esi
	movl	%r14d, %edx
	movq	%rax, %rcx
	callq	_fwrite
	movq	%r15, %rdi
	callq	_fclose
	movq	%rbx, %rdi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_free                           ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"wb"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_WriteTGA                       ; -- Begin function WriteTGA
	.p2align	2
_WriteTGA:                              ; @WriteTGA
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x23, x3
	mov	x24, x2
	mov	x22, x1
	mov	x21, x0
	mul	w8, w2, w3
	lsl	w25, w8, #2
	add	w20, w25, #18
	mov	x0, x20
	bl	_malloc
	mov	x19, x0
	mov	w1, #0
	mov	w2, #18
	bl	_memset
	mov	w8, #2
	str	w8, [x19, #8]
	and	w8, w24, #0xff
	asr	w9, w24, #8
	stp	w8, w9, [x19, #48]
	and	w8, w23, #0xff
	asr	w9, w23, #8
	stp	w8, w9, [x19, #56]
	mov	w8, #32
	str	w8, [x19, #64]
	cmp	w25, #1
	b.lt	LBB0_9
; %bb.1:
	mov	w8, #22
	cmp	x20, #22
	csel	x8, x20, x8, hi
	sub	x8, x8, #19
	cmp	x8, #12
	b.lo	LBB0_6
; %bb.2:
	add	x9, x19, #72
	mov	w10, #22
	cmp	x20, #22
	csel	x10, x20, x10, hi
	sub	x10, x10, #19
	and	x10, x10, #0x3ffffffffffffffc
	lsl	x10, x10, #2
	add	x11, x10, x19
	add	x11, x11, #88
	add	x10, x10, x22
	add	x10, x10, #16
	cmp	x9, x10
	ccmp	x11, x22, #0, lo
	b.hi	LBB0_6
; %bb.3:
	lsr	x8, x8, #2
	add	x10, x8, #1
	and	x11, x10, #0x7ffffffffffffffc
	lsl	x8, x11, #2
	add	x8, x8, #18
	mov	x12, x11
	mov	x13, x22
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ld4.4s	{ v0, v1, v2, v3 }, [x13], #64
	mov.16b	v4, v2
	mov.16b	v5, v1
	mov.16b	v6, v0
	mov.16b	v7, v3
	st4.4s	{ v4, v5, v6, v7 }, [x9], #64
	subs	x12, x12, #4
	b.ne	LBB0_4
; %bb.5:
	cmp	x10, x11
	b.ne	LBB0_7
	b	LBB0_9
LBB0_6:
	mov	w8, #18
LBB0_7:
	lsl	x10, x8, #2
	add	x9, x10, x19
	add	x9, x9, #8
	add	x10, x10, x22
	sub	x10, x10, #72
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w11, [x10, #8]
	stur	w11, [x9, #-8]
	ldr	w11, [x10, #4]
	lsl	x12, x8, #2
	orr	x12, x12, #0x4
	str	w11, [x19, x12]
	ldr	w11, [x10]
	str	w11, [x9]
	ldr	w11, [x10, #12]
	str	w11, [x9, #4]
	add	x8, x8, #4
	add	x9, x9, #16
	add	x10, x10, #16
	cmp	x8, x20
	b.lo	LBB0_8
LBB0_9:
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	bl	_fopen
	mov	x21, x0
	mov	x0, x19
	mov	w1, #1
	mov	x2, x20
	mov	x3, x21
	bl	_fwrite
	mov	x0, x21
	bl	_fclose
	mov	x0, x19
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_free
	.loh AdrpAdd	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"wb"

.subsections_via_symbols
