// File: akinanop[P]mvl-solver/src/LinearEncode.cc
// Function: LinearEncode(CommandLine*)
void LinearEncode(CommandLine * cline)
{
  //local variables
  ifstream infile;
  ofstream outfile;
  char line_buffer[3000];
  char word_buffer[3000];
  int num_clause = 0;
  int num_var = 0;
  int new_num_clause = 0;
  int new_num_var = 0;
  int * domain;
  int * index;
  int var, val;
  int temp;
  bool isdone = false;
  int count = 0;
  char ch, ch1;

  //opening infile to read and checking if it opens
  infile.open(cline->FILE, ios::in);
  if(!infile)
    {
      cout<<endl;
      cout<<"**** ERROR ****"<<endl;
      cout<<"Could not open input file : "<<endl;
      cout<<endl;
      exit(1);
    }

  //opening outfile to write the new clauses
  outfile.open(cline->MODEL_FILE, ios::out);
  if(!outfile)
    {
      cout<<endl;
      cout<<"**** ERROR ****"<<endl;
      cout<<"Could not open output file : "<<endl;
      cout<<endl;
      exit(1);
    }

  //now reading each line from the infile and if needed to convert
  //then converting it and writing to outfile or just writing directly
  while(infile.getline(line_buffer, 3000))
    {
      //if line is comment - just write
      if(line_buffer[0] == 'c')
	{
	  //do nothing
	  ;
	}
      //else if line is p cnf var_num clause_num - just write
      else if(line_buffer[0] == 'p')
	{
	  //do nothing
	  temp = sscanf(line_buffer, "p cnf %d %d", &var, &val);
	  num_var = var;
	  num_clause = val;
	  domain = new int[var+1];
	  index = new int[var+1];
	  //default initialization to domain value 2
	  for(int i=0; i<var+1; i++)
	    domain[i] = 2;
	}
      //else if line is d var# domsize
      else if(line_buffer[0] == 'd')
	{
	  temp = sscanf(line_buffer, "d %d %d", &var, &val);
	  count++;
	  new_num_var += 2*val-1;
	  new_num_clause += 4*(val-2)+3+1;
	  domain[var] = val;
	}
      //else its variables
      else
	{
	  if(!isdone)
	    {
	      isdone = true;
	      new_num_clause += num_clause;
	      new_num_var += (num_var - count);
	      outfile<<"p cnf "<<new_num_var<<" "<<new_num_clause<<endl;
	      //compute the index values for each variable=domainvalue
	      index[1] = 1;
	      for(int i=2; i<num_var+1; i++)
		{
		  if(domain[i-1] == 2)
		    index[i] = index[i-1]+1;
		  else
		    index[i] = 2*domain[i-1] -1 + index[i-1];
		}
	      int var_t1 = 0;
	      int var_t2 = 0;
	      //add the extra clauses
	      for(int i=0; i<num_var+1; i++)
		{
		  if(domain[i] > 2)
		    {
		      //write the ALO condition
		      for(int j=0; j<domain[i]; j++)
			{
			  outfile<<index[i]+j<<" ";
			}
		      outfile<<" 0"<<endl;
		      var_t1 = index[i]+domain[i];
		      var_t2 = index[i];
		      outfile<<-(var_t1)<<" "<<(var_t2)<<" 0"<<endl;
		      outfile<<var_t1<<" "<<-(var_t2)<<" 0"<<endl;
		      for(int j=0; j<domain[i]-2; j++)
			{
			  outfile<<-(var_t1+1+j)<<" "<<(var_t1+j)<<" "<<var_t2+1+j<<" 0"<<endl;
			  outfile<<var_t1+1+j<<" "<<-(var_t1+j)<<" 0"<<endl;
			  outfile<<var_t1+1+j<<" "<<-(var_t2+1+j)<<" 0"<<endl;
			}
		      for(int j=0; j<domain[i]-1; j++)
			{
			  var_t1=-(index[i]+domain[i]+j);
			  var_t2=-(index[i]+1+j);
			  outfile<<var_t1<<" "<<var_t2<<" 0\n";
			}
		    }
		  else
		    {
		      //do nothing
		      ;
		    }
		}
	    }

	  char * lp = line_buffer;
	  do
	    {
	      char * wp = word_buffer;
	      //erasing all leading space/tabs
	      while (*lp && ((*lp == ' ') || (*lp == '\t')))
		{
		  lp++;
		}
	      //reading each value into word buffer
	      while (*lp && (*lp != ' ') && (*lp != '\t') && (*lp != '\n'))
		{
		  *(wp++) = *(lp++);
		}
	      *wp = '\0';
	      //converting into int and writing to file
	      if(strlen(word_buffer) != 0)
		{
		  temp = sscanf(word_buffer, "%d %c %d", &var, &ch, &val);
		  if(ch == '!')
		    temp = sscanf(word_buffer, "%d %c %c %d", &var, &ch, &ch1, &val);
		  //checking if variable = 0 i.e end of line
		  if(var != 0)
		    {
		      if(domain[var] > 2)
			{
			  var = index[var] + val;
			  if(ch == '!')
			    outfile<<"-"<<var<<" ";
			  else
			    outfile<<var<<" ";
			}
		      else
			{
			  if(val == 1)
			    {
			      var = index[var];
			      outfile<<var<<" ";
			    }
			  else
			    {
			      var = -index[var];
			      outfile<<var<<" ";
			    }
			}
		    }
		}
	    }while(*lp);
	  outfile<<"0"<<endl;
	}
    }

  //closing file
  infile.close();
  outfile.close();
}

