// File: /workspace/github_cpp_makefile_star2_O3/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 0xafd4(%rip), %rbp      # 0x22634
leaq 0x10(%rsp), %r12
xorl %r13d, %r13d
cmpq %rbx, 0x30bc3d1(%rip)   # 0x30d3a40
jne 0x1767e
cmpb $0x0, 0x20bc392(%rip)   # 0x20d3a0a
jne 0x1784b
movq %rbx, %rdi
leaq 0x8a25(%rip), %rsi      # 0x200ad
leaq 0xc(%rsp), %rdx
xorl %eax, %eax
callq 0x4580
incl %eax
cmpl $0x1, %eax
ja 0x176b7
testq %r13, %r13
leaq 0xb032(%rip), %rdi      # 0x226d7
leaq 0xb00f(%rip), %rax      # 0x226bb
cmoveq %rax, %rdi
xorl %eax, %eax
callq 0x9e9c
cmpl $-0x1, 0xc(%rsp)
je 0x1784b
movl $0x1, %edi
movl $0x10, %esi
callq 0x41e0
movq %r13, (%rax)
movq %rax, 0x28(%rsp)
movq %rax, %r15
addq $0x8, %r15
movq %rbx, %rdi
leaq 0xb003(%rip), %rsi      # 0x226ed
leaq 0x8(%rsp), %rdx
leaq 0x4(%rsp), %rcx
xorl %eax, %eax
callq 0x4580
cmpl $0x2, %eax
je 0x1770e
leaq 0xafed(%rip), %rdi      # 0x226f4
xorl %eax, %eax
callq 0x9e9c
movslq 0x8(%rsp), %r14
cmpq $-0x1, %r14
je 0x17841
movl $0x1, %edi
movl $0x50, %esi
callq 0x41e0
movq %rax, %r13
xorq $0x1, %r14
shlq $0x6, %r14
leaq 0x20bc2d2(%rip), %rax   # 0x20d3a10
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)
movl $0x20, %edi
callq 0x42f0
movq %rax, %r14
movl 0x4(%rsp), %esi
movq %rax, %rdi
callq 0xc128
movq %r15, 0x30(%rsp)
movq %r14, 0x48(%r13)
cmpl $0x0, 0x4(%rsp)
jle 0x17829
xorl %r14d, %r14d
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movq %rbx, %rdi
movq %rbp, %rsi
movq %r12, %rdx
leaq 0x18(%rsp), %rcx
leaq 0x20(%rsp), %r8
xorl %eax, %eax
callq 0x4580
cmpl $0x3, %eax
je 0x177cc
leaq 0xaf4c(%rip), %rdi      # 0x22711
xorl %eax, %eax
callq 0x9e9c
movsd 0x10(%rsp), %xmm0
movq 0x48(%r13), %rax
movq 0x10(%rax), %rax
movl 0x4(%rsp), %ecx
leal (%r15,%rcx), %edx
movslq %edx, %rdx
shlq $0x3, %rdx
leaq (%rdx,%rdx,2), %rdx
movsd %xmm0, (%rax,%rdx)
movsd 0x18(%rsp), %xmm0
movq 0x48(%r13), %rax
movq 0x10(%rax), %rax
movsd %xmm0, 0x8(%rax,%rdx)
movsd 0x20(%rsp), %xmm0
movq 0x48(%r13), %rax
movq 0x10(%rax), %rax
movsd %xmm0, 0x10(%rax,%rdx)
incl %r14d
decl %r15d
cmpl %ecx, %r14d
jl 0x1779f
movq $0x0, (%r13)
movq 0x30(%rsp), %rax
movq %r13, (%rax)
movq %r13, %r15
jmp 0x176e0
movq 0x28(%rsp), %r13
jmp 0x17668
movq %r13, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x20, %esi
movq %r14, %rdi
callq 0x4300
movq %rbx, %rdi
callq 0x4540