LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/trace.cpp
// Function: MakeTnode(int)
static void     MakeTnode(const int nodenum)
{
    tnode_t*        t;
    dplane_t*       plane;
    int             i;
    dnode_t*        node;

    t = tnode_p++;

    node = g_dnodes + nodenum;
    plane = g_dplanes + node->planenum;

    t->type = plane->type;
    VectorCopy(plane->normal, t->normal);
#ifdef ZHLT_PLANETYPE_FIX //debug
	if (plane->normal[(plane->type)%3] < 0)
		if (plane->type < 3)
			Warning ("MakeTnode: negative plane");
		else
			Developer (DEVELOPER_LEVEL_MESSAGE, "Warning: MakeTnode: negative plane\n");
#endif
    t->dist = plane->dist;

    for (i = 0; i < 2; i++)
    {
        if (node->children[i] < 0)
            t->children[i] = g_dleafs[-node->children[i] - 1].contents;
        else
        {
            t->children[i] = tnode_p - tnodes;
            MakeTnode(node->children[i]);
        }
    }

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x66c7aa8(%rip), %rbx   # 0x66f9ad0
leaq 0x20(%rbx), %rax
movq %rax, 0x66c7a9d(%rip)   # 0x66f9ad0
movslq %edi, %rax
leaq (%rax,%rax,2), %r14
leaq 0x10be3bf(%rip), %r15   # 0x10f0400
movslq (%r15,%r14,8), %rax
leaq (%rax,%rax,4), %rax
leaq 0xafe3a0(%rip), %rcx    # 0xb303f0
leaq (%rcx,%rax,4), %r12
movl 0x10(%r12), %eax
movl %eax, (%rbx)
movss (%r12), %xmm0
movss %xmm0, 0x4(%rbx)
movss 0x4(%r12), %xmm0
movss %xmm0, 0x8(%rbx)
movss 0x8(%r12), %xmm0
movss %xmm0, 0xc(%rbx)
movslq 0x10(%r12), %rax
imulq $0x55555556, %rax, %rcx # imm = 0x55555556
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rcx
addl %edx, %ecx
leal (%rcx,%rcx,2), %ecx
movl %eax, %edx
subl %ecx, %edx
movslq %edx, %rcx
xorps %xmm0, %xmm0
ucomiss (%r12,%rcx,4), %xmm0
jbe 0x320d3
cmpl $0x2, %eax
jg 0x320c0
leaq 0xcc00(%rip), %rdi      # 0x3ecb7
xorl %eax, %eax
callq 0xa2a6
jmp 0x320d3
leaq 0xcc0a(%rip), %rsi      # 0x3ecd1
movl $0x3, %edi
xorl %eax, %eax
callq 0xa446
leaq (%r15,%r14,8), %r14
movss 0xc(%r12), %xmm0
movss %xmm0, 0x10(%rbx)
movb $0x1, %bpl
xorl %eax, %eax
leaq 0xa1e3d1(%rip), %r15    # 0xa504c0
movzwl 0x4(%r14,%rax,2), %ecx
testw %cx, %cx
js 0x3211d
movq 0x66c79cf(%rip), %rcx   # 0x66f9ad0
subq 0x66c79c0(%rip), %rcx   # 0x66f9ac8
shrq $0x5, %rcx
movl %ecx, 0x14(%rbx,%rax,4)
movswl 0x4(%r14,%rax,2), %edi
callq 0x32019
jmp 0x32135
notl %ecx
movzwl %cx, %ecx
leaq (%rcx,%rcx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rcx, %rdx
movl (%r15,%rdx), %ecx
movl %ecx, 0x14(%rbx,%rax,4)
movl $0x1, %eax
testb $0x1, %bpl
movl $0x0, %ebp
jne 0x320ef
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/trace.cpp
// Function: MergeOpaqueFaces(int, int)
int MergeOpaqueFaces (int firstface, int numfaces)
{
	int i, j, newnum;
	opaqueface_t *faces = &opaquefaces[firstface];
	for (i = 0; i < numfaces; i++)
	{
		for (j = 0; j < i; j++)
		{
			if (TryMerge (&faces[i], &faces[j]))
			{
				delete faces[j].winding;
				faces[j].winding = NULL;
				j = -1;
				continue;
			}
		}
	}
	for (i = 0, j = 0; i < numfaces; i++)
	{
		if (faces[i].winding)
		{
			faces[j] = faces[i];
			j++;
		}
	}
	newnum = j;
	for (; j < numfaces; j++)
	{
		memset (&faces[j], 0, sizeof(opaqueface_t));
	}
	return newnum;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %r9d
movq 0x66c6ea9(%rip), %r8    # 0x66f9ad8
movslq %edi, %r10
testl %esi, %esi
jle 0x32d06
movq %r10, 0x8(%rsp)
leaq (%r10,%r10,2), %r13
shlq $0x5, %r13
movq %r8, 0x10(%rsp)
addq %r8, %r13
movl %r9d, 0x4(%rsp)
movl %r9d, %ebx
xorl %r12d, %r12d
testq %r12, %r12
je 0x32cad
leaq (%r12,%r12,2), %r14
shlq $0x5, %r14
addq %r13, %r14
xorl %ebp, %ebp
movslq %ebp, %rax
leaq (%rax,%rax,2), %r15
shlq $0x5, %r15
addq %r13, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x3246a
testb %al, %al
je 0x32ca3
movq (%r15), %rdi
testq %rdi, %rdi
je 0x32c97
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, (%r15)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
incl %ebp
movslq %ebp, %rax
cmpq %rax, %r12
jg 0x32c6c
incq %r12
cmpq %rbx, %r12
jne 0x32c5a
movl 0x4(%rsp), %r9d
testl %r9d, %r9d
jle 0x32d0b
shlq $0x5, %rbx
leaq (%rbx,%rbx,2), %rax
xorl %edx, %edx
xorl %r14d, %r14d
movq 0x10(%rsp), %r8
movq 0x8(%rsp), %r10
cmpq $0x0, (%r13,%rdx)
je 0x32cfb
leaq (%rdx,%r13), %rsi
movslq %r14d, %r14
leaq (%r14,%r14,2), %rdi
shlq $0x5, %rdi
addq %r13, %rdi
movl $0xc, %ecx
rep  movsq (%rsi), %es:(%rdi)
incl %r14d
addq $0x60, %rdx
cmpq %rdx, %rax
jne 0x32cd6
jmp 0x32d18
xorl %r14d, %r14d
jmp 0x32d18
xorl %r14d, %r14d
movq 0x10(%rsp), %r8
movq 0x8(%rsp), %r10
cmpl %r9d, %r14d
jge 0x32d4c
movslq %r14d, %rax
addq %rax, %r10
leaq (%r10,%r10,2), %rax
shlq $0x5, %rax
addq %rax, %r8
movl %r14d, %eax
notl %eax
addl %r9d, %eax
leaq (%rax,%rax,2), %rdx
shlq $0x5, %rdx
addq $0x60, %rdx
movq %r8, %rdi
xorl %esi, %esi
callq 0x4190
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/trace.cpp
// Function: DeleteOpaqueNodes()
void DeleteOpaqueNodes ()
{
	int i;
	for (i = 0; i < g_numfaces; i++)
	{
		opaqueface_t *of = &opaquefaces[i];
		if (of->winding)
			delete of->winding;
		if (of->edges)
			free (of->edges);
	}
	free (opaquefaces);
	free (opaquenodes);
	free (opaquemodels);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
leaq 0x1b7d12b(%rip), %rbx   # 0x1bb03f4
cmpl $0x0, (%rbx)
jle 0x3330b
movl $0x20, %r14d
xorl %r15d, %r15d
movq 0x66c67fa(%rip), %r12   # 0x66f9ad8
movq -0x20(%r12,%r14), %rdi
testq %rdi, %rdi
je 0x332ee
movq (%rdi), %rax
callq *0x8(%rax)
movq (%r12,%r14), %rdi
testq %rdi, %rdi
je 0x332fc
callq 0x4370
incq %r15
movslq (%rbx), %rax
addq $0x60, %r14
cmpq %rax, %r15
jl 0x332d7
movq 0x66c67c6(%rip), %rdi   # 0x66f9ad8
callq 0x4370
movq 0x66c67c2(%rip), %rdi   # 0x66f9ae0
callq 0x4370
movq 0x66c67be(%rip), %rdi   # 0x66f9ae8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4370
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/trace.cpp
// Function: CountOpaqueFaces_r(opaquenode_s*)
int CountOpaqueFaces_r (opaquenode_t *node)
{
	int count;
	count = node->numfaces;
	if (node->children[0] >= 0)
	{
		count += CountOpaqueFaces_r (&opaquenodes[node->children[0]]);
	}
	if (node->children[1] >= 0)
	{
		count += CountOpaqueFaces_r (&opaquenodes[node->children[1]]);
	}
	return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movq 0x66c60aa(%rip), %r15   # 0x66f9ae0
movl 0x20(%rbx), %ebp
movslq 0x14(%rbx), %rax
testq %rax, %rax
js 0x33a51
leaq (%rax,%rax,8), %rax
leaq (%r15,%rax,4), %rdi
callq 0x33a22
addl %eax, %ebp
movslq 0x18(%rbx), %rax
testq %rax, %rax
js 0x33a67
leaq (%rax,%rax,8), %rax
leaq (%r15,%rax,4), %rbx
addl %ebp, %r14d
jmp 0x33a36
addl %r14d, %ebp
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/hlrad/trace.cpp
// Function: TestPointOpaque_r(int, bool, float const*)
int TestPointOpaque_r (int nodenum, bool solid, const vec3_t point)
{
	opaquenode_t *thisnode;
	vec_t dist;
	while (1)
	{
		if (nodenum < 0)
		{
			if (solid && g_dleafs[-nodenum-1].contents == CONTENTS_SOLID)
				return 1;
			else
				return 0;
		}
		thisnode = &opaquenodes[nodenum];
		switch (thisnode->type)
		{
		case plane_x:
			dist = point[0] - thisnode->dist;
			break;
		case plane_y:
			dist = point[1] - thisnode->dist;
			break;
		case plane_z:
			dist = point[2] - thisnode->dist;
			break;
		default:
			dist = DotProduct (point, thisnode->normal) - thisnode->dist;
		}
		if (dist > HUNT_WALL_EPSILON)
		{
			nodenum = thisnode->children[0];
		}
		else if (dist < -HUNT_WALL_EPSILON)
		{
			nodenum = thisnode->children[1];
		}
		else
		{
			break;
		}
	}
	{
		int facenum;
		for (facenum = thisnode->firstface; facenum < thisnode->firstface + thisnode->numfaces; facenum++)
		{
			if (TestLineOpaque_face (facenum, point))
			{
				return 1;
			}
		}
	}
	return TestPointOpaque_r (thisnode->children[0], solid, point)
		|| TestPointOpaque_r (thisnode->children[1], solid, point);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebx
testl %edi, %edi
js 0x33bc2
movq %rdx, %r14
movsd 0xade6(%rip), %xmm2     # 0x3e8a8
movsd 0xade6(%rip), %xmm3     # 0x3e8b0
movzbl %bl, %ebp
movq 0x66c600c(%rip), %rax   # 0x66f9ae0
movl %edi, %ecx
leaq (%rcx,%rcx,8), %rcx
leaq (%rax,%rcx,4), %r12
movl (%r12), %ecx
cmpl $0x2, %ecx
je 0x33aff
cmpl $0x1, %ecx
je 0x33af7
testl %ecx, %ecx
jne 0x33b07
movss (%r14), %xmm0
jmp 0x33b35
movss 0x4(%r14), %xmm0
jmp 0x33b35
movss 0x8(%r14), %xmm0
jmp 0x33b35
movss 0x4(%r14), %xmm0
mulss 0x8(%r12), %xmm0
movss (%r14), %xmm1
mulss 0x4(%r12), %xmm1
addss %xmm0, %xmm1
movss 0x8(%r14), %xmm0
mulss 0xc(%r12), %xmm0
addss %xmm1, %xmm0
subss 0x10(%r12), %xmm0
cvtss2sd %xmm0, %xmm0
movl $0x14, %ecx
ucomisd %xmm2, %xmm0
ja 0x33b56
movl $0x18, %ecx
ucomisd %xmm0, %xmm3
jbe 0x33b64
movl (%r12,%rcx), %edi
testl %edi, %edi
jns 0x33ad4
jmp 0x33bc2
cmpl $0x0, 0x20(%r12)
jle 0x33b92
movl 0x1c(%r12), %r15d
movl %r15d, %edi
movq %r14, %rsi
callq 0x3333a
testl %eax, %eax
jne 0x33bf0
incl %r15d
movl 0x20(%r12), %eax
addl 0x1c(%r12), %eax
cmpl %eax, %r15d
jl 0x33b71
movl 0x14(%r12), %edi
movl %ebp, %esi
movq %r14, %rdx
callq 0x33aa5
testl %eax, %eax
jne 0x33bf0
movl 0x18(%r12), %edi
testl %edi, %edi
movsd 0xacf4(%rip), %xmm2     # 0x3e8a8
movsd 0xacf4(%rip), %xmm3     # 0x3e8b0
jns 0x33acd
testb %bl, %bl
je 0x33be5
notl %edi
leaq (%rdi,%rdi,8), %rax
leaq (%rax,%rax,2), %rcx
addq %rdi, %rcx
leaq 0xa1c8e6(%rip), %rdx    # 0xa504c0
movl $0x1, %eax
cmpl $-0x2, (%rdx,%rcx)
je 0x33be7
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %eax
jmp 0x33be7
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/common/mathlib.h
// Function: VectorNormalize(float*)
inline vec_t   VectorNormalize(vec3_t v)
{
    double          length;

    length = DotProduct(v, v);
    length = sqrt(length);
    if (length < NORMAL_EPSILON)
    {
        VectorClear(v);
        return 0.0;
    }

    v[0] /= length;
    v[1] /= length;
    v[2] /= length;

    return length;
}

// Assembly:
movsd (%rdi), %xmm0
movaps %xmm0, %xmm1
mulps %xmm0, %xmm1
shufps $0x55, %xmm1, %xmm1     # xmm1 = xmm1[1,1,1,1]
movaps %xmm0, %xmm3
mulss %xmm0, %xmm3
addss %xmm1, %xmm3
movss 0x8(%rdi), %xmm2
movaps %xmm2, %xmm1
mulss %xmm2, %xmm1
addss %xmm3, %xmm1
cvtss2sd %xmm1, %xmm1
xorps %xmm3, %xmm3
sqrtsd %xmm1, %xmm3
movsd 0x34e5(%rip), %xmm1     # 0x37118
ucomisd %xmm3, %xmm1
jbe 0x33c45
xorpd %xmm1, %xmm1
xorps %xmm2, %xmm2
xorps %xmm0, %xmm0
jmp 0x33c71
cvtps2pd %xmm0, %xmm0
movapd %xmm3, %xmm1
unpcklpd %xmm3, %xmm1            # xmm1 = xmm1[0],xmm3[0]
divpd %xmm1, %xmm0
cvtpd2ps %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtss2sd %xmm2, %xmm0
divsd %xmm3, %xmm0
xorps %xmm2, %xmm2
cvtsd2ss %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtsd2ss %xmm3, %xmm0
movss %xmm2, 0x8(%rdi)
movlpd %xmm1, (%rdi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/transparency.cpp
// Function: FreeTransparencyArrays()
void	FreeTransparencyArrays( )
{
	if (s_sorted_list) free(s_sorted_list);
	if (s_trans_list)  free(s_trans_list);
	
	s_trans_list = NULL;
	s_sorted_list = NULL;
	
	s_max_trans_count = s_trans_count = s_sorted_count = 0;
}

// Assembly:
pushq %rax
movq 0x66c5620(%rip), %rdi   # 0x66f9b08
testq %rdi, %rdi
je 0x344f2
callq 0x4370
movq 0x66c561f(%rip), %rdi   # 0x66f9b18
testq %rdi, %rdi
je 0x34503
callq 0x4370
xorl %eax, %eax
movq %rax, 0x66c560c(%rip)   # 0x66f9b18
movq %rax, 0x66c55f5(%rip)   # 0x66f9b08
movl %eax, 0x66c55e7(%rip)   # 0x66f9b00
movl %eax, 0x66c55f5(%rip)   # 0x66f9b14
movl %eax, 0x66c55eb(%rip)   # 0x66f9b10
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/transparency.cpp
// Function: GetTransparency(unsigned int, unsigned int, float (&) [3], unsigned int&)
void GetTransparency(const unsigned p1, const unsigned p2, vec3_t &trans, unsigned int &next_index)
{
	VectorFill( trans, 1.0 );
	
	for( unsigned i = next_index; i < s_sorted_count; i++ )
	{
		if ( s_sorted_list[i].p1 < p1 )
		{
			continue;
		}
		else if ( s_sorted_list[i].p1 == p1 )
		{
			if ( s_sorted_list[i].p2 < p2 )
			{
				continue;
			}
			else if ( s_sorted_list[i].p2 == p2 )
			{
				VectorCopy( s_trans_list[s_sorted_list[i].data_index], trans );
				next_index = i + 1;
			
				return;
			}
			else //if ( s_sorted_list[i].p2 > p2 )
			{
				next_index = i;
			
				return;
			}
		}
		else //if ( s_sorted_list[i].p1 > p1 )
		{
			next_index = i;
			
			return;
		}
	}
	
	next_index = s_sorted_count;
}

// Assembly:
movsd 0x75e1(%rip), %xmm0     # 0x3bb10
movsd %xmm0, (%rdx)
movl $0x3f800000, 0x8(%rdx)  # imm = 0x3F800000
movl (%rcx), %eax
movl 0x66c55bd(%rip), %r8d   # 0x66f9b00
cmpl %r8d, %eax
jae 0x345b8
movq 0x66c55b9(%rip), %r9    # 0x66f9b08
leaq (%rax,%rax,2), %r10
leaq (%r9,%r10,4), %r9
addq $0x8, %r9
cmpl %edi, -0x8(%r9)
jb 0x34569
jne 0x345b5
cmpl %esi, -0x4(%r9)
jae 0x34576
incl %eax
addq $0xc, %r9
cmpl %eax, %r8d
jne 0x3455b
jmp 0x345b8
jne 0x345b5
movq 0x66c5599(%rip), %rsi   # 0x66f9b18
movl (%r9), %edi
leaq (%rdi,%rdi,2), %rdi
movss (%rsi,%rdi,4), %xmm0
movss %xmm0, (%rdx)
movl (%r9), %edi
leaq (%rdi,%rdi,2), %rdi
movss 0x4(%rsi,%rdi,4), %xmm0
movss %xmm0, 0x4(%rdx)
movl (%r9), %edi
leaq (%rdi,%rdi,2), %rdi
movss 0x8(%rsi,%rdi,4), %xmm0
movss %xmm0, 0x8(%rdx)
incl %eax
movl %eax, %r8d
movl %r8d, (%rcx)
retq
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/transparency.cpp
// Function: AddStyleToStyleArray(unsigned int, unsigned int, int)
void	AddStyleToStyleArray(const unsigned p1, const unsigned p2, const int style)
{
	if (style == -1)
		return;
	//make thread safe
	ThreadLock();
	
	//realloc if needed
	while( s_style_count >= s_max_style_count )
	{
		unsigned int old_max_count = s_max_style_count;
#ifdef HLRAD_TRANSPARENCY_FAST
		s_max_style_count = qmax (64u, (unsigned int)((double)s_max_style_count * 1.41));
#else
		s_max_style_count += STYLE_LIST_GROWTH;
#endif
#ifdef ZHLT_64BIT_FIX
		if (s_max_style_count >= (unsigned int)INT_MAX)
		{
			Error ("AddStyleToStyleArray: array size exceeded INT_MAX");
		}
#endif
		
		s_style_list = (styleList_t *)realloc( s_style_list, sizeof(styleList_t) * s_max_style_count );
#ifdef HLRAD_HLASSUMENOMEMORY
		hlassume (s_style_list != NULL, assume_NoMemory);
#endif
		
#ifdef HLRAD_TRANSPARENCY_FAST
		memset( &s_style_list[old_max_count], 0, sizeof(styleList_t) * (s_max_style_count - old_max_count) );
#else
		memset( &s_style_list[old_max_count], 0, sizeof(styleList_t) * STYLE_LIST_GROWTH );
#endif
	}
	
	s_style_list[s_style_count].p1 = p1;
	s_style_list[s_style_count].p2 = p2;
	s_style_list[s_style_count].style = (char)style;
	
	s_style_count++;
	
	//unlock list
	ThreadUnlock();
}

// Assembly:
cmpl $-0x1, %edx
je 0x345f8
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %edi, %r14d
movl %esi, 0x4(%rsp)
callq 0xb321
movl 0x66c5540(%rip), %eax   # 0x66f9b20
movl 0x66c553d(%rip), %r12d  # 0x66f9b24
cmpl %r12d, %eax
jae 0x345f9
movq 0x66c5535(%rip), %rbp   # 0x66f9b28
jmp 0x346bc
retq
leaq 0xa8b4(%rip), %r15      # 0x3eeb4
movl %r12d, %r13d
xorps %xmm0, %xmm0
cvtsi2sd %r13, %xmm0
mulsd 0xa7ed(%rip), %xmm0     # 0x3ee00
cvttsd2si %xmm0, %rcx
cmpl $0x41, %ecx
movl $0x40, %eax
cmovael %ecx, %eax
movl %eax, 0x66c54fb(%rip)   # 0x66f9b24
cmpl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
jb 0x34641
movq %r15, %rdi
xorl %eax, %eax
callq 0x9f34
movl 0x66c54e3(%rip), %eax   # 0x66f9b24
movq 0x66c54e0(%rip), %rdi   # 0x66f9b28
movl %eax, %eax
shlq $0x2, %rax
leaq (%rax,%rax,2), %rsi
callq 0x4560
movq %rax, 0x66c54ca(%rip)   # 0x66f9b28
xorl %edi, %edi
testq %rax, %rax
setne %dil
movl $0x1, %esi
callq 0xa6ed
movq 0x66c54b0(%rip), %rbp   # 0x66f9b28
leaq (,%r13,2), %rax
addq %r13, %rax
leaq (,%rax,4), %rdi
addq %rbp, %rdi
movl 0x66c548f(%rip), %r13d  # 0x66f9b24
movl %r13d, %eax
subl %r12d, %eax
shlq $0x2, %rax
leaq (%rax,%rax,2), %rdx
xorl %esi, %esi
callq 0x4190
movl 0x66c5470(%rip), %eax   # 0x66f9b20
movl %r13d, %r12d
cmpl %r13d, %eax
jae 0x34600
movl %eax, %ecx
leaq (%rcx,%rcx,2), %rcx
movl %r14d, (%rbp,%rcx,4)
movl 0x4(%rsp), %edx
movl %edx, 0x4(%rbp,%rcx,4)
movb %bl, 0x8(%rbp,%rcx,4)
incl %eax
movl %eax, 0x66c5445(%rip)   # 0x66f9b20
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb332
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/transparency.cpp
// Function: CreateFinalStyleArrays(char const*)
void	CreateFinalStyleArrays(const char *print_name)
{
	if( s_style_count == 0 )
	{
		return;
	}
	//need to sorted for fast search function
	qsort( s_style_list, s_style_count, sizeof(styleList_t), SortStyleList );
	
#ifdef ZHLT_64BIT_FIX
	size_t size = s_max_style_count * sizeof(styleList_t);
#else
	unsigned size = s_max_style_count * sizeof(styleList_t);
#endif
	if ( size > 1024 * 1024 )
        	Log("%-20s: %5.1f megs \n", print_name, (double)size / (1024.0 * 1024.0));
        else if ( size > 1024 )
        	Log("%-20s: %5.1f kilos\n", print_name, (double)size / 1024.0);
        else
        	Log("%-20s: %5.1f bytes\n", print_name, (double)size); //--vluzacn
}

// Assembly:
pushq %rbx
movl 0x66c542b(%rip), %esi   # 0x66f9b20
testq %rsi, %rsi
je 0x34745
movq %rdi, %rbx
movq 0x66c5424(%rip), %rdi   # 0x66f9b28
leaq 0x64(%rip), %rcx        # 0x3476f
movl $0xc, %edx
callq 0x4600
movl 0x66c5409(%rip), %eax   # 0x66f9b24
leaq (,%rax,4), %rcx
leaq (%rcx,%rcx,2), %rcx
cvtsi2sd %rcx, %xmm0
cmpq $0x15556, %rax          # imm = 0x15556
jb 0x34747
mulsd 0x41d4(%rip), %xmm0     # 0x38910
leaq 0xa710(%rip), %rdi      # 0x3ee53
jmp 0x34764
popq %rbx
retq
cmpl $0x56, %eax
jb 0x3475d
mulsd 0xa6b4(%rip), %xmm0     # 0x3ee08
leaq 0xa70c(%rip), %rdi      # 0x3ee67
jmp 0x34764
leaq 0xa717(%rip), %rdi      # 0x3ee7b
movq %rbx, %rsi
movb $0x1, %al
popq %rbx
jmp 0x9c46
// File: /workspace/github_cpp_makefile_star2_O3/FreeSlave[P]vhlt/hlrad/vismatrix.cpp
// Function: CheckVisBitVismatrix(unsigned int, unsigned int, float (&) [3], unsigned int&)
static bool     CheckVisBitVismatrix(unsigned p1, unsigned p2
#ifdef HLRAD_HULLU
									 , vec3_t &transparency_out
									 , unsigned int &next_index
#endif
									 )
{
    unsigned        bitpos;

#ifdef HLRAD_HULLU
    const unsigned a = p1;
    const unsigned b = p2;

    VectorFill(transparency_out, 1.0);
#endif

    if (p1 > p2)
    {
#ifndef HLRAD_HULLU
        const unsigned a = p1;
        const unsigned b = p2;
#endif
        p1 = b;
        p2 = a;
    }

    if (p1 > g_num_patches)
    {
        Warning("in CheckVisBit(), p1 > num_patches");
    }
    if (p2 > g_num_patches)
    {
        Warning("in CheckVisBit(), p2 > num_patches");
    }

#ifdef HALFBIT
    bitpos = p1 * g_num_patches - (p1 * (p1 + 1)) / 2 + p2;
#else
    bitpos = p1 * g_num_patches + p2;
#endif

    if (s_vismatrix[bitpos >> 3] & (1 << (bitpos & 7)))
    {
#ifdef HLRAD_HULLU    	
    	if(g_customshadow_with_bouncelight)
    	{
    	    GetTransparency( a, b, transparency_out, next_index );
    	}
#endif
        return true;
    }

    return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, (%rsp)
movq %rdx, %r14
movl %esi, %ebp
movl %edi, %r15d
movsd 0x70fa(%rip), %xmm0     # 0x3bb10
cmpl %esi, %edi
movl %esi, %r12d
cmoval %edi, %r12d
movsd %xmm0, (%rdx)
movl %esi, %r13d
cmovbl %edi, %r13d
movl $0x3f800000, 0x8(%rdx)  # imm = 0x3F800000
leaq 0x5402fb0(%rip), %rbx   # 0x54379e8
movl (%rbx), %ecx
cmpl %ecx, %r13d
jbe 0x34a4f
leaq 0xa4f6(%rip), %rdi      # 0x3ef3c
xorl %eax, %eax
callq 0xa2a6
movl (%rbx), %ecx
cmpl %ecx, %r12d
jbe 0x34a64
leaq 0xa504(%rip), %rdi      # 0x3ef5f
xorl %eax, %eax
callq 0xa2a6
movl (%rbx), %ecx
imull %r13d, %ecx
leal 0x1(%r13), %eax
imull %r13d, %eax
shrl %eax
subl %eax, %ecx
addl %r12d, %ecx
movq 0x66c50b2(%rip), %rax   # 0x66f9b30
movl %ecx, %edx
shrl $0x3, %edx
movzbl (%rax,%rdx), %eax
andb $0x7, %cl
movl $0x1, %ebx
shll %cl, %ebx
andl %eax, %ebx
je 0x34ab2
leaq 0x54c4f8c(%rip), %rax   # 0x54f9a28
cmpb $0x1, (%rax)
jne 0x34ab2
movl %r15d, %edi
movl %ebp, %esi
movq %r14, %rdx
movq (%rsp), %rcx
callq 0x34527
testl %ebx, %ebx
setne %al
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/hlrad/vismatrixutil.cpp
// Function: FindTransferOffsetPatchnum(transfer_index_t*, patch_s const*, unsigned int)
int             FindTransferOffsetPatchnum(transfer_index_t* tIndex, const patch_t* const patch, const unsigned patchnum)
{
    //
    // binary search for match
    //
    int             low = 0;
    int             high = patch->iIndex - 1;
    int             offset;

    while (1)
    {
        offset = (low + high) / 2;

        if ((tIndex[offset].index + tIndex[offset].size) < patchnum)
        {
            low = offset + 1;
        }
        else if (tIndex[offset].index > patchnum)
        {
            high = offset - 1;
        }
        else
        {
            unsigned        x;
            unsigned int    rval = 0;
            transfer_index_t* pIndex = tIndex;

            for (x = 0; x < offset; x++, pIndex++)
            {
                rval += pIndex->size + 1;
            }
            rval += patchnum - tIndex[offset].index;
            return rval;
        }
        if (low > high)
        {
            return -1;
        }
    }
}

// Assembly:
movl 0x38(%rsi), %eax
decl %eax
xorl %ecx, %ecx
leal (%rax,%rcx), %r8d
movl %r8d, %esi
shrl $0x1f, %esi
addl %r8d, %esi
sarl %esi
movslq %esi, %r9
movl (%rdi,%r9,4), %r10d
movl %r10d, %r9d
shrl $0xc, %r9d
andl $0xfff, %r10d           # imm = 0xFFF
addl %r9d, %r10d
cmpl %edx, %r10d
jae 0x35099
incl %esi
movl %esi, %ecx
jmp 0x350a4
movl %edx, %eax
subl %r9d, %eax
jae 0x350ae
decl %esi
movl %esi, %eax
cmpl %eax, %ecx
jle 0x35067
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
incl %r8d
xorl %edx, %edx
cmpl $0x3, %r8d
jb 0x350e0
movl %esi, %ecx
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorl %esi, %esi
movl $0xfff, %r8d            # imm = 0xFFF
xorl %edx, %edx
movl (%rdi,%rsi,4), %r9d
andl %r8d, %r9d
addl %r9d, %edx
incl %edx
incq %rsi
cmpl %esi, %ecx
jne 0x350cd
addl %edx, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/gtarcoder[P]libevent_utils/connection.cpp
// Function: Connection::PeerReadCallback(bufferevent*, void*)
void Connection::PeerReadCallback(struct bufferevent* bev, void* arg){
    Connection* item = (Connection*)arg;
    if(item->recv_raw_mode_){
        item->OnPeerRead();
    }else{
        struct evbuffer* input = bufferevent_get_input(bev);
        if(item->buffer_len_ < 0){
            evbuffer_remove(input, (void*)&item->buffer_len_, 4);   
            item->buffer_len_ = ntohl(item->buffer_len_);
        }
        if(item->buffer_len_ > 0 && item->buffer_len_ <= evbuffer_get_length(input)){
            evbuffer_remove(input, (void*)item->buffer_, item->buffer_len_); 
            item->buffer_[item->buffer_len_] = '\0';
            //process the data received
            item->OnPeerRead();
            //cleared the buffer
            item->buffer_len_ = -1;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
cmpb $0x1, 0x10090(%rsi)
jne 0x25d7
movq (%rbx), %rax
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmpq *0x10(%rax)
callq 0x21a0
movq %rax, %r14
movl 0x1008c(%rbx), %eax
testl %eax, %eax
jns 0x2608
leaq 0x1008c(%rbx), %r15
movl $0x4, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x22e0
movl (%r15), %eax
bswapl %eax
movl %eax, (%r15)
testl %eax, %eax
jle 0x2654
movl %eax, %r15d
movq %r14, %rdi
callq 0x22b0
cmpq %r15, %rax
jb 0x2654
leaq 0x8d(%rbx), %rsi
movslq 0x1008c(%rbx), %rdx
movq %r14, %rdi
callq 0x22e0
movslq 0x1008c(%rbx), %rax
movb $0x0, 0x8d(%rbx,%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movl $0xffffffff, 0x1008c(%rbx) # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/gtarcoder[P]libevent_utils/connection.cpp
// Function: Connection::Start()
bool Connection::Start(){
    if (SetKeepLive(fd_, 20, 5, 3) < 0)
       return false;
    if (SetRecvSendBufSize(fd_, 0xfffff) < 0)
       return false;
    if(SetReuseAddr(fd_) < 0)
       return false;
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x58(%rdi), %edi
movl $0x14, %esi
movl $0x5, %edx
movl $0x3, %ecx
callq 0x3e30
testl %eax, %eax
js 0x2878
movl 0x58(%rbx), %edi
movl $0xfffff, %esi          # imm = 0xFFFFF
callq 0x3dc3
testl %eax, %eax
js 0x2878
movl 0x58(%rbx), %edi
callq 0x3d7a
testl %eax, %eax
setns %al
jmp 0x287a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/gtarcoder[P]libevent_utils/tcp_client.cpp
// Function: TcpClient::KeepAliveCallback(int, short, void*)
void TcpClient::KeepAliveCallback(evutil_socket_t fd, short event, void* arg){
    printf("in %s:%s\n", __FILE__, __func__);
    TcpClient* client = (TcpClient*)arg;
    //reconnect
    if(!client->connected_){
        client->DoConnect();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdx, %rbx
leaq 0x1627(%rip), %rdi      # 0x413b
leaq 0x15e9(%rip), %rsi      # 0x4104
leaq 0x15f1(%rip), %rdx      # 0x4113
xorl %eax, %eax
callq 0x2040
cmpb $0x0, 0x8c(%rbx)
je 0x2b39
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2b48
nop
// File: /workspace/github_cpp_makefile_star2_O3/gtarcoder[P]libevent_utils/tcp_client.cpp
// Function: TcpClient::DoConnect()
bool TcpClient::DoConnect(){
    if(fd_ < 0){
        fd_ = socket(AF_INET, SOCK_STREAM, 0);
        if(fd_ < 0){
            printf("create socket failed in %s:%s\n", __FILE__, __func__);
            return false;
        }
        bufferevent_setfd(peer_event_, fd_);
    }

    struct sockaddr_in peer_addr;
    peer_addr.sin_family = AF_INET;
    peer_addr.sin_addr.s_addr = inet_addr(peer_ip_.c_str());
    peer_addr.sin_port = htons(peer_port_);
    int ret = bufferevent_socket_connect(peer_event_, (const sockaddr*)&peer_addr, sizeof(peer_addr));
    if (ret < 0){
        printf("bufferevent socket connect failed in %s:%s!\n", __FILE__, __func__);
        return false;
    }
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
cmpl $0x0, 0x58(%rdi)
jns 0x2b7f
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x2080
movl %eax, 0x58(%rbx)
testl %eax, %eax
js 0x2bd5
movq 0x28(%rbx), %rdi
movl %eax, %esi
callq 0x23a0
leaq -0x20(%rbp), %r14
movw $0x2, (%r14)
movq 0x60(%rbx), %rdi
callq 0x22a0
movl %eax, 0x4(%r14)
movzwl 0x80(%rbx), %eax
rolw $0x8, %ax
movw %ax, 0x2(%r14)
movq 0x28(%rbx), %rdi
movq %r14, %rsi
movl $0x10, %edx
callq 0x22d0
testl %eax, %eax
setns %bl
jns 0x2bf3
leaq 0x1654(%rip), %rdi      # 0x4219
leaq 0x1538(%rip), %rsi      # 0x4104
leaq 0x163c(%rip), %rdx      # 0x420f
jmp 0x2bec
leaq 0x1614(%rip), %rdi      # 0x41f0
leaq 0x1521(%rip), %rsi      # 0x4104
leaq 0x1625(%rip), %rdx      # 0x420f
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2040
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/gtarcoder[P]libevent_utils/tcp_client.cpp
// Function: TcpClient::Start()
bool TcpClient::Start(){
    
    if(!DoConnect())
        return false;    

    if(SetKeepLive(fd_, 20, 5, 3) < 0){
        printf("set keep alive failed in %s:%s\n", __FILE__, __func__);
        return false;
    }
    if(SetRecvSendBufSize(fd_, 0xfffff) < 0){
        printf("set recv sned bufsize failed in %s:%s\n", __FILE__, __func__);
        return false;
    }

    //create a timer to keep connection alive
    keepalive_event_ = event_new(base_, -1, EV_PERSIST, TcpClient::KeepAliveCallback, this);
    if(!keepalive_event_){
        printf("create event failed in %s:%s!\n", __FILE__, __func__);
        return false;
    }
     
    struct timeval tv = {10, 0};
    evtimer_add(keepalive_event_, &tv);
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
callq 0x2b48
testb %al, %al
je 0x2d42
movl 0x58(%rbx), %edi
movl $0x14, %esi
movl $0x5, %edx
movl $0x3, %ecx
callq 0x3e30
testl %eax, %eax
js 0x2d46
movl 0x58(%rbx), %edi
movl $0xfffff, %esi          # imm = 0xFFFFF
callq 0x3dc3
testl %eax, %eax
js 0x2d4f
movq 0x30(%rbx), %rdi
leaq -0x206(%rip), %rcx      # 0x2b04
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0x10, %edx
movq %rbx, %r8
callq 0x2210
movq %rax, 0x10098(%rbx)
testq %rax, %rax
je 0x2d58
movups 0x1519(%rip), %xmm0     # 0x4248
leaq -0x20(%rbp), %rsi
movaps %xmm0, (%rsi)
movq %rax, %rdi
callq 0x2120
movb $0x1, %bl
jmp 0x2d76
xorl %ebx, %ebx
jmp 0x2d76
leaq 0x13d8(%rip), %rdi      # 0x4125
jmp 0x2d5f
leaq 0x13f5(%rip), %rdi      # 0x414b
jmp 0x2d5f
leaq 0x1413(%rip), %rdi      # 0x4172
leaq 0x139e(%rip), %rsi      # 0x4104
leaq 0x13d8(%rip), %rdx      # 0x4145
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2040
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/gtarcoder[P]libevent_utils/tcp_client.cpp
// Function: TcpClient::OnPeerRead()
void TcpClient::OnPeerRead(){
    //this is for test
    printf("received data from peer, length = %d, data = %s\n", buffer_len_, buffer_);
    usleep(1000000);
    
    char *msg = "hello server!\n";
    Write(msg, strlen(msg));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x1008c(%rdi), %esi
leaq 0x8d(%rdi), %rdx
leaq 0x13f4(%rip), %rdi      # 0x4191
xorl %eax, %eax
callq 0x2040
movl $0xf4240, %edi          # imm = 0xF4240
callq 0x2310
leaq 0x140d(%rip), %rsi      # 0x41c2
movq %rbx, %rdi
movl $0xe, %edx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x292a
// File: /workspace/github_cpp_makefile_star2_O3/gtarcoder[P]libevent_utils/tcp_client.cpp
// Function: TcpClient::OnPeerEvent(short)
void TcpClient::OnPeerEvent(short events){
   if (events == BEV_EVENT_CONNECTED){
        printf("connected!\n");
        connected_ = true;

        //this is for test
        usleep(1000000);
        char *msg = "hello server!\n";
        Write(msg, strlen(msg));

   }else if (events & BEV_EVENT_EOF){
        evutil_closesocket(fd_);
        fd_ = -1;
        bufferevent_setfd(peer_event_, -1);
        connected_ = false;
        printf("connection closed!\n");
   }else if (events & BEV_EVENT_ERROR){
        printf("got an error on TcpClient: %s\n", strerror(errno));
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x80, %esi
jne 0x2e10
leaq 0x12fc(%rip), %rdi      # 0x40dc
callq 0x2340
movb $0x1, 0x8c(%rbx)
movl $0xf4240, %edi          # imm = 0xF4240
callq 0x2310
leaq 0x13c5(%rip), %rsi      # 0x41c2
movq %rbx, %rdi
movl $0xe, %edx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x292a
movzwl %si, %eax
testb $0x10, %al
jne 0x2e22
testb $0x20, %al
jne 0x2e58
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl 0x58(%rbx), %edi
callq 0x2180
movl $0xffffffff, 0x58(%rbx) # imm = 0xFFFFFFFF
movq 0x28(%rbx), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x23a0
movb $0x0, 0x8c(%rbx)
leaq 0x127c(%rip), %rdi      # 0x40c9
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2340
callq 0x2030
movl (%rax), %edi
callq 0x20e0
leaq 0x1366(%rip), %rdi      # 0x41d1
movq %rax, %rsi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2040
nop
// File: /workspace/github_cpp_makefile_star2_O3/gtarcoder[P]libevent_utils/tcp_server.cpp
// Function: TcpServer::Bind(char const*, unsigned short, event_base*)
void TcpServer::Bind(const char* ip, uint16_t port, struct event_base* base){
    base_ = base;
    listen_addr_.sin_family = AF_INET;
    listen_addr_.sin_addr.s_addr = inet_addr(ip);
    listen_addr_.sin_port = htons(port);
    listener_ = evconnlistener_new_bind(
                base_, 
                ListenCallback,
                this, 
                LEV_OPT_REUSEABLE|LEV_OPT_CLOSE_ON_FREE,
                -1,
                (const sockaddr*)&listen_addr_, 
                sizeof(listen_addr_));
    if (!listener_){
        printf("evconnlistener create failed in %s:%s!\n", __FILE__, __func__);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rdi, %r14
movq %rcx, 0x8(%rdi)
leaq 0x18(%rdi), %r15
movw $0x2, 0x18(%rdi)
movq %rsi, %rdi
callq 0x22a0
movl %eax, 0x1c(%r14)
rolw $0x8, %bx
movw %bx, 0x1a(%r14)
movq 0x8(%r14), %rdi
movl $0x10, (%rsp)
leaq -0x13a(%rip), %rsi      # 0x2e7c
movq %r14, %rdx
movl $0xa, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movq %r15, %r9
callq 0x2230
movq %rax, 0x10(%r14)
testq %rax, %rax
je 0x2fe0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x127c(%rip), %rdi      # 0x4263
leaq 0x129d(%rip), %rsi      # 0x428b
leaq 0x12a5(%rip), %rdx      # 0x429a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2040
// File: /workspace/github_cpp_makefile_star2_O3/gtarcoder[P]libevent_utils/tcp_server.cpp
// Function: TcpServer::OnListen(evconnlistener*, int, sockaddr*, int)
void TcpServer::OnListen(struct evconnlistener* listener, evutil_socket_t sock, struct sockaddr* addr, int socklen){
    string client_ip = string(inet_ntoa(((struct sockaddr_in*)addr)->sin_addr));
    uint16_t client_port = ntohs(((struct sockaddr_in*)addr)->sin_port);
    printf("receive connection from %s:%d\n", client_ip.c_str(), client_port);
    Connection* conn = new Connection(client_ip, client_port, 0, next_client_index_);
    connections_[next_client_index_++] = conn;
    conn->Initialize(base_, sock);
    conn->Start();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, %r14
movl %edx, %ebx
movq %rdi, %r15
movl 0x4(%rcx), %edi
callq 0x2130
leaq -0x70(%rbp), %r12
leaq -0x2a(%rbp), %rdx
movq %r12, %rdi
movq %rax, %rsi
callq 0x2100
movzwl 0x2(%r14), %eax
rolw $0x8, %ax
movq (%r12), %rsi
movzwl %ax, %r12d
leaq 0x124d(%rip), %rdi      # 0x429f
movl %r12d, %edx
xorl %eax, %eax
callq 0x2040
movl $0x10098, %edi          # imm = 0x10098
callq 0x2280
movq %rax, %r14
leaq -0x40(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
addq %rsi, %rdx
leaq -0x50(%rbp), %rdi
callq 0x2a52
movzwl 0x68(%r15), %r8d
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
movl %r12d, %edx
xorl %ecx, %ecx
callq 0x2680
movq -0x50(%rbp), %rdi
cmpq %r13, %rdi
je 0x30a9
callq 0x2250
leaq 0x30(%r15), %rdi
movl 0x68(%r15), %eax
movl %eax, %ecx
incl %ecx
movw %cx, 0x68(%r15)
leaq -0x2a(%rbp), %rsi
movw %ax, (%rsi)
callq 0x31c4
movq %r14, (%rax)
movq 0x8(%r15), %rsi
movq %r14, %rdi
movl %ebx, %edx
xorl %ecx, %ecx
callq 0x2882
movq (%r14), %rax
movq %r14, %rdi
callq *0x38(%rax)
leaq -0x60(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x30f4
callq 0x2250
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3125
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r13, %rdi
je 0x311b
callq 0x2250
jmp 0x311b
movq %rax, %rbx
movq %r14, %rdi
callq 0x2250
jmp 0x3128
movq %rax, %rbx
leaq -0x60(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x313a
callq 0x2250
movq %rbx, %rdi
callq 0x23b0
// File: /workspace/github_cpp_makefile_star2_O3/gtarcoder[P]libevent_utils/udp_socket.cpp
// Function: UdpSocket::ReadCallback(int, short, void*)
void UdpSocket::ReadCallback(evutil_socket_t fd, short events, void* arg){
    UdpSocket* udp_socket = (UdpSocket*)arg;
    udp_socket->read_len_ = recv(udp_socket->fd_, udp_socket->read_buffer_, 0xffff, 0);
    udp_socket->read_buffer_[udp_socket->read_len_] = '\0';
    assert(udp_socket->read_cb_);
    udp_socket->read_cb_(udp_socket->read_buffer_, udp_socket->read_len_);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movl 0x1003c(%rdx), %edi
leaq 0x38(%rdx), %r14
movl $0xffff, %edx           # imm = 0xFFFF
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x20c0
movl %eax, 0x10038(%rbx)
cltq
movb $0x0, 0x38(%rbx,%rax)
cmpq $0x0, 0x18(%rbx)
je 0x34ea
leaq 0x8(%rbx), %rdi
movl 0x10038(%rbx), %eax
leaq -0x20(%rbp), %rsi
movq %r14, (%rsi)
leaq -0x14(%rbp), %rdx
movl %eax, (%rdx)
callq *0x20(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0xdd8(%rip), %rdi       # 0x42c9
leaq 0xde6(%rip), %rsi       # 0x42de
leaq 0xdee(%rip), %rcx       # 0x42ed
movl $0xa, %edx
callq 0x2190
nop
// File: /workspace/github_cpp_makefile_star2_O3/gtarcoder[P]libevent_utils/udp_socket.cpp
// Function: UdpSocket::Bind(char const*, unsigned short, event_base*)
bool UdpSocket::Bind(const char* local_ip, uint16_t local_port, struct event_base* base){
    base_ = base;
    assert(base_);    
    if(!Bind(local_ip, local_port))
      return false;
    event_ = event_new(base_, fd_, EV_PERSIST|EV_READ, UdpSocket::ReadCallback, this); 
    if(!event_){
        printf("event new failed in %s!\n", __func__);
        return false;
    }
    event_add(event_, NULL);
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rcx, 0x28(%rdi)
testq %rcx, %rcx
je 0x3581
movq %rdi, %rbx
movzwl %dx, %edx
callq 0x35a0
testb %al, %al
je 0x355d
movq 0x28(%rbx), %rdi
movl 0x1003c(%rbx), %esi
leaq -0xad(%rip), %rcx       # 0x348c
movl $0x12, %edx
movq %rbx, %r8
callq 0x2210
movq %rax, 0x30(%rbx)
testq %rax, %rax
je 0x3561
movq %rax, %rdi
xorl %esi, %esi
callq 0x2120
movb $0x1, %bl
jmp 0x3578
xorl %ebx, %ebx
jmp 0x3578
leaq 0xe05(%rip), %rdi       # 0x436d
leaq 0xd2b(%rip), %rsi       # 0x429a
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2040
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0xd9d(%rip), %rdi       # 0x4325
leaq 0xd4f(%rip), %rsi       # 0x42de
leaq 0xd95(%rip), %rcx       # 0x432b
movl $0x10, %edx
callq 0x2190
// File: /workspace/github_cpp_makefile_star2_O3/gtarcoder[P]libevent_utils/udp_socket.cpp
// Function: UdpSocket::Bind(char const*, unsigned short)
bool UdpSocket::Bind(const char* local_ip, uint16_t local_port){
    struct sockaddr_in local_addr;
    local_addr.sin_family = AF_INET;
    local_addr.sin_port = htons(local_port);
    local_addr.sin_addr.s_addr = inet_addr(local_ip);
    uint32_t option = 1;
    if (setsockopt(fd_, SOL_SOCKET, SO_REUSEADDR, (char*)&option, sizeof(option)) < 0){
       perror("set socket reuse addr\n");
       return false;
    }
    if (bind(fd_, (sockaddr*)&local_addr, sizeof(local_addr)) != 0){
       perror("bind socket\n");
       return false;
    }
    SetRecvSendBufSize(fd_, 0xfffff);
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movw $0x2, -0x1c(%rbp)
rolw $0x8, %dx
movw %dx, -0x1a(%rbp)
movq %rsi, %rdi
callq 0x22a0
movl %eax, -0x18(%rbp)
leaq -0xc(%rbp), %rcx
movl $0x1, (%rcx)
movl 0x1003c(%rbx), %edi
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x23c0
testl %eax, %eax
js 0x361f
movl 0x1003c(%rbx), %edi
leaq -0x1c(%rbp), %rsi
movl $0x10, %edx
callq 0x2060
testl %eax, %eax
jne 0x3628
movl 0x1003c(%rbx), %edi
movl $0xfffff, %esi          # imm = 0xFFFFF
callq 0x3dc3
movb $0x1, %al
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
leaq 0xd83(%rip), %rdi       # 0x43a9
jmp 0x362f
leaq 0xd91(%rip), %rdi       # 0x43c0
callq 0x2200
xorl %eax, %eax
jmp 0x3618
// File: /workspace/github_cpp_makefile_star2_O3/gtarcoder[P]libevent_utils/udp_socket.cpp
// Function: UdpSocket::UdpSocket()
UdpSocket::UdpSocket(){
#ifndef LINUX //in windows system
    static bool was_inited = false;
  	if (wsa_inited_){
		return;
	}

	WSADATA wsaData;
	int iErrorCode;
	if (WSAStartup(MAKEWORD(2, 1), &wsaData)) //µ÷ÓÃWindows Sockets DLL
	{
		printf("Winsock init failed in %s\n", __func__);
		WSACleanup();
		return;
	}
	wsa_inited_ = true;
#endif

#ifdef ASYNC_UDP
    event_ = NULL;
    base_ = NULL;
    read_cb_=NULL;
#endif

    //create a udp socket
    fd_ = socket(AF_INET, SOCK_DGRAM, 0);
    if(fd_ < 0){
        printf("udp create failed in %s\n", __func__);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x3730(%rip), %rax      # 0x6d78
movq %rax, (%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
movups %xmm0, 0x18(%rdi)
movups %xmm0, 0x28(%rdi)
movl $0x2, %edi
movl $0x2, %esi
xorl %edx, %edx
callq 0x2080
movl %eax, 0x1003c(%rbx)
testl %eax, %eax
js 0x367c
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0xd03(%rip), %rdi       # 0x4386
leaq 0xd15(%rip), %rsi       # 0x439f
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2040
nop
// File: /workspace/github_cpp_makefile_star2_O3/gtarcoder[P]libevent_utils/udp_socket.cpp
// Function: UdpSocket::~UdpSocket()
UdpSocket::~UdpSocket(){
#ifdef LINUX
    close(fd_);
#else
    closesocket(fd_);
#endif

#ifdef ASYNC_UDP
    if(event_)
        event_free(event_);
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x36d0(%rip), %rax      # 0x6d78
movq %rax, (%rdi)
movl 0x1003c(%rdi), %edi
callq 0x23f0
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x36c4
callq 0x2370
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x36de
addq $0x8, %rbx
movq %rbx, %rdi
movq %rbx, %rsi
movl $0x3, %edx
callq *%rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
jmp 0x36e7
movq %rax, %rdi
callq 0x2a44
nop
// File: /workspace/github_cpp_makefile_star2_O3/gtarcoder[P]libevent_utils/udp_socket.cpp
// Function: UdpSocket::Send(char*, int)
int UdpSocket::Send(char* buf, int len){
	int result = sendto(fd_, buf, len, 0, (sockaddr*)&remote_addr_, sizeof(remote_addr_));
	if (result < 0){
		perror("udp send\n");
	}
    return result;	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl 0x1003c(%rdi), %eax
movslq %edx, %rdx
leaq 0x10040(%rdi), %r8
movl %eax, %edi
xorl %ecx, %ecx
movl $0x10, %r9d
callq 0x2050
movq %rax, %rbx
testl %ebx, %ebx
js 0x3747
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0xc7f(%rip), %rdi       # 0x43cd
callq 0x2200
jmp 0x373e
nop
// File: /workspace/github_cpp_makefile_star2_O3/gtarcoder[P]libevent_utils/udp_socket.cpp
// Function: UdpSocket::SendTo(char*, int, char const*, unsigned short)
int UdpSocket::SendTo(char* buf, int len, const char* dst_ip, uint16_t dst_port){
	struct sockaddr_in sock_addr;
	sock_addr.sin_family = AF_INET;
	sock_addr.sin_port = htons(dst_port);
	sock_addr.sin_addr.s_addr = inet_addr(dst_ip);
	int result = sendto(fd_, buf, len, 0, (sockaddr*)&sock_addr, sizeof(sockaddr));
	if (result < 0){
		perror("udp send\n");
	}
	return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
leaq -0x30(%rbp), %r12
movw $0x2, (%r12)
rolw $0x8, %r8w
movw %r8w, 0x2(%r12)
movq %rcx, %rdi
callq 0x22a0
movl %eax, 0x4(%r12)
movl 0x1003c(%r15), %edi
movslq %ebx, %rdx
movq %r14, %rsi
xorl %ecx, %ecx
movq %r12, %r8
movl $0x10, %r9d
callq 0x2050
movq %rax, %rbx
testl %ebx, %ebx
js 0x37c3
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc03(%rip), %rdi       # 0x43cd
callq 0x2200
jmp 0x37b4
nop
// File: /workspace/github_cpp_makefile_star2_O3/gtarcoder[P]libevent_utils/udp_socket.cpp
// Function: UdpSocket::SendTo(char*, int, sockaddr_in const&)
int UdpSocket::SendTo(char* buf, int len, const struct sockaddr_in& sock_addr){
	int result = sendto(fd_, buf, len, 0, (sockaddr*)&sock_addr, sizeof(sockaddr));
	if (result < 0){
		perror("udp send\n");
	}
	return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rcx, %r8
movl 0x1003c(%rdi), %edi
movslq %edx, %rdx
xorl %ecx, %ecx
movl $0x10, %r9d
callq 0x2050
movq %rax, %rbx
testl %ebx, %ebx
js 0x3801
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0xbc5(%rip), %rdi       # 0x43cd
callq 0x2200
jmp 0x37f8
nop
// File: /workspace/github_cpp_makefile_star2_O3/gtarcoder[P]libevent_utils/udp_socket.cpp
// Function: UdpSocket::RecvFrom(char*, int, unsigned int*, unsigned short*)
int UdpSocket::RecvFrom(char* buf, int buf_len, uint32_t* from_ip, uint16_t* from_port){
	struct sockaddr_in sock_addr;
#ifdef LINUX
	socklen_t addr_len = sizeof(sock_addr);
#else
	int addr_len = sizeof(sock_addr);
#endif
	int recv_bytes = recvfrom(fd_, buf, buf_len, 0, (sockaddr*)&sock_addr, &addr_len);
	if (recv_bytes < 0){
		perror("udp recv\n");
	}
	if (from_ip){
		*from_ip = ntohl(sock_addr.sin_addr.s_addr);
	}
	if (from_port){
		*from_port = ntohs(sock_addr.sin_port);
	}

	return recv_bytes;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movq %rcx, %r14
leaq -0x1c(%rbp), %r9
movl $0x10, (%r9)
movl 0x1003c(%rdi), %edi
movslq %edx, %rdx
leaq -0x2c(%rbp), %r8
xorl %ecx, %ecx
callq 0x21d0
movq %rax, %r15
testl %r15d, %r15d
js 0x38bb
testq %r14, %r14
je 0x389d
movl -0x28(%rbp), %eax
bswapl %eax
movl %eax, (%r14)
testq %rbx, %rbx
je 0x38ad
movzwl -0x2a(%rbp), %eax
rolw $0x8, %ax
movw %ax, (%rbx)
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb15(%rip), %rdi       # 0x43d7
callq 0x2200
jmp 0x3890
nop
// File: /workspace/github_cpp_makefile_star2_O3/gtarcoder[P]libevent_utils/utils.cpp
// Function: InitSocketAddr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, unsigned short, sockaddr_in*)
void InitSocketAddr(std::string& ip, uint16_t port, sockaddr_in* addr){
	memset((char*)addr, 0, sizeof(sockaddr_in));
	addr->sin_family = AF_INET;
	addr->sin_port = htons(port);
#ifndef LINUX
	addr->sin_addr.S_un.S_addr = inet_addr(ip.c_str());
#else
	addr->sin_addr.s_addr = inet_addr(ip.c_str());
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl $0x0, 0xc(%rdx)
movq $0x0, 0x4(%rdx)
movw $0x2, (%rdx)
rolw $0x8, %si
movw %si, 0x2(%rdx)
movq (%rdi), %rdi
callq 0x22a0
movl %eax, 0x4(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/gtarcoder[P]libevent_utils/utils.cpp
// Function: SetNonBlock(int)
int SetNonBlock(int fd){
	int flags;
	flags = fcntl(fd, F_GETFL);
	if (flags < 0) return flags;
	flags |= O_NONBLOCK;
	if (fcntl(fd, F_SETFL, flags) < 0){
    perror("fcntl set nonblock error : ");
    return -1;
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %edi, %r14d
xorl %ebx, %ebx
movl $0x3, %esi
xorl %eax, %eax
callq 0x2170
testl %eax, %eax
js 0x3d71
orl $0x800, %eax            # imm = 0x800
movl %r14d, %edi
movl $0x4, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x2170
testl %eax, %eax
jns 0x3d73
leaq 0x69c(%rip), %rdi       # 0x4401
callq 0x2200
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x3d73
movl %eax, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/gtarcoder[P]libevent_utils/utils.cpp
// Function: SetReuseAddr(int)
int SetReuseAddr(int fd){
	int on = 1;
	if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < -1){
    perror("setsocketopt so_reuseaddr error : ");
    return -1;
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq -0x4(%rbp), %rcx
movl $0x1, (%rcx)
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x23c0
movl %eax, %ecx
xorl %eax, %eax
cmpl $-0x2, %ecx
jle 0x3db0
addq $0x10, %rsp
popq %rbp
retq
leaq 0x666(%rip), %rdi       # 0x441d
callq 0x2200
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x3daa