	.file	"extr_lightmaps_ydnar.c_WriteTGA24.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"wb"
.LC1:
	.string	"Unable to open %s for writing"
	.text
	.p2align 4
	.globl	WriteTGA24
	.type	WriteTGA24, @function
WriteTGA24:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	mov	r15, rsi
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	mov	r13, rdi
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	mov	r12d, edx
	imul	r12d, ecx
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	ebx, edx
	lea	r14d, 18[r12+r12*2]
	sub	rsp, 24
	.cfi_def_cfa_offset 80
	mov	edi, r14d
	mov	DWORD PTR 12[rsp], ecx
	mov	QWORD PTR [rsp], r8
	call	safe_malloc@PLT
	mov	edx, 18
	xor	esi, esi
	mov	rdi, rax
	mov	rbp, rax
	call	memset@PLT
	movzx	eax, bl
	mov	ecx, DWORD PTR 12[rsp]
	mov	DWORD PTR 8[rbp], 2
	mov	DWORD PTR 48[rbp], eax
	mov	eax, ebx
	sar	eax, 8
	mov	DWORD PTR 64[rbp], 24
	mov	DWORD PTR 52[rbp], eax
	movzx	eax, cl
	sar	ecx, 8
	mov	DWORD PTR 56[rbp], eax
	mov	DWORD PTR 60[rbp], ecx
	cmp	r14d, 18
	jle	.L2
	mov	eax, 18
	.p2align 4,,10
	.p2align 3
.L3:
	mov	edx, DWORD PTR -64[r15+rax*4]
	mov	DWORD PTR 0[rbp+rax*4], edx
	mov	edx, DWORD PTR -68[r15+rax*4]
	mov	DWORD PTR 4[rbp+rax*4], edx
	mov	edx, DWORD PTR -72[r15+rax*4]
	mov	DWORD PTR 8[rbp+rax*4], edx
	add	rax, 3
	cmp	r14d, eax
	jg	.L3
.L2:
	lea	rsi, .LC0[rip]
	mov	rdi, r13
	call	fopen@PLT
	mov	r15, rax
	test	rax, rax
	je	.L14
.L4:
	cmp	QWORD PTR [rsp], 0
	mov	rcx, r15
	je	.L5
	sub	r12d, ebx
	mov	edx, 18
	mov	esi, 1
	mov	rdi, rbp
	call	fwrite@PLT
	lea	eax, [r12+r12*2]
	cdqe
	lea	r12, 72[rbp+rax*4]
	cmp	rbp, r12
	ja	.L7
	lea	r13d, [rbx+rbx*2]
	movsx	rbx, r13d
	sal	rbx, 2
	neg	rbx
	.p2align 4,,10
	.p2align 3
.L8:
	mov	rdi, r12
	mov	rcx, r15
	mov	edx, r13d
	mov	esi, 1
	call	fwrite@PLT
	add	r12, rbx
	cmp	rbp, r12
	jbe	.L8
.L7:
	mov	rdi, r15
	call	fclose@PLT
	add	rsp, 24
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	rdi, rbp
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	jmp	free@PLT
	.p2align 4,,10
	.p2align 3
.L5:
	.cfi_restore_state
	mov	edx, r14d
	mov	esi, 1
	mov	rdi, rbp
	call	fwrite@PLT
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L14:
	mov	rsi, r13
	lea	rdi, .LC1[rip]
	call	Error@PLT
	jmp	.L4
	.cfi_endproc
.LFE0:
	.size	WriteTGA24, .-WriteTGA24
	.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_lightmaps_ydnar.c_WriteTGA24.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"wb\000"
	.align	2
.LC1:
	.ascii	"Unable to open %s for writing\000"
	.text
	.align	2
	.global	WriteTGA24
	.syntax unified
	.arm
	.fpu softvfp
	.type	WriteTGA24, %function
WriteTGA24:
	@ args = 4, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r3, r4, r5, r6, r7, r8, r9, r10, fp, lr}
	mul	r4, r3, r2
	add	r10, r4, r4, lsl #1
	add	r10, r10, #18
	mov	r8, r0
	mov	r0, r10
	mov	fp, r3
	mov	r6, r2
	mov	r7, r1
	ldr	r9, [sp, #40]
	bl	safe_malloc
	mov	r2, #18
	mov	r1, #0
	mov	r5, r0
	bl	memset
	mov	r2, #2
	mov	r3, #24
	and	r0, r6, #255
	asr	r1, r6, #8
	str	r2, [r5, #8]
	cmp	r10, #18
	and	r2, fp, #255
	asr	fp, fp, #8
	str	r0, [r5, #48]
	str	r1, [r5, #52]
	str	r2, [r5, #56]
	str	fp, [r5, #60]
	str	r3, [r5, #64]
	ble	.L2
	mov	ip, r5
	mov	r3, #18
	sub	lr, r7, #64
	sub	r0, r7, #68
	sub	r7, r7, #72
.L3:
	ldr	r2, [lr, r3, lsl #2]
	add	ip, ip, #12
	str	r2, [ip, #60]
	ldr	r2, [r0, r3, lsl #2]
	str	r2, [ip, #64]
	ldr	r2, [r7, r3, lsl #2]
	add	r3, r3, #3
	cmp	r10, r3
	str	r2, [ip, #68]
	bgt	.L3
.L2:
	mov	r0, r8
	ldr	r1, .L15
	bl	fopen
	subs	r7, r0, #0
	beq	.L14
.L4:
	cmp	r9, #0
	beq	.L5
	sub	r4, r4, r6
	add	r4, r4, r4, lsl #1
	add	r4, r5, r4, lsl #2
	mov	r3, r7
	mov	r2, #18
	mov	r1, #1
	mov	r0, r5
	add	r4, r4, #72
	bl	fwrite
	cmp	r5, r4
	bhi	.L7
	add	r6, r6, r6, lsl #1
	lsl	r8, r6, #2
	rsb	r8, r8, #0
.L8:
	mov	r0, r4
	mov	r3, r7
	mov	r2, r6
	mov	r1, #1
	add	r4, r4, r8
	bl	fwrite
	cmp	r5, r4
	bls	.L8
.L7:
	mov	r0, r7
	bl	fclose
	mov	r0, r5
	pop	{r3, r4, r5, r6, r7, r8, r9, r10, fp, lr}
	b	free
.L5:
	mov	r2, r10
	mov	r3, r7
	mov	r1, #1
	mov	r0, r5
	bl	fwrite
	b	.L7
.L14:
	mov	r1, r8
	ldr	r0, .L15+4
	bl	Error
	b	.L4
.L16:
	.align	2
.L15:
	.word	.LC0
	.word	.LC1
	.size	WriteTGA24, .-WriteTGA24
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
