	.file	"extr_writebsp.c_EmitLeaf.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"MAX_MAP_LEAFS"
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC1:
	.string	"WARNING: Node brush list corrupted (0x%08X)\n"
	.section	.rodata.str1.1
.LC2:
	.string	"MAX_MAP_LEAFBRUSHES"
.LC3:
	.string	"MAX_MAP_LEAFFACES"
	.text
	.p2align 4
	.globl	EmitLeaf
	.type	EmitLeaf, @function
EmitLeaf:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	mov	r13, rdi
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	sub	rsp, 8
	.cfi_def_cfa_offset 48
	mov	rax, QWORD PTR numBSPLeafs[rip]
	cmp	rax, QWORD PTR MAX_MAP_LEAFS[rip]
	jnb	.L18
.L2:
	lea	rbx, [rax+rax*2]
	add	rax, 1
	mov	edi, DWORD PTR 28[r13]
	mov	QWORD PTR numBSPLeafs[rip], rax
	mov	eax, DWORD PTR 36[r13]
	sal	rbx, 4
	add	rbx, QWORD PTR bspLeafs[rip]
	mov	DWORD PTR 44[rbx], eax
	mov	eax, DWORD PTR 32[r13]
	mov	esi, DWORD PTR 36[rbx]
	mov	DWORD PTR 40[rbx], eax
	call	VectorCopy@PLT
	mov	esi, DWORD PTR 32[rbx]
	mov	edi, DWORD PTR 24[r13]
	call	VectorCopy@PLT
	mov	rax, QWORD PTR numBSPLeafBrushes[rip]
	mov	r12, QWORD PTR 16[r13]
	mov	QWORD PTR [rbx], rax
	test	r12, r12
	je	.L12
	lea	rbp, .LC2[rip]
	cmp	r12, 255
	ja	.L5
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L6:
	mov	rdx, QWORD PTR [r12]
	mov	r12, QWORD PTR 8[r12]
	mov	ecx, DWORD PTR [rdx]
	mov	rdx, QWORD PTR bspLeafBrushes[rip]
	mov	DWORD PTR [rdx+rax*4], ecx
	add	rax, 1
	mov	QWORD PTR numBSPLeafBrushes[rip], rax
	test	r12, r12
	je	.L19
	cmp	r12, 255
	jbe	.L4
.L5:
	cmp	QWORD PTR MAX_MAP_LEAFBRUSHES[rip], rax
	ja	.L6
	mov	rdi, rbp
	call	Error@PLT
	mov	rax, QWORD PTR numBSPLeafBrushes[rip]
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	mov	edi, DWORD PTR SYS_WRN[rip]
	mov	rdx, r12
	lea	rsi, .LC1[rip]
	call	Sys_FPrintf@PLT
	mov	rax, QWORD PTR numBSPLeafBrushes[rip]
	sub	rax, QWORD PTR [rbx]
.L3:
	cmp	QWORD PTR 8[r13], 0
	mov	QWORD PTR 8[rbx], rax
	jne	.L1
	mov	rax, QWORD PTR numBSPLeafSurfaces[rip]
	mov	r12, QWORD PTR 0[r13]
	mov	QWORD PTR 16[rbx], rax
	test	r12, r12
	je	.L13
	lea	rbp, .LC3[rip]
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L10:
	mov	ecx, DWORD PTR [r12]
	mov	rdx, QWORD PTR bspLeafSurfaces[rip]
	mov	r12, QWORD PTR 8[r12]
	mov	DWORD PTR [rdx+rax*4], ecx
	add	rax, 1
	mov	QWORD PTR numBSPLeafSurfaces[rip], rax
	test	r12, r12
	je	.L20
.L11:
	cmp	QWORD PTR MAX_MAP_LEAFFACES[rip], rax
	ja	.L10
	mov	rdi, rbp
	call	Error@PLT
	mov	rax, QWORD PTR numBSPLeafSurfaces[rip]
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L20:
	sub	rax, QWORD PTR 16[rbx]
.L9:
	mov	QWORD PTR 24[rbx], rax
.L1:
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L19:
	.cfi_restore_state
	sub	rax, QWORD PTR [rbx]
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L18:
	lea	rdi, .LC0[rip]
	call	Error@PLT
	mov	rax, QWORD PTR numBSPLeafs[rip]
	jmp	.L2
.L13:
	xor	eax, eax
	jmp	.L9
.L12:
	xor	eax, eax
	jmp	.L3
	.cfi_endproc
.LFE0:
	.size	EmitLeaf, .-EmitLeaf
	.comm	numBSPLeafs,8,8
	.comm	numBSPLeafSurfaces,8,8
	.comm	numBSPLeafBrushes,8,8
	.comm	bspLeafs,8,8
	.comm	bspLeafSurfaces,8,8
	.comm	bspLeafBrushes,8,8
	.comm	SYS_WRN,4,4
	.comm	MAX_MAP_LEAFS,8,8
	.comm	MAX_MAP_LEAFFACES,8,8
	.comm	MAX_MAP_LEAFBRUSHES,8,8
	.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_writebsp.c_EmitLeaf.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"MAX_MAP_LEAFS\000"
	.align	2
