LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/portals.cpp
// Function: RemovePortalFromNode(portal_s*, node_s*)
void            RemovePortalFromNode(portal_t* portal, node_t* l)
{
    portal_t**      pp;
    portal_t*       t;

    // remove reference to the current portal
    pp = &l->portals;
    while (1)
    {
        t = *pp;
        if (!t)
        {
            Error("RemovePortalFromNode: portal not in leaf");
        }

        if (t == portal)
        {
            break;
        }

        if (t->nodes[0] == l)
        {
            pp = &t->next[0];
        }
        else if (t->nodes[1] == l)
        {
            pp = &t->next[1];
        }
        else
        {
            Error("RemovePortalFromNode: portal not bounding leaf");
        }
    }

    if (portal->nodes[0] == l)
    {
        *pp = portal->next[0];
        portal->nodes[0] = NULL;
    }
    else if (portal->nodes[1] == l)
    {
        *pp = portal->next[1];
        portal->nodes[1] = NULL;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xb0(%rsi), %r13
leaq 0xd7a4(%rip), %r15      # 0x2132b
leaq 0xd7c6(%rip), %r12      # 0x21354
movq (%r13), %rbp
testq %rbp, %rbp
jne 0x13ba1
movq %r15, %rdi
xorl %eax, %eax
callq 0x9e9c
cmpq %rbx, %rbp
je 0x13bd0
cmpq %r14, 0x48(%rbp)
je 0x13bbe
cmpq %r14, 0x50(%rbp)
je 0x13bc7
movq %r12, %rdi
xorl %eax, %eax
callq 0x9e9c
jmp 0x13b8e
addq $0x58, %rbp
movq %rbp, %r13
jmp 0x13b8e
addq $0x60, %rbp
movq %rbp, %r13
jmp 0x13b8e
cmpq %r14, 0x48(%rbx)
je 0x13be7
cmpq %r14, 0x50(%rbx)
jne 0x13bff
leaq 0x50(%rbx), %rax
movl $0x60, %ecx
jmp 0x13bf0
leaq 0x48(%rbx), %rax
movl $0x58, %ecx
movq (%rbx,%rcx), %rcx
movq %rcx, (%r13)
movq $0x0, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/portals.cpp
// Function: WritePortalfile(node_s*)
void            WritePortalfile(node_t* headnode)
{
    // set the visleafnum field in every leaf and count the total number of portals
    num_visleafs = 0;
    num_visportals = 0;
    NumberLeafs_r(headnode);

    // write the file
    pf = fopen(g_portfilename, "w");
    if (!pf)
    {
        Error("Error writing portal file %s", g_portfilename);
    }
#ifdef HLBSP_VIEWPORTAL
	if (g_viewportal)
	{
		char filename[_MAX_PATH];
		safe_snprintf(filename, _MAX_PATH, "%s_portal.pts", g_Mapname);
		pf_view = fopen (filename, "w");
		if (!pf_view)
		{
			Error ("Couldn't open %s", filename);
		}
		Log ("Writing '%s' ...\n", filename);
	}
#endif

    fprintf(pf, "%i\n", num_visleafs);
    fprintf(pf, "%i\n", num_visportals);

#ifdef ZHLT_DETAILBRUSH
	WriteLeafCount_r (headnode);
#endif
    WritePortalFile_r(headnode);
    fclose(pf);
#ifdef HLBSP_VIEWPORTAL
	if (g_viewportal)
	{
		fclose (pf_view);
	}
#endif
    Log("BSP generation successful, writing portal file '%s'\n", g_portfilename);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x1000, %rsp           # imm = 0x1000
movq %rdi, %rbx
xorl %eax, %eax
movl %eax, 0x20babdf(%rip)   # 0x20ce9d8
movl %eax, 0x20babdd(%rip)   # 0x20ce9dc
callq 0x13f27
leaq 0x20bdbf5(%rip), %rdi   # 0x20d1a00
leaq 0xe355(%rip), %rsi      # 0x22167
callq 0x4370
movq %rax, 0x20babc2(%rip)   # 0x20ce9e0
testq %rax, %rax
jne 0x13e38
leaq 0xd559(%rip), %rdi      # 0x21383
leaq 0x20bdbcf(%rip), %rsi   # 0x20d1a00
xorl %eax, %eax
callq 0x9e9c
leaq 0x20bfbcc(%rip), %r15   # 0x20d3a0b
cmpb $0x1, (%r15)
jne 0x13ea2
leaq 0xd554(%rip), %rdx      # 0x213a0
leaq 0x164bd(%rip), %rcx     # 0x2a310
movq %rsp, %r14
movl $0x1000, %esi           # imm = 0x1000
movq %r14, %rdi
xorl %eax, %eax
callq 0x877f
leaq 0xe2fb(%rip), %rsi      # 0x22167
movq %r14, %rdi
callq 0x4370
movq %rax, 0x20bab6d(%rip)   # 0x20ce9e8
testq %rax, %rax
jne 0x13e91
leaq 0xd527(%rip), %rdi      # 0x213ae
movq %rsp, %rsi
xorl %eax, %eax
callq 0x9e9c
leaq 0xd527(%rip), %rdi      # 0x213bf
movq %rsp, %rsi
xorl %eax, %eax
callq 0x9bae
movq 0x20bab37(%rip), %rdi   # 0x20ce9e0
movl 0x20bab29(%rip), %edx   # 0x20ce9d8
leaq 0xc1f7(%rip), %r14      # 0x200ad
movq %r14, %rsi
xorl %eax, %eax
callq 0x4440
movq 0x20bab19(%rip), %rdi   # 0x20ce9e0
movl 0x20bab0f(%rip), %edx   # 0x20ce9dc
movq %r14, %rsi
xorl %eax, %eax
callq 0x4440
movq %rbx, %rdi
callq 0x13fc8
movq %rbx, %rdi
callq 0x14016
movq 0x20baaf2(%rip), %rdi   # 0x20ce9e0
callq 0x42e0
cmpb $0x1, (%r15)
jne 0x13f05
movq 0x20baae8(%rip), %rdi   # 0x20ce9e8
callq 0x42e0
leaq 0xd4c5(%rip), %rdi      # 0x213d1
leaq 0x20bdaed(%rip), %rsi   # 0x20d1a00
xorl %eax, %eax
callq 0x9bae
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/portals.cpp
// Function: WriteLeafCount_r(node_s*)
static void WriteLeafCount_r (node_t *node)
{
	if (!node->isportalleaf)
	{
		WriteLeafCount_r (node->children[0]);
		WriteLeafCount_r (node->children[1]);
	}
	else
	{
		if (node->contents == CONTENTS_SOLID)
		{
			return;
		}
		int count = CountChildLeafs_r (node);
		fprintf (pf, "%i\n", count);
	}
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpb $0x0, 0x49(%rdi)
jne 0x13feb
movq 0x88(%rbx), %rdi
callq 0x13fc8
movq 0x90(%rbx), %rbx
cmpb $0x1, 0x49(%rbx)
jne 0x13fd2
cmpl $-0x2, 0xa0(%rbx)
jne 0x13ff6
popq %rbx
retq
movq %rbx, %rdi
callq 0x14489
movq 0x20ba9db(%rip), %rdi   # 0x20ce9e0
leaq 0xc0a1(%rip), %rsi      # 0x200ad
movl %eax, %edx
xorl %eax, %eax
popq %rbx
jmp 0x4440
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/portals.cpp
// Function: FreePortals(node_s*)
void            FreePortals(node_t* node)
{
    portal_t*       p;
    portal_t*       nextp;

#ifdef ZHLT_DETAILBRUSH
	if (!node->isportalleaf)
#else
    if (node->planenum != -1)
#endif
    {
        FreePortals(node->children[0]);
        FreePortals(node->children[1]);
        return;
    }

    for (p = node->portals; p; p = nextp)
    {
        if (p->nodes[0] == node)
        {
            nextp = p->next[0];
        }
        else
        {
            nextp = p->next[1];
        }
        RemovePortalFromNode(p, p->nodes[0]);
        RemovePortalFromNode(p, p->nodes[1]);
        delete p->winding;
        FreePortal(p);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpb $0x0, 0x49(%rdi)
jne 0x14433
movq 0x88(%rbx), %rdi
callq 0x1440c
movq 0x90(%rbx), %rbx
cmpb $0x1, 0x49(%rbx)
jne 0x1441a
movq 0xb0(%rbx), %r14
testq %r14, %r14
je 0x14483
movq 0x48(%r14), %rsi
xorl %eax, %eax
cmpq %rbx, %rsi
setne %al
movq 0x58(%r14,%rax,8), %r15
movq %r14, %rdi
callq 0x13b68
movq 0x50(%r14), %rsi
movq %r14, %rdi
callq 0x13b68
movq 0x68(%r14), %rdi
testq %rdi, %rdi
je 0x14473
movq (%rdi), %rax
callq *0x8(%rax)
movq %r14, %rdi
callq 0x14e71
movq %r15, %r14
testq %r15, %r15
jne 0x1443f
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/portals.cpp
// Function: CountChildLeafs_r(node_s*)
static int CountChildLeafs_r (node_t *node)
{
	if (node->planenum == -1)
	{ // dleaf
		if (node->iscontentsdetail)
		{ // solid
			return 0;
		}
		else
		{
			return 1;
		}
	}
	else
	{ // node
		int count = 0;
		count += CountChildLeafs_r (node->children[0]);
		count += CountChildLeafs_r (node->children[1]);
		return count;
	}
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $-0x1, 0x80(%rdi)
je 0x144ba
xorl %ebp, %ebp
movq 0x88(%rbx), %rdi
callq 0x14489
movq 0x90(%rbx), %rbx
addl %eax, %ebp
cmpl $-0x1, 0x80(%rbx)
jne 0x1449a
jmp 0x144bc
xorl %ebp, %ebp
movzbl 0x4a(%rbx), %eax
xorl $0x1, %eax
addl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/qbsp.cpp
// Function: NewSideFromSide(side_s const*)
side_t *NewSideFromSide (const side_t *s)
{
	side_t *news;
	news = AllocSide ();
	news->plane = s->plane;
	news->w = new Winding (*s->w);
	return news;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r15
movl $0x1, %edi
movl $0x50, %esi
callq 0x41e0
movq %rax, %rbx
movups 0x8(%r15), %xmm0
movups 0x18(%r15), %xmm1
movups 0x28(%r15), %xmm2
movups 0x38(%r15), %xmm3
movups %xmm0, 0x8(%rax)
movups %xmm1, 0x18(%rax)
movups %xmm2, 0x28(%rax)
movups %xmm3, 0x38(%rax)
movl $0x20, %edi
callq 0x42f0
movq %rax, %r14
movq 0x48(%r15), %rsi
movq %rax, %rdi
callq 0xc174
movq %r14, 0x48(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
movl $0x20, %esi
movq %r14, %rdi
callq 0x4300
movq %rbx, %rdi
callq 0x4540
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/qbsp.cpp
// Function: FreeBrush(brush_s*)
void FreeBrush (brush_t *b)
{
	if (b->sides)
	{
		side_t *s, *next;
		for (s = b->sides; s; s = next)
		{
			next = s->next;
			FreeSide (s);
		}
	}
	free (b);
	return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %r14
testq %r14, %r14
je 0x14f5f
movq (%r14), %r15
movq 0x48(%r14), %rdi
testq %rdi, %rdi
je 0x14f4f
movq (%rdi), %rax
callq *0x8(%rax)
movq %r14, %rdi
callq 0x4380
movq %r15, %r14
testq %r15, %r15
jne 0x14f3d
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x4380
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/qbsp.cpp
// Function: NewBrushFromBrush(brush_s const*)
brush_t *NewBrushFromBrush (const brush_t *b)
{
	brush_t *newb;
	newb = AllocBrush ();
	side_t *s, **pnews;
	for (s = b->sides, pnews = &newb->sides; s; s = s->next, pnews = &(*pnews)->next)
	{
		*pnews = NewSideFromSide (s);
	}
	return newb;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
movl $0x1, %edi
movl $0x10, %esi
callq 0x41e0
movq %rax, %rbx
movq 0x8(%r14), %r14
testq %r14, %r14
je 0x14fac
movq %rbx, %r15
addq $0x8, %r15
movq %r14, %rdi
callq 0x14ea1
movq %rax, (%r15)
movq (%r14), %r14
movq %rax, %r15
testq %r14, %r14
jne 0x14f96
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/qbsp.cpp
// Function: ClipBrush(brush_s**, plane_t const*, double)
void ClipBrush (brush_t **b, const dplane_t *split, vec_t epsilon)
{
	side_t *s, **pnext;
	Winding *w;
	for (pnext = &(*b)->sides, s = *pnext; s; s = *pnext)
	{
		if (s->w->Clip (*split, false, epsilon))
		{
			pnext = &s->next;
		}
		else
		{
			*pnext = s->next;
			FreeSide (s);
		}
	}
	if (!(*b)->sides)
	{ // empty brush
		FreeBrush (*b);
		*b = NULL;
		return;
	}
	w = new Winding (*split);
	for (s = (*b)->sides; s; s = s->next)
	{
		if (!w->Clip (s->plane, false, epsilon))
		{
			break;
		}
	}
	if (w->m_NumPoints == 0)
	{
		delete w;
	}
	else
	{
		s = AllocSide ();
		s->plane = *split;
		s->w = w;
		s->next = (*b)->sides;
		(*b)->sides = s;
	}
	return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movsd %xmm0, (%rsp)
movq %rdi, %rbx
movq (%rdi), %r15
movq 0x8(%r15), %r12
testq %r12, %r12
je 0x150bb
movq %rsi, %r14
addq $0x8, %r15
movq 0x48(%r12), %rdi
movq %r14, %rsi
xorl %edx, %edx
movsd (%rsp), %xmm0
callq 0xcea2
testb %al, %al
je 0x14ff9
movq %r12, %r15
jmp 0x15018
movq (%r12), %rax
movq %rax, (%r15)
movq 0x48(%r12), %rdi
testq %rdi, %rdi
je 0x15010
movq (%rdi), %rax
callq *0x8(%rax)
movq %r12, %rdi
callq 0x4380
movq (%r15), %r12
testq %r12, %r12
jne 0x14fdc
movq (%rbx), %r15
cmpq $0x0, 0x8(%r15)
je 0x150bb
movl $0x20, %edi
callq 0x42f0
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0xc710
movq (%rbx), %r12
addq $0x8, %r12
movq (%r12), %r12
testq %r12, %r12
je 0x1506e
leaq 0x8(%r12), %rsi
movq %r15, %rdi
xorl %edx, %edx
movsd (%rsp), %xmm0
callq 0xcea2
testb %al, %al
jne 0x1504d
cmpl $0x0, 0x8(%r15)
je 0x150d6
movl $0x1, %edi
movl $0x50, %esi
callq 0x41e0
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups 0x30(%r14), %xmm3
movups %xmm0, 0x8(%rax)
movups %xmm1, 0x18(%rax)
movups %xmm2, 0x28(%rax)
movups %xmm3, 0x38(%rax)
movq %r15, 0x48(%rax)
movq (%rbx), %rcx
movq 0x8(%rcx), %rdx
movq %rdx, (%rax)
movq %rax, 0x8(%rcx)
jmp 0x150ca
movq %r15, %rdi
callq 0x14f2c
movq $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq (%r15), %rax
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmpq *0x8(%rax)
movq %rax, %rbx
movl $0x20, %esi
movq %r15, %rdi
callq 0x4300
movq %rbx, %rdi
callq 0x4540
// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %r15
pushq %r14
pushq %rbx
subq $0x190, %rsp            # imm = 0x190
movq %rsi, %r14
movq %rdi, %r15
movl $0x1, %edi
movl $0x10, %esi
callq 0x41e0
movq %rax, %rbx
movq %rax, 0x8(%rsp)
leaq 0x10(%rsp), %rax
xorl %ecx, %ecx
xorps %xmm0, %xmm0
movabsq $0x3ff0000000000000, %rdx # imm = 0x3FF0000000000000
movabsq $-0x4010000000000000, %rsi # imm = 0xBFF0000000000000
movaps 0xafc2(%rip), %xmm1     # 0x202b0
movq %rax, %rdi
xorl %r8d, %r8d
movaps %xmm0, (%rdi)
movq %rcx, 0x10(%rdi)
movq %rdx, (%rax)
movsd (%r15,%r8,8), %xmm2
movsd %xmm2, 0x30(%rdi)
movaps %xmm0, 0xc0(%rdi)
movq %rcx, 0xd0(%rdi)
movq %rsi, 0xc0(%rax)
movsd (%r14,%r8,8), %xmm2
xorps %xmm1, %xmm2
movlps %xmm2, 0xf0(%rdi)
incq %r8
addq $0x40, %rdi
addq $0x48, %rax
cmpq $0x3, %r8
jne 0x152f4
movl $0x1, %edi
movl $0x50, %esi
callq 0x41e0
movq %rax, 0x8(%rbx)
leaq 0x10(%rsp), %r15
movaps (%r15), %xmm0
movaps 0x10(%r15), %xmm1
movaps 0x20(%r15), %xmm2
movaps 0x30(%r15), %xmm3
movups %xmm0, 0x8(%rax)
movups %xmm1, 0x18(%rax)
movups %xmm2, 0x28(%rax)
movups %xmm3, 0x38(%rax)
movl $0x20, %edi
callq 0x42f0
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
callq 0xc710
movq 0x8(%rbx), %rax
movq %r14, 0x48(%rax)
movl $0x40, %r14d
leaq 0x8(%rsp), %rbx
leaq (%rsp,%r14), %rsi
addq $0x10, %rsi
movq %rbx, %rdi
movsd 0x7d60(%rip), %xmm0     # 0x1d118
callq 0x14fb5
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0x153d7
leaq 0x40(%r14), %rcx
cmpq $0x140, %r14            # imm = 0x140
movq %rcx, %r14
jne 0x153a5
addq $0x190, %rsp            # imm = 0x190
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
movl $0x20, %esi
movq %r14, %rdi
callq 0x4300
movq %rbx, %rdi
callq 0x4540
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/qbsp.cpp
// Function: CalcBrushBounds(brush_s const*, double (&) [3], double (&) [3])
void CalcBrushBounds (const brush_t *b, vec3_t &mins, vec3_t &maxs)
{
	VectorFill (mins, BOGUS_RANGE);
	VectorFill (maxs, -BOGUS_RANGE);
	for (side_t *s = b->sides; s; s = s->next)
	{
		vec3_t windingmins, windingmaxs;
		s->w->getBounds (windingmins, windingmaxs);
		VectorCompareMinimum (mins, windingmins, mins);
		VectorCompareMaximum (maxs, windingmaxs, maxs);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
movaps 0xc050(%rip), %xmm0     # 0x21460
movups %xmm0, (%rsi)
movabsq $0x4101940000000000, %rax # imm = 0x4101940000000000
movq %rax, 0x10(%rsi)
movapd 0xc047(%rip), %xmm0     # 0x21470
movupd %xmm0, (%rdx)
movabsq $-0x3efe6c0000000000, %rax # imm = 0xC101940000000000
movq %rax, 0x10(%rdx)
movq 0x8(%rdi), %r13
testq %r13, %r13
je 0x154a9
movq %rdx, %rbx
movq %rsi, %r14
leaq 0x20(%rsp), %r15
movq %rsp, %r12
movq 0x48(%r13), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0xb9ba
movupd (%r14), %xmm0
minpd 0x20(%rsp), %xmm0
movupd %xmm0, (%r14)
movsd 0x10(%r14), %xmm0
minsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x10(%r14)
movupd (%rbx), %xmm0
maxpd (%rsp), %xmm0
movupd %xmm0, (%rbx)
movsd 0x10(%rbx), %xmm0
maxsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x10(%rbx)
movq (%r13), %r13
testq %r13, %r13
jne 0x15452
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/solidbsp.cpp
// Function: BuildSurfaceTree(surface_s*, double)
surfacetree_t *BuildSurfaceTree (surface_t *surfaces, vec_t epsilon)
{
	surfacetree_t *tree;
	tree = (surfacetree_t *)malloc (sizeof (surfacetree_t));
	tree->epsilon = epsilon;
	tree->result.middle = new std::vector< face_t * >;
	tree->headnode = (surfacetreenode_t *)malloc (sizeof (surfacetreenode_t));
	tree->headnode->leaffaces = new std::vector< face_t * >;
	{
		surface_t *p2;
		face_t *f;
		for (p2 = surfaces; p2; p2 = p2->next)
		{
			if (p2->onnode)
			{
				continue;
			}
			for (f = p2->faces; f; f = f->next)
			{
				tree->headnode->leaffaces->push_back (f);
			}
		}
	}
	tree->dontbuild = tree->headnode->leaffaces->size () < 20;
	BuildSurfaceTree_r (tree, tree->headnode);
	if (tree->dontbuild)
	{
		*tree->result.middle = *tree->headnode->leaffaces;
		tree->result.backsize = 0;
		tree->result.frontsize = 0;
	}
	return tree;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movsd %xmm0, 0x10(%rsp)
movq %rdi, %r14
movl $0x28, %edi
callq 0x4400
movq %rax, %rbx
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x8(%rax)
movl $0x18, %edi
callq 0x42f0
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
xorl %r12d, %r12d
movq %r12, 0x10(%rax)
movq %rax, 0x20(%rbx)
movl $0x68, %edi
callq 0x4400
movq %rax, %r15
movq %rax, 0x10(%rbx)
movl $0x18, %edi
callq 0x42f0
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq %r12, 0x10(%rax)
movq %rax, 0x60(%r15)
testq %r14, %r14
je 0x17ec9
leaq 0x8(%rsp), %r12
cmpq $0x0, 0x40(%r14)
je 0x17e8d
movq (%r14), %r14
testq %r14, %r14
jne 0x17e7c
jmp 0x17ec5
movq 0x48(%r14), %rax
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x17e83
movq 0x60(%r15), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x17eb3
movq %rax, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x17ebb
movq %r12, %rdx
callq 0x19e32
movq 0x8(%rsp), %rax
movq (%rax), %rax
jmp 0x17e91
movq 0x60(%r15), %rax
movq 0x8(%rax), %rcx
subq (%rax), %rcx
cmpq $0xa0, %rcx
setb (%rbx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x178c4
cmpb $0x1, (%rbx)
jne 0x17f03
movq 0x10(%rbx), %rax
movq 0x20(%rbx), %rdi
movq 0x60(%rax), %rsi
callq 0x19d4e
movq $0x0, 0x18(%rbx)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/solidbsp.cpp
// Function: TestSurfaceTree(surfacetree_t*, plane_t const*)
void TestSurfaceTree (surfacetree_t *tree, const dplane_t *split)
{
	if (tree->dontbuild)
	{
		return;
	}
	tree->result.middle->clear ();
	tree->result.backsize = 0;
	tree->result.frontsize = 0;
	TestSurfaceTree_r (tree, tree->headnode, split);
}

// Assembly:
cmpb $0x0, (%rdi)
je 0x18080
retq
movq %rsi, %rdx
movq 0x20(%rdi), %rax
movq (%rax), %rcx
cmpq %rcx, 0x8(%rax)
je 0x18094
movq %rcx, 0x8(%rax)
movq $0x0, 0x18(%rdi)
movq 0x10(%rdi), %rsi
jmp 0x17f12
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/solidbsp.cpp
// Function: DeleteSurfaceTree_r(surfacetreenode_s*)
void DeleteSurfaceTree_r (surfacetreenode_t *node)
{
	if (node->isleaf)
	{
		delete node->leaffaces;
	}
	else
	{
		DeleteSurfaceTree_r (node->children[0]);
		free (node->children[0]);
		DeleteSurfaceTree_r (node->children[1]);
		free (node->children[1]);
		delete node->nodefaces;
	}
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpb $0x1, 0x38(%rdi)
jne 0x180b5
movq 0x60(%rbx), %rbx
jmp 0x180dd
movq 0x40(%rbx), %rdi
callq 0x180a5
movq 0x40(%rbx), %rdi
callq 0x4380
movq 0x48(%rbx), %rdi
callq 0x180a5
movq 0x48(%rbx), %rdi
callq 0x4380
movq 0x50(%rbx), %rbx
testq %rbx, %rbx
je 0x180f6
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x180f6
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x4300
movl $0x18, %esi
movq %rbx, %rdi
popq %rbx
jmp 0x4300
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/solidbsp.cpp
// Function: DeleteSurfaceTree(surfacetree_t*)
void DeleteSurfaceTree (surfacetree_t *tree)
{
	DeleteSurfaceTree_r (tree->headnode);
	free (tree->headnode);
	delete tree->result.middle;
	free (tree);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
callq 0x180a5
movq 0x10(%rbx), %rdi
callq 0x4380
movq 0x20(%rbx), %r14
testq %r14, %r14
je 0x1813a
movq (%r14), %rdi
testq %rdi, %rdi
je 0x1813a
movq 0x10(%r14), %rsi
subq %rdi, %rsi
callq 0x4300
movl $0x18, %esi
movq %r14, %rdi
callq 0x4300
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4380
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/solidbsp.cpp
// Function: FixDetaillevelForDiscardable(node_s*, int)
void FixDetaillevelForDiscardable (node_t *node, int detaillevel)
{
	// when we move on to the next detaillevel, some discardable faces of previous detail level remain not on node (because they are discardable). remove them now
	surface_t *s, **psnext;
	face_t *f, **pfnext;
	for (psnext = &node->surfaces; s = *psnext, s != NULL; )
	{
		if (s->onnode)
		{
			psnext = &s->next;
			continue;
		}
		hlassume (s->faces, assume_ValidPointer);
		for (pfnext = &s->faces; f = *pfnext, f != NULL; )
		{
			if (detaillevel == -1 || f->detaillevel < detaillevel)
			{
				*pfnext = f->next;
				FreeFace (f);
			}
			else
			{
				pfnext = &f->next;
			}
		}
		if (!s->faces)
		{
			*psnext = s->next;
			FreeSurface (s);
		}
		else
		{
			psnext = &s->next;
			CalcSurfaceInfo (s);
			hlassume (!(detaillevel == -1 || s->detaillevel < detaillevel), assume_first);
		}
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq (%rdi), %r14
testq %r14, %r14
je 0x1824e
movl %esi, %ebx
movq %rdi, %r15
cmpq $0x0, 0x40(%r14)
je 0x181bb
movq %r14, %r15
jmp 0x1822f
xorl %edi, %edi
cmpq $0x0, 0x48(%r14)
setne %dil
movl $0x2, %esi
callq 0xa655
movq 0x48(%r14), %rdi
testq %rdi, %rdi
je 0x18221
leaq 0x48(%r14), %r12
movq %r12, %r13
cmpl $-0x1, %ebx
je 0x181ea
cmpl %ebx, 0x14(%rdi)
jge 0x181f8
movq (%rdi), %rax
movq %rax, (%r13)
callq 0x14e49
jmp 0x181fb
movq %rdi, %r13
movq (%r13), %rdi
testq %rdi, %rdi
jne 0x181e0
cmpq $0x0, (%r12)
je 0x18221
movq %r14, %rdi
callq 0x18258
cmpl $-0x1, %ebx
je 0x1823d
cmpl %ebx, 0x50(%r14)
setge %al
jmp 0x1823f
movq (%r14), %rax
movq %rax, (%r15)
movq %r14, %rdi
callq 0x14e5d
movq (%r15), %r14
testq %r14, %r14
jne 0x181af
jmp 0x1824e
xorl %eax, %eax
movzbl %al, %edi
xorl %esi, %esi
callq 0xa655
jmp 0x181b6
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/solidbsp.cpp
// Function: CalcSurfaceInfo(surface_s*)
static void     CalcSurfaceInfo(surface_t* surf)
{
    int             i;
    int             j;
    face_t*         f;

    hlassume(surf->faces != NULL, assume_ValidPointer);    // "CalcSurfaceInfo() surface without a face"

    //
    // calculate a bounding box
    //
    for (i = 0; i < 3; i++)
    {
        surf->mins[i] = 99999;
        surf->maxs[i] = -99999;
    }

#ifdef ZHLT_DETAILBRUSH
	surf->detaillevel = -1;
#endif
    for (f = surf->faces; f; f = f->next)
    {
        if (f->contents >= 0)
        {
            Error("Bad contents");
        }
        for (i = 0; i < f->numpoints; i++)
        {
            for (j = 0; j < 3; j++)
            {
                if (f->pts[i][j] < surf->mins[j])
                {
                    surf->mins[j] = f->pts[i][j];
                }
                if (f->pts[i][j] > surf->maxs[j])
                {
                    surf->maxs[j] = f->pts[i][j];
                }
            }
        }
#ifdef ZHLT_DETAILBRUSH
		if (surf->detaillevel == -1 || f->detaillevel < surf->detaillevel)
		{
			surf->detaillevel = f->detaillevel;
		}
#endif
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %edi, %edi
cmpq $0x0, 0x48(%rbx)
setne %dil
movl $0x2, %esi
callq 0xa655
movq $-0x3, %rax
movabsq $0x40f869f000000000, %rcx # imm = 0x40F869F000000000
movabsq $-0x3f07961000000000, %rdx # imm = 0xC0F869F000000000
movq %rcx, 0x28(%rbx,%rax,8)
movq %rdx, 0x40(%rbx,%rax,8)
incq %rax
jne 0x18290
movl $0xffffffff, 0x50(%rbx) # imm = 0xFFFFFFFF
movq 0x48(%rbx), %r15
testq %r15, %r15
je 0x18338
leaq 0xa624(%rip), %r14      # 0x228de
cmpl $0x0, 0x10(%r15)
js 0x182cb
movq %r14, %rdi
xorl %eax, %eax
callq 0x9e9c
cmpl $0x0, 0x2c(%r15)
jle 0x1831d
leaq 0x38(%r15), %rax
xorl %ecx, %ecx
xorl %edx, %edx
movsd (%rax,%rdx,8), %xmm0
movsd 0x10(%rbx,%rdx,8), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x182f6
movsd %xmm0, 0x10(%rbx,%rdx,8)
movsd (%rax,%rdx,8), %xmm0
ucomisd 0x28(%rbx,%rdx,8), %xmm0
jbe 0x18304
movsd %xmm0, 0x28(%rbx,%rdx,8)
incq %rdx
cmpq $0x3, %rdx
jne 0x182da
incq %rcx
movslq 0x2c(%r15), %rdx
addq $0x18, %rax
cmpq %rdx, %rcx
jl 0x182d8
movl 0x50(%rbx), %ecx
movl 0x14(%r15), %eax
cmpl $-0x1, %ecx
je 0x1832d
cmpl %ecx, %eax
jge 0x18330
movl %eax, 0x50(%rbx)
movq (%r15), %r15
testq %r15, %r15
jne 0x182ba
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/solidbsp.cpp
// Function: MakeLeaf(node_s*)
static void MakeLeaf (node_t *leafnode)
{
	int				nummarkfaces;
	face_t			*markfaces[MAX_LEAF_FACES + 1];
	surface_t		*surf;
	face_t			*f;	

    leafnode->planenum = -1;

	leafnode->iscontentsdetail = leafnode->detailbrushes != NULL;
	FreeLeafBrushes (leafnode);
	leafnode->detailbrushes = NULL;
#ifdef HLBSP_DETAILBRUSH_CULL
	if (leafnode->boundsbrush)
	{
		FreeBrush (leafnode->boundsbrush);
	}
	leafnode->boundsbrush = NULL;
#endif

	if (!(leafnode->isportalleaf && leafnode->contents == CONTENTS_SOLID))
	{
		nummarkfaces = 0;
		for (surf = leafnode->surfaces; surf; surf = surf->next)
		{
			if (!surf->onnode)
			{
				continue;
			}
#ifdef HLCSG_HLBSP_SOLIDHINT
			if (!surf->onnode)
			{
				continue;
			}
#endif
			for (f = surf->faces; f; f = f->next)
			{
				if (f->original == NULL)
				{ // because it is not on node or its content is solid
					continue;
				}
#ifdef HLCSG_HLBSP_SOLIDHINT
				if (f->original == NULL)
				{
					continue;
				}
#endif
				hlassume(nummarkfaces < MAX_LEAF_FACES, assume_MAX_LEAF_FACES);

				markfaces[nummarkfaces++] = f->original;
			}
		}
		markfaces[nummarkfaces] = NULL;                    // end marker
		nummarkfaces++;

		leafnode->markfaces = (face_t**)malloc(nummarkfaces * sizeof(*leafnode->markfaces));
		memcpy(leafnode->markfaces, markfaces, nummarkfaces * sizeof(*leafnode->markfaces));
	}

	FreeLeafSurfs(leafnode);
	leafnode->surfaces = NULL;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20010, %rsp          # imm = 0x20010
movq %rdi, %rbx
movl $0xffffffff, 0x80(%rdi) # imm = 0xFFFFFFFF
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
setne 0x4a(%rbx)
je 0x19a79
movq (%rdi), %r14
callq 0x14f2c
movq %r14, %rdi
testq %r14, %r14
jne 0x19a69
movq $0x0, 0x8(%rbx)
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x19a8f
callq 0x14f2c
movq $0x0, 0x10(%rbx)
cmpb $0x1, 0x49(%rbx)
jne 0x19aa6
cmpl $-0x2, 0xa0(%rbx)
je 0x19b24
movq (%rbx), %r14
xorl %ebp, %ebp
testq %r14, %r14
je 0x19af4
cmpq $0x0, 0x40(%r14)
je 0x19aef
movq 0x48(%r14), %r15
testq %r15, %r15
je 0x19aef
cmpq $0x0, 0x20(%r15)
je 0x19aea
xorl %edi, %edi
cmpl $0x4000, %ebp           # imm = 0x4000
setl %dil
movl $0x12, %esi
callq 0xa655
movq 0x20(%r15), %rax
movslq %ebp, %rcx
incl %ebp
movq %rax, (%rsp,%rcx,8)
movq (%r15), %r15
jmp 0x19abb
movq (%r14), %r14
jmp 0x19aab
movslq %ebp, %rax
movq $0x0, (%rsp,%rax,8)
leaq 0x8(,%rax,8), %r14
movq %r14, %rdi
callq 0x4400
movq %rax, 0xa8(%rbx)
movq %rsp, %rsi
movq %rax, %rdi
movq %r14, %rdx
callq 0x4260
movq (%rbx), %r14
testq %r14, %r14
je 0x19b58
movq (%r14), %r15
movq 0x48(%r14), %rdi
testq %rdi, %rdi
je 0x19b48
movq (%rdi), %r12
callq 0x14e49
movq %r12, %rdi
testq %r12, %r12
jne 0x19b38
movq %r14, %rdi
callq 0x14e5d
movq %r15, %r14
testq %r15, %r15
jne 0x19b2c
movq $0x0, (%rbx)
addq $0x20010, %rsp          # imm = 0x20010
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/surfaces.cpp
// Function: GetEdge(double const*, double const*, face_s*)
int             GetEdge(const vec3_t p1, const vec3_t p2, face_t* f)
{
    int             v1;
    int             v2;
    dedge_t*        edge;
    int             i;

    hlassert(f->contents);

    v1 = GetVertex(p1, f->planenum);
    v2 = GetVertex(p2, f->planenum);
    for (i = firstmodeledge; i < g_numedges; i++)
    {
        edge = &g_dedges[i];
        if (v1 == edge->v[1] && v2 == edge->v[0] && !edgefaces[i][1] && edgefaces[i][0]->contents == f->contents
#ifdef HLBSP_EDGESHARE_SAMESIDE
			&& edgefaces[i][0]->planenum != (f->planenum ^ 1)
			&& edgefaces[i][0]->contents == f->contents
#endif
			)
        {
            edgefaces[i][1] = f;
            return -i;
        }
    }

    // emit an edge
    hlassume(g_numedges < MAX_MAP_EDGES, assume_MAX_MAP_EDGES);
    edge = &g_dedges[g_numedges];
    g_numedges++;
    edge->v[0] = v1;
    edge->v[1] = v2;
    edgefaces[i][0] = f;

    return i;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movl 0x8(%rdx), %esi
callq 0x1a2b5
movl %eax, %r14d
movl 0x8(%rbx), %esi
movq %r15, %rdi
callq 0x1a2b5
movl %eax, %r15d
movl 0x11207(%rip), %ebp     # 0x2b400
leaq 0x1cf91bc(%rip), %r13   # 0x1d133bc
movl (%r13), %eax
leaq 0x32b9865(%rip), %r12   # 0x32d3a70
cmpl %eax, %ebp
jge 0x1a25f
movslq %ebp, %rcx
leaq 0x2(,%rcx,4), %rcx
leaq 0x1cf919f(%rip), %rdx   # 0x1d133c0
movzwl (%rdx,%rcx), %esi
cmpl %esi, %r14d
jne 0x1a253
movzwl -0x2(%rdx,%rcx), %esi
cmpl %esi, %r15d
jne 0x1a253
cmpq $0x0, (%r12,%rcx,4)
jne 0x1a253
movq -0x8(%r12,%rcx,4), %rsi
movl 0x10(%rsi), %edi
cmpl 0x10(%rbx), %edi
jne 0x1a253
movl 0x8(%rbx), %edi
xorl 0x8(%rsi), %edi
cmpl $0x1, %edi
jne 0x1a2ad
incl %ebp
addq $0x4, %rcx
cmpl %ebp, %eax
jne 0x1a221
movl %eax, %ebp
xorl %edi, %edi
cmpl $0x3e800, %eax          # imm = 0x3E800
setl %dil
movl $0x2d, %esi
callq 0xa655
movslq (%r13), %rax
leaq 0x1cf9141(%rip), %rcx   # 0x1d133c0
leal 0x1(%rax), %edx
movl %edx, (%r13)
movw %r14w, (%rcx,%rax,4)
movw %r15w, 0x2(%rcx,%rax,4)
movslq %ebp, %rax
shlq $0x4, %rax
movq %rbx, (%rax,%r12)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, (%r12,%rcx,4)
negl %ebp
jmp 0x1a29c
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/surfaces.cpp
// Function: MakeFaceEdges()
static void     InitHash()
{
    vec3_t          size;
    vec_t           volume;
    vec_t           scale;
    int             newsize[2];
    int             i;

    memset(hashverts, 0, sizeof(hashverts));

    for (i = 0; i < 3; i++)
    {
        hash_min[i] = -8000;
        size[i] = 16000;
    }

    volume = size[0] * size[1];

    scale = sqrt(volume / NUM_HASH);

#ifdef HLBSP_HASH_FIX
	hash_numslots[0] = (int)floor (size[0] / scale);
	hash_numslots[1] = (int)floor (size[1] / scale);
	while (hash_numslots[0] * hash_numslots[1] > NUM_HASH)
	{
		Developer (DEVELOPER_LEVEL_WARNING, "hash_numslots[0] * hash_numslots[1] > NUM_HASH");
		hash_numslots[0]--;
		hash_numslots[1]--;
	}

	hash_scale[0] = hash_numslots[0] / size[0];
	hash_scale[1] = hash_numslots[1] / size[1];
#else
    newsize[0] = size[0] / scale;
    newsize[1] = size[1] / scale;

    hash_scale[0] = newsize[0] / size[0];
    hash_scale[1] = newsize[1] / size[1];
    hash_scale[2] = newsize[1];
#endif

    hvert_p = hvertex;
}

// Assembly:
pushq %rbx
subq $0x50, %rsp
leaq 0x36a13bc(%rip), %rdi   # 0x36bba70
xorl %ebx, %ebx
movl $0x8000, %edx           # imm = 0x8000
xorl %esi, %esi
callq 0x4180
leaq 0x36a93d7(%rip), %rax   # 0x36c3aa0
movabsq $-0x3f40c00000000000, %rcx # imm = 0xC0BF400000000000
movabsq $0x40cf400000000000, %rdx # imm = 0x40CF400000000000
movq %rcx, (%rbx,%rax)
movq %rdx, 0x30(%rsp,%rbx)
addq $0x8, %rbx
cmpq $0x18, %rbx
jne 0x1a6dd
movapd 0x30(%rsp), %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
movapd %xmm1, (%rsp)
mulsd %xmm1, %xmm0
mulsd 0x8501(%rip), %xmm0     # 0x22c10
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x1a71f
sqrtsd %xmm0, %xmm0
jmp 0x1a724
callq 0x4240
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
movapd (%rsp), %xmm1
divpd %xmm0, %xmm1
movapd %xmm1, 0x10(%rsp)
movapd %xmm1, %xmm0
callq 0x4530
movapd %xmm0, 0x20(%rsp)
movapd 0x10(%rsp), %xmm0
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
callq 0x4530
movapd 0x20(%rsp), %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
cvttpd2dq %xmm1, %xmm0
movd %xmm0, %eax
pshufd $0x55, %xmm0, %xmm1     # xmm1 = xmm0[1,1,1,1]
movd %xmm1, %ecx
imull %eax, %ecx
movq %xmm0, 0x36a933d(%rip)  # 0x36c3ab8
cmpl $0x1001, %ecx           # imm = 0x1001
jl 0x1a7c9
leaq 0x8502(%rip), %rbx      # 0x22c8c
movl $0x2, %edi
movq %rbx, %rsi
xorl %eax, %eax
callq 0xa3ae
movq 0x36a9317(%rip), %xmm0  # 0x36c3ab8
paddd 0x8477(%rip), %xmm0     # 0x22c20
movd %xmm0, %eax
pshufd $0x55, %xmm0, %xmm1     # xmm1 = xmm0[1,1,1,1]
movd %xmm1, %ecx
imull %eax, %ecx
movq %xmm0, 0x36a92f7(%rip)  # 0x36c3ab8
cmpl $0x1000, %ecx           # imm = 0x1000
jg 0x1a78a
cvtdq2pd %xmm0, %xmm0
divpd (%rsp), %xmm0
movapd %xmm0, 0x36a92a6(%rip)  # 0x36c3a80
leaq 0x36a92ef(%rip), %rax   # 0x36c3ad0
movq %rax, 0x36a9288(%rip)   # 0x36c3a70
leaq 0x1cf8bcd(%rip), %rax   # 0x1d133bc
movl (%rax), %eax
movl %eax, 0x10c09(%rip)     # 0x2b400
addq $0x50, %rsp
popq %rbx
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/tjunc.cpp
// Function: tjunc(node_s*)
void            tjunc(node_t* headnode)
{
    vec3_t          maxs, mins;
    int             i;

    Verbose("---- tjunc ----\n");

    if (g_notjunc)
    {
        return;
    }

    //
    // identify all points on common edges
    //

    // origin points won't allways be inside the map, so extend the hash area 
    for (i = 0; i < 3; i++)
    {
        if (fabs(headnode->maxs[i]) > fabs(headnode->mins[i]))
        {
            maxs[i] = fabs(headnode->maxs[i]);
        }
        else
        {
            maxs[i] = fabs(headnode->mins[i]);
        }
    }
    VectorSubtract(vec3_origin, maxs, mins);

    InitHash(mins, maxs);

    numwedges = numwverts = 0;

    tjunc_find_r(headnode);

    Verbose("%i world edges  %i edge points\n", numwedges, numwverts);

    //
    // add extra vertexes on edges where needed
    //
    tjuncs = tjuncfaces = 0;

    tjunc_fix_r(headnode);

    Verbose("%i edges added by tjunctions\n", tjuncs);
    Verbose("%i faces added by tjunctions\n", tjuncfaces);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x84f3(%rip), %rdi      # 0x22d00
xorl %ebp, %ebp
xorl %eax, %eax
callq 0xa2ef
leaq 0x20b91e7(%rip), %rax   # 0x20d3a04
cmpb $0x0, (%rax)
je 0x1a829
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movaps 0x8490(%rip), %xmm0     # 0x22cc0
movaps %xmm0, 0x3a31279(%rip)  # 0x3a4bab0
movabsq $-0x3f40c00000000000, %rax # imm = 0xC0BF400000000000
movq %rax, 0x3a31278(%rip)   # 0x3a4bac0
leaq 0x3a29251(%rip), %rdi   # 0x3a43aa0
movl $0x8000, %edx           # imm = 0x8000
xorl %esi, %esi
callq 0x4180
movabsq $0x4000000040, %rax     # imm = 0x4000000040
movq %rax, 0x3a3125c(%rip)   # 0x3a4bac8
movaps 0x845d(%rip), %xmm0     # 0x22cd0
movaps %xmm0, 0x3a31266(%rip)  # 0x3a4bae0
movl %ebp, 0x3a31220(%rip)   # 0x3a4baa0
movl %ebp, 0x3a3121e(%rip)   # 0x3a4baa4
movq %rbx, %rdi
callq 0x1a8ea
movl 0x3a31210(%rip), %esi   # 0x3a4baa4
movl 0x3a31206(%rip), %edx   # 0x3a4baa0
leaq 0x8470(%rip), %rdi      # 0x22d11
xorl %eax, %eax
callq 0xa2ef
movl %ebp, 0x3a311fa(%rip)   # 0x3a4baa8
movl %ebp, 0x3a311f8(%rip)   # 0x3a4baac
movq %rbx, %rdi
callq 0x1a9c5
movl 0x3a311ea(%rip), %esi   # 0x3a4baac
leaq 0x8468(%rip), %rdi      # 0x22d31
xorl %eax, %eax
callq 0xa2ef
movl 0x3a311d2(%rip), %esi   # 0x3a4baa8
leaq 0x8472(%rip), %rdi      # 0x22d4f
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xa2ef
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/tjunc.cpp
// Function: tjunc_find_r(node_s*)
static void     tjunc_find_r(node_t* node)
{
    face_t*         f;

    if (node->planenum == PLANENUM_LEAF)
    {
        return;
    }

    for (f = node->faces; f; f = f->next)
    {
        AddFaceEdges(f);
    }

    tjunc_find_r(node->children[0]);
    tjunc_find_r(node->children[1]);
}

// Assembly:
cmpl $-0x1, 0x80(%rdi)
je 0x1a9c4
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x20(%rsp), %rbp
leaq 0x18(%rsp), %r14
movq %rbx, 0x8(%rsp)
movq 0x98(%rbx), %rbx
testq %rbx, %rbx
je 0x1a991
movl 0x2c(%rbx), %ecx
testl %ecx, %ecx
jle 0x1a98c
leaq 0x38(%rbx), %r12
movq %r12, 0x10(%rsp)
xorl %r13d, %r13d
incq %r13
movl %r13d, %eax
cltd
idivl %ecx
leaq (%rdx,%rdx,2), %rax
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax,8), %rsi
movq %r12, %rdi
movq %rbp, %rdx
movq %r14, %rcx
callq 0x1b14b
movq %rbp, %r15
movq %rax, %rbp
movsd 0x20(%rsp), %xmm0
movq %rax, %rdi
callq 0x1b6ae
movsd 0x18(%rsp), %xmm0
movq %rbp, %rdi
movq %r15, %rbp
callq 0x1b6ae
movslq 0x2c(%rbx), %rcx
addq $0x18, %r12
cmpq %rcx, %r13
jl 0x1a936
movq (%rbx), %rbx
jmp 0x1a91e
movq 0x8(%rsp), %rbx
movq 0x88(%rbx), %rdi
callq 0x1a8ea
movq 0x90(%rbx), %rbx
cmpl $-0x1, 0x80(%rbx)
jne 0x1a912
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/tjunc.cpp
// Function: AddVert(wedge_s const*, double)
static void     AddVert(const wedge_t* const w, const vec_t t)
{
    wvert_t*        v;
    wvert_t*        newv;

    v = w->head.next;
    do
    {
        if (fabs(v->t - t) < T_EPSILON)
        {
            return;
        }
        if (v->t > t)
        {
            break;
        }
        v = v->next;
    }
    while (1);

    // insert a new wvert before v
    hlassume(numwverts < MAX_WVERTS, assume_MAX_WVERTS);

    newv = &wverts[numwverts];
    numwverts++;

    newv->t = t;
    newv->next = v;
    newv->prev = v->prev;
    v->prev->next = newv;
    v->prev = newv;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq 0x48(%rdi), %rbx
movsd (%rbx), %xmm1
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
andpd 0x4bf5(%rip), %xmm2     # 0x202c0
movsd 0x4dad(%rip), %xmm4     # 0x20480
ucomisd %xmm2, %xmm4
ja 0x1b763
movapd 0x4bdb(%rip), %xmm2     # 0x202c0
ucomisd %xmm0, %xmm1
ja 0x1b707
movq 0x10(%rbx), %rbx
movsd (%rbx), %xmm1
movapd %xmm1, %xmm3
subsd %xmm0, %xmm3
andpd %xmm2, %xmm3
ucomisd %xmm3, %xmm4
jbe 0x1b6e5
jmp 0x1b763
xorl %edi, %edi
cmpl $0x40000, 0x3a3038d(%rip) # imm = 0x40000
setl %dil
movl $0x14, %esi
movsd %xmm0, 0x8(%rsp)
callq 0xa655
movslq 0x3a30372(%rip), %rax   # 0x3a4baa0
leaq (%rax,%rax,2), %rcx
leaq 0x44303c7(%rip), %rdx   # 0x444bb00
leaq (%rdx,%rcx,8), %rcx
incl %eax
movl %eax, 0x3a3035b(%rip)   # 0x3a4baa0
movsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rcx)
movq %rbx, 0x10(%rcx)
movq 0x8(%rbx), %rax
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rax)
movq %rcx, 0x8(%rbx)
addq $0x10, %rsp
popq %rbx
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/writebsp.cpp
// Function: OutputEdges_face(face_s*)
void OutputEdges_face (face_t *f)
{
	if (CheckFaceForHint(f)
		|| CheckFaceForSkip(f)
#ifdef ZHLT_NULLTEX
        || CheckFaceForNull(f)  // AJM
#endif
#ifdef HLCSG_HLBSP_SOLIDHINT
		|| CheckFaceForDiscardable (f)
#endif
#ifdef HLCSG_HLBSP_VOIDTEXINFO
		|| f->texturenum == -1
#endif
#ifdef HLBSP_REMOVECOVEREDFACES
		|| f->referenced == 0
#endif
		|| CheckFaceForEnv_Sky(f)//Cpt_Andrew - Env_Sky Check
		)
	{
		return;
	}
	f->outputedges = (int *)malloc (f->numpoints * sizeof (int));
	hlassume (f->outputedges != NULL, assume_NoMemory);
	int i;
	for (i = 0; i < f->numpoints; i++)
	{
		int e = GetEdge (f->pts[i], f->pts[(i + 1) % f->numpoints], f);
		f->outputedges[i] = e;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
callq 0x15575
testb %al, %al
jne 0x1ba3c
movq %rbx, %rdi
callq 0x15599
testb %al, %al
jne 0x1ba3c
movq %rbx, %rdi
callq 0x154f3
testb %al, %al
jne 0x1ba3c
movq %rbx, %rdi
callq 0x155bd
testb %al, %al
jne 0x1ba3c
cmpl $-0x1, 0xc(%rbx)
je 0x1ba3c
cmpl $0x0, 0x34(%rbx)
je 0x1ba3c
movq %rbx, %rdi
callq 0x15551
testb %al, %al
jne 0x1ba3c
movslq 0x2c(%rbx), %rdi
shlq $0x2, %rdi
callq 0x4400
movq %rax, 0x18(%rbx)
xorl %edi, %edi
testq %rax, %rax
setne %dil
movl $0x1, %esi
callq 0xa655
movl 0x2c(%rbx), %ecx
testl %ecx, %ecx
jle 0x1ba3c
leaq 0x38(%rbx), %r12
xorl %r13d, %r13d
movq %r12, %r14
leaq 0x1(%r13), %r15
movl %r15d, %eax
cltd
idivl %ecx
leaq (%rdx,%rdx,2), %rax
leaq (%r12,%rax,8), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x1a1c9
movq 0x18(%rbx), %rcx
movl %eax, (%rcx,%r13,4)
movslq 0x2c(%rbx), %rcx
addq $0x18, %r14
movq %r15, %r13
cmpq %rcx, %r15
jl 0x1ba07
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/writebsp.cpp
// Function: OutputEdges_r(node_s*, int)
int OutputEdges_r (node_t *node, int detaillevel)
{
	int next = -1;
	if (node->planenum == -1)
	{
		return next;
	}
	face_t *f;
	for (f = node->faces; f; f = f->next)
	{
		if (f->detaillevel > detaillevel)
		{
			if (next == -1? true: f->detaillevel < next)
			{
				next = f->detaillevel;
			}
		}
		if (f->detaillevel == detaillevel)
		{
			OutputEdges_face (f);
		}
	}
	int i;
	for (i = 0; i < 2; i++)
	{
		int r = OutputEdges_r (node->children[i], detaillevel);
		if (r == -1? false: next == -1? true: r < next)
		{
			next = r;
		}
	}
	return next;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpl $-0x1, 0x80(%rdi)
je 0x1bacb
movl %esi, %ebx
movq %rdi, %r14
movq 0x98(%rdi), %r15
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %r15, %r15
je 0x1ba91
movl %ebp, %eax
movl 0x14(%r15), %ecx
cmpl %ebp, %ecx
cmovll %ecx, %ebp
cmpl $-0x1, %eax
cmovel %ecx, %ebp
cmpl %ebx, %ecx
cmovlel %eax, %ebp
jne 0x1ba8c
movq %r15, %rdi
callq 0x1b971
movq (%r15), %r15
jmp 0x1ba67
movb $0x1, %r15b
xorl %eax, %eax
movq 0x88(%r14,%rax,8), %rdi
movl %ebx, %esi
callq 0x1ba46
cmpl %ebp, %eax
movl %ebp, %ecx
cmovll %eax, %ecx
cmpl $-0x1, %ebp
cmovel %eax, %ecx
cmpl $-0x1, %eax
cmovnel %ecx, %ebp
movl $0x1, %eax
testb $0x1, %r15b
movl $0x0, %r15d
jne 0x1ba96
jmp 0x1bad0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlbsp/writebsp.cpp
// Function: WritePlane(int)
static int WritePlane(int planenum)
{
	planenum = planenum & (~1);

	if(g_noopt)
	{
		return planenum;
	}

	PlaneMap::iterator item = gPlaneMap.find(planenum);
	if(item != gPlaneMap.end())
	{
		return item->second;
	}
	//add plane to BSP
	hlassume(gNumMappedPlanes < MAX_MAP_PLANES, assume_MAX_MAP_PLANES);
	gMappedPlanes[gNumMappedPlanes] = g_dplanes[planenum];
	gPlaneMap.insert(PlaneMap::value_type(planenum,gNumMappedPlanes));

	return gNumMappedPlanes++;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movl %edi, %ebx
andl $-0x2, %ebx
leaq 0x20b6e90(%rip), %rax   # 0x20d3a00
cmpb $0x0, (%rax)
jne 0x1cc3c
movq 0x4a32fa0(%rip), %rcx   # 0x4a4fb20
testq %rcx, %rcx
je 0x1cbb7
leaq 0x4a32f8c(%rip), %rax   # 0x4a4fb18
xorl %edx, %edx
cmpl %ebx, 0x20(%rcx)
setl %dl
cmovgeq %rcx, %rax
movq 0x10(%rcx,%rdx,8), %rcx
testq %rcx, %rcx
jne 0x1cb8c
leaq 0x4a32f6f(%rip), %rcx   # 0x4a4fb18
cmpq %rcx, %rax
je 0x1cbb7
cmpl 0x20(%rax), %ebx
jge 0x1cc44
xorl %edi, %edi
cmpl $0x8000, 0x4a32fb1(%rip) # imm = 0x8000
setl %dil
movl $0x23, %esi
callq 0xa655
movslq %ebx, %rax
shlq $0x6, %rax
leaq 0x20b6e31(%rip), %rcx   # 0x20d3a10
movslq 0x4a32f8e(%rip), %rdx   # 0x4a4fb74
leaq 0x8(%rsp), %rsi
movl %ebx, (%rsi)
movl %edx, 0x4(%rsi)
shlq $0x6, %rdx
leaq 0x4b72f65(%rip), %rdi   # 0x4b8fb60
movaps (%rcx,%rax), %xmm0
movaps 0x10(%rcx,%rax), %xmm1
movaps 0x20(%rcx,%rax), %xmm2
movaps 0x30(%rcx,%rax), %xmm3
movaps %xmm0, (%rdx,%rdi)
movaps %xmm1, 0x10(%rdx,%rdi)
movaps %xmm2, 0x20(%rdx,%rdi)
movaps %xmm3, 0x30(%rdx,%rdi)
leaq 0x4a32ee8(%rip), %rdi   # 0x4a4fb10
callq 0x1cca0
movl 0x4a32f41(%rip), %ebx   # 0x4a4fb74
leal 0x1(%rbx), %eax
movl %eax, 0x4a32f38(%rip)   # 0x4a4fb74
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
movl 0x24(%rax), %ebx
jmp 0x1cc3c
nop
// File: /workspace/github_cpp_makefile_star2_O3/rtackx[P]ComSim/main.cpp
// Function: select_similarity(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, Graph*&)
Projection* select_similarity(string similarity_index, Graph*& in_graph)
{
	if(similarity_index == "cn")
		return new CommonNeighbors(in_graph);
	else if(similarity_index == "ji")
		return new JaccardIndex(in_graph);
	else if(similarity_index == "aa")
		return new AdamicAdar(in_graph);
	else if(similarity_index == "ra")
		return new ResourceAllocator(in_graph);
	else if(similarity_index == "lhn")
		return new LHN1(in_graph);
	else if(similarity_index == "pan")
		return new PA_Neighbor(in_graph);

  return NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x79fa(%rip), %rsi      # 0xa7ca
callq 0x20c0
testl %eax, %eax
je 0x2e54
leaq 0x79ed(%rip), %rsi      # 0xa7cd
movq %r14, %rdi
callq 0x20c0
testl %eax, %eax
je 0x2e71
leaq 0x79d9(%rip), %rsi      # 0xa7d0
movq %r14, %rdi
callq 0x20c0
testl %eax, %eax
je 0x2e8b
leaq 0x79c5(%rip), %rsi      # 0xa7d3
movq %r14, %rdi
callq 0x20c0
testl %eax, %eax
je 0x2ea5
leaq 0x79b1(%rip), %rsi      # 0xa7d6
movq %r14, %rdi
callq 0x20c0
testl %eax, %eax
je 0x2ebf
leaq 0x799e(%rip), %rsi      # 0xa7da
movq %r14, %rdi
callq 0x20c0
testl %eax, %eax
je 0x2ed9
xorl %r14d, %r14d
jmp 0x2ef1
movl $0x20, %edi
callq 0x2250
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x5cd2
jmp 0x2ef1
movl $0x20, %edi
callq 0x2250
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x5e46
jmp 0x2ef1
movl $0x20, %edi
callq 0x2250
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x603e
jmp 0x2ef1
movl $0x20, %edi
callq 0x2250
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x60fc
jmp 0x2ef1
movl $0x20, %edi
callq 0x2250
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x61b6
jmp 0x2ef1
movl $0x20, %edi
callq 0x2250
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x63bc
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
jmp 0x2f06
jmp 0x2f06
jmp 0x2f06
jmp 0x2f06
jmp 0x2f06
movq %rax, %rbx
movq %r14, %rdi
callq 0x2220
movq %rbx, %rdi
callq 0x23d0
// File: /workspace/github_cpp_makefile_star2_O3/rtackx[P]ComSim/graph.cpp
// Function: Graph::~Graph()
Graph::~Graph()
{
	unsigned int index, nb;

	index = 0;
	while(index < n)
	{
		nb = list_nodes[index]->nb_neighbors;
		delete list_nodes[index];
		index++;		
	}

	if(list_nodes)
		delete[] list_nodes;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, (%rdi)
je 0x3e17
xorl %r15d, %r15d
movq 0x8(%rbx), %rax
movq (%rax,%r15,8), %r14
testq %r14, %r14
je 0x3e05
movq %r14, %rdi
callq 0x26a2
movq %r14, %rdi
callq 0x2220
incq %r15
movl (%rbx), %eax
cmpq %rax, %r15
jb 0x3df0
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x3e2a
popq %rbx
popq %r14
popq %r15
jmp 0x22c0
popq %rbx
popq %r14
popq %r15
retq