// File: FreeSlave[P]vhlt/hlbsp/qbsp.cpp
// Function: BrushFromBox(double const*, double const*)
brush_t *BrushFromBox (const vec3_t mins, const vec3_t maxs)
{
	brush_t *b = AllocBrush ();
	dplane_t planes[6];
	for (int k = 0; k < 3; k++)
	{
		VectorFill (planes[k].normal, 0.0);
		planes[k].normal[k] = 1.0;
		planes[k].dist = mins[k];
		VectorFill (planes[k+3].normal, 0.0);
		planes[k+3].normal[k] = -1.0;
		planes[k+3].dist = -maxs[k];
	}
	b->sides = AllocSide ();
	b->sides->plane = planes[0];
	b->sides->w = new Winding (planes[0]);
	for (int k = 1; k < 6; k++)
	{
		ClipBrush (&b, &planes[k], NORMAL_EPSILON);
		if (b == NULL)
		{
			break;
		}
	}
	return b;
}

// Assembly:
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rdi, 0x1b0(%rsp)
movq %rsi, 0x1a8(%rsp)
callq 0x250b0
movq %rax, 0x1a0(%rsp)
movl $0x0, 0x1c(%rsp)
cmpl $0x3, 0x1c(%rsp)
jge 0x25811
movslq 0x1c(%rsp), %rcx
leaq 0x20(%rsp), %rax
shlq $0x6, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movslq 0x1c(%rsp), %rcx
leaq 0x20(%rsp), %rax
shlq $0x6, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x8(%rax)
movslq 0x1c(%rsp), %rcx
leaq 0x20(%rsp), %rax
shlq $0x6, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x10(%rax)
movslq 0x1c(%rsp), %rcx
leaq 0x20(%rsp), %rax
shlq $0x6, %rcx
addq %rcx, %rax
movslq 0x1c(%rsp), %rcx
movsd 0x13a39(%rip), %xmm0    # 0x39148
movsd %xmm0, (%rax,%rcx,8)
movq 0x1b0(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movslq 0x1c(%rsp), %rcx
leaq 0x20(%rsp), %rax
shlq $0x6, %rcx
addq %rcx, %rax
movsd %xmm0, 0x30(%rax)
movl 0x1c(%rsp), %eax
addl $0x3, %eax
movslq %eax, %rcx
leaq 0x20(%rsp), %rax
shlq $0x6, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movl 0x1c(%rsp), %eax
addl $0x3, %eax
movslq %eax, %rcx
leaq 0x20(%rsp), %rax
shlq $0x6, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x8(%rax)
movl 0x1c(%rsp), %eax
addl $0x3, %eax
movslq %eax, %rcx
leaq 0x20(%rsp), %rax
shlq $0x6, %rcx
addq %rcx, %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x10(%rax)
movl 0x1c(%rsp), %eax
addl $0x3, %eax
movslq %eax, %rcx
leaq 0x20(%rsp), %rax
shlq $0x6, %rcx
addq %rcx, %rax
movslq 0x1c(%rsp), %rcx
movsd 0x13ca8(%rip), %xmm0    # 0x39460
movsd %xmm0, (%rax,%rcx,8)
movq 0x1a8(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movl 0x1c(%rsp), %eax
addl $0x3, %eax
movslq %eax, %rcx
leaq 0x20(%rsp), %rax
shlq $0x6, %rcx
addq %rcx, %rax
movsd %xmm0, 0x30(%rax)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x2569c
callq 0x24f90
movq %rax, %rcx
movq 0x1a0(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x1a0(%rsp), %rax
movq 0x8(%rax), %rax
movaps 0x20(%rsp), %xmm0
movaps 0x30(%rsp), %xmm1
movaps 0x40(%rsp), %xmm2
movaps 0x50(%rsp), %xmm3
movups %xmm3, 0x38(%rax)
movups %xmm2, 0x28(%rax)
movups %xmm1, 0x18(%rax)
movups %xmm0, 0x8(%rax)
movl $0x20, %edi
callq 0x42f0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, (%rsp)
leaq 0x20(%rsp), %rsi
callq 0xf740
jmp 0x25875
movq (%rsp), %rcx
movq 0x1a0(%rsp), %rax
movq 0x8(%rax), %rax
movq %rcx, 0x48(%rax)
movl $0x1, 0x8(%rsp)
cmpl $0x6, 0x8(%rsp)
jge 0x258f8
movslq 0x8(%rsp), %rax
leaq 0x20(%rsp), %rsi
shlq $0x6, %rax
addq %rax, %rsi
leaq 0x1a0(%rsp), %rdi
movsd 0x107af(%rip), %xmm0    # 0x36068
callq 0x251c0
cmpq $0x0, 0x1a0(%rsp)
jne 0x258e9
jmp 0x258f8
movq (%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x10(%rsp)
movl %eax, 0xc(%rsp)
movl $0x20, %esi
callq 0x4300
jmp 0x25908
jmp 0x258eb
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x25891
movq 0x1a0(%rsp), %rax
addq $0x1b8, %rsp            # imm = 0x1B8
retq
movq 0x10(%rsp), %rdi
callq 0x4520
nopw %cs:(%rax,%rax)