// File: /workspace/github_c_makefile_star2_O1/vlenhart[P]q3bsp/q3shader.cpp
// Function: QuakeShaderFactory::Process(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&)
void QuakeShaderFactory::Process(const StringVector &args)
{

  if ( args[0] == "{" )
  {
    mBraceCount++;
  }
  else
  {
    if ( args[0] == "}" )
    {
      mBraceCount--;

      if ( mBraceCount == 0 ) // shader finished 
      {
        if ( mCurrent )
        {
          const StringRef& ref = mCurrent->GetName();
          QuakeShaderMap::iterator found;
          found = mShaders.find(ref);
          if ( found != mShaders.end() )
          {
            printf("Can't add shader %s, it already exists!!\n",ref.Get());
          }
          else
          {
            mShaders[ref] = mCurrent;
            printf("Added shader: %s\n",ref.Get());
            mCurrent = 0;
          }
        }
        else
        {
          printf("Got closing brace without valid shader defined.\n");
        }
      }
      else
      {
		  if ( mBraceCount == 1 ) {// shader stage finished        
			if (mCurrent && mCurrentStage)
				mCurrent->AddStage(mCurrentStage);
			delete mCurrentStage;
			mCurrentStage = 0;

		} 
		else  if ( mBraceCount < 0 )
        {
          printf("Missmatched closing brace situation!??\n");
          mBraceCount = 0;
        }
      }
    }
    else
    {
      if ( !mBraceCount )
      {
        delete mCurrent; // if didn't process the last one
        mCurrent = 0;
		delete mCurrentStage; // if didn't process the last one
        mCurrentStage = 0;

		// new shader start
        char name[256];
        //if ( GetName(args[0],name))
		strcpy(name,args[0].c_str()); // we take the full path name 
        {
          StringRef ref = StringDict::gStringDict().Get(name);
          mCurrent = new QuakeShader(ref);
        }
      }
      else
      if (mCurrent) {
		  if (mBraceCount == 1) { // at shader level 
		    if ( args[0] == "cull" && args.size() == 2)
	        {		// disable none trans alphashadow nomarks
				 mCurrent->mCull = args[1];
			}
		    else if ( args[0] == "surfaceparm" && args.size() == 2)
	        {
				if ( args[1] == "nolightmap" )
					 mCurrent->mNoLightMap = true;
				else if ( args[1] == "sky" )
					 mCurrent->mSky = true;
			}
			else if ( args[0] == "skyparms")
	        {

			}
		  } else 	
		  if (mBraceCount == 2) {	// at stage lavel 
		    if (!mCurrentStage) 
				mCurrentStage = new ShaderStage;


			String arg0; 
			strlwr(args[0],arg0);

			// process command!
			// store data in mCurrentStage

			if ( arg0 == "map"  && args.size() == 2  )
			{
			  //char name[256];
			  // this strips the extension ?	
			  //if ( GetName(args[1],name) )
			  if (args[1] != "$lightmap")	
			  {
				const StringRef ref = StringDict::gStringDict().Get(args[1]);
				mCurrentStage->map = ref;
				mCurrent->AddTexture(ref);
				//printf("Adding texture %s\n",ref.Get());
			  } else {
				  mCurrentStage->isLightMap = true;
			  }	
			}
			else if ( arg0 == "clampmap"  && args.size() == 2  )
			{
			  if (args[1] != "$lightmap")	
			  {
				const StringRef ref = StringDict::gStringDict().Get(args[1]);
				mCurrentStage->map = ref;
 				mCurrentStage->clamp = true;

				mCurrent->AddTexture(ref);
				//printf("Adding texture %s\n",ref.Get());
			  } else {
				  mCurrentStage->isLightMap = true;
				  //if (mCurrentStage->textureBlendMode == String(""))
				  //mCurrentStage->textureBlendMode = "ADD";
			  }	
			}
			else if ( arg0 == "animmap") {
				mCurrentStage->isAnimMap = true;
				mCurrentStage->animMapFrequency = (float)atof(args[1].c_str());
				for (unsigned int i=2; i< args.size(); i++) 
					mCurrentStage->animMap.push_back(args[i]);
			}
			else if ( arg0 == "blendfunc")
			{
					//blendFunc GL_DST_COLOR GL_ZERO
					//blendFunc GL_DST_COLOR GL_ONE_MINUS_DST_ALPHA
					//blendFunc GL_ONE GL_ONE
					//blendFunc GL_ONE GL_ZERO
					//blendFunc blend
					//blendFunc filter
					// [Source * <srcBlend>] + [Destination * <dstBlend>]
					if (args.size() == 3) {

						String arg1; 
						strupr(args[1],arg1);
						String arg2; 
						strupr(args[2],arg2);


						mCurrentStage->blendFuncSrc = arg1;
						mCurrentStage->blendFuncDst = arg2;

						if (arg1=="GL_SRC_ALPHA")
							mCurrentStage->textureBlendMode = "BLENDTEXTUREALPHA";

						if (arg1=="GL_ONE" &&  arg2=="GL_ZERO")
							mCurrentStage->textureBlendMode = "REPLACE";
						else 
						if (arg1=="GL_ONE" &&  arg2=="GL_ONE")
							mCurrentStage->textureBlendMode = "ADD";
						else 
						if (arg1=="GL_SRC_ALPHA" && arg2=="GL_ONE_MINUS_SRC_ALPHA")
							mCurrentStage->textureBlendMode = "BLENDTEXTUREALPHA";
						else 
						if (arg1=="GL_DST_COLOR" &&  arg2 =="GL_ONE_MINUS_DST_ALPHA")
							//mCurrentStage->textureBlendMode = "BLENDCURRENTALPHA"; // ??? 
							mCurrentStage->textureBlendMode = "MODULATE"; // ??? 
						else if (arg1=="GL_DST_COLOR" &&  arg2=="GL_ZERO")
							mCurrentStage->textureBlendMode = "MODULATE"; 


					   // GL_DST_COLOR GL_ONE_MINUS_DST_ALPHA
					   // GL_DST_COLOR GL_ZERO
					}
					else mCurrentStage->blendFuncSrc = args[1];
					if (args[1]=="add") {
						mCurrentStage->textureBlendMode = "ADD";
						mCurrentStage->blendFuncSrc = "GL_ONE";
						mCurrentStage->blendFuncDst = "GL_ONE";
					} else 
					if (args[1]=="filter") {
						mCurrentStage->textureBlendMode = "MODULATE";
						mCurrentStage->blendFuncSrc = "GL_DST_COLOR";
						mCurrentStage->blendFuncDst = "GL_ZERO";
					} else 
					if (args[1]=="blend") { // ??
						mCurrentStage->textureBlendMode = "BLENDTEXTUREALPHA";
						mCurrentStage->blendFuncSrc = "GL_SRC_ALPHA";
						mCurrentStage->blendFuncDst = "GL_ONE_MINUS_SRC_ALPHA";
					}

					//tcmod scroll 0 1
					//tcMod turb 0 .25 0 5.6
					//tcmod scale 1.5 1.5
					//tcGen environment
					//tcMod scroll 0.15 0.15
					//depthWrite
					//map $lightmap
					
					//rgbGen identity
					//rgbGen wave sin .5 .5 0 .5	
					//depthfunc equal



			}
			else if (arg0 == "alphafunc") 
			{  // GE128 
			}
			else if (arg0 == "tcmod")
			{
				if (mCurrentStage->tcmod.length()>0) 	mCurrentStage->tcmod += ',';

				if (args[1] == "scale" || args[1] == "scroll" || args[1] == "rotate") {
					for (unsigned int i=1; i< args.size(); i++) {
						mCurrentStage->tcmodOk += args[i];
						mCurrentStage->tcmodOk += ' ';
					}

				} else {
					for (unsigned int i=1; i< args.size(); i++) {
						mCurrentStage->tcmod += args[i];
						mCurrentStage->tcmod += ' ';
					}
				}
			}
			else if (arg0 == "tcgen")
			{
				if (mCurrentStage->tcmod.length()>0) 	mCurrentStage->tcmod += ',';
				mCurrentStage->tcmod += "tcgen ";
				for (unsigned int i=1; i< args.size(); i++) {
					mCurrentStage->tcmod += args[i];
					mCurrentStage->tcmod += ' ';
				}
			}
			else if (arg0 == "rgbgen")
			{
				// identityLighting
				// identity
				// wave <func> <base> <amp> <phase> <freq>
				for (unsigned int i=1; i< args.size(); i++) {
					if (i>1) mCurrentStage->rgbGen += ' ';
					mCurrentStage->rgbGen += args[i];
				}
			}
			else {

			}
		  } // braceCount == 2
      }
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rsi, %r14
movq %rdi, %r13
movq (%rsi), %rdi
leaq 0x6a8e(%rip), %rsi      # 0x1361e
callq 0x20d0
testl %eax, %eax
je 0xcc23
movq (%r14), %rdi
leaq 0x6a79(%rip), %rsi      # 0x13620
callq 0x20d0
movl 0x18(%r13), %ecx
testl %eax, %eax
je 0xcc2c
movq 0x20(%r13), %r15
testl %ecx, %ecx
je 0xccc6
testq %r15, %r15
je 0xd872
cmpl $0x2, %ecx
je 0xcecf
cmpl $0x1, %ecx
jne 0xd872
movq (%r14), %rdi
leaq 0x6a79(%rip), %rsi      # 0x1365e
callq 0x20d0
testl %eax, %eax
jne 0xcf8b
movq (%r14), %rbx
movq 0x8(%r14), %rax
subq %rbx, %rax
cmpq $0x40, %rax
jne 0xcf8b
callq 0x697e
movq 0x20(%rbx), %rsi
movq %rax, %rdi
callq 0x6a12
movq 0x20(%r13), %rcx
movq %rax, (%rcx)
jmp 0xd872
incl 0x18(%r13)
jmp 0xd872
leal -0x1(%rcx), %eax
movl %eax, 0x18(%r13)
cmpl $0x2, %ecx
je 0xce0f
cmpl $0x1, %ecx
jne 0xceb0
movq 0x20(%r13), %r14
testq %r14, %r14
je 0xd1a6
leaq 0x30(%r14), %rsi
movq 0x40(%r13), %rdx
leaq 0x38(%r13), %rax
movq %rax, %rcx
testq %rdx, %rdx
je 0xcc85
movq (%rsi), %rdi
movq %rax, %rcx
xorl %r8d, %r8d
cmpq 0x20(%rdx), %rdi
setb %r8b
cmovaeq %rdx, %rcx
movq 0x10(%rdx,%r8,8), %rdx
testq %rdx, %rdx
jne 0xcc6c
movq %rax, %rdx
cmpq %rax, %rcx
je 0xcc9b
movq 0x20(%rcx), %rdx
cmpq (%rsi), %rdx
cmovbq %rax, %rcx
movq %rcx, %rdx
cmpq %rax, %rdx
je 0xd1c3
movq (%rsi), %rsi
leaq 0x6974(%rip), %rdi      # 0x13622
xorl %eax, %eax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2050
testq %r15, %r15
je 0xcd0e
leaq 0x50(%r15), %rdi
callq 0xdd96
movq 0x38(%r15), %rdi
testq %rdi, %rdi
je 0xcce9
movq 0x48(%r15), %rsi
subq %rdi, %rsi
callq 0x2230
movq 0x10(%r15), %rdi
leaq 0x20(%r15), %rax
cmpq %rax, %rdi
je 0xcd01
movq (%rax), %rsi
incq %rsi
callq 0x2230
movl $0x68, %esi
movq %r15, %rdi
callq 0x2230
movq $0x0, 0x20(%r13)
movq 0x28(%r13), %r15
testq %r15, %r15
je 0xcd8f
movq 0x88(%r15), %rdi
leaq 0x98(%r15), %rax
cmpq %rax, %rdi
je 0xcd3d
movq (%rax), %rsi
incq %rsi
callq 0x2230
movq 0x68(%r15), %rdi
leaq 0x78(%r15), %rax
cmpq %rax, %rdi
je 0xcd55
movq (%rax), %rsi
incq %rsi
callq 0x2230
movq 0x48(%r15), %rdi
leaq 0x58(%r15), %rax
cmpq %rax, %rdi
je 0xcd6d
movq (%rax), %rsi
incq %rsi
callq 0x2230
movq 0x8(%r15), %rdi
testq %rdi, %rdi
je 0xcd82
movq 0x18(%r15), %rsi
subq %rdi, %rsi
callq 0x2230
movl $0xb8, %esi
movq %r15, %rdi
callq 0x2230
xorl %r15d, %r15d
movq %r15, 0x28(%r13)
movq (%r14), %rax
movq (%rax), %rsi
leaq -0x170(%rbp), %r14
movq %r14, %rdi
callq 0x21f0
callq 0x697e
movq %rax, %rdi
movq %r14, %rsi
callq 0x6a12
movq %rax, %r14
movl $0x68, %edi
callq 0x2220
leaq 0x5de3(%rip), %rcx      # 0x12bb2
movq %rcx, (%rax)
leaq 0x20(%rax), %rcx
movq %rcx, 0x10(%rax)
movq %r15, 0x18(%rax)
movb %r15b, 0x20(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rax)
movups %xmm0, 0x48(%rax)
movups %xmm0, 0x58(%rax)
movq %r14, 0x30(%rax)
movw $0x0, 0x8(%rax)
movb %r15b, 0xa(%rax)
movl $0x0, 0xc(%rax)
movq %rax, 0x20(%r13)
jmp 0xd872
movq 0x20(%r13), %rdi
testq %rdi, %rdi
je 0xce2a
movq 0x28(%r13), %rsi
testq %rsi, %rsi
je 0xce2a
addq $0x50, %rdi
callq 0xde60
movq 0x28(%r13), %r14
testq %r14, %r14
je 0xcea3
movq 0x88(%r14), %rdi
leaq 0x98(%r14), %rax
cmpq %rax, %rdi
je 0xce51
movq (%rax), %rsi
incq %rsi
callq 0x2230
movq 0x68(%r14), %rdi
leaq 0x78(%r14), %rax
cmpq %rax, %rdi
je 0xce69
movq (%rax), %rsi
incq %rsi
callq 0x2230
movq 0x48(%r14), %rdi
leaq 0x58(%r14), %rax
cmpq %rax, %rdi
je 0xce81
movq (%rax), %rsi
incq %rsi
callq 0x2230
movq 0x8(%r14), %rdi
testq %rdi, %rdi
je 0xce96
movq 0x18(%r14), %rsi
subq %rdi, %rsi
callq 0x2230
movl $0xb8, %esi
movq %r14, %rdi
callq 0x2230
movq $0x0, 0x28(%r13)
jmp 0xd872
jge 0xd872
leaq 0x68ad(%rip), %rdi      # 0x1376a
callq 0x2350
movl $0x0, 0x18(%r13)
jmp 0xd872
cmpq $0x0, 0x28(%r13)
jne 0xceef
movl $0xb8, %edi
callq 0x2220
movq %rax, %r15
movq %rax, %rdi
callq 0xdb32
movq %r15, 0x28(%r13)
leaq -0x160(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq (%r14), %rdi
leaq -0x170(%rbp), %rsi
callq 0xd924
leaq 0x6783(%rip), %rsi      # 0x1369e
leaq -0x170(%rbp), %rdi
callq 0x20d0
testl %eax, %eax
jne 0xcff6
movq (%r14), %rdi
movq 0x8(%r14), %rax
subq %rdi, %rax
cmpq $0x40, %rax
jne 0xcff6
addq $0x20, %rdi
leaq 0x6739(%rip), %rsi      # 0x13687
callq 0x20d0
testl %eax, %eax
je 0xd453
callq 0x697e
movq (%r14), %rcx
movq 0x20(%rcx), %rsi
movq %rax, %rdi
callq 0x6a12
leaq -0x50(%rbp), %rsi
movq %rax, (%rsi)
movq 0x28(%r13), %rcx
movq %rax, (%rcx)
movq 0x20(%r13), %rdi
callq 0xdc4a
jmp 0xd850
movq (%r14), %rdi
leaq 0x66ce(%rip), %rsi      # 0x13663
callq 0x20d0
testl %eax, %eax
jne 0xd06c
movq (%r14), %rdi
movq 0x8(%r14), %rax
subq %rdi, %rax
cmpq $0x40, %rax
jne 0xd06c
addq $0x20, %rdi
leaq 0x66ae(%rip), %rsi      # 0x1366f
callq 0x20d0
testl %eax, %eax
je 0xd558
movq (%r14), %rdi
addq $0x20, %rdi
leaq 0x669e(%rip), %rsi      # 0x1367a
callq 0x20d0
testl %eax, %eax
jne 0xd872
movq 0x20(%r13), %rax
movb $0x1, 0xa(%rax)
jmp 0xd872
leaq 0x6694(%rip), %rsi      # 0x13691
leaq -0x170(%rbp), %rdi
callq 0x20d0
testl %eax, %eax
jne 0xd08c
movq (%r14), %rdi
movq 0x8(%r14), %rax
subq %rdi, %rax
cmpq $0x40, %rax
jne 0xd08c
addq $0x20, %rdi
leaq 0x665f(%rip), %rsi      # 0x13687
callq 0x20d0
testl %eax, %eax
je 0xd453
callq 0x697e
movq (%r14), %rcx
movq 0x20(%rcx), %rsi
movq %rax, %rdi
callq 0x6a12
leaq -0x50(%rbp), %rsi
movq %rax, (%rsi)
movq 0x28(%r13), %rcx
movq %rax, (%rcx)
movb $0x1, 0xaa(%rcx)
movq 0x20(%r13), %rdi
callq 0xdc4a
jmp 0xd850
movq (%r14), %rdi
leaq 0x6608(%rip), %rsi      # 0x1367e
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x20d0
leaq 0x6607(%rip), %rsi      # 0x1369a
leaq -0x170(%rbp), %rdi
callq 0x20d0
testl %eax, %eax
movq %r13, -0x30(%rbp)
je 0xd1ee
leaq 0x65f0(%rip), %rsi      # 0x136a2
leaq -0x170(%rbp), %rdi
callq 0x20d0
testl %eax, %eax
je 0xd296
leaq 0x6665(%rip), %rsi      # 0x13732
leaq -0x170(%rbp), %rdi
callq 0x20d0
testl %eax, %eax
je 0xd850
leaq 0x6654(%rip), %rsi      # 0x1373c
leaq -0x170(%rbp), %rdi
callq 0x20d0
testl %eax, %eax
je 0xd481
leaq 0x6653(%rip), %rsi      # 0x13756
leaq -0x170(%rbp), %rdi
callq 0x20d0
testl %eax, %eax
je 0xd5d2
leaq 0x6645(%rip), %rsi      # 0x13763
leaq -0x170(%rbp), %rdi
callq 0x20d0
testl %eax, %eax
jne 0xd850
movq 0x8(%r14), %rax
subq (%r14), %rax
cmpq $0x21, %rax
jb 0xd850
movl $0x1, %r15d
movl $0x1, %ebx
movl $0x88, %r12d
movq -0x30(%rbp), %r13
cmpl $0x2, %r15d
jb 0xd16f
movq 0x28(%r13), %rdi
addq %r12, %rdi
movl $0x20, %esi
callq 0x21d0
movq (%r14), %rax
shlq $0x5, %rbx
movq 0x28(%r13), %rdi
addq %r12, %rdi
movq (%rax,%rbx), %rsi
movq 0x8(%rax,%rbx), %rdx
callq 0x20e0
movq 0x8(%r14), %rax
subq (%r14), %rax
incl %r15d
sarq $0x5, %rax
movq %r15, %rbx
cmpq %r15, %rax
ja 0xd158
jmp 0xd850
leaq 0x65e4(%rip), %rdi      # 0x13791
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2350
leaq 0x30(%r13), %rdi
callq 0xdac8
movq %r14, (%rax)
movq 0x30(%r14), %rsi
leaq 0x6472(%rip), %rdi      # 0x1364c
xorl %eax, %eax
callq 0x2050
movq $0x0, 0x20(%r13)
jmp 0xd872
movq 0x28(%r13), %rbx
movb $0x1, 0xa9(%rbx)
movq (%r14), %rax
movq 0x20(%rax), %rdi
callq 0x22d0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x20(%rbx)
movq (%r14), %r15
movq 0x8(%r14), %rax
subq %r15, %rax
cmpq $0x41, %rax
jb 0xd850
movl $0x2, %ebx
movl $0x3, %r13d
movq -0x30(%rbp), %rax
movq 0x28(%rax), %r12
callq 0x697e
shlq $0x5, %rbx
movq (%r15,%rbx), %rsi
movq %rax, %rdi
callq 0x6a12
movq %rax, -0x50(%rbp)
movq 0x10(%r12), %rsi
cmpq 0x18(%r12), %rsi
je 0xd268
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x10(%r12)
jmp 0xd278
addq $0x8, %r12
movq %r12, %rdi
leaq -0x50(%rbp), %rdx
callq 0xe8d8
movl %r13d, %ebx
movq (%r14), %r15
movq 0x8(%r14), %rax
subq %r15, %rax
sarq $0x5, %rax
incl %r13d
cmpq %rbx, %rax
ja 0xd22d
jmp 0xd850
movq (%r14), %r15
movq 0x8(%r14), %rax
subq %r15, %rax
cmpq $0x60, %rax
jne 0xd463
leaq -0x40(%rbp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
addq $0x20, %r15
leaq -0x50(%rbp), %rsi
movq %r15, %rdi
callq 0xd981
leaq -0x60(%rbp), %r15
movq %r15, -0x10(%r15)
movq $0x0, -0x8(%r15)
movb $0x0, (%r15)
movq (%r14), %rdi
addq $0x40, %rdi
leaq -0x70(%rbp), %rsi
callq 0xd981
callq 0x697e
movq -0x50(%rbp), %rsi
movq %rax, %rdi
callq 0x6a12
movq 0x28(%r13), %rcx
movq %rax, 0x28(%rcx)
callq 0x697e
movq -0x70(%rbp), %rsi
movq %rax, %rdi
callq 0x6a12
movq 0x28(%r13), %rcx
movq %rax, 0x30(%rcx)
leaq 0x637e(%rip), %rsi      # 0x136ac
leaq -0x50(%rbp), %rdi
callq 0x20d0
testl %eax, %eax
jne 0xd35a
callq 0x697e
leaq 0x6372(%rip), %rsi      # 0x136b9
movq %rax, %rdi
callq 0x6a12
movq 0x28(%r13), %rcx
movq %rax, 0xb0(%rcx)
leaq 0x636a(%rip), %rsi      # 0x136cb
leaq -0x50(%rbp), %rdi
callq 0x20d0
testl %eax, %eax
jne 0xd386
leaq 0x635d(%rip), %rsi      # 0x136d2
leaq -0x70(%rbp), %rdi
callq 0x20d0
testl %eax, %eax
je 0xd670
leaq 0x633e(%rip), %rsi      # 0x136cb
leaq -0x50(%rbp), %rdi
callq 0x20d0
testl %eax, %eax
jne 0xd3b2
leaq 0x632a(%rip), %rsi      # 0x136cb
leaq -0x70(%rbp), %rdi
callq 0x20d0
testl %eax, %eax
je 0xd686
leaq 0x62f3(%rip), %rsi      # 0x136ac
leaq -0x50(%rbp), %rdi
callq 0x20d0
testl %eax, %eax
jne 0xd3de
leaq 0x6319(%rip), %rsi      # 0x136e6
leaq -0x70(%rbp), %rdi
callq 0x20d0
testl %eax, %eax
je 0xd69c
leaq 0x6318(%rip), %rsi      # 0x136fd
leaq -0x50(%rbp), %rdi
callq 0x20d0
testl %eax, %eax
jne 0xd40a
leaq 0x6311(%rip), %rsi      # 0x1370a
leaq -0x70(%rbp), %rdi
callq 0x20d0
testl %eax, %eax
je 0xd6b2
leaq 0x62ec(%rip), %rsi      # 0x136fd
leaq -0x50(%rbp), %rdi
callq 0x20d0
testl %eax, %eax
jne 0xd6d1
leaq 0x62a9(%rip), %rsi      # 0x136d2
leaq -0x70(%rbp), %rdi
callq 0x20d0
testl %eax, %eax
jne 0xd6d1
callq 0x697e
leaq 0x52b0(%rip), %rsi      # 0x126f6
movq %rax, %rdi
callq 0x6a12
jmp 0xd6c6
movq 0x28(%r13), %rax
movb $0x1, 0xa8(%rax)
jmp 0xd850
callq 0x697e
movq 0x20(%r15), %rsi
movq %rax, %rdi
callq 0x6a12
movq 0x28(%r13), %rcx
movq %rax, 0x28(%rcx)
jmp 0xd6fb
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rdi
cmpq $0x0, 0x70(%rdi)
je 0xd49e
addq $0x68, %rdi
movl $0x2c, %esi
callq 0x21d0
movq (%r14), %rdi
addq $0x20, %rdi
leaq 0x6296(%rip), %rsi      # 0x13742
callq 0x20d0
testl %eax, %eax
je 0xd565
movq (%r14), %rdi
addq $0x20, %rdi
leaq 0x6281(%rip), %rsi      # 0x13748
callq 0x20d0
testl %eax, %eax
je 0xd565
movq (%r14), %rdi
addq $0x20, %rdi
leaq 0x626d(%rip), %rsi      # 0x1374f
callq 0x20d0
testl %eax, %eax
je 0xd565
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
cmpq $0x21, %rcx
jb 0xd850
movl $0x1, %ecx
movl $0x2, %r15d
movq -0x30(%rbp), %rbx
shlq $0x5, %rcx
movq 0x28(%rbx), %rdi
addq $0x68, %rdi
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
callq 0x20e0
movq 0x28(%rbx), %rdi
addq $0x68, %rdi
movl $0x20, %esi
callq 0x21d0
movl %r15d, %ecx
movq (%r14), %rax
movq 0x8(%r14), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
incl %r15d
cmpq %rcx, %rdx
ja 0xd50e
jmp 0xd850
movq 0x20(%r13), %rax
movb $0x1, 0x9(%rax)
jmp 0xd872
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
cmpq $0x21, %rcx
jb 0xd850
movl $0x1, %ecx
movl $0x2, %r15d
movq -0x30(%rbp), %rbx
shlq $0x5, %rcx
movq 0x28(%rbx), %rdi
addq $0x48, %rdi
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
callq 0x20e0
movq 0x28(%rbx), %rdi
addq $0x48, %rdi
movl $0x20, %esi
callq 0x21d0
movl %r15d, %ecx
movq (%r14), %rax
movq 0x8(%r14), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
incl %r15d
cmpq %rcx, %rdx
ja 0xd588
jmp 0xd850
movq -0x30(%rbp), %rbx
movq 0x28(%rbx), %rdi
cmpq $0x0, 0x70(%rdi)
je 0xd5ef
addq $0x68, %rdi
movl $0x2c, %esi
callq 0x21d0
movq 0x28(%rbx), %rdi
addq $0x68, %rdi
leaq 0x615e(%rip), %rsi      # 0x1375c
callq 0x2400
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
cmpq $0x21, %rcx
jb 0xd850
movl $0x1, %ecx
movl $0x2, %r15d
movq -0x30(%rbp), %rbx
shlq $0x5, %rcx
movq 0x28(%rbx), %rdi
addq $0x68, %rdi
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
callq 0x20e0
movq 0x28(%rbx), %rdi
addq $0x68, %rdi
movl $0x20, %esi
callq 0x21d0
movl %r15d, %ecx
movq (%r14), %rax
movq 0x8(%r14), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
incl %r15d
cmpq %rcx, %rdx
ja 0xd626
jmp 0xd850
callq 0x697e
leaq 0x605e(%rip), %rsi      # 0x136da
movq %rax, %rdi
callq 0x6a12
jmp 0xd6c6
callq 0x697e
leaq 0x6050(%rip), %rsi      # 0x136e2
movq %rax, %rdi
callq 0x6a12
jmp 0xd6c6
callq 0x697e
leaq 0x6011(%rip), %rsi      # 0x136b9
movq %rax, %rdi
callq 0x6a12
jmp 0xd6c6
callq 0x697e
leaq 0x5038(%rip), %rsi      # 0x126f6
movq %rax, %rdi
callq 0x6a12
movq 0x28(%r13), %rcx
movq %rax, 0xb0(%rcx)
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0xd6e6
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2230
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0xd6fb
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2230
movq (%r14), %rdi
addq $0x20, %rdi
leaq 0x6018(%rip), %rsi      # 0x13721
callq 0x20d0
testl %eax, %eax
je 0xd7a8
movq (%r14), %rdi
addq $0x20, %rdi
leaq 0x6001(%rip), %rsi      # 0x13725
callq 0x20d0
testl %eax, %eax
je 0xd7f9
movq (%r14), %rdi
addq $0x20, %rdi
leaq 0x5fed(%rip), %rsi      # 0x1372c
callq 0x20d0
testl %eax, %eax
jne 0xd850
callq 0x697e
leaq 0x5f61(%rip), %rsi      # 0x136b9
movq %rax, %rdi
callq 0x6a12
movq -0x30(%rbp), %rbx
movq 0x28(%rbx), %rcx
movq %rax, 0xb0(%rcx)
callq 0x697e
leaq 0x5f31(%rip), %rsi      # 0x136ac
movq %rax, %rdi
callq 0x6a12
movq 0x28(%rbx), %rcx
movq %rax, 0x28(%rcx)
callq 0x697e
leaq 0x5f4f(%rip), %rsi      # 0x136e6
movq %rax, %rdi
callq 0x6a12
movq 0x28(%rbx), %rcx
jmp 0xd84c
callq 0x697e
leaq 0x5f2e(%rip), %rsi      # 0x136e2
movq %rax, %rdi
callq 0x6a12
movq 0x28(%r13), %rcx
movq %rax, 0xb0(%rcx)
callq 0x697e
leaq 0x5ef8(%rip), %rsi      # 0x136cb
movq %rax, %rdi
callq 0x6a12
movq 0x28(%r13), %rcx
movq %rax, 0x28(%rcx)
callq 0x697e
leaq 0x5edc(%rip), %rsi      # 0x136cb
movq %rax, %rdi
callq 0x6a12
jmp 0xd848
callq 0x697e
leaq 0x4ef1(%rip), %rsi      # 0x126f6
movq %rax, %rdi
callq 0x6a12
movq 0x28(%r13), %rcx
movq %rax, 0xb0(%rcx)
callq 0x697e
leaq 0x5ed9(%rip), %rsi      # 0x136fd
movq %rax, %rdi
callq 0x6a12
movq 0x28(%r13), %rcx
movq %rax, 0x28(%rcx)
callq 0x697e
leaq 0x5e92(%rip), %rsi      # 0x136d2
movq %rax, %rdi
callq 0x6a12
movq 0x28(%r13), %rcx
movq %rax, 0x30(%rcx)
movq -0x170(%rbp), %rdi
leaq -0x160(%rbp), %rax
cmpq %rax, %rdi
je 0xd872
movq -0x160(%rbp), %rsi
incq %rsi
callq 0x2230
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xd8ab
jmp 0xd8ab
jmp 0xd8ab
jmp 0xd8ab
jmp 0xd8ab
jmp 0xd8f7
jmp 0xd8f7
jmp 0xd8f7
jmp 0xd8ab
jmp 0xd8f7
jmp 0xd8f7
jmp 0xd8f7
jmp 0xd8ab
movq %rax, %rbx
jmp 0xd8c3
jmp 0xd8f7
jmp 0xd8f7
jmp 0xd8f7
jmp 0xd8ab
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0xd8c3
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2230
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0xd8fa
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2230
jmp 0xd8fa
jmp 0xd8f7
jmp 0xd8f7
jmp 0xd8f7
movq %rax, %rbx
movl $0xb8, %esi
movq %r15, %rdi
jmp 0xd917
jmp 0xd8f7
jmp 0xd8f7
jmp 0xd8f7
jmp 0xd8f7
jmp 0xd8f7
movq %rax, %rbx
movq -0x170(%rbp), %rdi
leaq -0x160(%rbp), %rax
cmpq %rax, %rdi
je 0xd91c
movq -0x160(%rbp), %rsi
incq %rsi
callq 0x2230
movq %rbx, %rdi
callq 0x23c0