// File: /workspace/github_c_makefile_star2_O3/vlenhart[P]q3bsp/vformat.cpp
// Function: VertexSection::SaveVRML2(_IO_FILE*, VFormatOptions&)
void VertexSection::SaveVRML2(FILE *fph,VFormatOptions &options)
{

  static int itemcount=1;

  bool hasLightMap = true;
  int numStages=2;
  int lightMapStage = 0; // place lightmap coord into this texture stage 
  bool vertexColor = true;

  //lightMapStage=1;

  // name of lightmap texture 
  StringRef lightMap;


  // parse mName into base texture + light map

  const char *foo = mName;
  char scratch[256];

  char *dest = scratch;
  while ( *foo && *foo != '+' ) *dest++ = *foo++;
  if (*foo == '+' && foo[1]) {
	  lightMap = foo+1;
	  hasLightMap = true;
  }	
  else  { 
	  hasLightMap = false;
	  numStages = 1;
	  lightMapStage = -1;
  }	
  *dest = 0;

  StringRef name(scratch);

  if (mShader) {
	  numStages =mShader->GetNumStages();
	  if (mShader->mNoLightMap) {
		  hasLightMap = false;
		  lightMapStage = -1;
	  }	else {
		  lightMapStage=mShader->mLightMapStage;
	  }	
	 //if (rgbGen == Identity)
	 //	 vertexColor = false;
  }	else {

  }	

  //fprintf(fph,"DEF item%d Shape {\n",itemcount++);
  fprintf(fph,"Shape {\n");
  fprintf(fph,"appearance ");


  // appearance node already defined ?
  AppearanceDefMap::iterator found;
  found = options.appearanceDefMap.find(mName);
  if ( found != options.appearanceDefMap.end()) { // simply use it 
	  //found.r
	  fprintf(fph,"USE %s\n",(const char *)(*found).second);
  } 
  else 
  {  // need to define new Appearance node 
	  if (options.verbose) {
		fprintf(fph," #%s\n",(const char *) mName);
		if (mShader) {
			  fprintf(fph," #shader %s\n",(const char *) mShader->GetName());
		}		
	  }	
	  
	  fprintf(fph,"DEF A%d Appearance {\n",options.appearanceCount);
	  char buf[60];
	  sprintf(buf,"_A%d",options.appearanceCount);

	  // insert new node into map 
	  options.textureDefMap.insert(AppearanceDefMap::value_type(StringRef(mName),StringRef(buf)));
	  
	  options.appearanceCount++;
		  
		  if (options.useLighting) {
			  fprintf(fph,"material Material {\n");
			  fprintf(fph,"  ambientIntensity 0.06536 \n");
			  fprintf(fph,"  diffuseColor 0.5373 0.1961 0.1961\n");
			  fprintf(fph,"  specularColor 0.9 0.9 0.9\n");
			  fprintf(fph,"  shininess 0.25\n");
			  //fprintf(fph,"  transparency 0\n");
			  fprintf(fph,"}\n");
		  }
		  else {  
		  if (options.useMat) {
			  if (!options.matDefined) {
				fprintf(fph,"material DEF MAT Material {\n");
				//fprintf(fph,"  diffuseColor 0 0 0\n");
				fprintf(fph,"  diffuseColor 1 1 1\n");
				//fprintf(fph,"  emissiveColor 0.5 0.5 0.5\n"); // overall brightness 
				fprintf(fph,"  emissiveColor 0.2 0.2 0.2\n"); // overall brightness 
				fprintf(fph,"}\n");
				options.matDefined = true;
			  } else 	
				fprintf(fph,"material USE MAT \n");

		  }
		  }
		  
		  
		  fprintf(fph,"texture ");
		  
		  bool tex1 = options.tex1;
		
		  
		  if (options.useMultiTexturing) {
			  fprintf(fph,"MultiTexture {\nmaterialColor TRUE texture [\n");
			  tex1 = true;
		
		  if (mShader) {
		    hasLightMap = false;
			numStages =mShader->GetNumStages();
			for (int i=0; i<numStages; i++) {
				
				//if (i>0 && numStages >2) // we can do only 2 stages 
				//	i=numStages-1;

				const ShaderStage& stage = mShader->GetStage(i);

				if (stage.isAnimMap) {
					if (options.useEffects) {
						fprintf(fph,"DEF MAP AnimMap {\nfrequency %f textures [\n",stage.animMapFrequency);
						for (unsigned int i=0; i<stage.animMap.size(); i++)
							WriteImageTexture(fph,stage.animMap[i],options,false,stage.clamp);

						//fprintf(fph,"] ROUTE TIMER.fraction_changed TO MAP.set_fraction \n");
					    fprintf(fph,"]ROUTE TIMER.time_changed TO MAP.set_time\n");

						fprintf(fph,"}");
					}else
						WriteImageTexture(fph,stage.animMap[0],options,false,stage.clamp);


				} else 
				if (stage.isLightMap) {
					WriteImageTexture(fph,lightMap,options,true,stage.clamp);
					hasLightMap = true;
					mShader->mLightMapStage=lightMapStage=i;
				} else 
					WriteImageTexture(fph,stage.map,options,false,stage.clamp);
			}
		  }	
		  else 
		  { // no shader
			//WriteImageTexture(fph,name,options,false);
			if (options.useMultiTexturing) {
				if (hasLightMap) {
					WriteImageTexture(fph,lightMap,options,true,false);
				}
			}
			WriteImageTexture(fph,name,options,false);

		  }	
		  } 
		  else {
			  // not useMultiTexturing
			  if (tex1) {
					if (mShader) 
					    mShader ->GetBaseTexture(name);

					WriteImageTexture(fph,name,options,false);

			  } else {	
				if (hasLightMap) {
					WriteImageTexture(fph,lightMap,options,true,false);
				}
				else WriteImageTexture(fph,"nomap",options,true,false);
			  }	

		  }	
		  if (options.useMultiTexturing) {
			  fprintf(fph,"]");
			  // add makes it to bright
			  // with modulate currently to dark
			  //if (numStages>1) 
			  if (mShader) {
				fprintf(fph,"mode [ ");
				bool hasTcMod = false;

				for (int i=0; i<numStages; i++) {
				
					//if (i>0 && numStages >2) // we can do only 2 stages 
					//	i=numStages-1;
					const ShaderStage& stage = mShader->GetStage(i);
					const char *mode = stage.textureBlendMode;
					
					if (stage.tcmod.length()>0) hasTcMod = true;
					if (stage.tcmodOk.length()>0) hasTcMod = true;

					if (i==0 && stage.textureBlendMode == String("ADD") && !stage.isLightMap)
						mode = "MODULATE";

					if (!mode) {
						if (i==0 && !options.useMat) 
							mode = "REPLACE";
					}	

					fprintf(fph,"\"%s\" ", mode ? mode : "ADD");
					fprintf(fph,"# blend %s %s \n",(const char *) stage.blendFuncSrc,(const char *) stage.blendFuncDst);

				}
				fprintf(fph,"]\n");

				// tcmod 
				if (hasTcMod) {
				fprintf(fph,"textureTransform [ ");

				for (int i=0; i<numStages; i++) {
				
					//if (i>0 && numStages >2) // we can do only 2 stages 
					//	i=numStages-1;
					const ShaderStage& stage = mShader->GetStage(i);
					const char *mode = stage.tcmod.c_str();
					const char *modeOk = stage.tcmodOk.c_str();

					if (stage.tcmod.length()>0 || stage.tcmodOk.length()>0 ) {
					   fprintf(fph,"DEF TC%d TcMod {\n",i);

					   if (stage.tcmodOk.length()>0)
						   fprintf(fph,"\t%s\n", modeOk);

					   if (stage.tcmod.length()>0) 
						   fprintf(fph,"\tmode \"%s\" \n",mode ? mode : "" );

					   //fprintf(fph,"ROUTE TIMER.fraction_changed TO TC%d.set_fraction \n",i);
					   fprintf(fph,"ROUTE TIMER.time_changed TO TC%d.set_time\n",i);
					   fprintf(fph,"}\n");
					}
					else  fprintf(fph,"NULL\n");

				}
				fprintf(fph,"]\n");
				}

			  } 
			  else {
				  if (hasLightMap)
					  fprintf(fph, "%s", options.blendMode);
				  else ; // MODULATE 
			  }					
			  fprintf(fph,"}");
		  }	// multi texture 
		  
		  fprintf(fph,"}\n");
  }	

  int tcount = mIndices.size()/3;

  // write the indexed face set 
  if ( 1 )
  {
    fprintf(fph,"geometry  IndexedFaceSet {\n");

    fprintf(fph,"\tccw FALSE creaseAngle 3.14\n");

	if (mShader && (mShader->mCull == StringRef("none") ||  mShader->mCull == StringRef("disable")))  {
	    fprintf(fph,"\tsolid FALSE\n");
	}
	if (mShader && (mShader->mCull == StringRef("back")))  {
	    fprintf(fph,"\tccw TRUE\n");
	}
    fprintf(fph,"\tcoordIndex [\n");

    UShortVector::iterator j= mIndices.begin();
    for (int i=0; i<tcount; i++)
    {
      int i1 = *j;
      j++;
      int i2 = *j;
      j++;
      int i3 = *j;
      j++;
      if ( i == (tcount-1) )
        fprintf(fph,"\t%d,%d,%d,-1]\n",i1,i2,i3);
      else
        fprintf(fph,"\t%d,%d,%d,-1,\n",i1,i2,i3);

    }
  }

  if ( 0 ) // if texCoord index == ccordIndex no need to export
  {
    fprintf(fph,"  textureCoordIndex [\n");
    UShortVector::iterator j= mIndices.begin();
    for (int i=0; i<tcount; i++)
    {
      int i1 = *j;
      j++;
      int i2 = *j;
      j++;
      int i3 = *j;
      j++;
      if ( i == (tcount-1) )
        fprintf(fph,"\t%d,%d,%d,-1]\n",i1,i2,i3);
      else
        fprintf(fph,"\t%d,%d,%d,-1,\n",i1,i2,i3);
    }
  }

  mPoints.SaveVRML2(fph,lightMapStage,options);

  fprintf(fph,"  }\n");
  fprintf(fph,"}\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdx, -0x50(%rbp)
movq %rsi, %r15
movq %rdi, %r13
leaq 0x3b73(%rip), %rax      # 0x12bb2
movq %rax, -0x58(%rbp)
movq (%rdi), %rax
xorl %ebx, %ebx
movzbl (%rax,%rbx), %ecx
testl %ecx, %ecx
je 0xf09d
cmpl $0x2b, %ecx
je 0xf061
movb %cl, -0x1d0(%rbp,%rbx)
incq %rbx
jmp 0xf048
cmpb $0x0, 0x1(%rax,%rbx)
je 0xf0af
movl $0x0, -0x30(%rbp)
movq %r15, %r14
leaq (%rax,%rbx), %r15
incq %r15
callq 0x69ac
movq %rax, %rdi
movq %r15, %rsi
movq %r14, %r15
callq 0x6a3e
movq %rax, -0x58(%rbp)
movb $0x1, %al
movl %eax, -0x2c(%rbp)
movl $0x2, %r14d
jmp 0xf0c3
movl %ecx, -0x2c(%rbp)
movl $0x1, %r14d
movl $0xffffffff, -0x30(%rbp) # imm = 0xFFFFFFFF
jmp 0xf0c3
movl $0x1, %r14d
movl $0xffffffff, -0x30(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x2c(%rbp)
movb $0x0, -0x1d0(%rbp,%rbx)
callq 0x69ac
leaq -0x1d0(%rbp), %rsi
movq %rax, %rdi
callq 0x6a3e
movq %rax, -0x68(%rbp)
movq 0x80(%r13), %rax
testq %rax, %rax
je 0xf11c
movq 0x58(%rax), %rcx
subq 0x50(%rax), %rcx
shrq $0x3, %rcx
imull $0xe9bd37a7, %ecx, %r14d # imm = 0xE9BD37A7
cmpb $0x0, 0x9(%rax)
movq -0x50(%rbp), %rbx
je 0xf122
movl $0xffffffff, -0x30(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x2c(%rbp)
jmp 0xf128
movq -0x50(%rbp), %rbx
jmp 0xf128
movl 0xc(%rax), %eax
movl %eax, -0x30(%rbp)
leaq 0x49ca(%rip), %rdi      # 0x13af9
movl $0x8, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
leaq 0x49ba(%rip), %rdi      # 0x13b02
movl $0xb, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
movq 0x40(%rbx), %rcx
testq %rcx, %rcx
movq %r13, -0x40(%rbp)
je 0xf199
leaq 0x38(%rbx), %rsi
movq (%r13), %rdx
movq %rsi, %rax
xorl %edi, %edi
cmpq 0x20(%rcx), %rdx
setb %dil
cmovaeq %rcx, %rax
movq 0x10(%rcx,%rdi,8), %rcx
testq %rcx, %rcx
jne 0xf172
cmpq %rsi, %rax
je 0xf199
cmpq %rdx, 0x20(%rax)
jae 0xf314
cmpb $0x1, 0x69(%rbx)
jne 0xf1d5
movq (%r13), %rdx
leaq 0x4964(%rip), %rsi      # 0x13b0e
movq %r15, %rdi
xorl %eax, %eax
callq 0x2300
movq 0x80(%r13), %rax
testq %rax, %rax
je 0xf1d5
movq 0x30(%rax), %rdx
leaq 0x4949(%rip), %rsi      # 0x13b14
movq %r15, %rdi
xorl %eax, %eax
callq 0x2300
movl 0x60(%rbx), %edx
leaq 0x4942(%rip), %rsi      # 0x13b21
movq %r15, %rdi
xorl %eax, %eax
callq 0x2300
movl 0x60(%rbx), %edx
leaq 0x4944(%rip), %rsi      # 0x13b37
movq %r15, %r12
leaq -0xd0(%rbp), %r15
movq %r15, %rdi
xorl %eax, %eax
callq 0x2080
movq (%r13), %rbx
callq 0x69ac
movq %rax, %rdi
movq %r15, %rsi
callq 0x6a3e
leaq -0x88(%rbp), %rsi
movq %rbx, (%rsi)
movq -0x50(%rbp), %rbx
movq %rax, 0x8(%rsi)
movq %rbx, %rdi
callq 0x111ba
incl 0x60(%rbx)
cmpb $0x1, 0x75(%rbx)
jne 0xf2e0
leaq 0x48f3(%rip), %rdi      # 0x13b3c
movl $0x14, %esi
movl $0x1, %edx
movq %r12, %rcx
callq 0x2410
leaq 0x48ef(%rip), %rdi      # 0x13b51
movl $0x1c, %esi
movl $0x1, %edx
movq %r12, %rcx
callq 0x2410
leaq 0x46b0(%rip), %rdi      # 0x1392b
movl $0x24, %esi
movl $0x1, %edx
movq %r12, %rcx
callq 0x2410
leaq 0x46bc(%rip), %rdi      # 0x13950
movl $0x1c, %esi
movl $0x1, %edx
movq %r12, %rcx
callq 0x2410
leaq 0x46c0(%rip), %rdi      # 0x1396d
movl $0x11, %esi
movl $0x1, %edx
movq %r12, %rcx
callq 0x2410
leaq 0x4b26(%rip), %rdi      # 0x13dec
movl $0x2, %esi
movl $0x1, %edx
movq %r12, %rcx
callq 0x2410
movq %r12, %r15
jmp 0xf399
cmpb $0x1, 0x76(%rbx)
movq %r12, %r15
jne 0xf399
cmpb $0x0, 0xb0(%rbx)
je 0xf32e
leaq 0x48c1(%rip), %rdi      # 0x13bbe
movl $0x12, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
jmp 0xf399
movq 0x28(%rax), %rdx
leaq 0x4779(%rip), %rsi      # 0x13a98
movq %r15, %rdi
xorl %eax, %eax
callq 0x2300
jmp 0xf94e
leaq 0x4839(%rip), %rdi      # 0x13b6e
movl $0x1c, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
leaq 0x483d(%rip), %rdi      # 0x13b8b
movl $0x15, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
leaq 0x483a(%rip), %rdi      # 0x13ba1
movl $0x1c, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
leaq 0x4a6c(%rip), %rdi      # 0x13dec
movl $0x2, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
movb $0x1, 0xb0(%rbx)
leaq 0x4831(%rip), %rdi      # 0x13bd1
movl $0x8, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
cmpb $0x1, 0x6a(%rbx)
jne 0xf56f
leaq 0x4817(%rip), %rdi      # 0x13bda
movl $0x2c, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
movq 0x80(%r13), %rax
testq %rax, %rax
je 0xf5a0
movq 0x58(%rax), %rcx
subq 0x50(%rax), %rcx
sarq $0x3, %rcx
movabsq $-0x2c8590b21642c859, %r14 # imm = 0xD37A6F4DE9BD37A7
imulq %rcx, %r14
testl %r14d, %r14d
jle 0xf8e0
movq %r15, -0x38(%rbp)
movq %r14, -0x60(%rbp)
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movq %r14, -0x48(%rbp)
xorl %r15d, %r15d
xorl %r14d, %r14d
movq 0x80(%r13), %rax
movq 0x50(%rax), %rax
imulq $0xb8, %r15, %rcx
leaq (%rax,%rcx), %r12
cmpb $0x1, 0xa9(%rax,%rcx)
jne 0xf4ef
cmpb $0x1, 0x77(%rbx)
jne 0xf52c
movl %r14d, -0x2c(%rbp)
xorps %xmm0, %xmm0
cvtss2sd 0x20(%r12), %xmm0
movq -0x38(%rbp), %r13
movq %r13, %rdi
leaq 0x479c(%rip), %rsi      # 0x13c07
movb $0x1, %al
callq 0x2300
movq 0x8(%r12), %rax
cmpq %rax, 0x10(%r12)
movq %rbx, %r14
je 0xf4bc
movl $0x1, %ebx
xorl %ecx, %ecx
leaq (%rax,%rcx,8), %rsi
movzbl 0xaa(%r12), %r8d
movq %r13, %rdi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x101d5
movl %ebx, %ecx
movq 0x8(%r12), %rax
movq 0x10(%r12), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
incl %ebx
cmpq %rcx, %rdx
ja 0xf488
movl $0x2a, %esi
movl $0x1, %edx
leaq 0x4765(%rip), %rdi      # 0x13c32
movq %r13, %rcx
callq 0x2410
movl $0x7d, %edi
movq %r13, %rsi
callq 0x22e0
movq %r14, %rbx
movq -0x40(%rbp), %r13
movl -0x2c(%rbp), %r14d
jmp 0xf551
cmpb $0x1, 0xa8(%r12)
movzbl 0xaa(%r12), %r8d
jne 0xf540
movq -0x38(%rbp), %rdi
leaq -0x58(%rbp), %rsi
movq %rbx, %rdx
movl $0x1, %ecx
callq 0x101d5
movq 0x80(%r13), %rax
movl %r15d, 0xc(%rax)
movb $0x1, %r14b
movl %r15d, -0x30(%rbp)
jmp 0xf551
movq 0x8(%r12), %rsi
movzbl 0xaa(%r12), %r8d
movq -0x38(%rbp), %rdi
jmp 0xf547
movq -0x38(%rbp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x101d5
incq %r15
cmpq -0x48(%rbp), %r15
jne 0xf421
movl %r14d, -0x2c(%rbp)
movq -0x38(%rbp), %r15
movq -0x60(%rbp), %r14
jmp 0xf602
cmpb $0x1, 0x6c(%rbx)
jne 0xf594
movq 0x80(%r13), %rax
testq %rax, %rax
je 0xf5c3
movq 0x38(%rax), %rcx
cmpq %rcx, 0x40(%rax)
je 0xf5c3
movq (%rcx), %rax
movq %rax, -0x68(%rbp)
jmp 0xf5c3
testb $0x1, -0x2c(%rbp)
je 0xf5d1
leaq -0x58(%rbp), %rsi
jmp 0xf5ef
cmpb $0x1, 0x6a(%rbx)
jne 0xf5c3
testb $0x1, -0x2c(%rbp)
je 0xf5c3
leaq -0x58(%rbp), %rsi
movq %r15, %rdi
movq %rbx, %rdx
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x101d5
leaq -0x68(%rbp), %rsi
movq %r15, %rdi
movq %rbx, %rdx
xorl %ecx, %ecx
jmp 0xf5fa
callq 0x69ac
leaq 0x4680(%rip), %rsi      # 0x13c5d
movq %rax, %rdi
callq 0x6a3e
leaq -0x88(%rbp), %rsi
movq %rax, (%rsi)
movq %r15, %rdi
movq %rbx, %rdx
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x101d5
cmpb $0x1, 0x6a(%rbx)
jne 0xf935
movl $0x5d, %edi
movq %r15, %rsi
callq 0x22e0
cmpq $0x0, 0x80(%r13)
je 0xf8c9
leaq 0x4635(%rip), %rdi      # 0x13c63
movl $0x7, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
testl %r14d, %r14d
jle 0xf8ec
movl %r14d, %eax
movq %rax, -0x60(%rbp)
imulq $0xb8, %rax, %rax
movq %rax, -0x48(%rbp)
movq %r15, -0x38(%rbp)
xorl %r15d, %r15d
xorl %r12d, %r12d
movq %r13, %r14
movq 0x80(%r13), %rax
movq 0x50(%rax), %r13
movq 0x70(%r13,%r12), %rax
movq 0xb0(%r13,%r12), %rbx
orq 0x50(%r13,%r12), %rax
setne %sil
testq %r12, %r12
jne 0xf720
movb %sil, -0x2c(%rbp)
leaq -0x78(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x88(%rbp), %rdi
leaq 0x400f(%rip), %rsi      # 0x136be
leaq 0x400b(%rip), %rdx      # 0x136c1
callq 0x6d58
callq 0x69ac
movq -0x88(%rbp), %rsi
movq %rax, %rdi
callq 0x6a3e
cmpq 0xb0(%r13,%r12), %rax
je 0xf6de
xorl %r14d, %r14d
jmp 0xf6ea
movb 0xa8(%r13,%r12), %r14b
xorb $0x1, %r14b
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0xf706
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x2230
leaq 0x2fe9(%rip), %rax      # 0x126f6
testb %r14b, %r14b
jne 0xf715
movq %rbx, %rax
movq %rax, %rbx
movq -0x40(%rbp), %r14
movb -0x2c(%rbp), %sil
movq -0x50(%rbp), %rax
testb $0x1, 0x76(%rax)
jne 0xf733
leaq 0x3f85(%rip), %rax      # 0x136b6
jmp 0xf735
xorl %eax, %eax
movq %r12, %rcx
orq %rbx, %rcx
cmovneq %rbx, %rax
leaq 0x3f78(%rip), %rdx      # 0x136be
testq %rax, %rax
je 0xf74e
movq %rax, %rdx
orb %sil, %r15b
movq -0x38(%rbp), %rbx
movq %rbx, %rdi
leaq 0x450c(%rip), %rsi      # 0x13c6b
xorl %eax, %eax
callq 0x2300
movq 0x28(%r13,%r12), %rdx
movq 0x30(%r13,%r12), %rcx
movq %rbx, %rdi
leaq 0x44f7(%rip), %rsi      # 0x13c71
xorl %eax, %eax
callq 0x2300
addq $0xb8, %r12
cmpq %r12, -0x48(%rbp)
movq %r14, %r13
jne 0xf665
leaq 0x42ef(%rip), %rdi      # 0x13a8b
movl $0x2, %esi
movl $0x1, %edx
movq -0x38(%rbp), %rbx
movq %rbx, %rcx
callq 0x2410
testb $0x1, %r15b
movq %rbx, %r15
je 0xf928
leaq 0x44bb(%rip), %rdi      # 0x13c81
movl $0x13, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
movl $0x70, %r14d
xorl %r12d, %r12d
movq -0x38(%rbp), %r15
movq -0x40(%rbp), %rax
movq 0x80(%rax), %rax
movq 0x50(%rax), %rbx
movq -0x28(%rbx,%r14), %rax
movq -0x8(%rbx,%r14), %r13
cmpq $0x0, (%rbx,%r14)
jne 0xf811
cmpq $0x0, -0x20(%rbx,%r14)
je 0xf8b2
movq %rax, -0x48(%rbp)
movq %r15, %rdi
leaq 0x4476(%rip), %rsi      # 0x13c95
movl %r12d, %edx
xorl %eax, %eax
callq 0x2300
cmpq $0x0, -0x20(%rbx,%r14)
je 0xf846
movq %r15, %rdi
leaq 0x446c(%rip), %rsi      # 0x13ca7
movq -0x48(%rbp), %rdx
xorl %eax, %eax
callq 0x2300
cmpq $0x0, (%rbx,%r14)
je 0xf86f
testq %r13, %r13
leaq 0x4544(%rip), %rax      # 0x13d9b
cmoveq %rax, %r13
movq %r15, %rdi
leaq 0x4447(%rip), %rsi      # 0x13cac
movq %r13, %rdx
xorl %eax, %eax
callq 0x2300
movq %r15, %rdi
leaq 0x4440(%rip), %rsi      # 0x13cb9
movl %r12d, %edx
xorl %eax, %eax
callq 0x2300
movl $0x2, %esi
movl $0x1, %edx
leaq 0x4558(%rip), %rdi      # 0x13dec
movq %r15, %rcx
callq 0x2410
incq %r12
addq $0xb8, %r14
cmpq %r12, -0x60(%rbp)
jne 0xf7e5
jmp 0xf907
movl $0x5, %esi
movl $0x1, %edx
leaq 0x4421(%rip), %rdi      # 0x13ce4
movq -0x38(%rbp), %rcx
jmp 0xf897
testb $0x1, -0x2c(%rbp)
je 0xf928
movq 0x98(%rbx), %rdi
movq %r15, %rsi
callq 0x2280
jmp 0xf928
movl $0x0, -0x2c(%rbp)
jmp 0xf602
leaq 0x4198(%rip), %rdi      # 0x13a8b
movl $0x2, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
jmp 0xf928
leaq 0x417d(%rip), %rdi      # 0x13a8b
movl $0x2, %esi
movl $0x1, %edx
movq -0x38(%rbp), %r15
movq %r15, %rcx
callq 0x2410
movq -0x40(%rbp), %r13
movl $0x7d, %edi
movq %r15, %rsi
callq 0x22e0
leaq 0x44b0(%rip), %rdi      # 0x13dec
movl $0x2, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
movq 0x28(%r13), %rax
subq 0x20(%r13), %rax
sarq %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rcx
movq %rdx, %r12
shrq %r12
leaq 0x4377(%rip), %rdi      # 0x13cea
movl $0x1b, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
leaq 0x437a(%rip), %rdi      # 0x13d06
movl $0x1c, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
movq 0x80(%r13), %rbx
testq %rbx, %rbx
je 0xfa3e
callq 0x69ac
leaq 0x4369(%rip), %rsi      # 0x13d23
movq %rax, %rdi
callq 0x6a3e
cmpq (%rbx), %rax
je 0xf9e7
movq 0x80(%r13), %rbx
callq 0x69ac
leaq 0x434e(%rip), %rsi      # 0x13d28
movq %rax, %rdi
callq 0x6a3e
cmpq (%rbx), %rax
jne 0xfa00
leaq 0x4342(%rip), %rdi      # 0x13d30
movl $0xd, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
movq 0x80(%r13), %rbx
testq %rbx, %rbx
je 0xfa3e
callq 0x69ac
leaq 0x4326(%rip), %rsi      # 0x13d3e
movq %rax, %rdi
callq 0x6a3e
cmpq (%rbx), %rax
jne 0xfa3e
leaq 0x4317(%rip), %rdi      # 0x13d43
movl $0xa, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
leaq 0x4309(%rip), %rdi      # 0x13d4e
movl $0xe, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x2410
testl %r12d, %r12d
movq %r15, %r13
jle 0xfa9f
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rbx
leaq 0x42ef(%rip), %r14      # 0x13d5d
leaq 0x42f7(%rip), %r15      # 0x13d6c
movzwl (%rbx), %edx
movzwl 0x2(%rbx), %ecx
movzwl 0x4(%rbx), %r8d
cmpl $0x1, %r12d
movq %r15, %rsi
cmoveq %r14, %rsi
movq %r13, %rdi
xorl %eax, %eax
callq 0x2300
addq $0x6, %rbx
decl %r12d
jne 0xfa75
movq -0x40(%rbp), %rdi
addq $0x38, %rdi
movq %r13, %rsi
movl -0x30(%rbp), %edx
movq -0x50(%rbp), %rcx
callq 0x103b4
leaq 0x3fa1(%rip), %rdi      # 0x13a5e
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x2410
leaq 0x4316(%rip), %rdi      # 0x13dec
movl $0x2, %esi
movl $0x1, %edx
movq %r13, %rcx
callq 0x2410
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0xfb19
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x2230
movq %rbx, %rdi
callq 0x23c0
nop