// File: /workspace/github_cpp_makefile_star2_O2/FreeSlave[P]vhlt/hlbsp/qbsp.cpp
// Function: ReadBrushes(_IO_FILE*)
static brush_t *ReadBrushes (FILE *file)
{
	brush_t *brushes = NULL;
	while (1)
	{
#ifdef HLBSP_REMOVEHULL2
		if (file == brushfiles[2] && g_nohull2)
			break;
#endif
		int r;
		int brushinfo;
		r = fscanf (file, "%i\n", &brushinfo);
		if (r == 0 || r == -1)
		{
			if (brushes == NULL)
			{
				Error ("ReadBrushes: no more models");
			}
			else
			{
				Error ("ReadBrushes: file end");
			}
		}
		if (brushinfo == -1)
		{
			break;
		}
		brush_t *b;
		b = AllocBrush ();
		b->next = brushes;
		brushes = b;
		side_t **psn;
		psn = &b->sides;
		while (1)
		{
			int planenum;
			int numpoints;
			r = fscanf (file, "%i %u\n", &planenum, &numpoints);
			if (r != 2)
			{
				Error ("ReadBrushes: get side failed");
			}
			if (planenum == -1)
			{
				break;
			}
			side_t *s;
			s = AllocSide ();
			s->plane = g_dplanes[planenum ^ 1];
			s->w = new Winding (numpoints);
			int x;
			for (x = 0; x < numpoints; x++)
			{
				double v[3];
				r = fscanf (file, "%lf %lf %lf\n", &v[0], &v[1], &v[2]);
				if (r != 3)
				{
					Error ("ReadBrushes: get point failed");
				}
				VectorCopy (v, s->w->m_Points[numpoints - 1 - x]);
			}
			s->next = NULL;
			*psn = s;
			psn = &s->next;
		}
	}
	return brushes;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0xafab(%rip), %rbp      # 0x20594
leaq 0x10(%rsp), %r12
xorl %r13d, %r13d
cmpq %rbx, 0x30bd458(%rip)   # 0x30d2a50
jne 0x15607
cmpb $0x0, 0x20bd419(%rip)   # 0x20d2a1a
jne 0x157b5
movq %rbx, %rdi
leaq 0x89fc(%rip), %rsi      # 0x1e00d
leaq 0xc(%rsp), %rdx
xorl %eax, %eax
callq 0x4590
incl %eax
cmpl $0x1, %eax
ja 0x15640
testq %r13, %r13
leaq 0xb009(%rip), %rdi      # 0x20637
leaq 0xafe6(%rip), %rax      # 0x2061b
cmoveq %rax, %rdi
xorl %eax, %eax
callq 0x8b1f
cmpl $-0x1, 0xc(%rsp)
je 0x157b5
callq 0x1305d
movq %r13, (%rax)
movq %rax, 0x28(%rsp)
movq %rax, %r15
addq $0x8, %r15
movq %rbx, %rdi
leaq 0xafe4(%rip), %rsi      # 0x2064d
leaq 0x8(%rsp), %rdx
leaq 0x4(%rsp), %rcx
xorl %eax, %eax
callq 0x4590
cmpl $0x2, %eax
je 0x1568d
leaq 0xafce(%rip), %rdi      # 0x20654
xorl %eax, %eax
callq 0x8b1f
movslq 0x8(%rsp), %r14
cmpq $-0x1, %r14
je 0x157ab
callq 0x12fc8
movq %rax, %r13
xorq $0x1, %r14
shlq $0x6, %r14
leaq 0x20bd36d(%rip), %rax   # 0x20d2a20
movups (%r14,%rax), %xmm0
movups 0x10(%r14,%rax), %xmm1
movups 0x20(%r14,%rax), %xmm2
movups 0x30(%r14,%rax), %xmm3
movups %xmm0, 0x8(%r13)
movups %xmm1, 0x18(%r13)
movups %xmm2, 0x28(%r13)
movups %xmm3, 0x38(%r13)
pushq $0x20
popq %rdi
callq 0x42f0
movq %rax, %r14
movl 0x4(%rsp), %esi
movq %rax, %rdi
callq 0xaa76
movq %r15, 0x30(%rsp)
movq %r14, 0x48(%r13)
xorl %r14d, %r14d
movl 0x4(%rsp), %eax
pushq $-0x1
popq %rcx
movl %ecx, %r15d
cmpl %eax, %r14d
jge 0x15796
movq %rbx, %rdi
movq %rbp, %rsi
movq %r12, %rdx
leaq 0x18(%rsp), %rcx
leaq 0x20(%rsp), %r8
xorl %eax, %eax
callq 0x4590
cmpl $0x3, %eax
je 0x15741
leaq 0xaf37(%rip), %rdi      # 0x20671
xorl %eax, %eax
callq 0x8b1f
movsd 0x10(%rsp), %xmm0
movq 0x48(%r13), %rax
movq 0x10(%rax), %rcx
movl 0x4(%rsp), %eax
leal (%r15,%rax), %edx
movslq %edx, %rdx
imulq $0x18, %rdx, %rdx
movsd %xmm0, (%rcx,%rdx)
movsd 0x18(%rsp), %xmm0
movq 0x48(%r13), %rcx
movq 0x10(%rcx), %rcx
movsd %xmm0, 0x8(%rcx,%rdx)
movsd 0x20(%rsp), %xmm0
movq 0x48(%r13), %rcx
movq 0x10(%rcx), %rcx
movsd %xmm0, 0x10(%rcx,%rdx)
incl %r14d
decl %r15d
jmp 0x1570b
andq $0x0, (%r13)
movq 0x30(%rsp), %rax
movq %r13, (%rax)
movq %r13, %r15
jmp 0x1565f
movq 0x28(%rsp), %r13
jmp 0x155f1
movq %r13, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x4300
movq %rbx, %rdi
callq 0x4550