// Assembly:
subq $0x1d88, %rsp           # imm = 0x1D88
movq %rdi, 0x1d80(%rsp)
leaq 0x1b78(%rsp), %rdi
callq 0x22b0
leaq 0x1978(%rsp), %rdi
callq 0x23f0
jmp 0x8ddb
movl $0x0, 0x1ec(%rsp)
movl $0x0, 0x1e8(%rsp)
movl $0x0, 0x1e4(%rsp)
movl $0x0, 0x1e0(%rsp)
movb $0x0, 0x1c3(%rsp)
movl $0x0, 0x1bc(%rsp)
movq 0x1d80(%rsp), %rax
movq 0x20(%rax), %rsi
leaq 0x1b78(%rsp), %rdi
movl $0x8, %edx
callq 0x2180
jmp 0x8e3a
movq 0x1b78(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x1b78(%rsp,%rax), %rdi
callq 0x2130
movb %al, 0x187(%rsp)
jmp 0x8e5c
movb 0x187(%rsp), %al
testb $0x1, %al
jne 0x8e6c
jmp 0x8f45
movq 0x1515d(%rip), %rdi     # 0x1dfd0
movq 0x15146(%rip), %rsi     # 0x1dfc0
callq 0x2260
jmp 0x8e81
movq 0x15148(%rip), %rdi     # 0x1dfd0
leaq 0xec45(%rip), %rsi      # 0x17ad4
callq 0x2220
movq %rax, 0x178(%rsp)
jmp 0x8e9e
movq 0x178(%rsp), %rdi
movq 0x15113(%rip), %rsi     # 0x1dfc0
callq 0x2260
jmp 0x8eb4
movq 0x15115(%rip), %rdi     # 0x1dfd0
leaq 0xeca1(%rip), %rsi      # 0x17b63
callq 0x2220
movq %rax, 0x170(%rsp)
jmp 0x8ed1
movq 0x170(%rsp), %rdi
movq 0x150e0(%rip), %rsi     # 0x1dfc0
callq 0x2260
jmp 0x8ee7
movq 0x150e2(%rip), %rdi     # 0x1dfd0
movq 0x150cb(%rip), %rsi     # 0x1dfc0
callq 0x2260
jmp 0x8efc
movl $0x1, %edi
callq 0x22e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1970(%rsp)
movl %eax, 0x196c(%rsp)
jmp 0x9dd7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1970(%rsp)
movl %eax, 0x196c(%rsp)
leaq 0x1978(%rsp), %rdi
callq 0x2380
jmp 0x9dd7
movq 0x1d80(%rsp), %rax
movq 0x28(%rax), %rsi
leaq 0x1978(%rsp), %rdi
movl $0x10, %edx
callq 0x2060
jmp 0x8f65
movq 0x1978(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x1978(%rsp,%rax), %rdi
callq 0x2130
movb %al, 0x16f(%rsp)
jmp 0x8f87
movb 0x16f(%rsp), %al
testb $0x1, %al
jne 0x8f97
jmp 0x9031
movq 0x15032(%rip), %rdi     # 0x1dfd0
movq 0x1501b(%rip), %rsi     # 0x1dfc0
callq 0x2260
jmp 0x8fac
movq 0x1501d(%rip), %rdi     # 0x1dfd0
leaq 0xeb1a(%rip), %rsi      # 0x17ad4
callq 0x2220
movq %rax, 0x160(%rsp)
jmp 0x8fc9
movq 0x160(%rsp), %rdi
movq 0x14fe8(%rip), %rsi     # 0x1dfc0
callq 0x2260
jmp 0x8fdf
movq 0x14fea(%rip), %rdi     # 0x1dfd0
leaq 0xeb93(%rip), %rsi      # 0x17b80
callq 0x2220
movq %rax, 0x158(%rsp)
jmp 0x8ffc
movq 0x158(%rsp), %rdi
movq 0x14fb5(%rip), %rsi     # 0x1dfc0
callq 0x2260
jmp 0x9012
movq 0x14fb7(%rip), %rdi     # 0x1dfd0
movq 0x14fa0(%rip), %rsi     # 0x1dfc0
callq 0x2260
jmp 0x9027
movl $0x1, %edi
callq 0x22e0
jmp 0x9033
leaq 0x1b78(%rsp), %rdi
leaq 0xdb0(%rsp), %rsi
movl $0xbb8, %edx            # imm = 0xBB8
callq 0x20f0
movq %rax, 0x150(%rsp)
jmp 0x9057
movq 0x150(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x2300
movb %al, 0x14f(%rsp)
jmp 0x9077
movb 0x14f(%rsp), %al
testb $0x1, %al
jne 0x9087
jmp 0x9d97
movsbl 0xdb0(%rsp), %eax
cmpl $0x63, %eax
jne 0x9099
jmp 0x9d92
movsbl 0xdb0(%rsp), %eax
cmpl $0x70, %eax
jne 0x91c2
leaq 0xeaed(%rip), %rsi      # 0x17b9e
xorl %eax, %eax
leaq 0xdb0(%rsp), %rdi
leaq 0x1cc(%rsp), %rdx
leaq 0x1c8(%rsp), %rcx
callq 0x2210
movl %eax, 0x1c4(%rsp)
movl 0x1cc(%rsp), %eax
movl %eax, 0x1e8(%rsp)
movl 0x1c8(%rsp), %eax
movl %eax, 0x1ec(%rsp)
movl 0x1cc(%rsp), %eax
incl %eax
cltq
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, 0x140(%rsp)
jmp 0x9123
movq 0x140(%rsp), %rax
movq %rax, 0x1d8(%rsp)
movl 0x1cc(%rsp), %eax
incl %eax
cltq
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x2030
movq %rax, 0x138(%rsp)
jmp 0x9163
movq 0x138(%rsp), %rax
movq %rax, 0x1d0(%rsp)
movl $0x0, 0x1b4(%rsp)
movl 0x1b4(%rsp), %eax
movl 0x1cc(%rsp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0x91bd
movq 0x1d8(%rsp), %rax
movslq 0x1b4(%rsp), %rcx
movl $0x2, (%rax,%rcx,4)
movl 0x1b4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1b4(%rsp)
jmp 0x917e
jmp 0x9d90
movsbl 0xdb0(%rsp), %eax
cmpl $0x64, %eax
jne 0x926b
leaq 0xdb0(%rsp), %rdi
leaq 0xe9c8(%rip), %rsi      # 0x17baa
leaq 0x1cc(%rsp), %rdx
leaq 0x1c8(%rsp), %rcx
movb $0x0, %al
callq 0x2210
movl %eax, 0x1c4(%rsp)
movl 0x1bc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1bc(%rsp)
movl 0x1c8(%rsp), %eax
shll %eax
subl $0x1, %eax
addl 0x1e0(%rsp), %eax
movl %eax, 0x1e0(%rsp)
movl 0x1c8(%rsp), %eax
subl $0x2, %eax
shll $0x2, %eax
addl $0x3, %eax
addl $0x1, %eax
addl 0x1e4(%rsp), %eax
movl %eax, 0x1e4(%rsp)
movl 0x1c8(%rsp), %edx
movq 0x1d8(%rsp), %rax
movslq 0x1cc(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x9d8e
testb $0x1, 0x1c3(%rsp)
jne 0x9a14
movb $0x1, 0x1c3(%rsp)
movl 0x1ec(%rsp), %ecx
movl 0x1e4(%rsp), %eax
addl %ecx, %eax
movl %eax, 0x1e4(%rsp)
movl 0x1e8(%rsp), %ecx
movl 0x1bc(%rsp), %eax
subl %eax, %ecx
movl 0x1e0(%rsp), %eax
addl %ecx, %eax
movl %eax, 0x1e0(%rsp)
leaq 0xe85b(%rip), %rsi      # 0x17b1a
leaq 0x1978(%rsp), %rdi
callq 0x2220
movq %rax, 0x130(%rsp)
jmp 0x92d6
movq 0x130(%rsp), %rdi
movl 0x1e0(%rsp), %esi
callq 0x2400
movq %rax, 0x128(%rsp)
jmp 0x92f4
movq 0x128(%rsp), %rdi
leaq 0xdf44(%rip), %rsi      # 0x17247
callq 0x2220
movq %rax, 0x120(%rsp)
jmp 0x9312
movq 0x120(%rsp), %rdi
movl 0x1e4(%rsp), %esi
callq 0x2400
movq %rax, 0x118(%rsp)
jmp 0x9330
movq 0x118(%rsp), %rdi
movq 0x14c81(%rip), %rsi     # 0x1dfc0
callq 0x2260
jmp 0x9346
movq 0x1d0(%rsp), %rax
movl $0x1, 0x4(%rax)
movl $0x2, 0x1b0(%rsp)
movl 0x1b0(%rsp), %eax
movl 0x1e8(%rsp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0x9424
movq 0x1d8(%rsp), %rax
movl 0x1b0(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
cmpl $0x2, (%rax,%rcx,4)
jne 0x93c4
movq 0x1d0(%rsp), %rax
movl 0x1b0(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movq 0x1d0(%rsp), %rax
movslq 0x1b0(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x940c
movq 0x1d8(%rsp), %rax
movl 0x1b0(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
shll %edx
subl $0x1, %edx
movq 0x1d0(%rsp), %rax
movl 0x1b0(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
addl (%rax,%rcx,4), %edx
movq 0x1d0(%rsp), %rax
movslq 0x1b0(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x940e
movl 0x1b0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1b0(%rsp)
jmp 0x9360
movl $0x0, 0x1ac(%rsp)
movl $0x0, 0x1a8(%rsp)
movl $0x0, 0x1a4(%rsp)
movl 0x1a4(%rsp), %eax
movl 0x1e8(%rsp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0x9a12
movq 0x1d8(%rsp), %rax
movslq 0x1a4(%rsp), %rcx
cmpl $0x2, (%rax,%rcx,4)
jle 0x99f8
movl $0x0, 0x1a0(%rsp)
movl 0x1a0(%rsp), %eax
movq 0x1d8(%rsp), %rcx
movslq 0x1a4(%rsp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x94fd
movq 0x1d0(%rsp), %rax
movslq 0x1a4(%rsp), %rcx
movl (%rax,%rcx,4), %esi
movl 0x1a0(%rsp), %eax
addl %eax, %esi
leaq 0x1978(%rsp), %rdi
callq 0x2400
movq %rax, 0x110(%rsp)
jmp 0x94d2
movq 0x110(%rsp), %rdi
leaq 0xdd66(%rip), %rsi      # 0x17247
callq 0x2220
jmp 0x94e8
jmp 0x94ea
movl 0x1a0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1a0(%rsp)
jmp 0x9483
leaq 0xe6ae(%rip), %rsi      # 0x17bb2
leaq 0x1978(%rsp), %rdi
callq 0x2220
movq %rax, 0x108(%rsp)
jmp 0x951b
movq 0x108(%rsp), %rdi
movq 0x14a96(%rip), %rsi     # 0x1dfc0
callq 0x2260
jmp 0x9531
movq 0x1d0(%rsp), %rax
movslq 0x1a4(%rsp), %rdx
movl (%rax,%rdx,4), %eax
movq 0x1d8(%rsp), %rcx
movl (%rcx,%rdx,4), %ecx
addl %ecx, %eax
movl %eax, 0x1ac(%rsp)
movq 0x1d0(%rsp), %rax
movslq 0x1a4(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x1a8(%rsp)
movl 0x1ac(%rsp), %esi
negl %esi
leaq 0x1978(%rsp), %rdi
callq 0x2400
movq %rax, 0x100(%rsp)
jmp 0x9592
movq 0x100(%rsp), %rdi
leaq 0xdca6(%rip), %rsi      # 0x17247
callq 0x2220
movq %rax, 0xf8(%rsp)
jmp 0x95b0
movq 0xf8(%rsp), %rdi
movl 0x1a8(%rsp), %esi
callq 0x2400
movq %rax, 0xf0(%rsp)
jmp 0x95ce
movq 0xf0(%rsp), %rdi
leaq 0xe5d5(%rip), %rsi      # 0x17bb2
callq 0x2220
movq %rax, 0xe8(%rsp)
jmp 0x95ec
movq 0xe8(%rsp), %rdi
movq 0x149c5(%rip), %rsi     # 0x1dfc0
callq 0x2260
jmp 0x9602
movl 0x1ac(%rsp), %esi
leaq 0x1978(%rsp), %rdi
callq 0x2400
movq %rax, 0xe0(%rsp)
jmp 0x9620
movq 0xe0(%rsp), %rdi
leaq 0xdc18(%rip), %rsi      # 0x17247
callq 0x2220
movq %rax, 0xd8(%rsp)
jmp 0x963e
movq 0xd8(%rsp), %rdi
movl 0x1a8(%rsp), %esi
negl %esi
callq 0x2400
movq %rax, 0xd0(%rsp)
jmp 0x965e
movq 0xd0(%rsp), %rdi
leaq 0xe545(%rip), %rsi      # 0x17bb2
callq 0x2220
movq %rax, 0xc8(%rsp)
jmp 0x967c
movq 0xc8(%rsp), %rdi
movq 0x14935(%rip), %rsi     # 0x1dfc0
callq 0x2260
jmp 0x9692
movl $0x0, 0x19c(%rsp)
movl 0x19c(%rsp), %eax
movq 0x1d8(%rsp), %rcx
movslq 0x1a4(%rsp), %rdx
movl (%rcx,%rdx,4), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jge 0x98f9
movl 0x1ac(%rsp), %esi
movl 0x19c(%rsp), %eax
addl %eax, %esi
notl %esi
leaq 0x1978(%rsp), %rdi
callq 0x2400
movq %rax, 0xc0(%rsp)
jmp 0x96eb
movq 0xc0(%rsp), %rdi
leaq 0xdb4d(%rip), %rsi      # 0x17247
callq 0x2220
movq %rax, 0xb8(%rsp)
jmp 0x9709
movq 0xb8(%rsp), %rdi
movl 0x1ac(%rsp), %esi
movl 0x19c(%rsp), %eax
addl %eax, %esi
callq 0x2400
movq %rax, 0xb0(%rsp)
jmp 0x9730
movq 0xb0(%rsp), %rdi
leaq 0xdb08(%rip), %rsi      # 0x17247
callq 0x2220
movq %rax, 0xa8(%rsp)
jmp 0x974e
movq 0xa8(%rsp), %rdi
movl 0x1a8(%rsp), %edx
movl 0x19c(%rsp), %eax
movl %eax, %ecx
movl %edx, %eax
leal 0x1(%rax,%rcx), %esi
callq 0x2400
movq %rax, 0xa0(%rsp)
jmp 0x977b
movq 0xa0(%rsp), %rdi
leaq 0xe428(%rip), %rsi      # 0x17bb2
callq 0x2220
movq %rax, 0x98(%rsp)
jmp 0x9799
movq 0x98(%rsp), %rdi
movq 0x14818(%rip), %rsi     # 0x1dfc0
callq 0x2260
jmp 0x97af
movl 0x1ac(%rsp), %edx
movl 0x19c(%rsp), %eax
movl %eax, %ecx
movl %edx, %eax
leal 0x1(%rax,%rcx), %esi
leaq 0x1978(%rsp), %rdi
callq 0x2400
movq %rax, 0x90(%rsp)
jmp 0x97dc
movq 0x90(%rsp), %rdi
leaq 0xda5c(%rip), %rsi      # 0x17247
callq 0x2220
movq %rax, 0x88(%rsp)
jmp 0x97fa
movq 0x88(%rsp), %rdi
movl 0x1ac(%rsp), %esi
movl 0x19c(%rsp), %eax
addl %eax, %esi
negl %esi
callq 0x2400
movq %rax, 0x80(%rsp)
jmp 0x9823
movq 0x80(%rsp), %rdi
leaq 0xe380(%rip), %rsi      # 0x17bb2
callq 0x2220
movq %rax, 0x78(%rsp)
jmp 0x983e
movq 0x78(%rsp), %rdi
movq 0x14776(%rip), %rsi     # 0x1dfc0
callq 0x2260
jmp 0x9851
movl 0x1ac(%rsp), %edx
movl 0x19c(%rsp), %eax
movl %eax, %ecx
movl %edx, %eax
leal 0x1(%rax,%rcx), %esi
leaq 0x1978(%rsp), %rdi
callq 0x2400
movq %rax, 0x70(%rsp)
jmp 0x987b
movq 0x70(%rsp), %rdi
leaq 0xd9c0(%rip), %rsi      # 0x17247
callq 0x2220
movq %rax, 0x68(%rsp)
jmp 0x9893
movq 0x68(%rsp), %rdi
movl 0x1a8(%rsp), %esi
movl 0x19c(%rsp), %eax
addl %eax, %esi
notl %esi
callq 0x2400
movq %rax, 0x60(%rsp)
jmp 0x98b6
movq 0x60(%rsp), %rdi
leaq 0xe2f0(%rip), %rsi      # 0x17bb2
callq 0x2220
movq %rax, 0x58(%rsp)
jmp 0x98ce
movq 0x58(%rsp), %rdi
movq 0x146e6(%rip), %rsi     # 0x1dfc0
callq 0x2260
jmp 0x98e1
jmp 0x98e3
movl 0x19c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x19c(%rsp)
jmp 0x969d
movl $0x0, 0x198(%rsp)
movl 0x198(%rsp), %eax
movq 0x1d8(%rsp), %rcx
movslq 0x1a4(%rsp), %rdx
movl (%rcx,%rdx,4), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x99f6
movq 0x1d0(%rsp), %rax
movslq 0x1a4(%rsp), %rdx
movl (%rax,%rdx,4), %eax
movq 0x1d8(%rsp), %rcx
movl (%rcx,%rdx,4), %ecx
addl %ecx, %eax
movl 0x198(%rsp), %ecx
addl %ecx, %eax
negl %eax
movl %eax, 0x1ac(%rsp)
movq 0x1d0(%rsp), %rax
movslq 0x1a4(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl 0x198(%rsp), %ecx
addl %ecx, %eax
notl %eax
movl %eax, 0x1a8(%rsp)
movl 0x1ac(%rsp), %esi
leaq 0x1978(%rsp), %rdi
callq 0x2400
movq %rax, 0x50(%rsp)
jmp 0x999b
movq 0x50(%rsp), %rdi
leaq 0xd8a0(%rip), %rsi      # 0x17247
callq 0x2220
movq %rax, 0x48(%rsp)
jmp 0x99b3
movq 0x48(%rsp), %rdi
movl 0x1a8(%rsp), %esi
callq 0x2400
movq %rax, 0x40(%rsp)
jmp 0x99cb
movq 0x40(%rsp), %rdi
leaq 0xe1de(%rip), %rsi      # 0x17bb5
callq 0x2220
jmp 0x99de
jmp 0x99e0
movl 0x198(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x198(%rsp)
jmp 0x9904
jmp 0x99fa
jmp 0x99fa
jmp 0x99fc
movl 0x1a4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1a4(%rsp)
jmp 0x9445
jmp 0x9a14
leaq 0xdb0(%rsp), %rax
movq %rax, 0x190(%rsp)
leaq 0x1f0(%rsp), %rax
movq %rax, 0x188(%rsp)
movq 0x190(%rsp), %rcx
xorl %eax, %eax
cmpb $0x0, (%rcx)
movb %al, 0x3f(%rsp)
je 0x9a7a
movq 0x190(%rsp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x20, %ecx
movb %al, 0x3e(%rsp)
je 0x9a72
movq 0x190(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x9, %eax
sete %al
movb %al, 0x3e(%rsp)
movb 0x3e(%rsp), %al
movb %al, 0x3f(%rsp)
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0x9a84
jmp 0x9a9a
movq 0x190(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x190(%rsp)
jmp 0x9a34
jmp 0x9a9c
movq 0x190(%rsp), %rcx
xorl %eax, %eax
cmpb $0x0, (%rcx)
movb %al, 0x3d(%rsp)
je 0x9af0
movq 0x190(%rsp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x20, %ecx
movb %al, 0x3d(%rsp)
je 0x9af0
movq 0x190(%rsp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x9, %ecx
movb %al, 0x3d(%rsp)
je 0x9af0
movq 0x190(%rsp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
setne %al
movb %al, 0x3d(%rsp)
movb 0x3d(%rsp), %al
testb $0x1, %al
jne 0x9afa
jmp 0x9b31
movq 0x190(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x190(%rsp)
movb (%rax), %cl
movq 0x188(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x188(%rsp)
movb %cl, (%rax)
jmp 0x9a9c
movq 0x188(%rsp), %rax
movb $0x0, (%rax)
leaq 0x1f0(%rsp), %rdi
callq 0x2120
cmpq $0x0, %rax
je 0x9d4b
leaq 0x1f0(%rsp), %rdi
leaq 0xe057(%rip), %rsi      # 0x17bb9
leaq 0x1cc(%rsp), %rdx
leaq 0x1bb(%rsp), %rcx
leaq 0x1c8(%rsp), %r8
movb $0x0, %al
callq 0x2210
movl %eax, 0x1c4(%rsp)
movsbl 0x1bb(%rsp), %eax
cmpl $0x21, %eax
jne 0x9bd2
leaq 0x1f0(%rsp), %rdi
leaq 0xe01e(%rip), %rsi      # 0x17bc2
leaq 0x1cc(%rsp), %rdx
leaq 0x1bb(%rsp), %rcx
leaq 0x1ba(%rsp), %r8
leaq 0x1c8(%rsp), %r9
movb $0x0, %al
callq 0x2210
movl %eax, 0x1c4(%rsp)
cmpl $0x0, 0x1cc(%rsp)
je 0x9d49
movq 0x1d8(%rsp), %rax
movslq 0x1cc(%rsp), %rcx
cmpl $0x2, (%rax,%rcx,4)
jle 0x9ca5
movq 0x1d0(%rsp), %rax
movslq 0x1cc(%rsp), %rcx
movl (%rax,%rcx,4), %eax
addl 0x1c8(%rsp), %eax
movl %eax, 0x1cc(%rsp)
movsbl 0x1bb(%rsp), %eax
cmpl $0x21, %eax
jne 0x9c70
leaq 0xdf9f(%rip), %rsi      # 0x17bce
leaq 0x1978(%rsp), %rdi
callq 0x2220
movq %rax, 0x30(%rsp)
jmp 0x9c43
movq 0x30(%rsp), %rdi
movl 0x1cc(%rsp), %esi
callq 0x2400
movq %rax, 0x28(%rsp)
jmp 0x9c5b
movq 0x28(%rsp), %rdi
leaq 0xd5e0(%rip), %rsi      # 0x17247
callq 0x2220
jmp 0x9c6e
jmp 0x9ca0
movl 0x1cc(%rsp), %esi
leaq 0x1978(%rsp), %rdi
callq 0x2400
movq %rax, 0x20(%rsp)
jmp 0x9c8b
movq 0x20(%rsp), %rdi
leaq 0xd5b0(%rip), %rsi      # 0x17247
callq 0x2220
jmp 0x9c9e
jmp 0x9ca0
jmp 0x9d47
cmpl $0x1, 0x1c8(%rsp)
jne 0x9cf9
movq 0x1d0(%rsp), %rax
movslq 0x1cc(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x1cc(%rsp)
movl 0x1cc(%rsp), %esi
leaq 0x1978(%rsp), %rdi
callq 0x2400
movq %rax, 0x18(%rsp)
jmp 0x9ce4
movq 0x18(%rsp), %rdi
leaq 0xd557(%rip), %rsi      # 0x17247
callq 0x2220
jmp 0x9cf7
jmp 0x9d45
movq 0x1d0(%rsp), %rax
movslq 0x1cc(%rsp), %rcx
movl (%rax,%rcx,4), %eax
negl %eax
movl %eax, 0x1cc(%rsp)
movl 0x1cc(%rsp), %esi
leaq 0x1978(%rsp), %rdi
callq 0x2400
movq %rax, 0x10(%rsp)
jmp 0x9d30
movq 0x10(%rsp), %rdi
leaq 0xd50b(%rip), %rsi      # 0x17247
callq 0x2220
jmp 0x9d43
jmp 0x9d45
jmp 0x9d47
jmp 0x9d49
jmp 0x9d4b
jmp 0x9d4d
movq 0x190(%rsp), %rax
cmpb $0x0, (%rax)
jne 0x9a24
leaq 0xde4e(%rip), %rsi      # 0x17bb3
leaq 0x1978(%rsp), %rdi
callq 0x2220
movq %rax, 0x8(%rsp)
jmp 0x9d79
movq 0x8(%rsp), %rdi
movq 0x1423b(%rip), %rsi     # 0x1dfc0
callq 0x2260
jmp 0x9d8c
jmp 0x9d8e
jmp 0x9d90
jmp 0x9d92
jmp 0x9033
leaq 0x1b78(%rsp), %rdi
callq 0x20a0
jmp 0x9da6
leaq 0x1978(%rsp), %rdi
callq 0x2360
jmp 0x9db5
leaq 0x1978(%rsp), %rdi
callq 0x2380
leaq 0x1b78(%rsp), %rdi
callq 0x20b0
addq $0x1d88, %rsp           # imm = 0x1D88
retq
leaq 0x1b78(%rsp), %rdi
callq 0x20b0
movq 0x1970(%rsp), %rdi
callq 0x2410
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)