LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/FreeSlave[P]vhlt/hlbsp/brink.cpp
// Function: FixBrinks(void const*, bbrinklevel_e, int&, dclipnode_t*, int, int, int&)
bool FixBrinks (const void *brinkinfo, bbrinklevel_e level, int &headnode_out, dclipnode_t *clipnodes_out, int maxsize, int size, int &size_out)
{
	const bbrinkinfo_t *info = (const bbrinkinfo_t *)brinkinfo;
	dclipnode_t *begin = clipnodes_out;
	dclipnode_t *end = &clipnodes_out[maxsize];
	dclipnode_t *current = &clipnodes_out[size];
#ifdef HLBSP_MERGECLIPNODE
	clipnodemap_t outputmap;
#endif
	int r;
	if (!FixBrinks_r (&info->clipnodes[0], level, r, begin, end, current
#ifdef HLBSP_MERGECLIPNODE
		, &outputmap
#endif
		))
	{
		return false;
	}
	headnode_out = r;
	size_out = current - begin;
	return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movslq %r9d, %rax
leaq (%rcx,%rax,8), %rax
leaq 0x18(%rsp), %r9
leaq 0x28(%rsp), %rcx
andl $0x0, (%rcx)
movq %rax, (%r9)
andq $0x0, 0x8(%rcx)
movslq %r8d, %rax
leaq (%rbx,%rax,8), %r8
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
andq $0x0, 0x20(%rcx)
movq 0x8(%rdi), %rdi
leaq 0x20(%rsp), %rax
movq %rax, (%rsp)
leaq 0x14(%rsp), %rdx
movq %rbx, %rcx
callq 0xf717
movl %eax, %ebp
testb %al, %al
je 0xf928
movq 0x70(%rsp), %rax
movl 0x14(%rsp), %ecx
movl %ecx, (%r14)
movq 0x18(%rsp), %rcx
subq %rbx, %rcx
shrq $0x3, %rcx
movl %ecx, (%rax)
leaq 0x20(%rsp), %rdi
callq 0xfc66
movl %ebp, %eax
addq $0x50, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xfc66
movq %rbx, %rdi
callq 0x4550
// File: /workspace/github_cpp_makefile_star2_O2/FreeSlave[P]vhlt/hlbsp/merge.cpp
// Function: MergePlaneFaces(surface_s*)
void            MergePlaneFaces(surface_t* plane)
{
    face_t*         f1;
    face_t*         next;
    face_t*         merged;

    merged = NULL;

    for (f1 = plane->faces; f1; f1 = next)
    {
        next = f1->next;
        merged = MergeFaceToList(f1, merged);
    }

    // chain all of the non-empty faces to the plane
    plane->faces = FreeMergeListScraps(merged);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x48(%rdi), %rdi
xorl %eax, %eax
testq %rdi, %rdi
je 0x10b4f
movq (%rdi), %r14
movq %rax, %rsi
callq 0x10b82
movq %r14, %rdi
jmp 0x10b3a
xorl %r14d, %r14d
testq %rax, %rax
je 0x10b78
movq (%rax), %r15
cmpl $-0x1, 0x2c(%rax)
jne 0x10b6d
movq %rax, %rdi
callq 0x12fa3
movq %r15, %rax
jmp 0x10b52
movq %r14, (%rax)
movq %rax, %r14
movq %r15, %rax
jmp 0x10b52
movq %r14, 0x48(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/FreeSlave[P]vhlt/hlbsp/merge.cpp
// Function: MergeAll(surface_s*)
void            MergeAll(surface_t* surfhead)
{
    surface_t*      surf;
    int             mergefaces;
    face_t*         f;

    Verbose("---- MergeAll ----\n");

    mergefaces = 0;
    for (surf = surfhead; surf; surf = surf->next)
    {
        MergePlaneFaces(surf);
        for (f = surf->faces; f; f = f->next)
        {
            mergefaces++;
        }
    }

    Verbose("%i mergefaces\n", mergefaces);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0xdcc9(%rip), %rdi      # 0x1ed9b
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x8f76
testq %r14, %r14
je 0x110fd
movq %r14, %rdi
callq 0x10b2c
leaq 0x48(%r14), %rax
decl %ebx
movq (%rax), %rax
incl %ebx
testq %rax, %rax
jne 0x110ee
movq (%r14), %r14
jmp 0x110db
leaq 0xdcab(%rip), %rdi      # 0x1edaf
movl %ebx, %esi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x8f76
// File: /workspace/github_cpp_makefile_star2_O2/FreeSlave[P]vhlt/hlbsp/outside.cpp
// Function: isClassnameAllowableOutside(char const*)
bool            isClassnameAllowableOutside(const char* const classname)
{
    if (g_strAllowableOutsideList)
    {
        unsigned        x;
        char**          list = g_strAllowableOutsideList;

        for (x = 0; x < g_nAllowableOutside; x++, list++)
        {
            if (list)
            {
                if (!strcasecmp(classname, *list))
                {
                    return true;
                }
            }
        }
    }

    return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x20bc7bd(%rip), %r14   # 0x20cd8e0
testq %r14, %r14
je 0x11153
movq %rdi, %rbx
movl 0x20bc7a6(%rip), %r15d  # 0x20cd8d8
xorl %r12d, %r12d
cmpl %r12d, %r15d
setne %bpl
je 0x11155
movq (%r14,%r12,8), %rsi
movq %rbx, %rdi
callq 0x4330
testl %eax, %eax
je 0x11155
incq %r12
jmp 0x11135
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/FreeSlave[P]vhlt/hlbsp/outside.cpp
// Function: MarkOccupied_r(node_s*)
void			MarkOccupied_r (node_t* node)
{
	if (node->empty == 1)
	{
		node->empty = 0;
		portal_t*       p;
		int             s;
		for (p = node->portals; p; p = p->next[!s])
		{
			s = (p->nodes[0] == node);
			MarkOccupied_r (p->nodes[s]);
		}
	}
}

// Assembly:
cmpl $0x1, 0xc4(%rdi)
jne 0x11b16
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
andl $0x0, 0xc4(%rdi)
leaq 0xb0(%rdi), %rax
movq (%rax), %r14
testq %r14, %r14
je 0x11b11
xorl %r15d, %r15d
xorl %eax, %eax
cmpq %rbx, 0x48(%r14)
setne %r15b
sete %al
movq 0x48(%r14,%rax,8), %rdi
callq 0x11ac6
leaq (%r14,%r15,8), %rax
addq $0x58, %rax
jmp 0x11ae5
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/FreeSlave[P]vhlt/hlbsp/outside.cpp
// Function: FillLeaf(node_s*)
static void FillLeaf (node_t *l)
{
	if (!l->isportalleaf)
	{
		Warning ("FillLeaf: not leaf");
		return;
	}
	if (l->contents == CONTENTS_SOLID)
	{
		Warning ("FillLeaf: fill solid");
		return;
	}
	FreeDetailNode_r (l);
	l->contents = CONTENTS_SOLID;
	l->planenum = -1;
}

// Assembly:
pushq %rbx
cmpb $0x0, 0x49(%rdi)
je 0x11b63
movq %rdi, %rbx
cmpl $-0x2, 0xa0(%rdi)
jne 0x11b72
leaq 0xd6bc(%rip), %rdi      # 0x1f21d
jmp 0x11b6a
leaq 0xd6a0(%rip), %rdi      # 0x1f20a
xorl %eax, %eax
popq %rbx
jmp 0x8e95
movq %rbx, %rdi
callq 0x11cfc
movl $0xfffffffe, 0xa0(%rbx) # imm = 0xFFFFFFFE
orl $-0x1, 0x80(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/FreeSlave[P]vhlt/hlbsp/outside.cpp
// Function: FillInside(node_s*)
void			FillInside (node_t* node)
{
	int i;
	g_outside_node.empty = 0;
	ResetMark_r (node);
    for (i = 1; i < g_numentities; i++)
    {
		if (*ValueForKey(&g_entities[i], "origin"))
		{
			vec3_t origin;
			node_t* innode;
			GetVectorForKey(&g_entities[i], "origin", origin);
			origin[2] += 1;
			innode = PointInLeaf (node, origin);
			MarkOccupied_r (innode);
			origin[2] -= 2;
			innode = PointInLeaf (node, origin);
			MarkOccupied_r (innode);
		}
	}
	RemoveUnused_r (node);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x20bbd7b(%rip), %rax   # 0x20cd920
andl $0x0, 0xc4(%rax)
callq 0x11a8c
leaq 0x200e848(%rip), %r14   # 0x2020400
addq $0x28, %r14
pushq $0x1
popq %r13
leaq 0x200e82d(%rip), %rbp   # 0x20203f4
leaq 0x9a74(%rip), %r15      # 0x1b642
movq %rsp, %r12
movslq (%rbp), %rax
cmpq %rax, %r13
jge 0x11c4f
movq %r14, %rdi
movq %r15, %rsi
callq 0x691b
cmpb $0x0, (%rax)
je 0x11c46
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x7190
movsd 0x10(%rsp), %xmm0
addsd 0xc422(%rip), %xmm0     # 0x1e028
movsd %xmm0, 0x10(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x11c66
movq %rax, %rdi
callq 0x11ac6
movsd 0x10(%rsp), %xmm0
addsd 0xd193(%rip), %xmm0     # 0x1edc0
movsd %xmm0, 0x10(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x11c66
movq %rax, %rdi
callq 0x11ac6
incq %r13
addq $0x28, %r14
jmp 0x11bd1
movq %rbx, %rdi
callq 0x11b17
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/FreeSlave[P]vhlt/hlbsp/outside.cpp
// Function: PointInLeaf(node_s*, double const*)
static node_t*  PointInLeaf(node_t* node, const vec3_t point)
{
    vec_t           d;

#ifdef ZHLT_DETAILBRUSH
	if (node->isportalleaf)
#else
    if (node->contents)
#endif
    {
        //Log("PointInLeaf::node->contents == %i\n", node->contents);
        return node;
    }

    d = DotProduct(g_dplanes[node->planenum].normal, point) - g_dplanes[node->planenum].dist;

    if (d > 0)
        return PointInLeaf(node->children[0], point);

    return PointInLeaf(node->children[1], point);
}

// Assembly:
movq %rdi, %rax
leaq 0x20c0db0(%rip), %rcx   # 0x20d2a20
cmpb $0x0, 0x49(%rax)
jne 0x11cbe
movslq 0x80(%rax), %rdx
shlq $0x6, %rdx
movsd 0x8(%rcx,%rdx), %xmm0
mulsd 0x8(%rsi), %xmm0
movsd (%rcx,%rdx), %xmm1
mulsd (%rsi), %xmm1
addsd %xmm0, %xmm1
movsd 0x10(%rcx,%rdx), %xmm0
mulsd 0x10(%rsi), %xmm0
addsd %xmm1, %xmm0
xorl %edi, %edi
ucomisd 0x30(%rcx,%rdx), %xmm0
setbe %dil
movq 0x88(%rax,%rdi,8), %rax
jmp 0x11c70
retq
// File: /workspace/github_cpp_makefile_star2_O2/FreeSlave[P]vhlt/hlbsp/outside.cpp
// Function: MarkFacesInside_r(node_s*)
static void MarkFacesInside_r (node_t *node)
{
	if (node->planenum == -1)
	{
		face_t **fp;
		for (fp = node->markfaces; *fp; fp++)
		{
	        (*fp)->outputnumber = 0;
		}
	}
	else
	{
		MarkFacesInside_r (node->children[0]);
		MarkFacesInside_r (node->children[1]);
	}
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpl $-0x1, 0x80(%rbx)
je 0x11ce1
movq 0x88(%rbx), %rdi
callq 0x11cbf
movq 0x90(%rbx), %rbx
jmp 0x11cc3
movq 0xa8(%rbx), %rax
movq (%rax), %rcx
testq %rcx, %rcx
je 0x11cfa
andl $0x0, 0x28(%rcx)
addq $0x8, %rax
jmp 0x11ce8
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/FreeSlave[P]vhlt/hlbsp/outside.cpp
// Function: FreeDetailNode_r(node_s*)
static void FreeDetailNode_r (node_t *n)
{
	int i;
	if (n->planenum == -1)
	{
		if (!(n->isportalleaf && n->contents == CONTENTS_SOLID))
		{
			free (n->markfaces);
			n->markfaces = NULL;
		}
		return;
	}
	for (i = 0; i < 2; i++)
	{
		FreeDetailNode_r (n->children[i]);
		free (n->children[i]);
		n->children[i] = NULL;
	}
	face_t *f, *next;
	for (f = n->faces; f; f = next)
	{
		next = f->next;
		FreeFace (f);
	}
	n->faces = NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $-0x1, 0x80(%rdi)
je 0x11d5d
xorl %r14d, %r14d
cmpq $0x2, %r14
je 0x11d3d
movq 0x88(%rbx,%r14,8), %rdi
callq 0x11cfc
movq 0x88(%rbx,%r14,8), %rdi
callq 0x4390
andq $0x0, 0x88(%rbx,%r14,8)
incq %r14
jmp 0x11d0f
movq 0x98(%rbx), %rdi
addq $0x98, %rbx
testq %rdi, %rdi
je 0x11d7f
movq (%rdi), %r14
callq 0x12fa3
movq %r14, %rdi
jmp 0x11d4b
cmpb $0x1, 0x49(%rbx)
jne 0x11d6c
cmpl $-0x2, 0xa0(%rbx)
je 0x11d83
movq 0xa8(%rbx), %rdi
addq $0xa8, %rbx
callq 0x4390
andq $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/FreeSlave[P]vhlt/hlbsp/portals.cpp
// Function: AddPortalToNodes(portal_s*, node_s*, node_s*)
void            AddPortalToNodes(portal_t* p, node_t* front, node_t* back)
{
    if (p->nodes[0] || p->nodes[1])
    {
        Error("AddPortalToNode: allready included");
    }

    p->nodes[0] = front;
    p->next[0] = front->portals;
    front->portals = p;

    p->nodes[1] = back;
    p->next[1] = back->portals;
    back->portals = p;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
cmpq $0x0, 0x48(%rdi)
jne 0x11da8
cmpq $0x0, 0x50(%r14)
je 0x11db6
leaq 0xd4b9(%rip), %rdi      # 0x1f268
xorl %eax, %eax
callq 0x8b1f
movq %r15, 0x48(%r14)
movq 0xb0(%r15), %rax
movq %rax, 0x58(%r14)
movq %r14, 0xb0(%r15)
movq %rbx, 0x50(%r14)
movq 0xb0(%rbx), %rax
movq %rax, 0x60(%r14)
movq %r14, 0xb0(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0xd484(%rip), %r15      # 0x1f28b
leaq 0xd4a6(%rip), %r12      # 0x1f2b4
movq (%r13), %rbp
testq %rbp, %rbp
jne 0x11e21
movq %r15, %rdi
xorl %eax, %eax
callq 0x8b1f
cmpq %rbx, %rbp
je 0x11e50
cmpq %r14, 0x48(%rbp)
je 0x11e3e
cmpq %r14, 0x50(%rbp)
je 0x11e47
movq %r12, %rdi
xorl %eax, %eax
callq 0x8b1f
jmp 0x11e0e
addq $0x58, %rbp
movq %rbp, %r13
jmp 0x11e0e
addq $0x60, %rbp
movq %rbp, %r13
jmp 0x11e0e
cmpq %r14, 0x48(%rbx)
je 0x11e64
cmpq %r14, 0x50(%rbx)
jne 0x11e77
leaq 0x50(%rbx), %rax
pushq $0x60
jmp 0x11e6a
leaq 0x48(%rbx), %rax
pushq $0x58
popq %rcx
movq (%rbx,%rcx), %rcx
movq %rcx, (%r13)
andq $0x0, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
andl $0x0, 0x20bb94a(%rip)   # 0x20cd9e8
movq %rdi, %rbx
andl $0x0, 0x20bb944(%rip)   # 0x20cd9ec
callq 0x121d0
leaq 0x20be95c(%rip), %rdi   # 0x20d0a10
leaq 0xe00c(%rip), %rsi      # 0x200c7
callq 0x4380
movq %rax, 0x20bb929(%rip)   # 0x20cd9f0
testq %rax, %rax
jne 0x120e1
leaq 0xd210(%rip), %rdi      # 0x1f2e3
leaq 0x20be936(%rip), %rsi   # 0x20d0a10
xorl %eax, %eax
callq 0x8b1f
leaq 0x20c0933(%rip), %r15   # 0x20d2a1b
cmpb $0x1, (%r15)
jne 0x1214b
leaq 0xd20b(%rip), %rdx      # 0x1f300
leaq 0x17224(%rip), %rcx     # 0x29320
movq %rsp, %r14
movl $0x1000, %esi           # imm = 0x1000
movq %r14, %rdi
xorl %eax, %eax
callq 0x766f
leaq 0xdfb2(%rip), %rsi      # 0x200c7
movq %r14, %rdi
callq 0x4380
movq %rax, 0x20bb8d4(%rip)   # 0x20cd9f8
testq %rax, %rax
jne 0x1213a
leaq 0xd1de(%rip), %rdi      # 0x1f30e
movq %rsp, %rsi
xorl %eax, %eax
callq 0x8b1f
leaq 0xd1de(%rip), %rdi      # 0x1f31f
movq %rsp, %rsi
xorl %eax, %eax
callq 0x8780
movq 0x20bb89e(%rip), %rdi   # 0x20cd9f0
movl 0x20bb890(%rip), %edx   # 0x20cd9e8
leaq 0xbeae(%rip), %r14      # 0x1e00d
movq %r14, %rsi
xorl %eax, %eax
callq 0x4450
movq 0x20bb880(%rip), %rdi   # 0x20cd9f0
movl 0x20bb876(%rip), %edx   # 0x20cd9ec
movq %r14, %rsi
xorl %eax, %eax
callq 0x4450
movq %rbx, %rdi
callq 0x1226c
movq %rbx, %rdi
callq 0x122b6
movq 0x20bb859(%rip), %rdi   # 0x20cd9f0
callq 0x42e0
cmpb $0x1, (%r15)
jne 0x121ae
movq 0x20bb84f(%rip), %rdi   # 0x20cd9f8
callq 0x42e0
leaq 0xd17c(%rip), %rdi      # 0x1f331
leaq 0x20be854(%rip), %rsi   # 0x20d0a10
xorl %eax, %eax
callq 0x8780
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/FreeSlave[P]vhlt/hlbsp/portals.cpp
// Function: NumberLeafs_r(node_s*)
static void     NumberLeafs_r(node_t* node)
{
    portal_t*       p;

#ifdef ZHLT_DETAILBRUSH
	if (!node->isportalleaf)
#else
    if (!node->contents)
#endif
    {                                                      // decision node
        node->visleafnum = -99;
        NumberLeafs_r(node->children[0]);
        NumberLeafs_r(node->children[1]);
        return;
    }

    if (node->contents == CONTENTS_SOLID)
    {                                                      // solid block, viewpoint never inside
        node->visleafnum = -1;
        return;
    }

    node->visleafnum = num_visleafs++;

    for (p = node->portals; p;)
    {
        if (p->nodes[0] == node)                           // only write out from first leaf
        {
            if (p->nodes[0]->contents == p->nodes[1]->contents)
            {
                num_visportals++;
            }
            p = p->next[0];
        }
        else
        {
            p = p->next[1];
        }
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpb $0x0, 0x49(%rbx)
jne 0x121f9
movl $0xffffff9d, 0xb8(%rbx) # imm = 0xFFFFFF9D
movq 0x88(%rbx), %rdi
callq 0x121d0
movq 0x90(%rbx), %rbx
jmp 0x121d4
cmpl $-0x2, 0xa0(%rbx)
jne 0x1220b
orl $-0x1, 0xb8(%rbx)
popq %rbx
retq
movl 0x20bb7d7(%rip), %eax   # 0x20cd9e8
leal 0x1(%rax), %ecx
movl %ecx, 0x20bb7ce(%rip)   # 0x20cd9e8
movl %eax, 0xb8(%rbx)
leaq 0xb0(%rbx), %rax
movl 0x20bb7bf(%rip), %ecx   # 0x20cd9ec
pushq $0x60
popq %rdx
pushq $0x58
popq %rsi
movq (%rax), %rax
testq %rax, %rax
je 0x12209
movq 0x48(%rax), %rdi
cmpq %rbx, %rdi
je 0x12249
movq %rdx, %rdi
jmp 0x12267
movl 0xa0(%rdi), %edi
movq 0x50(%rax), %r8
cmpl 0xa0(%r8), %edi
jne 0x12264
incl %ecx
movl %ecx, 0x20bb788(%rip)   # 0x20cd9ec
movq %rsi, %rdi
addq %rdi, %rax
jmp 0x12233
// File: /workspace/github_cpp_makefile_star2_O2/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(%rbx)
jne 0x1228b
movq 0x88(%rbx), %rdi
callq 0x1226c
movq 0x90(%rbx), %rbx
jmp 0x12270
cmpl $-0x2, 0xa0(%rbx)
jne 0x12296
popq %rbx
retq
movq %rbx, %rdi
callq 0x12695
movq 0x20bb74b(%rip), %rdi   # 0x20cd9f0
leaq 0xbd61(%rip), %rsi      # 0x1e00d
movl %eax, %edx
xorl %eax, %eax
popq %rbx
jmp 0x4450
// File: /workspace/github_cpp_makefile_star2_O2/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(%rbx)
jne 0x12642
movq 0x88(%rbx), %rdi
callq 0x1261f
movq 0x90(%rbx), %rbx
jmp 0x12627
movq 0xb0(%rbx), %r14
testq %r14, %r14
je 0x1268f
movq 0x48(%r14), %rsi
xorl %eax, %eax
cmpq %rbx, %rsi
setne %al
movq 0x58(%r14,%rax,8), %r15
movq %r14, %rdi
callq 0x11de8
movq 0x50(%r14), %rsi
movq %r14, %rdi
callq 0x11de8
movq 0x68(%r14), %rdi
testq %rdi, %rdi
je 0x12682
movq (%rdi), %rax
callq *0x8(%rax)
movq %r14, %rdi
callq 0x12fc3
movq %r15, %r14
jmp 0x12649
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
xorl %ebx, %ebx
cmpl $-0x1, 0x80(%r14)
je 0x126bf
movq 0x88(%r14), %rdi
callq 0x12695
movq 0x90(%r14), %r14
addl %eax, %ebx
jmp 0x1269e
movzbl 0x4a(%r14), %eax
xorl $0x1, %eax
addl %eax, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
callq 0x12fc8
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)
pushq $0x20
popq %rdi
callq 0x42f0
movq %rax, %r14
movq 0x48(%r15), %rsi
movq %rax, %rdi
callq 0xaaba
movq %r14, 0x48(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x4300
movq %rbx, %rdi
callq 0x4550
// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x1308a
testq %rdi, %rdi
je 0x1308a
movq (%rdi), %r14
callq 0x12fd3
movq %r14, %rdi
jmp 0x13078
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4390
// File: /workspace/github_cpp_makefile_star2_O2/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, %rbx
callq 0x1305d
movq %rax, %r14
addq $0x8, %rbx
movq %rax, %r15
addq $0x8, %r15
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x130cc
movq %rbx, %rdi
callq 0x12fef
movq %rax, (%r15)
movq %rax, %r15
jmp 0x130b4
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %r12
addq $0x8, %r12
movq (%r12), %r15
testq %r15, %r15
je 0x13125
movq 0x48(%r15), %rdi
movq %r14, %rsi
xorl %edx, %edx
movsd (%rsp), %xmm0
callq 0xb666
testb %al, %al
jne 0x13120
movq (%r15), %rax
movq %rax, (%r12)
movq %r15, %rdi
callq 0x12fd3
jmp 0x130ef
movq %r15, %r12
jmp 0x130ef
movq (%rbx), %rdi
cmpq $0x0, 0x8(%rdi)
je 0x131b4
pushq $0x20
popq %rdi
callq 0x42f0
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0xb018
movq (%rbx), %r12
addq $0x8, %r12
movq (%r12), %r12
testq %r12, %r12
je 0x13171
leaq 0x8(%r12), %rsi
movq %r15, %rdi
xorl %edx, %edx
movsd (%rsp), %xmm0
callq 0xb666
testb %al, %al
jne 0x13150
cmpl $0x0, 0x8(%r15)
je 0x131c9
callq 0x12fc8
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 0x131bd
callq 0x13068
andq $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
pushq $0x20
popq %rsi
movq %r15, %rdi
callq 0x4300
movq %rbx, %rdi
callq 0x4550
// File: /workspace/github_cpp_makefile_star2_O2/FreeSlave[P]vhlt/hlbsp/qbsp.cpp
// Function: SplitBrush(brush_s*, plane_t const*, brush_s**, brush_s**)
void SplitBrush (brush_t *in, const dplane_t *split, brush_t **front, brush_t **back)
	// 'in' will be freed
{
	in->next = NULL;
	bool onfront;
	bool onback;
	onfront = false;
	onback = false;
	side_t *s;
	for (s = in->sides; s; s = s->next)
	{
		switch (s->w->WindingOnPlaneSide (split->normal, split->dist, 2 * ON_EPSILON))
		{
		case SIDE_CROSS:
			onfront = true;
			onback = true;
			break;
		case SIDE_FRONT:
			onfront = true;
			break;
		case SIDE_BACK:
			onback = true;
			break;
		case SIDE_ON:
			break;
		}
		if (onfront && onback)
			break;
	}
	if (!onfront && !onback)
	{
		FreeBrush (in);
		*front = NULL;
		*back = NULL;
		return;
	}
	if (!onfront)
	{
		*front = NULL;
		*back = in;
		return;
	}
	if (!onback)
	{
		*front = in;
		*back = NULL;
		return;
	}
	*front = in;
	*back = NewBrushFromBrush (in);
	dplane_t frontclip = *split;
	dplane_t backclip = *split;
	VectorSubtract (vec3_origin, backclip.normal, backclip.normal);
	backclip.dist = -backclip.dist;
	ClipBrush (front, &frontclip, NORMAL_EPSILON);
	ClipBrush (back, &backclip, NORMAL_EPSILON);
	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rcx, 0x8(%rsp)
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
andq $0x0, (%rdi)
leaq 0x8(%rdi), %rbx
xorl %r13d, %r13d
xorl %ebp, %ebp
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x13263
movq 0x48(%rbx), %rdi
movsd 0x30(%r15), %xmm0
movq %r15, %rsi
movsd 0xc17c(%rip), %xmm1     # 0x1f3b8
callq 0xb5d6
cmpl $0x1, %eax
je 0x13254
cmpl $-0x2, %eax
je 0x13277
testl %eax, %eax
jne 0x13257
movb $0x1, %r13b
jmp 0x1325d
movb $0x1, %bpl
testb $0x1, %r13b
je 0x1321f
testb $0x1, %bpl
je 0x1321f
testb $0x1, %r13b
je 0x13339
testb $0x1, %bpl
je 0x1334d
movq %r12, (%r14)
movq %r12, %rdi
callq 0x13099
movq 0x8(%rsp), %rbx
movq %rax, (%rbx)
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups 0x20(%r15), %xmm2
movups 0x30(%r15), %xmm3
leaq 0x50(%rsp), %rsi
movaps %xmm3, 0x30(%rsi)
movaps %xmm2, 0x20(%rsi)
movaps %xmm1, 0x10(%rsi)
movaps %xmm0, (%rsi)
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups 0x20(%r15), %xmm2
movups 0x30(%r15), %xmm3
leaq 0x10(%rsp), %r15
movaps %xmm0, (%r15)
movaps %xmm1, 0x10(%r15)
movaps %xmm3, 0x30(%r15)
movaps %xmm2, 0x20(%r15)
leaq 0x9a4d(%rip), %rax      # 0x1cd30
movapd (%rax), %xmm0
subpd (%r15), %xmm0
movapd %xmm0, (%r15)
movsd 0x10(%rax), %xmm0
subsd 0x10(%r15), %xmm0
movsd %xmm0, 0x10(%r15)
movsd 0x30(%r15), %xmm0
xorps 0xaef1(%rip), %xmm0     # 0x1e200
movlps %xmm0, 0x30(%r15)
movsd 0x7d64(%rip), %xmm0     # 0x1b080
movq %r14, %rdi
callq 0x130d5
movq %rbx, %rdi
movq %r15, %rsi
movsd 0x7d4e(%rip), %xmm0     # 0x1b080
callq 0x130d5
jmp 0x13367
testb $0x1, %bpl
je 0x13352
andq $0x0, (%r14)
movq 0x8(%rsp), %rax
movq %r12, (%rax)
jmp 0x13367
movq %r12, (%r14)
jmp 0x1335e
movq %r12, %rdi
callq 0x13068
andq $0x0, (%r14)
movq 0x8(%rsp), %rax
andq $0x0, (%rax)
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
callq 0x1305d
movq %rax, %rbx
movq %rax, 0x8(%rsp)
pushq $0x18
popq %rax
xorl %ecx, %ecx
xorps %xmm0, %xmm0
movabsq $0x3ff0000000000000, %rdx # imm = 0x3FF0000000000000
movabsq $-0x4010000000000000, %rsi # imm = 0xBFF0000000000000
movaps 0xae45(%rip), %xmm1     # 0x1e200
cmpq $0x18, %rcx
je 0x13411
andq $0x0, 0x20(%rsp,%rcx,8)
movaps %xmm0, 0x10(%rsp,%rcx,8)
movq %rdx, -0xb0(%rsp,%rax,8)
movsd (%r15,%rcx), %xmm2
movsd %xmm2, 0x40(%rsp,%rcx,8)
andq $0x0, 0xe0(%rsp,%rcx,8)
movaps %xmm0, 0xd0(%rsp,%rcx,8)
movq %rsi, 0x10(%rsp,%rax,8)
movsd (%r14,%rcx), %xmm2
xorps %xmm1, %xmm2
movlps %xmm2, 0x100(%rsp,%rcx,8)
addq $0x8, %rcx
addq $0x9, %rax
jmp 0x133bb
callq 0x12fc8
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)
pushq $0x20
popq %rdi
callq 0x42f0
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
callq 0xb018
movq 0x8(%rbx), %rax
movq %r14, 0x48(%rax)
pushq $0x40
popq %rax
leaq 0x8(%rsp), %r14
leaq 0x40(%rax), %r15
cmpq $0x1c0, %r15            # imm = 0x1C0
je 0x1349c
leaq (%rsp,%rax), %rsi
addq $0x10, %rsi
movq %r14, %rdi
movsd 0x7bf8(%rip), %xmm0     # 0x1b080
callq 0x130d5
movq 0x8(%rsp), %rbx
movq %r15, %rax
testq %rbx, %rbx
jne 0x13468
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x190, %rsp            # imm = 0x190
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x4300
movq %rbx, %rdi
callq 0x4550
// File: /workspace/github_cpp_makefile_star2_O2/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
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movaps 0xbee1(%rip), %xmm0     # 0x1f3c0
movups %xmm0, (%rsi)
movabsq $0x4101940000000000, %rax # imm = 0x4101940000000000
movq %rax, 0x10(%rsi)
movapd 0xbed8(%rip), %xmm0     # 0x1f3d0
movupd %xmm0, (%rdx)
movabsq $-0x3efe6c0000000000, %rax # imm = 0xC101940000000000
movq %rax, 0x10(%rdx)
addq $0x8, %r15
leaq 0x20(%rsp), %r12
movq %rsp, %r13
movq (%r15), %r15
testq %r15, %r15
je 0x1356e
movq 0x48(%r15), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0xa43e
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)
jmp 0x13516
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0x28
popq %rdi
callq 0x4410
movq %rax, %rbx
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x8(%rax)
pushq $0x18
popq %r12
movq %r12, %rdi
callq 0x42f0
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movq %rax, 0x20(%rbx)
pushq $0x68
popq %rdi
callq 0x4410
movq %rax, %r15
movq %rax, 0x10(%rbx)
movq %r12, %rdi
callq 0x42f0
andq $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq %rax, 0x60(%r15)
leaq 0x8(%rsp), %r12
testq %r14, %r14
je 0x15d11
cmpq $0x0, 0x40(%r14)
je 0x15ced
movq (%r14), %r14
jmp 0x15cdc
leaq 0x48(%r14), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x15ce8
movq 0x60(%r15), %rdi
movq %r12, %rsi
callq 0x17a0a
movq 0x8(%rsp), %rax
jmp 0x15cf1
movq 0x60(%r15), %rax
movq 0x8(%rax), %rcx
subq (%rax), %rcx
cmpq $0xa0, %rcx
setb (%rbx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x15820
cmpb $0x1, (%rbx)
jne 0x15d4c
movq 0x10(%rbx), %rax
movq 0x20(%rbx), %rdi
movq 0x60(%rax), %rsi
callq 0x17a28
andq $0x0, 0x18(%rbx)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/FreeSlave[P]vhlt/hlbsp/solidbsp.cpp
// Function: TestSurfaceTree_r(surfacetree_t*, surfacetreenode_s const*, plane_t const*)
void TestSurfaceTree_r (surfacetree_t *tree, const surfacetreenode_t *node, const dplane_t *split)
{
	if (node->size == 0)
	{
		return;
	}
	vec_t low, high;
	low = high = -split->dist;
	for (int k = 0; k < 3; k++)
	{
		if (split->normal[k] >= 0)
		{
			high += split->normal[k] * node->maxs[k];
			low += split->normal[k] * node->mins[k];
		}
		else
		{
			high += split->normal[k] * node->mins[k];
			low += split->normal[k] * node->maxs[k];
		}
	}
	if (low > tree->epsilon)
	{
		tree->result.frontsize += node->size;
#ifdef HLCSG_HLBSP_SOLIDHINT
		tree->result.frontsize -= node->size_discardable;
#endif
		return;
	}
	if (high < -tree->epsilon)
	{
		tree->result.backsize += node->size;
#ifdef HLCSG_HLBSP_SOLIDHINT
		tree->result.backsize -= node->size_discardable;
#endif
		return;
	}
	if (node->isleaf)
	{
		for (std::vector< face_t * >::iterator i = node->leaffaces->begin (); i != node->leaffaces->end (); ++i)
		{
			tree->result.middle->push_back (*i);
		}
	}
	else
	{
		for (std::vector< face_t * >::iterator i = node->nodefaces->begin (); i != node->nodefaces->end (); ++i)
		{
			tree->result.middle->push_back (*i);
		}
		TestSurfaceTree_r (tree, node->children[0], split);
		TestSurfaceTree_r (tree, node->children[1], split);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movapd 0x848c(%rip), %xmm4     # 0x1e200
xorpd %xmm5, %xmm5
movl (%r14), %eax
testl %eax, %eax
je 0x15e48
movsd 0x30(%r15), %xmm0
xorpd %xmm4, %xmm0
leaq 0x20(%r14), %rcx
leaq 0x8(%r14), %rdx
xorl %esi, %esi
movapd %xmm0, %xmm1
cmpq $0x3, %rsi
je 0x15dd5
movsd (%r15,%rsi,8), %xmm2
ucomisd %xmm5, %xmm2
movq %rdx, %r8
movq %rcx, %rdi
jb 0x15db9
movq %rcx, %r8
movq %rdx, %rdi
movsd (%r8,%rsi,8), %xmm3
mulsd %xmm2, %xmm3
addsd %xmm3, %xmm1
mulsd (%rdi,%rsi,8), %xmm2
addsd %xmm2, %xmm0
incq %rsi
jmp 0x15d9b
movsd 0x8(%rbx), %xmm2
ucomisd %xmm2, %xmm0
ja 0x15e2c
xorpd %xmm4, %xmm2
ucomisd %xmm1, %xmm2
ja 0x15e3b
cmpb $0x1, 0x38(%r14)
je 0x15e54
movq 0x50(%r14), %rax
movq (%rax), %r12
cmpq 0x8(%rax), %r12
je 0x15e14
movq 0x20(%rbx), %rdi
movq %r12, %rsi
callq 0x17a0a
addq $0x8, %r12
movq 0x50(%r14), %rax
jmp 0x15df8
movq 0x40(%r14), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x15d5b
movq 0x48(%r14), %r14
jmp 0x15d6c
addl 0x18(%rbx), %eax
movl %eax, 0x18(%rbx)
subl 0x4(%r14), %eax
movl %eax, 0x18(%rbx)
jmp 0x15e48
addl 0x1c(%rbx), %eax
movl %eax, 0x1c(%rbx)
subl 0x4(%r14), %eax
movl %eax, 0x1c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x60(%r14), %rax
movq (%rax), %r15
cmpq 0x8(%rax), %r15
je 0x15e48
movq 0x20(%rbx), %rdi
movq %r15, %rsi
callq 0x17a0a
addq $0x8, %r15
movq 0x60(%r14), %rax
jmp 0x15e5b
// File: /workspace/github_cpp_makefile_star2_O2/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 0x15e7d
retq
movq %rsi, %rdx
movq 0x20(%rdi), %rax
movq (%rax), %rcx
cmpq %rcx, 0x8(%rax)
je 0x15e91
movq %rcx, 0x8(%rax)
andq $0x0, 0x18(%rdi)
movq 0x10(%rdi), %rsi
jmp 0x15d5b
// File: /workspace/github_cpp_makefile_star2_O2/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 0x15eaf
movq 0x60(%rbx), %rbx
jmp 0x15ed7
movq 0x40(%rbx), %rdi
callq 0x15e9f
movq 0x40(%rbx), %rdi
callq 0x4390
movq 0x48(%rbx), %rdi
callq 0x15e9f
movq 0x48(%rbx), %rdi
callq 0x4390
movq 0x50(%rbx), %rbx
testq %rbx, %rbx
je 0x15ee4
movq %rbx, %rdi
callq 0x17c4c
pushq $0x18
popq %rsi
movq %rbx, %rdi
popq %rbx
jmp 0x4300
// File: /workspace/github_cpp_makefile_star2_O2/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 0x15e9f
movq 0x10(%rbx), %rdi
callq 0x4390
movq 0x20(%rbx), %r14
testq %r14, %r14
je 0x15f1a
movq %r14, %rdi
callq 0x17c4c
pushq $0x18
popq %rsi
movq %r14, %rdi
callq 0x4300
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4390
// File: /workspace/github_cpp_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r15
pushq $0x2
popq %rbp
movq (%r15), %r14
testq %r14, %r14
je 0x16013
cmpq $0x0, 0x40(%r14)
jne 0x1600b
leaq 0x48(%r14), %r12
xorl %edi, %edi
cmpq $0x0, 0x48(%r14)
setne %dil
movl %ebp, %esi
callq 0x92bb
movq %r12, %r13
movq (%r13), %rdi
testq %rdi, %rdi
je 0x15fd2
cmpl $-0x1, %ebx
je 0x15fbf
cmpl %ebx, 0x14(%rdi)
jge 0x15fcd
movq (%rdi), %rax
movq %rax, (%r13)
callq 0x12fa3
jmp 0x15fac
movq %rdi, %r13
jmp 0x15fac
cmpq $0x0, (%r12)
jne 0x15fe9
movq (%r14), %rax
movq %rax, (%r15)
movq %r14, %rdi
callq 0x12fb3
jmp 0x15f80
movq %r14, %rdi
callq 0x16022
cmpl $-0x1, %ebx
je 0x15fff
cmpl %ebx, 0x50(%r14)
setge %al
jmp 0x16001
xorl %eax, %eax
movzbl %al, %edi
xorl %esi, %esi
callq 0x92bb
movq %r14, %r15
jmp 0x15f80
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
leaq 0x48(%rdi), %r15
xorl %edi, %edi
cmpq $0x0, 0x48(%rbx)
setne %dil
pushq $0x2
popq %rsi
callq 0x92bb
pushq $-0x18
popq %rax
movabsq $0x40f869f000000000, %rcx # imm = 0x40F869F000000000
movabsq $-0x3f07961000000000, %rdx # imm = 0xC0F869F000000000
testq %rax, %rax
je 0x1606d
movq %rcx, 0x28(%rbx,%rax)
movq %rdx, 0x40(%rbx,%rax)
addq $0x8, %rax
jmp 0x16058
pushq $-0x1
popq %rax
leaq 0xa7c7(%rip), %r14      # 0x2083e
movl %eax, 0x50(%rbx)
movq (%r15), %r15
testq %r15, %r15
je 0x160f4
cmpl $0x0, 0x10(%r15)
js 0x16093
movq %r14, %rdi
xorl %eax, %eax
callq 0x8b1f
leaq 0x38(%r15), %rax
xorl %ecx, %ecx
movslq 0x2c(%r15), %rdx
cmpq %rdx, %rcx
jge 0x160e2
xorl %edx, %edx
cmpq $0x3, %rdx
je 0x160d9
movsd (%rax,%rdx,8), %xmm0
movsd 0x10(%rbx,%rdx,8), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x160c6
movsd %xmm0, 0x10(%rbx,%rdx,8)
movsd (%rax,%rdx,8), %xmm0
ucomisd 0x28(%rbx,%rdx,8), %xmm0
jbe 0x160d4
movsd %xmm0, 0x28(%rbx,%rdx,8)
incq %rdx
jmp 0x160a4
incq %rcx
addq $0x18, %rax
jmp 0x16099
movl 0x50(%rbx), %ecx
movl 0x14(%r15), %eax
cmpl $-0x1, %ecx
je 0x16077
cmpl %ecx, %eax
jge 0x1607a
jmp 0x16077
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
orl $-0x1, 0x80(%rdi)
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
setne 0x4a(%rbx)
testq %rdi, %rdi
je 0x1775f
movq (%rdi), %r14
callq 0x13068
movq %r14, %rdi
jmp 0x1774d
andq $0x0, 0x8(%rbx)
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x17772
callq 0x13068
andq $0x0, 0x10(%rbx)
cmpb $0x1, 0x49(%rbx)
jne 0x17786
cmpl $-0x2, 0xa0(%rbx)
je 0x17805
xorl %r14d, %r14d
pushq $0x12
popq %rbp
movq %rbx, %r15
movq (%r15), %r15
testq %r15, %r15
je 0x177d8
cmpq $0x0, 0x40(%r15)
je 0x1778f
leaq 0x48(%r15), %r12
movq (%r12), %r12
testq %r12, %r12
je 0x1778f
cmpq $0x0, 0x20(%r12)
je 0x177a2
xorl %edi, %edi
cmpl $0x4000, %r14d          # imm = 0x4000
setl %dil
movl %ebp, %esi
callq 0x92bb
movq 0x20(%r12), %rax
movslq %r14d, %rcx
incl %r14d
movq %rax, (%rsp,%rcx,8)
jmp 0x177a2
movslq %r14d, %rax
andq $0x0, (%rsp,%rax,8)
leaq 0x8(,%rax,8), %r14
movq %r14, %rdi
callq 0x4410
movq %rax, 0xa8(%rbx)
movq %rsp, %rsi
movq %rax, %rdi
movq %r14, %rdx
callq 0x4260
movq (%rbx), %r14
testq %r14, %r14
je 0x17833
movq (%r14), %r15
movq 0x48(%r14), %rdi
testq %rdi, %rdi
je 0x17826
movq (%rdi), %r12
callq 0x12fa3
movq %r12, %rdi
jmp 0x17814
movq %r14, %rdi
callq 0x12fb3
movq %r15, %r14
jmp 0x17808
andq $0x0, (%rbx)
addq $0x20010, %rsp          # imm = 0x20010
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq