// File: /workspace/github_cpp_makefile_star2_O1/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 $0x48, %rsp
movq %rdi, %rbx
leaq 0xbc9d(%rip), %rbp      # 0x23657
leaq 0x10(%rsp), %r12
xorl %r13d, %r13d
cmpq %rbx, 0x30bd087(%rip)   # 0x30d4a50
jne 0x179d8
cmpb $0x0, 0x20bd048(%rip)   # 0x20d4a1a
jne 0x17bce
movq %rbx, %rdi
leaq 0x96db(%rip), %rsi      # 0x210bd
leaq 0xc(%rsp), %rdx
xorl %eax, %eax
callq 0x4590
incl %eax
cmpl $0x1, %eax
ja 0x17a11
testq %r13, %r13
leaq 0xbcfb(%rip), %rdi      # 0x236fa
leaq 0xbcd8(%rip), %rax      # 0x236de
cmoveq %rax, %rdi
xorl %eax, %eax
callq 0x9f84
movl 0xc(%rsp), %eax
cmpl $-0x1, %eax
je 0x17bc5
movl %eax, 0x4(%rsp)
movl $0x10, %edi
callq 0x4400
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq %r13, (%rax)
movq %rax, 0x30(%rsp)
movq %rax, %r15
addq $0x8, %r15
movq %rbx, %rdi
leaq 0xbcc5(%rip), %rsi      # 0x23710
leaq 0x8(%rsp), %rdx
movq %rsp, %rcx
xorl %eax, %eax
callq 0x4590
cmpl $0x2, %eax
je 0x17a6d
leaq 0xbcb1(%rip), %rdi      # 0x23717
xorl %eax, %eax
callq 0x9f84
movslq 0x8(%rsp), %r14
cmpq $-0x1, %r14
je 0x17bb2
movl $0x50, %edi
callq 0x4400
movq %rax, %r13
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq %r14, 0x40(%rsp)
movq %r14, %rax
xorq $0x1, %rax
shlq $0x6, %rax
leaq 0x20bcf6a(%rip), %rcx   # 0x20d4a20
movups (%rax,%rcx), %xmm0
movups 0x10(%rax,%rcx), %xmm1
movups 0x20(%rax,%rcx), %xmm2
movups 0x30(%rax,%rcx), %xmm3
movups %xmm3, 0x38(%r13)
movups %xmm2, 0x28(%r13)
movups %xmm1, 0x18(%r13)
movups %xmm0, 0x8(%r13)
movl $0x20, %edi
callq 0x42f0
movq %rax, %r14
movl (%rsp), %esi
movq %rax, %rdi
callq 0xc2da
movq %r15, 0x38(%rsp)
movq %r14, 0x48(%r13)
cmpl $0x0, (%rsp)
jle 0x17b9a
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 0x4590
cmpl $0x3, %eax
je 0x17b3e
leaq 0xbbfd(%rip), %rdi      # 0x23734
xorl %eax, %eax
callq 0x9f84
movsd 0x10(%rsp), %xmm0
movq 0x48(%r13), %rax
movq 0x10(%rax), %rax
movl (%rsp), %ecx
addl %r15d, %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
movsd %xmm0, (%rax,%rcx)
movsd 0x18(%rsp), %xmm0
movq 0x48(%r13), %rax
movq 0x10(%rax), %rax
movsd %xmm0, 0x8(%rax,%rcx)
movsd 0x20(%rsp), %xmm0
movq 0x48(%r13), %rax
movq 0x10(%rax), %rax
movsd %xmm0, 0x10(%rax,%rcx)
incl %r14d
decl %r15d
cmpl (%rsp), %r14d
jl 0x17b11
movq $0x0, (%r13)
movq 0x38(%rsp), %rax
movq %r13, (%rax)
movq %r13, %r15
movq 0x40(%rsp), %r14
cmpl $-0x1, %r14d
jne 0x17a41
movq 0x30(%rsp), %r13
movl 0x4(%rsp), %eax
cmpl $-0x1, %eax
jne 0x179c2
movq %r13, %rax
addq $0x48, %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