LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/q3bsp.cpp
// Function: Quake3BSP::ReadEntities(void const*)
void Quake3BSP::ReadEntities(const void *mem)
{
  assert( mOk );
  int lsize;
  int lcount;
  
  const char *elements = (const char *) mHeader.LumpInfo(Q3_ENTITIES,mem,lsize,lcount);
  assert( lsize == sizeof(char) );

  mEntities.clear();

  const char *estart=elements;
  const char *p=estart;
  int level=0;
  for (int i=0; i<lcount; i++)
  {
	 if (*p == '{') {
		 level++;
		 if (level == 1) estart = p+1;
	 } else if (*p == '}') {
		 level--;
		 if (level == 0) {
			EntityReference *e=new EntityReference(estart,p-estart-1);

		    mEntities.push_back(*e);
			estart = p+1;
		 }
	 }
	 p++;

  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpb $0x0, (%rdi)
je 0x836d
movq %rsi, %rdx
movq %rdi, %rbx
addq $0x18, %rdi
xorl %r13d, %r13d
leaq -0x3c(%rbp), %r14
leaq -0x2c(%rbp), %r8
xorl %esi, %esi
movq %r14, %rcx
callq 0x8482
cmpl $0x1, (%r14)
jne 0x838c
movq %rax, %r15
addq $0x1d0, %rbx            # imm = 0x1D0
movq %rbx, %rdi
callq 0x9954
movq %r15, %r14
incq %r14
leal -0x1(%r15), %eax
movq %rax, -0x38(%rbp)
xorl %eax, %eax
cmpl -0x2c(%rbp), %r13d
jge 0x835e
movzbl -0x1(%r14), %ecx
cmpl $0x7d, %ecx
je 0x8321
cmpl $0x7b, %ecx
jne 0x8356
testl %eax, %eax
leal 0x1(%rax), %eax
cmoveq %r14, %r15
jmp 0x8356
decl %eax
jne 0x8356
pushq $0x20
popq %rdi
callq 0x2220
movq %rax, %r12
movq -0x38(%rbp), %rax
leal (%rax,%r13), %edx
subl %r15d, %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x9962
movq %rbx, %rdi
movq %r12, %rsi
callq 0x999c
xorl %eax, %eax
movq %r14, %r15
incl %r13d
incq %r14
jmp 0x8301
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8899(%rip), %rdi      # 0x10c0d
leaq 0x8896(%rip), %rsi      # 0x10c11
leaq 0x8ce3(%rip), %rcx      # 0x11065
movl $0x2bd, %edx            # imm = 0x2BD
callq 0x2180
leaq 0x8cfd(%rip), %rdi      # 0x11090
leaq 0x8877(%rip), %rsi      # 0x10c11
leaq 0x8cc4(%rip), %rcx      # 0x11065
movl $0x2c2, %edx            # imm = 0x2C2
callq 0x2180
movq %rax, %rbx
pushq $0x20
popq %rsi
movq %r12, %rdi
callq 0x2230
movq %rbx, %rdi
callq 0x23e0
nop
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/q3bsp.cpp
// Function: QuakeNode::QuakeNode(int const*)
QuakeNode::QuakeNode(const int *node)
{
  const dnode_t *n = (const dnode_t*) node;

  mPlane = node[0];
  mLeftChild = node[1];
  mRightChild = node[2];

  mBound.r1.x = float( node[3] );
  mBound.r1.y = float( node[4] );
  mBound.r1.z = float( node[5] );
  mBound.r2.x = float( node[6] );
  mBound.r2.y = float( node[7] );
  mBound.r2.z = float( node[8] );

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
andq $0x0, 0xb4(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0xa4(%rdi)
movl (%rsi), %eax
movl %eax, 0x98(%rdi)
movl 0x4(%rsi), %eax
movl %eax, 0x9c(%rdi)
movl 0x8(%rsi), %eax
movl %eax, 0xa0(%rdi)
cvtsi2ssl 0xc(%rsi), %xmm0
movss %xmm0, 0xa4(%rdi)
cvtsi2ssl 0x10(%rsi), %xmm0
movss %xmm0, 0xa8(%rdi)
cvtsi2ssl 0x14(%rsi), %xmm0
movss %xmm0, 0xac(%rdi)
cvtsi2ssl 0x18(%rsi), %xmm0
movss %xmm0, 0xb0(%rdi)
cvtsi2ssl 0x1c(%rsi), %xmm0
movss %xmm0, 0xb4(%rdi)
cvtsi2ssl 0x20(%rsi), %xmm0
movss %xmm0, 0xb8(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/q3bsp.cpp
// Function: QuakeLeaf::QuakeLeaf(int const*)
QuakeLeaf::QuakeLeaf(const int *node)
{
  const dleaf_t *n = (const dleaf_t*) node;

  mCluster = node[0];
  mArea    = node[1];

  mBound.r1.x = float( node[2] );
  mBound.r1.y = float( node[3] );
  mBound.r1.z = float( node[4] );

  mBound.r2.x = float( node[5] );
  mBound.r2.y = float( node[6] );
  mBound.r2.z = float( node[7] );

  mFirstFace      = node[8];
  mFaceCount      = node[9];
  mFirstUnknown   = node[10];
  mNumberUnknowns = node[11];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
andq $0x0, 0x18(%rdi)
movl (%rsi), %eax
movl %eax, (%rdi)
movl 0x4(%rsi), %eax
movl %eax, 0x4(%rdi)
cvtsi2ssl 0x8(%rsi), %xmm0
movss %xmm0, 0x8(%rdi)
cvtsi2ssl 0xc(%rsi), %xmm0
movss %xmm0, 0xc(%rdi)
cvtsi2ssl 0x10(%rsi), %xmm0
movss %xmm0, 0x10(%rdi)
cvtsi2ssl 0x14(%rsi), %xmm0
movss %xmm0, 0x14(%rdi)
cvtsi2ssl 0x18(%rsi), %xmm0
movss %xmm0, 0x18(%rdi)
cvtsi2ssl 0x1c(%rsi), %xmm0
movss %xmm0, 0x1c(%rdi)
movl 0x20(%rsi), %eax
movl %eax, 0x20(%rdi)
movl 0x24(%rsi), %eax
movl %eax, 0x24(%rdi)
movl 0x28(%rsi), %eax
movl %eax, 0x28(%rdi)
movl 0x2c(%rsi), %eax
movl %eax, 0x2c(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/q3bsp.cpp
// Function: QuakeVertex::Get(LightMapVertex&) const
void QuakeVertex::Get(LightMapVertex &vtx) const
{
  vtx.mPos.x    = mPos.x;
  vtx.mPos.y    = mPos.y;
  vtx.mPos.z    = mPos.z;


  vtx.mTexel1.x = mTexel1.x;
  vtx.mTexel1.y = mTexel1.y;

  vtx.mTexel2.x = mTexel2.x;
  vtx.mTexel2.y = mTexel2.y;

  vtx.mColor.x    = float((mColor>>0) & 0xFF) / 255.0f;
  vtx.mColor.y    = float((mColor>>8) & 0xFF) / 255.0f;
  vtx.mColor.z    = float((mColor>>16) & 0xFF) / 255.0f;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movss (%rdi), %xmm0
movss %xmm0, (%rsi)
movss 0x4(%rdi), %xmm0
movss %xmm0, 0x4(%rsi)
movss 0x8(%rdi), %xmm0
movss %xmm0, 0x8(%rsi)
movss 0xc(%rdi), %xmm0
movss %xmm0, 0xc(%rsi)
movss 0x10(%rdi), %xmm0
movss %xmm0, 0x10(%rsi)
movss 0x14(%rdi), %xmm0
movss %xmm0, 0x14(%rsi)
movss 0x18(%rdi), %xmm0
movss %xmm0, 0x18(%rsi)
movl 0x28(%rdi), %eax
movl $0xff, %ecx
movl %eax, %edx
andl %ecx, %edx
cvtsi2ss %edx, %xmm0
movss 0x78f0(%rip), %xmm1     # 0x101d8
divss %xmm1, %xmm0
movss %xmm0, 0x1c(%rsi)
movl %eax, %edx
shrl $0x8, %edx
andl %ecx, %edx
cvtsi2ss %edx, %xmm0
shrl $0x10, %eax
andl %ecx, %eax
cvtsi2ss %eax, %xmm2
divss %xmm1, %xmm0
movss %xmm0, 0x20(%rsi)
divss %xmm1, %xmm2
movss %xmm2, 0x24(%rsi)
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/q3bsp.cpp
// Function: ShaderReference::GetShaderFileName(char*)
void ShaderReference::GetShaderFileName(char *tname)
{
  strcpy(tname,"");
  int len = strlen(mName);
  if ( !len ) 
	  return;
  
  const char *foo = &mName[0];
  while ( *foo && *foo != '/' ) foo++;

  if ( !*foo ) return;
  foo++;
  
  char *dest = tname;
  while ( *foo && *foo != '/' )
  {
    *dest++ = *foo++;
  }
  *dest = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movb $0x0, (%rsi)
callq 0x2110
testl %eax, %eax
je 0x8e3a
movzbl (%r14), %eax
testl %eax, %eax
je 0x8e3a
cmpl $0x2f, %eax
je 0x8e1b
incq %r14
jmp 0x8e09
pushq $0x1
popq %rax
movzbl (%r14,%rax), %ecx
testl %ecx, %ecx
je 0x8e35
cmpl $0x2f, %ecx
je 0x8e35
movb %cl, -0x1(%rbx,%rax)
incq %rax
jmp 0x8e1e
movb $0x0, -0x1(%rbx,%rax)
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/q3bsp.cpp
// Function: ShaderReference::GetTextureName(char*)
void ShaderReference::GetTextureName(char *tname)
{
  strcpy(tname,"null");
  int len = strlen(mName);
  if ( !len ) return;
  const char *foo = &mName[len-1];
  while ( *foo && *foo != '/' ) foo--;
  if ( !*foo ) return;
  foo++;
  char *dest = tname;
  while ( *foo )
  {
    *dest++ = *foo++;
  }
  *dest = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movb $0x0, 0x4(%rsi)
movl $0x6c6c756e, (%rsi)     # imm = 0x6C6C756E
callq 0x2110
testl %eax, %eax
je 0x8e92
decl %eax
cltq
addq %rax, %r14
movzbl (%r14), %eax
testl %eax, %eax
je 0x8e92
cmpl $0x2f, %eax
je 0x8e79
decq %r14
jmp 0x8e67
pushq $0x1
popq %rax
movb (%r14,%rax), %cl
testb %cl, %cl
je 0x8e8d
movb %cl, -0x1(%rbx,%rax)
incq %rax
jmp 0x8e7c
movb $0x0, -0x1(%rbx,%rax)
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/q3bsp.cpp
// Function: Quake3BSP::SaveEntitiesVRML2(_IO_FILE*, VFormatOptions&) const
void Quake3BSP::SaveEntitiesVRML2(
			FILE *fph,
            VFormatOptions &options) const 
{
  if ( mEntities.size() )
  {
    if ( fph )
    {
      fprintf(fph,"DEF Entities Group {\n");
      fprintf(fph,"children [\n");

      EntityReferenceVector::const_iterator i;

      for (i=mEntities.begin(); i!=mEntities.end(); ++i)
      {
			SaveEntity(*i,fph,options);
      }

      fprintf(fph,"]}\n");

    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x91d6
movq %rdi, %r14
movq 0x1d0(%rdi), %rax
cmpq %rax, 0x1d8(%rdi)
je 0x91d6
movq %rsi, %rbx
leaq 0x7fd5(%rip), %rdi      # 0x11163
pushq $0x15
popq %rsi
pushq $0x1
popq %r15
movq %r15, %rdx
movq %rbx, %rcx
callq 0x2440
leaq 0x7fd2(%rip), %rdi      # 0x11179
pushq $0xb
popq %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x2440
movq 0x1d0(%r14), %r15
cmpq 0x1d8(%r14), %r15
je 0x91e1
movq %r15, %rsi
movq %rbx, %rdx
callq 0x8e98
addq $0x20, %r15
jmp 0x91bc
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7f9d(%rip), %rdi      # 0x11185
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2440
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/q3bsp.cpp
// Function: Quake3BSP::SaveNode(int, _IO_FILE*, VFormatOptions&)
void Quake3BSP::SaveNode(
			int nodeNum, 
			FILE *fph,
            VFormatOptions &options)

{
	if (nodeNum<0) {
		// negative numbers are -(leafs+1), not nodes
		int leafNum = - (nodeNum+1);
		SaveNodeBsp(&mLeaves[leafNum],fph,options);
	}
	else {
		SaveNodeBsp(&mNodes[nodeNum],fph,options);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testl %esi, %esi
js 0x921b
movl %esi, %eax
imulq $0x24, %rax, %rsi
addq 0x140(%rdi), %rsi
popq %rbp
jmp 0x93b0
notl %esi
imulq $0x30, %rsi, %rsi
addq 0x1b8(%rdi), %rsi
popq %rbp
jmp 0x922e
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/q3bsp.cpp
// Function: Quake3BSP::SaveNodeBsp(dleaf_t const*, _IO_FILE*, VFormatOptions&)
void Quake3BSP::SaveNodeBsp(
			const dleaf_t *node, 

			FILE *fph,
            VFormatOptions &options) 
{

	// save the leaf surfaces & brushes 
	if (node->numLeafSurfaces == 0) {
		fprintf(fph,"NULL ");
		return;
	}
	if (node->numLeafSurfaces >1) {
		//fprintf(fph,"Group { children [\n");
	}
    VertexMesh mesh;

	// print all the surfaces 
	for (int i=0; i<node->numLeafSurfaces;i++) {
		int surface = node->firstLeafSurface + i;
		surface = mLeafSurfaces[surface];
		fprintf(fph,"## surface %d \n",surface);

		mFaces[surface].Build(mElements,mVertices,mShaders,mLmPrefix,mName,mCodeName,mesh);
	}

	mesh.SaveVRML2(fph,options);

	if (node->numLeafSurfaces >1) {
		//fprintf(fph,"]}");
	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %r8
movl 0x24(%rsi), %eax
testl %eax, %eax
je 0x9370
movq %rsi, %r15
movq %rdi, %r12
movq %rcx, -0x30(%rbp)
leaq 0x7951(%rip), %rcx      # 0x10bb2
leaq -0x98(%rbp), %rdx
movq %rcx, -0x10(%rdx)
andl $0x0, (%rdx)
andq $0x0, 0x8(%rdx)
movq %rdx, 0x10(%rdx)
movq %rdx, 0x18(%rdx)
andq $0x0, -0x18(%rdx)
andq $0x0, 0x20(%rdx)
movaps 0x7953(%rip), %xmm0     # 0x10be0
movups %xmm0, 0x28(%rdx)
movabsq $-0x319194d7319194d8, %rcx # imm = 0xCE6E6B28CE6E6B28
movq %rcx, 0x38(%rdx)
leaq 0xf0(%rdi), %rcx
movq %rcx, -0x58(%rbp)
leaq 0xc0(%rdi), %rcx
movq %rcx, -0x50(%rbp)
leaq 0xd8(%rdi), %rcx
movq %rcx, -0x48(%rbp)
leaq 0x1f0(%rdi), %rcx
movq %rcx, -0x40(%rbp)
leaq 0x10(%rdi), %rcx
movq %rcx, -0x38(%rbp)
xorl %r13d, %r13d
cmpl %eax, %r13d
jge 0x933f
movslq 0x20(%r15), %rax
addq %r13, %rax
movq 0x158(%r12), %rcx
movslq (%rcx,%rax,4), %r14
movq %r8, %rbx
movq %r8, %rdi
leaq 0x7ebf(%rip), %rsi      # 0x111ba
movl %r14d, %edx
xorl %eax, %eax
callq 0x2330
imulq $0x6c, %r14, %rdi
addq 0xa8(%r12), %rdi
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq -0x48(%rbp), %rcx
movq -0x40(%rbp), %r8
leaq -0xb0(%rbp), %rax
pushq %rax
pushq -0x38(%rbp)
callq 0x891a
popq %rax
popq %rcx
movl 0x24(%r15), %eax
incq %r13
movq %rbx, %r8
jmp 0x92d6
leaq -0xb0(%rbp), %rdi
movq %r8, %rsi
movq -0x30(%rbp), %rdx
callq 0xdb0e
leaq -0xb0(%rbp), %rdi
callq 0xd910
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7e3d(%rip), %rdi      # 0x111b4
pushq $0x5
popq %rsi
pushq $0x1
popq %rdx
movq %r8, %rcx
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2440
jmp 0x9398
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0xd910
movq %rbx, %rdi
callq 0x23e0
nop
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/q3bsp.cpp
// Function: Quake3BSP::SaveNodeBsp(dnode_t const*, _IO_FILE*, VFormatOptions&)
void Quake3BSP::SaveNodeBsp(
			const dnode_t *node, 

			FILE *fph,
            VFormatOptions &options)
{

	const dplane_t	*plane;
	
	if (node->planeNum != PLANENUM_LEAF) {
		plane = &mPlanes[node->planeNum];
		//d = DotProduct (origin, plane->normal) - plane->dist;
		// if (d >= 0) node = node->children[0];
		vec3_t normal;

		// is this correct ??
		options.MapVector(plane->normal,normal) ;
	
		fprintf(fph,"BspTree { plane %g %g %g %g \n",normal[0], normal[1],normal[2],plane->dist);

		fprintf(fph,"front "); SaveNode(node->children[0],fph,options);

		fprintf(fph,"back ");SaveNode(node->children[1],fph,options);

		fprintf(fph,"}\n");

	}	else {
#if 0
		portal_t	**pp, *t;
	
		pp = &node->portals;
		while (1)
		{
			t = *pp;
			if (!t)
				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 (!node->brushlist)
			fprintf (fph,"NULL\n");
		else
		{
			for (bb=node->brushlist ; bb ; bb=bb->next) {
				//_printf ("%i ", bb->original->brushnum);
			}
			//_printf ("\n");
		}
		return;
#endif

	}

}

// Assembly:
movslq (%rsi), %rax
cmpq $-0x1, %rax
je 0x94a1
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r15
movq 0x128(%rdi), %rcx
shlq $0x4, %rax
movss 0x7816(%rip), %xmm1     # 0x10c00
movss (%rcx,%rax), %xmm0
mulss %xmm1, %xmm0
mulss 0x8(%rcx,%rax), %xmm1
movss 0x4(%rcx,%rax), %xmm2
mulss 0x77fd(%rip), %xmm2     # 0x10c04
cvtss2sd %xmm0, %xmm0
cvtss2sd %xmm1, %xmm1
cvtss2sd %xmm2, %xmm2
cvtss2sd 0xc(%rcx,%rax), %xmm3
leaq 0x7d69(%rip), %rsi      # 0x11189
movq %rdx, %rdi
movb $0x4, %al
callq 0x2330
leaq 0x7d76(%rip), %rdi      # 0x111a7
pushq $0x6
popq %rsi
pushq $0x1
popq %r13
movq %r13, %rdx
movq %rbx, %rcx
callq 0x2440
movl 0x4(%r12), %esi
movq %r15, %rdi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x9200
leaq 0x7d51(%rip), %rdi      # 0x111ae
pushq $0x5
popq %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x2440
movl 0x8(%r12), %esi
movq %r15, %rdi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x9200
leaq 0x897b(%rip), %rdi      # 0x11e00
pushq $0x2
popq %rsi
movq %r13, %rdx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2440
retq
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/./rect.h
// Function: Rect3d<float>::MinMax(float, float, float)
void MinMax(Type x,Type y,Type z)
  {
    if ( x < r1.GetX() ) r1.SetX(x);
    if ( y < r1.GetY() ) r1.SetY(y);
    if ( z < r1.GetZ() ) r1.SetZ(z);

    if ( x > r2.GetX() ) r2.SetX(x);
    if ( y > r2.GetY() ) r2.SetY(y);
    if ( z > r2.GetZ() ) r2.SetZ(z);
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
movss (%rdi), %xmm3
ucomiss %xmm0, %xmm3
jbe 0xa9b1
movss %xmm0, (%rdi)
movss 0x4(%rdi), %xmm3
ucomiss %xmm1, %xmm3
jbe 0xa9c0
movss %xmm1, 0x4(%rdi)
movss 0x8(%rdi), %xmm3
ucomiss %xmm2, %xmm3
jbe 0xa9cf
movss %xmm2, 0x8(%rdi)
ucomiss 0xc(%rdi), %xmm0
jbe 0xa9da
movss %xmm0, 0xc(%rdi)
ucomiss 0x10(%rdi), %xmm1
jbe 0xa9e5
movss %xmm1, 0x10(%rdi)
ucomiss 0x14(%rdi), %xmm2
jbe 0xa9f0
movss %xmm2, 0x14(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/q3shader.cpp
// Function: QuakeShaderFactory::AddShader(StringRef const&)
bool  QuakeShaderFactory::AddShader(const StringRef &sname)
{

  mBraceCount = 0;
  mCurrent    = 0;

  mCurrentStage = 0;

  char filename[1024];
  sprintf(filename, "scripts/%s", sname.Get());
  Fload shader(filename);

  if (!shader.GetData()) {
    printf("***********SHADER FILE NOT FOUND in scripts/ : %s \n",sname.c_str());
    return false;
  }

  // TODO (vlaube): should we use the full filename here?
  mShaderFiles[sname] = true; 

  printf("***********SHADER FILE PROCESS : %s \n",sname.c_str());

  while ( 1 )
  {

    char *str = shader.GetString();

    if ( !str ) break;

    ShaderString(str); // process one string.
  }

  delete mCurrent;
  mCurrent = 0;
  delete mCurrentStage;
  mCurrentStage = 0;
  return true;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x450, %rsp            # imm = 0x450
movq %rdi, %rbx
andl $0x0, 0x18(%rdi)
movq %rsi, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rdi)
movq (%rsi), %rdx
leaq 0x5f7a(%rip), %rsi      # 0x115a9
leaq -0x470(%rbp), %r15
movq %r15, %rdi
xorl %eax, %eax
callq 0x2080
leaq -0x48(%rbp), %rdi
leaq -0x21(%rbp), %rdx
movq %r15, %rsi
callq 0x5b0c
leaq -0x70(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x6bac
leaq -0x48(%rbp), %rdi
callq 0x2120
movq -0x68(%rbp), %r15
testq %r15, %r15
je 0xb6fb
leaq 0x60(%rbx), %rdi
movq %r14, %rsi
callq 0xc594
leaq 0x20(%rbx), %r12
movb $0x1, (%rax)
movq (%r14), %rsi
leaq 0x5f58(%rip), %rdi      # 0x115e8
xorl %eax, %eax
callq 0x2050
leaq -0x70(%rbp), %r14
movq %r14, %rdi
callq 0x6caa
testq %rax, %rax
je 0xb6b5
movq %rbx, %rdi
movq %rax, %rsi
callq 0xb85a
jmp 0xb69b
movq (%r12), %r14
testq %r14, %r14
je 0xb6c6
movq %r14, %rdi
callq 0xc566
pushq $0x68
popq %rsi
movq %r14, %rdi
callq 0x2230
andq $0x0, 0x20(%rbx)
movq 0x28(%rbx), %r14
testq %r14, %r14
je 0xb6e7
movq %r14, %rdi
callq 0xc5e6
movl $0xb8, %esi
movq %r14, %rdi
callq 0x2230
andq $0x0, 0x28(%rbx)
jmp 0xb70c
movq (%r14), %rsi
leaq 0x5eaf(%rip), %rdi      # 0x115b4
xorl %eax, %eax
callq 0x2050
testq %r15, %r15
setne %bl
leaq -0x70(%rbp), %rdi
callq 0x6c92
movl %ebx, %eax
addq $0x450, %rsp            # imm = 0x450
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb742
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x2120
jmp 0xb74e
movq %rax, %rbx
jmp 0xb74e
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x6c92
movq %rbx, %rdi
callq 0x23e0
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/q3shader.cpp
// Function: QuakeShaderFactory::~QuakeShaderFactory()
QuakeShaderFactory::~QuakeShaderFactory(void)
{
  QuakeShaderMap::iterator i;
  for (i=mShaders.begin(); i!=mShaders.end(); ++i)
  {
    QuakeShader *shader = (*i).second;
    delete shader;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x48(%rdi), %r15
leaq 0x38(%rdi), %r13
pushq $0x68
popq %r14
cmpq %r13, %r15
je 0xb7a1
movq 0x28(%r15), %r12
testq %r12, %r12
je 0xb789
movq %r12, %rdi
callq 0xc566
movq %r12, %rdi
movq %r14, %rsi
callq 0x2230
movq %r15, %rdi
callq 0x2190
movq %rax, %r15
jmp 0xb773
leaq 0x30(%rbx), %r14
leaq 0x60(%rbx), %rdi
callq 0xc824
movq %r14, %rdi
callq 0xc880
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x61c2
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/q3shader.cpp
// Function: QuakeShaderFactory::Locate(StringRef const&)
QuakeShader * QuakeShaderFactory::Locate(const StringRef &str)
{
  QuakeShaderMap::iterator found;
  found = mShaders.find(str);
  if ( found != mShaders.end() ) return (*found).second;
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
addq $0x30, %rdi
callq 0xcf30
addq $0x38, %rbx
cmpq %rbx, %rax
je 0xb827
movq 0x28(%rax), %rax
jmp 0xb829
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/q3shader.cpp
// Function: QuakeShaderFactory::ShaderFileLoaded(StringRef const&)
bool 
QuakeShaderFactory::ShaderFileLoaded(const StringRef &str)
{
  QuakeShaderFileMap::iterator found;
  found = mShaderFiles.find(str);
  if ( found != mShaderFiles.end() ) 
	  return (*found).second;
  return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
addq $0x60, %rdi
callq 0xcf8c
addq $0x68, %rbx
cmpq %rbx, %rax
je 0xb850
movb 0x28(%rax), %al
jmp 0xb852
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/q3shader.cpp
// Function: QuakeShaderFactory::ShaderString(char const*)
void QuakeShaderFactory::ShaderString(const char *str)
{
  char workspace[1024];

  char *dest = workspace;

  while ( *str )
  {
    if ( str[0] == '/' && str[1] == '/' ) 
		break;
    *dest++ = *str++;
  }
  *dest = 0;
  int len = strlen(workspace);
  if ( len == 0 ) return;

  ArgList::Set( workspace ); // crunch it into arguments.
  // now ready to process it as a series of arguments!
  if ( mArgs.size() ) Process(mArgs);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x430, %rsp            # imm = 0x430
movq %rdi, %rbx
xorl %eax, %eax
movzbl (%rsi,%rax), %ecx
cmpl $0x2f, %ecx
je 0xb87c
testl %ecx, %ecx
jne 0xb883
jmp 0xb88f
cmpb $0x2f, 0x1(%rsi,%rax)
je 0xb88f
movb %cl, -0x440(%rbp,%rax)
incq %rax
jmp 0xb86d
movb $0x0, -0x440(%rbp,%rax)
leaq -0x440(%rbp), %rdi
callq 0x2110
testl %eax, %eax
je 0xb8e9
leaq -0x38(%rbp), %r14
leaq -0x440(%rbp), %rsi
leaq -0x11(%rbp), %rdx
movq %r14, %rdi
callq 0x5b0c
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5fe2
leaq -0x38(%rbp), %rdi
callq 0x2120
movq 0x8(%rbx), %rax
cmpq (%rbx), %rax
je 0xb8e9
movq %rbx, %rdi
movq %rbx, %rsi
callq 0xb90a
addq $0x430, %rsp            # imm = 0x430
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
callq 0x2120
movq %rbx, %rdi
callq 0x23e0
nop
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/./q3shader.h
// Function: QuakeShader::QuakeShader(StringRef const&)
QuakeShader(const StringRef &ref)
  {
    mName = ref;
	mTrans = false;
	mNoLightMap = false;
	mSky = false;
	mLightMapStage=0;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x4535(%rip), %rax      # 0x10bb2
movq %rax, (%rdi)
leaq 0x20(%rdi), %rcx
movq %rcx, 0x10(%rdi)
andq $0x0, 0x18(%rdi)
xorl %ecx, %ecx
movb %cl, 0x20(%rdi)
movq %rax, 0x30(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rdi)
movups %xmm0, 0x48(%rdi)
movups %xmm0, 0x58(%rdi)
movq (%rsi), %rax
movq %rax, 0x30(%rdi)
andw $0x0, 0x8(%rdi)
movb %cl, 0xa(%rdi)
andl $0x0, 0xc(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/vformat.cpp
// Function: ExistsFile(char const*)
bool ExistsFile(const char *path) 
{
	FILE *f = fopen(path,"rb");
	if (!f) 
		return false;
	fclose(f);
	return true;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x2bd3(%rip), %rsi      # 0x101e8
callq 0x22a0
movq %rax, %rbx
testq %rax, %rax
je 0xd62a
movq %rbx, %rdi
callq 0x2210
testq %rbx, %rbx
setne %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/vformat.cpp
// Function: VertexLess::operator()(int, int) const
bool VertexLess::operator()(int v1,int v2) const
{

  const LightMapVertex& a = Get(v1);
  const LightMapVertex& b = Get(v2);

  if ( a.GetX() < b.GetX() ) return true;
  if ( a.GetX() > b.GetX() ) return false;

  if ( a.GetY() < b.GetY() ) return true;
  if ( a.GetY() > b.GetY() ) return false;

  if ( a.GetZ() < b.GetZ() ) return true;
  if ( a.GetZ() > b.GetZ() ) return false;

  if ( a.mTexel1.x < b.mTexel1.x ) return true;
  if ( a.mTexel1.x > b.mTexel1.x ) return false;

  if ( a.mTexel1.y < b.mTexel1.y ) return true;
  if ( a.mTexel1.y > b.mTexel1.y ) return false;

  if ( a.mTexel2.x < b.mTexel2.x ) return true;
  if ( a.mTexel2.x > b.mTexel2.x ) return false;

  if ( a.mTexel2.y < b.mTexel2.y ) return true;
  if ( a.mTexel2.y > b.mTexel2.y ) return false;


  return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0xbe8f(%rip), %rcx      # 0x196e4
movq %rcx, %rdi
cmpl $-0x1, %esi
je 0xd86e
movq 0xbeac(%rip), %rax      # 0x19710
movslq %esi, %rsi
imulq $0x28, %rsi, %rdi
addq (%rax), %rdi
cmpl $-0x1, %edx
je 0xd884
movq 0xbe96(%rip), %rax      # 0x19710
movslq %edx, %rcx
imulq $0x28, %rcx, %rcx
addq (%rax), %rcx
movss (%rdi), %xmm0
movss (%rcx), %xmm1
movb $0x1, %al
ucomiss %xmm0, %xmm1
ja 0xd8ab
ucomiss %xmm1, %xmm0
jbe 0xd89c
xorl %eax, %eax
jmp 0xd8ab
movss 0x4(%rdi), %xmm0
movss 0x4(%rcx), %xmm1
ucomiss %xmm0, %xmm1
jbe 0xd8ad
popq %rbp
retq
ucomiss %xmm1, %xmm0
ja 0xd898
movss 0x8(%rdi), %xmm0
movss 0x8(%rcx), %xmm1
ucomiss %xmm0, %xmm1
ja 0xd8ab
ucomiss %xmm1, %xmm0
ja 0xd898
movss 0xc(%rdi), %xmm0
movss 0xc(%rcx), %xmm1
ucomiss %xmm0, %xmm1
ja 0xd8ab
ucomiss %xmm1, %xmm0
ja 0xd898
movss 0x10(%rdi), %xmm0
movss 0x10(%rcx), %xmm1
ucomiss %xmm0, %xmm1
ja 0xd8ab
ucomiss %xmm1, %xmm0
ja 0xd898
movss 0x14(%rdi), %xmm0
movss 0x14(%rcx), %xmm1
ucomiss %xmm0, %xmm1
ja 0xd8ab
ucomiss %xmm1, %xmm0
ja 0xd898
movss 0x18(%rcx), %xmm0
ucomiss 0x18(%rdi), %xmm0
jbe 0xd898
jmp 0xd8ab
nop
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/vformat.cpp
// Function: VertexMesh::~VertexMesh()
VertexMesh::~VertexMesh(void)
{
  VertexSectionMap::iterator i;
  for (i=mSections.begin(); i!=mSections.end(); ++i)
  {
    VertexSection *section = (*i).second;
    delete section;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x28(%rdi), %r14
leaq 0x18(%rdi), %r12
cmpq %r12, %r14
je 0xd956
movq 0x28(%r14), %r15
testq %r15, %r15
je 0xd93c
movq %r15, %rdi
callq 0xf116
movl $0x88, %esi
movq %r15, %rdi
callq 0x2230
movq %r14, %rdi
callq 0x2190
movq %rax, %r14
jmp 0xd926
addq $0x10, %rbx
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xf366
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/vformat.cpp
// Function: VertexMesh::AddTri(StringRef const&, LightMapVertex const&, LightMapVertex const&, LightMapVertex const&)
void VertexMesh::AddTri(const StringRef &name,const LightMapVertex &v1,const LightMapVertex &v2,const LightMapVertex &v3)
{
  VertexSection *section;

  if ( name == mLastName )
  {
    section = mLastSection;
  }
  else
  {
    VertexSectionMap::iterator found;
    found = mSections.find( name );
    if ( found != mSections.end() )
    {
      section = mLastSection = (*found).second;
      mLastName = name;
    }
    else
    {
      mLastSection = section = new VertexSection( name );
      mSections[name] = section;
      mLastName = name;
    }
  }

  assert( section );

  section->AddTri( v1, v2, v3 );

  mBound.MinMax( v1.mPos );
  mBound.MinMax( v2.mPos );
  mBound.MinMax( v3.mPos );

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, -0x38(%rbp)
movq %rcx, %r15
movq %rdx, %r12
movq %rdi, %r14
movq 0x8(%rdi), %rax
cmpq (%rsi), %rax
je 0xd9b9
movq %rsi, %rbx
leaq 0x10(%r14), %r13
movq %r13, %rdi
callq 0xf8d2
leaq 0x18(%r14), %rcx
cmpq %rcx, %rax
je 0xd9e0
movq 0x28(%rax), %r13
movq %r13, (%r14)
movq (%rbx), %rax
movq %rax, 0x8(%r14)
jmp 0xd9bc
movq (%r14), %r13
testq %r13, %r13
jne 0xda15
leaq 0x3e17(%rip), %rdi      # 0x117df
leaq 0x3e18(%rip), %rsi      # 0x117e7
leaq 0x3e1d(%rip), %rcx      # 0x117f3
movl $0xb8, %edx
callq 0x2180
movq %r13, -0x30(%rbp)
movl $0x88, %edi
callq 0x2220
movq %rax, %r13
movq %rax, %rdi
movq %rbx, %rsi
callq 0xf13a
movq %r13, (%r14)
movq -0x30(%rbp), %rdi
movq %rbx, %rsi
callq 0xf19e
movq %r13, (%rax)
movq (%rbx), %rax
movq %rax, 0x8(%r14)
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq -0x38(%rbp), %rbx
movq %rbx, %rcx
callq 0xda76
addq $0x40, %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x97ae
movq %r14, %rdi
movq %r15, %rsi
callq 0x97ae
movq %r14, %rdi
movq %rbx, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x97ae
movq %rax, %rbx
movl $0x88, %esi
movq %r13, %rdi
callq 0x2230
movq %rbx, %rdi
callq 0x23e0
nop
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/vformat.cpp
// Function: VertexSection::AddTri(LightMapVertex const&, LightMapVertex const&, LightMapVertex const&)
void VertexSection::AddTri(const LightMapVertex &v1,
            const LightMapVertex &v2,
            const LightMapVertex &v3)
{
  mBound.MinMax(v1.mPos);
  mBound.MinMax(v2.mPos);
  mBound.MinMax(v3.mPos);

  AddPoint(v1);
  AddPoint(v2);
  AddPoint(v3);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
leaq 0x8(%rdi), %r13
movq %r13, %rdi
callq 0x97ae
movq %r13, %rdi
movq %r14, %rsi
callq 0x97ae
movq %r13, %rdi
movq %rbx, %rsi
callq 0x97ae
movq %r12, %rdi
movq %r15, %rsi
callq 0xdae2
movq %r12, %rdi
movq %r14, %rsi
callq 0xdae2
movq %r12, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xdae2
nop
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/vformat.cpp
// Function: VertexMesh::SaveVRML2(_IO_FILE*, VFormatOptions&) const
void VertexMesh::SaveVRML2(
			FILE *fph,
            VFormatOptions &options) const 
{
	if ( mSections.size() )
	{
		
		if ( fph )
		{
			//fprintf(fph,"#VRML V2.0 utf8 generated by QBSP \n");
			if (mSections.size() >0) {
				fprintf(fph,"Group {\n");
				fprintf(fph,"children [\n");
			}	
			VertexSectionMap::const_iterator i;
			
			for (i=mSections.begin(); i!=mSections.end(); ++i)
			{
				(*i).second->SaveVRML2(fph,options);
			}
			if (mSections.size() >0) {
				
				fprintf(fph,"\n]\n}\n");
			}
			
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0xdbbb
movq %rdi, %r15
cmpq $0x0, 0x38(%rdi)
je 0xdbbb
movq %rdx, %r14
movq %rsi, %rbx
leaq 0x3630(%rip), %rdi      # 0x11170
pushq $0x8
popq %rsi
pushq $0x1
popq %r12
movq %r12, %rdx
movq %rbx, %rcx
callq 0x2440
leaq 0x3620(%rip), %rdi      # 0x11179
pushq $0xb
popq %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x2440
movq 0x28(%r15), %r12
leaq 0x18(%r15), %r13
cmpq %r13, %r12
je 0xdb91
movq 0x28(%r12), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0xdbca
movq %r12, %rdi
callq 0x2290
movq %rax, %r12
jmp 0xdb6f
cmpq $0x0, 0x38(%r15)
je 0xdbbb
leaq 0x3cc7(%rip), %rdi      # 0x11866
pushq $0x5
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2440
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/vformat.cpp
// Function: VertexMesh::SaveVRML(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool) const
void VertexMesh::SaveVRML(const String &name,  // base file name
              bool tex1) const           // texture channel 1=(true)
{
  if ( mSections.size() )
  {
    String oname = name+".wrl";
    FILE *fph = fopen(oname.c_str(),"wb");

    if ( fph )
    {
      fprintf(fph,"#VRML V1.0 ascii\n");
      fprintf(fph,"Separator {\n");
      fprintf(fph,"  ShapeHints {\n");
      fprintf(fph,"    shapeType SOLID\n");
      fprintf(fph,"    vertexOrdering COUNTERCLOCKWISE\n");
      fprintf(fph,"    faceType CONVEX\n");
      fprintf(fph,"  }\n");

      VertexSectionMap::const_iterator i;

      for (i=mSections.begin(); i!=mSections.end(); ++i)
      {
        (*i).second->SaveVRML(fph,tex1);
      }

      fprintf(fph,"}\n");

      fclose(fph);
    }
  }
}

// Assembly:
cmpq $0x0, 0x38(%rdi)
je 0xe70b
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %r15d
movq %rdi, %rbx
leaq 0x1f59(%rip), %rdx      # 0x10540
leaq -0x48(%rbp), %r14
movq %r14, %rdi
callq 0x5b47
movq (%r14), %rdi
leaq 0x1cc7(%rip), %rsi      # 0x102c4
callq 0x22a0
testq %rax, %rax
je 0xe6f4
movq %rax, %r14
leaq 0x3257(%rip), %rdi      # 0x1186c
pushq $0x11
popq %rsi
pushq $0x1
popq %r12
movq %r12, %rdx
movq %rax, %rcx
callq 0x2440
leaq 0x32ba(%rip), %rdi      # 0x118e8
pushq $0xc
popq %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x2440
leaq 0x323b(%rip), %rdi      # 0x1187e
pushq $0xf
popq %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x2440
leaq 0x3236(%rip), %rdi      # 0x1188e
pushq $0x14
popq %r13
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x2440
leaq 0x3232(%rip), %rdi      # 0x118a3
pushq $0x24
popq %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x2440
leaq 0x3242(%rip), %rdi      # 0x118c8
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x2440
leaq 0x33d7(%rip), %rdi      # 0x11a72
pushq $0x4
popq %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x2440
movq 0x28(%rbx), %r12
addq $0x18, %rbx
movzbl %r15b, %r15d
cmpq %rbx, %r12
je 0xe6d7
movq 0x28(%r12), %rdi
movq %r14, %rsi
movl %r15d, %edx
callq 0xe70c
movq %r12, %rdi
callq 0x2290
movq %rax, %r12
jmp 0xe6b5
leaq 0x3722(%rip), %rdi      # 0x11e00
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rcx
callq 0x2440
movq %r14, %rdi
callq 0x2210
leaq -0x48(%rbp), %rdi
callq 0x2120
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/vlenhart[P]q3bsp/./vformat.h
// Function: VertexPool::GetVertex(LightMapVertex const&)
int GetVertex(const LightMapVertex& vtx)
  {
    VertexLess::SetSearch(vtx,&mVtxs);
    VertexSet::iterator found;
    found = mVertSet.find( -1 );
    if ( found != mVertSet.end() )
    {
      return *found;
    }
    int idx = mVtxs.size();
    assert( idx >= 0 && idx < 65536 );
    mVtxs.push_back( vtx );
    mVertSet.insert( idx );
    return idx;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x30(%rdi), %r15
movq %rsi, %rdi
movq %r15, %rsi
callq 0xf3c2
leaq -0x20(%rbp), %rsi
orl $-0x1, (%rsi)
movq %rbx, %rdi
callq 0xf424
leaq 0x8(%rbx), %rcx
cmpq %rcx, %rax
je 0xf22c
movl 0x20(%rax), %eax
jmp 0xf263
movq 0x38(%rbx), %rax
subq 0x30(%rbx), %rax
pushq $0x28
popq %rcx
cqto
idivq %rcx
movl %eax, -0x1c(%rbp)
cmpl $0x10000, %eax          # imm = 0x10000
jae 0xf26e
movq %r15, %rdi
movq %r14, %rsi
callq 0xf3e8
leaq -0x1c(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xf710
movl (%r14), %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2bcf(%rip), %rdi      # 0x11e44
leaq 0x2be0(%rip), %rsi      # 0x11e5c
leaq 0x2be5(%rip), %rcx      # 0x11e68
movl $0xf7, %edx
callq 0x2180
nop
// File: /workspace/github_c_makefile_star2_O2/rchiossi[P]dexterity/lib/bytestream.c
// Function: bsalloc
ByteStream* bsalloc(unsigned int size) {
  ByteStream* bs = (ByteStream*) malloc_s(sizeof(ByteStream));

  if (bs == NULL) {
    printf("ERROR: Cannot allocate bytestream structure.\n");
    exit(-1);
  }

  bs->filename = NULL;
  bs->size = size;

  bs->exhausted = 0;
  bs->offset = 0;
  
  bs->data = (uint8_t*) mmap(NULL, size, PROT_READ | PROT_WRITE, 
			     MAP_PRIVATE | MAP_ANONYMOUS, -1, 0x0);

  if (bs->data == MAP_FAILED) {
    free(bs);
    printf("ERROR: Unable to map memory.\n");
    exit(-1);
  }

  return bs;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edi, %ebp
pushq $0x20
popq %rdi
callq 0x46a0
testq %rax, %rax
je 0x4a28
movq %rax, %rbx
andq $0x0, (%rax)
movl %ebp, %esi
movq %rsi, 0x8(%rax)
andq $0x0, 0x18(%rax)
pushq $0x3
popq %rdx
pushq $0x22
popq %rcx
pushq $-0x1
popq %r8
xorl %edi, %edi
xorl %r9d, %r9d
callq 0x4210
movq %rax, 0x10(%rbx)
cmpq $-0x1, %rax
je 0x4a31
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x5665(%rip), %rdi      # 0xa094
jmp 0x4a40
movq %rbx, %rdi
callq 0x4060
leaq 0x561c(%rip), %rdi      # 0xa05c
callq 0x40e0
pushq $-0x1
popq %rdi
callq 0x47c0
// File: /workspace/github_c_makefile_star2_O2/rchiossi[P]dexterity/lib/bytestream.c
// Function: bsmap
ByteStream* bsmap(char* filename) {
  int fd;
  struct stat fdstat;
  ByteStream* bs;

  fd = open(filename,O_RDONLY);

  if (fd == -1) {
    printf("ERROR: File %s doesn't exists or cannot be read.\n",filename);
    exit(-1);
  }

  if (fstat(fd, &fdstat) == -1) {
    close(fd);
    printf("ERROR: Unable to get file size for %s.\n",filename);
    exit(-1);
  }

  bs = (ByteStream*) malloc_s(sizeof(ByteStream));

  if (bs == NULL) {
    close(fd);
    printf("ERROR: Cannot allocate bytestream structure.\n");
    exit(-1);
  }

  bs->filename = filename;
  bs->size = fdstat.st_size;

  bs->exhausted = 0;
  bs->offset = 0;
  
  bs->data = (uint8_t*) mmap(NULL, bs->size, PROT_READ | PROT_WRITE,
			     MAP_PRIVATE,fd,0x0);

  if (bs->data == MAP_FAILED) {
    free(bs);
    close(fd);
    printf("ERROR: Unable to map file.\n");
    exit(-1);
  }

  close(fd); 

  return bs;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x90, %rsp
movq %rdi, %r14
xorl %esi, %esi
xorl %eax, %eax
callq 0x4710
cmpl $-0x1, %eax
je 0x4ad0
movl %eax, %ebx
movq %rsp, %rsi
movl %eax, %edi
callq 0x4880
cmpl $-0x1, %eax
je 0x4ad9
pushq $0x20
popq %rdi
callq 0x46a0
testq %rax, %rax
je 0x4af3
movq %rax, %r15
movq %r14, (%rax)
movq 0x30(%rsp), %rsi
movq %rsi, 0x8(%rax)
andq $0x0, 0x18(%rax)
pushq $0x3
popq %rdx
pushq $0x2
popq %rcx
xorl %edi, %edi
movl %ebx, %r8d
xorl %r9d, %r9d
callq 0x4210
movq %rax, 0x10(%r15)
cmpq $-0x1, %rax
je 0x4b03
movl %ebx, %edi
callq 0x4310
movq %r15, %rax
addq $0x90, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x5529(%rip), %rdi      # 0xa000
jmp 0x4ae7
movl %ebx, %edi
callq 0x4310
leaq 0x554b(%rip), %rdi      # 0xa032
movq %r14, %rsi
xorl %eax, %eax
callq 0x4250
jmp 0x4b1e
movl %ebx, %edi
callq 0x4310
leaq 0x5593(%rip), %rdi      # 0xa094
jmp 0x4b19
movq %r15, %rdi
callq 0x4060
movl %ebx, %edi
callq 0x4310
leaq 0x5560(%rip), %rdi      # 0xa079
callq 0x40e0
pushq $-0x1
popq %rdi
callq 0x47c0
// File: /workspace/github_c_makefile_star2_O2/rchiossi[P]dexterity/lib/bytestream.c
// Function: bsfree
int bsfree(ByteStream* bs) {
  int ret = 0;

  if (bs->data != NULL) {
    ret = munmap(bs->data,bs->size);
  }

  free(bs);

  return ret;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x4b42
movq 0x8(%rbx), %rsi
callq 0x4660
movl %eax, %ebp
jmp 0x4b44
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x4060
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/rchiossi[P]dexterity/lib/bytestream.c
// Function: bsread
unsigned int bsread(ByteStream* bs, uint8_t* data, size_t size) {
  unsigned int* in;
  unsigned int* out;
  
  unsigned int asize;

  unsigned int isize;
  unsigned int ioffset;

  unsigned int i;

  if (bs->exhausted) return 0;

  if (bs->offset >= bs->size) return 0;

  if (bs->offset+size > bs->size) {
    size = bs->size - bs->offset;
    bs->exhausted = 1;
  }

  //align read
  asize = sizeof(unsigned int) - (bs->offset % sizeof(unsigned int)); 

  for (i=0; i<asize && i<size; i++) {
    data[i] = bs->data[bs->offset+i];
  }

  bs->offset += i;
  data += i;
  size -= i;
  asize = i;

  //optimized read
  isize = size / sizeof(unsigned int);
  ioffset = bs->offset / sizeof(unsigned int);

  in = (uint32_t*) bs->data;
  out = (uint32_t*) data;

  for (i=0; i<isize; i++) {
    out[i] = in[ioffset+i];
  }

  bs->offset += i * sizeof(unsigned int);
  data += i * sizeof(unsigned int);
  
  //trailing bytes read
  size -= isize * sizeof(unsigned int);

  for (i=0; i<size; i++) {
    data[i] = bs->data[bs->offset+i];
  }

  bs->offset += i;

  return isize * sizeof(unsigned int) + size + asize;
}

// Assembly:
xorl %eax, %eax
cmpl $0x0, 0x1c(%rdi)
je 0x4b6c
retq
movl 0x18(%rdi), %r8d
movq 0x8(%rdi), %r9
movq %r9, %rcx
subq %r8, %rcx
jbe 0x4b6b
leaq (%r8,%rdx), %rax
cmpq %r9, %rax
jbe 0x4b8f
movl $0x1, 0x1c(%rdi)
movq %rcx, %rdx
pushq %rbx
andl $0x3, %r8d
movl $0x4, %ecx
subl %r8d, %ecx
cmpq %rcx, %rdx
cmovbq %rdx, %rcx
xorl %eax, %eax
movl 0x18(%rdi), %r8d
cmpq %rax, %rcx
je 0x4bc2
movq 0x10(%rdi), %r9
addl %eax, %r8d
movb (%r9,%r8), %r8b
movb %r8b, (%rsi,%rax)
incq %rax
jmp 0x4ba5
addl %ecx, %r8d
movl %r8d, 0x18(%rdi)
addq %rcx, %rsi
movq %rdx, %rax
subq %rcx, %rax
movq %rax, %rcx
shrq $0x2, %rcx
movq 0x10(%rdi), %r9
movl %ecx, %r10d
shrl $0x2, %r8d
xorl %r11d, %r11d
xorl %ecx, %ecx
cmpq %r10, %rcx
jae 0x4c02
leal (%r8,%rcx), %ebx
movl (%r9,%rbx,4), %ebx
movl %ebx, (%rsi,%rcx,4)
incq %rcx
addl $0x4, %r11d
jmp 0x4be9
addl %r11d, 0x18(%rdi)
movabsq $-0x3fffffffd, %r8      # imm = 0xFFFFFFFC00000003
andq %r8, %rax
xorl %r8d, %r8d
movl %r8d, %r8d
cmpq %r8, %rax
jbe 0x4c3c
movq 0x10(%rdi), %r9
movl 0x18(%rdi), %r10d
addl %r8d, %r10d
movb (%r9,%r10), %r9b
movq %r8, %r10
addq %rsi, %r10
movb %r9b, (%r10,%rcx,4)
incl %r8d
jmp 0x4c16
addl %r8d, 0x18(%rdi)
movl %edx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/rchiossi[P]dexterity/lib/bytestream.c
// Function: bswrite
int bswrite(ByteStream* bs, uint8_t* data, unsigned int size) {
  unsigned int* in;
  unsigned int* out;
  
  unsigned int asize;

  unsigned int isize;
  unsigned int ioffset;

  unsigned int i;

  if (bs->exhausted) return 0;

  if (bs->offset >= bs->size) return 0;

  if (bs->offset+size > bs->size) {
    size = bs->size - bs->offset;
    bs->exhausted = 1;
  }

  //align write
  asize = sizeof(unsigned int) - (bs->offset % sizeof(unsigned int)); 

  for (i=0; i<asize && i<size; i++) {
    bs->data[bs->offset+i] = data[i];
  }

  bs->offset += i;
  data += i;
  size -= i;
  asize = i;

  //optimized write
  isize = size / sizeof(unsigned int);
  ioffset = bs->offset / sizeof(unsigned int);

  in = (uint32_t*) data;
  out = (uint32_t*) bs->data;

  for (i=0; i<isize; i++) {
    out[ioffset+i] = in[i];
  }

  bs->offset += i * sizeof(unsigned int);
  data += i * sizeof(unsigned int);

  //write finishing bytes
  size -= i * sizeof(unsigned int);

  for (i=0; i<size; i++) {
    bs->data[bs->offset+i] = data[i];
  }

  bs->offset += i;

  return isize * sizeof(unsigned int) + size + asize;
}

// Assembly:
xorl %eax, %eax
cmpl $0x0, 0x1c(%rdi)
je 0x4c6b
retq
movl 0x18(%rdi), %r8d
movq 0x8(%rdi), %rcx
cmpq %r8, %rcx
jbe 0x4c6a
leal (%r8,%rdx), %eax
cmpq %rax, %rcx
jae 0x4c8d
subl %r8d, %ecx
movl $0x1, 0x1c(%rdi)
movl %ecx, %edx
andl $0x3, %r8d
pushq $0x4
popq %rcx
subl %r8d, %ecx
cmpl %edx, %ecx
cmovael %edx, %ecx
xorl %eax, %eax
cmpq %rax, %rcx
je 0x4cbb
movb (%rsi,%rax), %r8b
movq 0x10(%rdi), %r9
movl 0x18(%rdi), %r10d
addl %eax, %r10d
movb %r8b, (%r9,%r10)
incq %rax
jmp 0x4c9e
subl %ecx, %edx
movl 0x18(%rdi), %eax
addl %ecx, %eax
movl %eax, 0x18(%rdi)
addq %rcx, %rsi
movl %edx, %r8d
shrl $0x2, %r8d
andl $-0x4, %eax
addq 0x10(%rdi), %rax
xorl %r9d, %r9d
cmpq %r9, %r8
je 0x4ceb
movl (%rsi,%r9,4), %r10d
movl %r10d, (%rax,%r9,4)
incq %r9
jmp 0x4cd9
shll $0x2, %r8d
addl %r8d, 0x18(%rdi)
addq %r8, %rsi
movl %edx, %eax
subl %r8d, %eax
xorl %r8d, %r8d
cmpq %rax, %r8
jae 0x4d1b
movb (%rsi,%r8), %r9b
movq 0x10(%rdi), %r10
movl 0x18(%rdi), %r11d
addl %r8d, %r11d
movb %r9b, (%r10,%r11)
incq %r8
jmp 0x4cfe
addl %r8d, 0x18(%rdi)
andl $-0x4, %edx
addl %ecx, %eax
addl %edx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/rchiossi[P]dexterity/lib/bytestream.c
// Function: bssave
int bssave(ByteStream* bs, char* filename) {
  FILE* f = fopen(filename,"w");

  if (bs == NULL || f == NULL) return -1;

  fwrite(bs->data, 1, bs->size, f);

  fflush(f);
  fclose(f);    
  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rax
movq %rdi, %r14
leaq 0x5304(%rip), %rsi      # 0xa05a
movq %rax, %rdi
callq 0x4740
movq %rax, %rbx
testq %r14, %r14
sete %al
testq %rbx, %rbx
sete %cl
orb %al, %cl
je 0x4d76
pushq $-0x1
popq %rax
jmp 0x4d9b
movq 0x8(%r14), %rdx
movq 0x10(%r14), %rdi
pushq $0x1
popq %rsi
movq %rbx, %rcx
callq 0x47d0
movq %rbx, %rdi
callq 0x4540
movq %rbx, %rdi
callq 0x4170
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O2/rchiossi[P]dexterity/lib/dex_builder.c
// Function: dxb_stringdata
void dxb_stringdata(ByteStream* bs, DexStringDataItem* obj) {
  uint8_t* tape;
  char end[] = "\x00";

  if (bs == NULL || obj == NULL) return;

  bsseek(bs,obj->meta.offset);

  l128write(bs,&(obj->size));

  tape = (uint8_t*) obj->data;

  if (ul128toui(obj->size) != 0x0) {
    while(*tape) {
      bswrite(bs,tape,sizeof(uint8_t));

      if ((*tape & 0xe0) == 0xc0 ) {
	tape += 1;
	bswrite(bs,tape,sizeof(uint8_t));
      }

      else if ((*tape & 0xf0) == 0xe0) {
	tape += 1;
	bswrite(bs,tape,sizeof(uint8_t)*2);
	tape += 1;
      }

      tape++;
    }
  }

  bswrite(bs,(uint8_t*)end,sizeof(uint8_t));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
andw $0x0, 0x6(%rsp)
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x5013
movq %rsi, %r15
movq %rdi, %rbx
movl 0x4(%rsi), %esi
callq 0x4480
leaq 0x8(%r15), %rsi
movq %rbx, %rdi
callq 0x44f0
movq 0x18(%r15), %r14
movq 0x8(%r15), %rdi
movl 0x10(%r15), %esi
callq 0x4180
testl %eax, %eax
je 0x5003
pushq $0x1
popq %rbp
pushq $0x2
popq %r15
cmpb $0x0, (%r14)
je 0x5003
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x4600
movzbl (%r14), %eax
movl %eax, %ecx
andl $-0x20, %ecx
cmpl $0xc0, %ecx
jne 0x4fe1
incq %r14
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x4600
jmp 0x4ffe
andl $-0x10, %eax
cmpl $0xe0, %eax
jne 0x4ffe
leaq 0x1(%r14), %rsi
movq %rbx, %rdi
movl %r15d, %edx
callq 0x4600
addq $0x2, %r14
incq %r14
jmp 0x4fab
leaq 0x6(%rsp), %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x4600
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/rchiossi[P]dexterity/lib/dex_builder.c
// Function: dxb_encodedfield
void dxb_encodedfield(ByteStream* bs, DexEncodedFieldItem* obj) {
  if (bs == NULL || obj == NULL) return;

  bsseek(bs,obj->meta.offset);

  l128write(bs,&(obj->field_idx_diff));
  l128write(bs,&(obj->access_flags));
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
je 0x502f
retq
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl 0x4(%rsi), %esi
callq 0x4480
leaq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x44f0
addq $0x14, %rbx
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x44f0
// File: /workspace/github_c_makefile_star2_O2/rchiossi[P]dexterity/lib/dex_builder.c
// Function: dxb_encodedmethod
void dxb_encodedmethod(ByteStream* bs, DexEncodedMethodItem* obj) {
  if (bs == NULL || obj == NULL) return;

  bsseek(bs,obj->meta.offset);
  l128write(bs,&(obj->method_idx_diff));
  l128write(bs,&(obj->access_flags));
  l128write(bs,&(obj->code_off));
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
je 0x5074
retq
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl 0x4(%rsi), %esi
callq 0x4480
leaq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x44f0
leaq 0x14(%rbx), %rsi
movq %r14, %rdi
callq 0x44f0
addq $0x20, %rbx
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x44f0