.LC1:
	.ascii	"WARNING: Node brush list corrupted (0x%08X)\012\000"
	.align	2
.LC2:
	.ascii	"MAX_MAP_LEAFBRUSHES\000"
	.align	2
.LC3:
	.ascii	"MAX_MAP_LEAFFACES\000"
	.text
	.align	2
	.global	EmitLeaf
	.syntax unified
	.arm
	.fpu softvfp
	.type	EmitLeaf, %function
EmitLeaf:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	r3, .L21
	ldr	r4, .L21+4
	ldr	r3, [r3]
	ldr	r7, [r4]
	mov	r6, r0
	cmp	r7, r3
	sub	sp, sp, #12
	bcs	.L18
.L2:
	ldr	r3, .L21+8
	ldr	r2, [r6, #24]
	ldr	r8, [r3]
	ldr	r3, [r6, #20]
	add	r5, r8, r7, lsl #5
	str	r2, [r5, #28]
	ldr	r1, [r5, #20]
	str	r3, [r5, #24]
	ldr	r0, [r6, #16]
	add	r3, r7, #1
	str	r3, [r4]
	ldr	r9, .L21+12
	bl	VectorCopy
	ldr	r1, [r5, #16]
	ldr	r0, [r6, #12]
	bl	VectorCopy
	ldr	r4, [r6, #8]
	ldr	r3, [r9]
	lsl	r2, r7, #5
	cmp	r4, #0
	str	r3, [r8, r7, lsl #5]
	str	r2, [sp, #4]
	beq	.L12
	cmp	r4, #255
	bls	.L4
	ldr	fp, .L21+16
	ldr	r10, .L21+20
	ldr	r7, .L21+24
	b	.L5
.L6:
	ldr	r0, [r4]
	ldr	r2, [r10]
	ldr	r0, [r0]
	ldr	r4, [r4, #4]
	str	r0, [r2, r3, lsl #2]
	cmp	r4, #0
	add	r3, r3, #1
	str	r3, [r9]
	beq	.L19
	cmp	r4, #255
	bls	.L4
.L5:
	ldr	r2, [fp]
	cmp	r2, r3
	bhi	.L6
	mov	r0, r7
	bl	Error
	ldr	r3, [r9]
	b	.L6
.L4:
	ldr	r3, .L21+28
	mov	r2, r4
	ldr	r0, [r3]
	ldr	r1, .L21+32
	bl	Sys_FPrintf
	ldr	r2, [sp, #4]
	ldr	r3, [r9]
	ldr	r2, [r8, r2]
	sub	r3, r3, r2
.L3:
	ldr	r2, [r6, #4]
	str	r3, [r5, #4]
	cmp	r2, #0
	bne	.L1
	ldr	r7, .L21+36
	ldr	r4, [r6]
	ldr	r3, [r7]
	cmp	r4, #0
	str	r3, [r5, #8]
	beq	.L13
	ldr	r8, .L21+40
	ldr	r6, .L21+44
	ldr	r9, .L21+48
	b	.L11
.L10:
	ldr	r1, [r4]
	ldr	r2, [r6]
	ldr	r4, [r4, #4]
	str	r1, [r2, r3, lsl #2]
	cmp	r4, #0
	add	r3, r3, #1
	str	r3, [r7]
	beq	.L20
.L11:
	ldr	r2, [r8]
	cmp	r2, r3
	bhi	.L10
	mov	r0, r9
	bl	Error
	ldr	r3, [r7]
	b	.L10
.L20:
	ldr	r4, [r5, #8]
	sub	r3, r3, r4
.L9:
	str	r3, [r5, #12]
.L1:
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L19:
	ldr	r2, [sp, #4]
	ldr	r2, [r8, r2]
	sub	r3, r3, r2
	b	.L3
.L18:
	ldr	r0, .L21+52
	bl	Error
	ldr	r7, [r4]
	b	.L2
.L13:
	mov	r3, r4
	b	.L9
.L12:
	mov	r3, r4
	b	.L3
.L22:
	.align	2
.L21:
	.word	MAX_MAP_LEAFS
	.word	numBSPLeafs
	.word	bspLeafs
	.word	numBSPLeafBrushes
	.word	MAX_MAP_LEAFBRUSHES
	.word	bspLeafBrushes
	.word	.LC2
	.word	SYS_WRN
	.word	.LC1
	.word	numBSPLeafSurfaces
	.word	MAX_MAP_LEAFFACES
	.word	bspLeafSurfaces
	.word	.LC3
	.word	.LC0
	.size	EmitLeaf, .-EmitLeaf
	.comm	numBSPLeafs,4,4
	.comm	numBSPLeafSurfaces,4,4
	.comm	numBSPLeafBrushes,4,4
	.comm	bspLeafs,4,4
	.comm	bspLeafSurfaces,4,4
	.comm	bspLeafBrushes,4,4
	.comm	SYS_WRN,4,4
	.comm	MAX_MAP_LEAFS,4,4
	.comm	MAX_MAP_LEAFFACES,4,4
	.comm	MAX_MAP_LEAFBRUSHES,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
