// File: /workspace/github_cpp_makefile_star2_O2/ashlall[P]StreamStats/ChiSquareExperiments/VaryMemoryCategorical.cpp
// Function: main
int main(int argc, char* argv[])
{
  if (argc < 5)
  {
    cout << "usage: VaryMemoryCategorical lower-memory upper-memory filename1 filename2" << endl;
    exit(1);
  }
  
  double lower = atof(argv[1]), upper = atof(argv[2]);
  char *filename1 = argv[3], *filename2 = argv[4];

  double memory_percent, mem = lower;
  int repeats = 0;
  while (mem <= (upper + 0.00000001))
  {
    repeats++;
    mem += 10;
  }

  double actual_values[repeats], estimated_values[repeats], percents[repeats];
  long times[repeats];
  long times2[repeats];
  std::vector<double> data1, data2;
  std::unordered_map<double,int> stream1, stream2;

  // creates and initializes the log file
  ofstream data_file;
  char str[100];
  name_file(str, argv, 0);
  data_file.open(str);
  ifstream input_file;
  char output[100];
  int stream_size1 = 0, stream_size2 = 0;

  input_file.open(filename1);
  while (!input_file.eof())
    {
      input_file >> output;
      data1.push_back(atof(output));
      stream_size1++;
      if (stream1.find(atof(output)) == stream1.end())
	stream1.insert(std::make_pair(atof(output),1));
      else
	stream1[atof(output)] += 1;
    }
  input_file.close();

  input_file.open(filename2);
  while (!input_file.eof())
    {
      input_file >> output;
      data2.push_back(atof(output));
      stream_size2++;
      if (stream2.find(atof(output)) == stream2.end())
	stream2.insert(std::make_pair(atof(output),1));
      else
	stream2[atof(output)] += 1;
    }
  input_file.close();

  data_file << filename1 << endl << filename2 << endl;
  data_file << "stream 1 size: " << stream_size1 << endl;
  data_file << "stream 2 size: " << stream_size2 << endl;
  data_file << "number of categories: " << stream1.size() << endl;
  memory_percent = lower;
  int i = 0, num_categories;


  while (memory_percent <= (upper + 0.00000001)) //accounts for rounding
  {
    data_file << "memory percent: " << memory_percent << endl;
    percents[i] = memory_percent;

    // calculates the estimated statistic
    ChiSquareCategorical sketch1(memory_percent);
    ChiSquareCategorical sketch2(memory_percent);

	timeval timeBefore, timeAfter; // initializes variables
  	long diffSeconds, diffUSeconds;
 	gettimeofday(&timeBefore, NULL); 

    for (std::vector<double>::iterator j = data1.begin(); j != data1.end();j++)
      sketch1.insert(*j);
    for (std::vector<double>::iterator j = data2.begin(); j != data2.end();j++)
      sketch2.insert(*j);

	gettimeofday(&timeAfter, NULL); // get time for insertion
  	diffSeconds = timeAfter.tv_sec - timeBefore.tv_sec;
  	diffUSeconds = timeAfter.tv_usec - timeBefore.tv_usec;

	times[i] = diffSeconds;
	times2[i] = diffUSeconds;

    double estimated_stat = sketch1.calculate_statistic(sketch2, 0);

    estimated_values[i] = estimated_stat;
    data_file << "estimate = " << estimated_stat << endl;

    // calculates actual statistic
    double constant1 = sqrt(double(stream_size2) / double(stream_size1));
    double constant2 = sqrt(double(stream_size1) / double(stream_size2));
    double actual_stat = 0;

    for (std::unordered_map<double,int>::const_iterator j = stream1.begin(); j!= stream1.end(); j++)
    {
      double frequency1 = j->second;
      double frequency2 = 0;
      num_categories++;
      if (stream2.find(j->first) != stream2.end())
	frequency2 = stream2[j->first];
      double value = frequency1 * constant1 - frequency2 * constant2;
      actual_stat += (value * value) / (frequency1 + frequency2);
    }
    // have to loop through other stream to find when first one is 0
    for (std::unordered_map<double,int>::const_iterator j = stream2.begin(); j!= stream2.end(); j++)
    {
      if (stream1.find(j->first) == stream1.end())
      {
	num_categories++;
	int frequency1 = 0;
	int frequency2 = j->second;
	double value = frequency1 * constant1 - frequency2 * constant2;
	actual_stat += (value * value) / (frequency1 + frequency2);
      }
    }
    actual_values[i] = actual_stat;
    data_file << "actual = " << actual_stat << endl;
    i++;
    memory_percent += 10;
  }
  data_file.close();

  // creates pvalues file
  name_file(str, argv, 3);
  data_file.open(str);

  // creates table file
  ofstream data2_file;
  name_file(str, argv, 1);
  data2_file.open(str);

  // creates time table file
  ofstream time_file;
  char str2[150];
  name_file(str2, argv, 5);
  time_file.open(str2);

  // creates extra file
  ofstream data3_file;
  name_file(str, argv, 2);
  data3_file.open(str);

  int deg_freedom = num_categories - 1;
  for (int i = 0; i < repeats; i++)
    {
      // adds values to the table
      data2_file << percents[i] << "\t";
      double error = abs(pochisq(estimated_values[i], deg_freedom) - pochisq(actual_values[i], deg_freedom));
      data2_file << error << endl;

	  // adds values to the time table
	  time_file << percents[i] << "\t";
      long double avg_time = times[i] + times2[i]/1000000.0;
      time_file << avg_time << endl;
	  
      // adds values to pvalue file
      data_file << pochisq(actual_values[i], deg_freedom) << " actual" << endl;
      data_file << pochisq(estimated_values[i], deg_freedom) << " estimated" << endl;

      // adds values to extra file
      data3_file << percents[i] << "\t";
      error = abs(estimated_values[i] - actual_values[i]) / actual_values[i];
      data3_file << error << endl;
    }
  data3_file.close();
  data2_file.close();
  data_file.close(); 
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xcd8, %rsp            # imm = 0xCD8
cmpl $0x4, %edi
jle 0x3920
movq %rsi, %rbx
movq 0x8(%rsi), %rdi
callq 0x21f0
movsd %xmm0, -0x38(%rbp)
movq 0x10(%rbx), %rdi
callq 0x21f0
movq 0x18(%rbx), %r14
addsd 0x2267(%rip), %xmm0     # 0x5130
movsd %xmm0, -0x78(%rbp)
movq 0x20(%rbx), %rax
movq %rax, -0x30(%rbp)
xorl %eax, %eax
movsd -0x38(%rbp), %xmm0
movsd -0x78(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jb 0x2ef5
addsd 0x2248(%rip), %xmm0     # 0x5138
incq %rax
jmp 0x2ee2
movq %rbx, -0x48(%rbp)
movq %rsp, %rcx
movq %rax, -0xf0(%rbp)
leaq 0xf(,%rax,8), %rax
andq $-0x10, %rax
subq %rax, %rcx
movq %rcx, -0x50(%rbp)
movq %rcx, %rsp
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x68(%rbp)
movq %rcx, %rsp
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x70(%rbp)
movq %rcx, %rsp
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x60(%rbp)
movq %rcx, %rsp
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x58(%rbp)
movq %rcx, %rsp
andq $0x0, -0xc0(%rbp)
xorpd %xmm0, %xmm0
andq $0x0, -0xa0(%rbp)
movapd %xmm0, -0xd0(%rbp)
movapd %xmm0, -0xb0(%rbp)
leaq -0x118(%rbp), %rax
movq %rax, -0x30(%rax)
pushq $0x1
popq %rdx
movq %rdx, -0x28(%rax)
movupd %xmm0, -0x20(%rax)
movl $0x3f800000, %ecx       # imm = 0x3F800000
movl %ecx, -0x10(%rax)
movupd %xmm0, -0x8(%rax)
leaq -0x150(%rbp), %rax
movq %rax, -0x30(%rax)
movq %rdx, -0x28(%rax)
movupd %xmm0, -0x20(%rax)
movl %ecx, -0x10(%rax)
movupd %xmm0, -0x8(%rax)
leaq -0x7f0(%rbp), %rdi
callq 0x22a0
leaq -0x3f0(%rbp), %rbx
movq %rbx, %rdi
movq -0x48(%rbp), %rsi
xorl %edx, %edx
callq 0x3a2a
leaq -0x7f0(%rbp), %rdi
pushq $0x10
popq %rdx
movq %rbx, %rsi
callq 0x2040
leaq -0xa98(%rbp), %rdi
callq 0x21d0
leaq -0xa98(%rbp), %rdi
pushq $0x8
popq %rdx
movq %r14, -0x40(%rbp)
movq %r14, %rsi
callq 0x2100
xorl %r13d, %r13d
leaq -0xb00(%rbp), %r14
leaq -0xd0(%rbp), %r15
leaq -0x380(%rbp), %r12
leaq -0x148(%rbp), %rbx
movq -0xa98(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x2, -0xa78(%rbp,%rax)
jne 0x30d1
leaq -0xa98(%rbp), %rdi
movq %r14, %rsi
callq 0x3bea
movq %r14, %rdi
callq 0x21f0
movsd %xmm0, -0x380(%rbp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x41c6
movq %r14, %rdi
callq 0x21f0
movsd %xmm0, -0x380(%rbp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4346
movq %r14, %rdi
testq %rax, %rax
je 0x30a7
callq 0x21f0
movsd %xmm0, -0x380(%rbp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x47e2
incl (%rax)
jmp 0x30c9
callq 0x21f0
movsd %xmm0, -0x380(%rbp)
movl $0x1, -0x378(%rbp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4478
incl %r13d
jmp 0x3025
leaq -0xa98(%rbp), %rdi
callq 0x2060
leaq -0xa98(%rbp), %rdi
pushq $0x8
popq %rdx
movq -0x30(%rbp), %rsi
callq 0x2100
xorl %ebx, %ebx
leaq -0xb00(%rbp), %r14
leaq -0x380(%rbp), %r12
leaq -0x180(%rbp), %r15
movq -0xa98(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x2, -0xa78(%rbp,%rax)
jne 0x31b6
leaq -0xa98(%rbp), %rdi
movq %r14, %rsi
callq 0x3bea
movq %r14, %rdi
callq 0x21f0
movsd %xmm0, -0x380(%rbp)
leaq -0xb0(%rbp), %rdi
movq %r12, %rsi
callq 0x41c6
movq %r14, %rdi
callq 0x21f0
movsd %xmm0, -0x380(%rbp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x4346
movq %r14, %rdi
testq %rax, %rax
je 0x318d
callq 0x21f0
movsd %xmm0, -0x380(%rbp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x47e2
incl (%rax)
jmp 0x31af
callq 0x21f0
movsd %xmm0, -0x380(%rbp)
movl $0x1, -0x378(%rbp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x4478
incl %ebx
jmp 0x3107
leaq -0xa98(%rbp), %rdi
callq 0x2060
leaq -0x7f0(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x21b0
movq %rax, %rdi
callq 0x20c0
movq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0x21b0
movq %rax, %rdi
callq 0x20c0
leaq 0x20a2(%rip), %rsi      # 0x5297
leaq -0x7f0(%rbp), %rdi
callq 0x21b0
movq %rax, %rdi
movl %r13d, %esi
callq 0x22c0
movq %rax, %rdi
callq 0x20c0
leaq 0x208c(%rip), %rsi      # 0x52a7
leaq -0x7f0(%rbp), %rdi
callq 0x21b0
movq %rax, %rdi
movl %ebx, %esi
callq 0x22c0
movq %rax, %rdi
callq 0x20c0
leaq 0x2077(%rip), %rsi      # 0x52b7
leaq -0x7f0(%rbp), %rdi
callq 0x21b0
movq -0x130(%rbp), %rsi
movq %rax, %rdi
callq 0x2110
movq %rax, %rdi
callq 0x20c0
cvtsi2sd %ebx, %xmm0
cvtsi2sd %r13d, %xmm1
movapd %xmm0, %xmm2
divsd %xmm1, %xmm2
sqrtsd %xmm2, %xmm2
divsd %xmm0, %xmm1
sqrtsd %xmm1, %xmm0
movapd 0x1ec8(%rip), %xmm1     # 0x5150
movapd %xmm0, -0xe0(%rbp)
xorpd %xmm0, %xmm1
movapd %xmm1, -0x110(%rbp)
xorl %r13d, %r13d
leaq -0x5f0(%rbp), %r15
xorpd %xmm0, %xmm0
movsd %xmm2, -0x90(%rbp)
mulsd %xmm2, %xmm0
movsd %xmm0, -0xe8(%rbp)
leaq -0x180(%rbp), %rbx
movsd -0x38(%rbp), %xmm1
movsd %xmm1, -0x38(%rbp)
movsd -0x78(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x35f4
leaq -0x7f0(%rbp), %rdi
leaq 0x1fe2(%rip), %rsi      # 0x52ce
callq 0x21b0
movq %rax, %rdi
movsd -0x38(%rbp), %xmm0
callq 0x2260
movq %rax, %rdi
callq 0x20c0
leaq -0x320(%rbp), %rax
movq %rax, -0x350(%rbp)
pushq $0x1
popq %rax
movq %rax, -0x348(%rbp)
leaq -0x350(%rbp), %rcx
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rcx)
movl $0x3f800000, %edx       # imm = 0x3F800000
movl %edx, -0x330(%rbp)
movupd %xmm0, 0x28(%rcx)
andq $0x0, -0x380(%rbp)
andq $0x0, -0x360(%rbp)
leaq -0x590(%rbp), %rcx
movq %rcx, -0x5c0(%rbp)
movq %rax, -0x5b8(%rbp)
leaq -0x5c0(%rbp), %rax
movupd %xmm0, 0x10(%rax)
movl %edx, -0x5a0(%rbp)
movupd %xmm0, 0x28(%rax)
andq $0x0, -0x5f0(%rbp)
movq -0x70(%rbp), %rax
movsd -0x38(%rbp), %xmm0
movsd %xmm0, (%rax,%r13,8)
andq $0x0, -0x5d0(%rbp)
movsd %xmm0, -0x370(%rbp)
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, -0x358(%rbp)
movsd %xmm0, -0x5e0(%rbp)
movq %rax, -0x5c8(%rbp)
leaq -0xd00(%rbp), %rdi
xorl %esi, %esi
callq 0x2270
movq -0xd0(%rbp), %r12
cmpq -0xc8(%rbp), %r12
je 0x33f7
movsd (%r12), %xmm0
leaq -0x380(%rbp), %rdi
callq 0x24a0
addq $0x8, %r12
jmp 0x33d6
movq -0xb0(%rbp), %r12
cmpq -0xa8(%rbp), %r12
je 0x341b
movsd (%r12), %xmm0
movq %r15, %rdi
callq 0x24a0
addq $0x8, %r12
jmp 0x33fe
leaq -0x890(%rbp), %rdi
xorl %esi, %esi
callq 0x2270
movq -0x890(%rbp), %rax
movq -0x888(%rbp), %rcx
subq -0xd00(%rbp), %rax
subq -0xcf8(%rbp), %rcx
movq -0x60(%rbp), %rdx
movq %rax, (%rdx,%r13,8)
movq -0x58(%rbp), %rax
movq %rcx, (%rax,%r13,8)
leaq -0x380(%rbp), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x254e
movq -0x68(%rbp), %rax
movsd %xmm0, (%rax,%r13,8)
leaq -0x7f0(%rbp), %rdi
leaq 0x1e61(%rip), %rsi      # 0x52df
movsd %xmm0, -0x30(%rbp)
callq 0x21b0
movsd -0x30(%rbp), %xmm0
movq %rax, %rdi
callq 0x2260
movq %rax, %rdi
callq 0x20c0
movq %r13, -0xf8(%rbp)
xorpd %xmm0, %xmm0
leaq -0x138(%rbp), %r13
movq (%r13), %r13
testq %r13, %r13
je 0x3528
movsd %xmm0, -0x30(%rbp)
leaq 0x8(%r13), %r12
cvtsi2sdl 0x10(%r13), %xmm0
movsd %xmm0, -0x40(%rbp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4346
testq %rax, %rax
je 0x34ed
movq %rbx, %rdi
movq %r12, %rsi
callq 0x48c2
cvtsi2sdl (%rax), %xmm0
jmp 0x34f1
xorpd %xmm0, %xmm0
movapd -0xe0(%rbp), %xmm1
mulsd %xmm0, %xmm1
movsd -0x40(%rbp), %xmm2
addsd %xmm2, %xmm0
mulsd -0x90(%rbp), %xmm2
subsd %xmm1, %xmm2
mulsd %xmm2, %xmm2
divsd %xmm0, %xmm2
movsd -0x30(%rbp), %xmm0
addsd %xmm2, %xmm0
incl %r14d
jmp 0x34af
leaq -0x170(%rbp), %r12
movq -0xf8(%rbp), %r13
movsd %xmm0, -0x30(%rbp)
movq (%r12), %r12
testq %r12, %r12
je 0x3590
leaq 0x8(%r12), %rsi
leaq -0x148(%rbp), %rdi
callq 0x4346
testq %rax, %rax
movsd -0x30(%rbp), %xmm0
jne 0x353b
incl %r14d
cvtsi2sdl 0x10(%r12), %xmm0
movapd -0x110(%rbp), %xmm1
mulsd %xmm0, %xmm1
addsd -0xe8(%rbp), %xmm1
mulsd %xmm1, %xmm1
divsd %xmm0, %xmm1
movsd -0x30(%rbp), %xmm0
addsd %xmm1, %xmm0
jmp 0x3536
movq -0x50(%rbp), %rax
movsd %xmm0, (%rax,%r13,8)
leaq -0x7f0(%rbp), %rdi
leaq 0x1d43(%rip), %rsi      # 0x52eb
callq 0x21b0
movq %rax, %rdi
movsd -0x30(%rbp), %xmm0
callq 0x2260
movq %rax, %rdi
callq 0x20c0
incq %r13
movsd -0x38(%rbp), %xmm0
addsd 0x1b66(%rip), %xmm0     # 0x5138
movsd %xmm0, -0x38(%rbp)
leaq -0x5c0(%rbp), %rdi
callq 0x3c0c
leaq -0x350(%rbp), %rdi
callq 0x3c0c
jmp 0x32c5
leaq -0x7f0(%rbp), %rdi
callq 0x2210
leaq -0x3f0(%rbp), %rbx
pushq $0x3
popq %rdx
movq %rbx, %rdi
movq -0x48(%rbp), %rsi
callq 0x3a2a
leaq -0x7f0(%rbp), %rdi
pushq $0x10
popq %rdx
movq %rbx, %rsi
callq 0x2040
leaq -0x380(%rbp), %rdi
callq 0x22a0
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq -0x48(%rbp), %rsi
callq 0x3a2a
leaq -0x380(%rbp), %rdi
pushq $0x10
popq %rdx
movq %rbx, %rsi
callq 0x2040
leaq -0x5f0(%rbp), %rdi
callq 0x22a0
leaq -0x890(%rbp), %rbx
pushq $0x5
popq %rdx
movq %rbx, %rdi
movq -0x48(%rbp), %rsi
callq 0x3a2a
leaq -0x5f0(%rbp), %rdi
pushq $0x10
popq %rdx
movq %rbx, %rsi
callq 0x2040
leaq -0xd00(%rbp), %rdi
callq 0x22a0
leaq -0x3f0(%rbp), %rbx
pushq $0x2
popq %rdx
movq %rbx, %rdi
movq -0x48(%rbp), %rsi
callq 0x3a2a
leaq -0xd00(%rbp), %rdi
pushq $0x10
popq %rdx
movq %rbx, %rsi
callq 0x2040
decl %r14d
xorl %r12d, %r12d
leaq 0x1c2b(%rip), %r15      # 0x52f5
leaq -0x7f0(%rbp), %r13
leaq -0xd00(%rbp), %rbx
subq $0x1, -0xf0(%rbp)
jb 0x387f
movq -0x70(%rbp), %rax
movsd (%rax,%r12), %xmm0
leaq -0x380(%rbp), %rdi
movsd %xmm0, -0x30(%rbp)
callq 0x2260
movq %rax, %rdi
movq %r15, %rsi
callq 0x21b0
movq -0x68(%rbp), %rax
movsd (%rax,%r12), %xmm0
movaps %xmm0, -0x90(%rbp)
movl %r14d, %edi
callq 0x2a6a
movaps %xmm0, -0xe0(%rbp)
movq -0x50(%rbp), %rax
movsd (%rax,%r12), %xmm0
movsd %xmm0, -0x40(%rbp)
movl %r14d, %edi
callq 0x2a6a
movapd -0xe0(%rbp), %xmm1
subsd %xmm0, %xmm1
andpd 0x1a09(%rip), %xmm1     # 0x5160
movapd %xmm1, %xmm0
leaq -0x380(%rbp), %rdi
callq 0x2260
movq %rax, %rdi
callq 0x20c0
leaq -0x5f0(%rbp), %rdi
movsd -0x30(%rbp), %xmm0
callq 0x2260
movq %rax, %rdi
movq %r15, %rsi
callq 0x21b0
movq -0x60(%rbp), %rax
cvtsi2sdq (%rax,%r12), %xmm0
movq -0x58(%rbp), %rax
cvtsi2sdq (%rax,%r12), %xmm1
divsd 0x1999(%rip), %xmm1     # 0x5140
addsd %xmm0, %xmm1
movsd %xmm1, -0x100(%rbp)
fldl -0x100(%rbp)
subq $0x10, %rsp
fstpt (%rsp)
leaq -0x5f0(%rbp), %rdi
callq 0x20d0
popq %rcx
popq %rdx
movq %rax, %rdi
callq 0x20c0
movsd -0x40(%rbp), %xmm0
movl %r14d, %edi
callq 0x2a6a
movq %r13, %rdi
callq 0x2260
movq %rax, %rdi
leaq 0x1b02(%rip), %rsi      # 0x52f7
callq 0x21b0
movq %rax, %rdi
callq 0x20c0
movapd -0x90(%rbp), %xmm0
movl %r14d, %edi
callq 0x2a6a
movq %r13, %rdi
callq 0x2260
movq %rax, %rdi
leaq 0x1adb(%rip), %rsi      # 0x52ff
callq 0x21b0
movq %rax, %rdi
callq 0x20c0
movq %rbx, %rdi
movsd -0x30(%rbp), %xmm0
callq 0x2260
movq %rax, %rdi
movq %r15, %rsi
callq 0x21b0
movapd -0x90(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
subsd %xmm1, %xmm0
andpd 0x18fe(%rip), %xmm0     # 0x5160
divsd %xmm1, %xmm0
movq %rbx, %rdi
callq 0x2260
movq %rax, %rdi
callq 0x20c0
addq $0x8, %r12
jmp 0x36d8
leaq -0xd00(%rbp), %rdi
callq 0x2210
leaq -0x380(%rbp), %rdi
callq 0x2210
leaq -0x7f0(%rbp), %rdi
callq 0x2210
leaq -0xd00(%rbp), %rdi
callq 0x2240
leaq -0x5f0(%rbp), %rdi
callq 0x2240
leaq -0x380(%rbp), %rdi
callq 0x2240
leaq -0xa98(%rbp), %rdi
callq 0x2070
leaq -0x7f0(%rbp), %rdi
callq 0x2240
leaq -0x180(%rbp), %rdi
callq 0x3cbc
leaq -0x148(%rbp), %rdi
callq 0x3cbc
leaq -0xb0(%rbp), %rdi
callq 0x41b2
leaq -0xd0(%rbp), %rdi
callq 0x41b2
xorl %eax, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x46b1(%rip), %rdi      # 0x7fd8
leaq 0x191e(%rip), %rsi      # 0x524c
callq 0x21b0
movq %rax, %rdi
callq 0x20c0
pushq $0x1
popq %rdi
callq 0x21e0
jmp 0x398e
jmp 0x3947
movq %rax, %rbx
jmp 0x399d
jmp 0x394e
movq %rax, %rbx
jmp 0x39a9
jmp 0x3985
jmp 0x3957
movq %rax, %rbx
jmp 0x39e6
movq %rax, %rbx
jmp 0x39f2
jmp 0x3985
jmp 0x398e
jmp 0x3985
jmp 0x3985
jmp 0x3985
jmp 0x3985
jmp 0x3985
jmp 0x3985
jmp 0x3985
jmp 0x3985
jmp 0x3985
jmp 0x3985
jmp 0x3985
jmp 0x398e
jmp 0x39bf
movq %rax, %rbx
jmp 0x39da
jmp 0x398e
jmp 0x39bf
movq %rax, %rbx
leaq -0xd00(%rbp), %rdi
callq 0x2240
leaq -0x5f0(%rbp), %rdi
callq 0x2240
leaq -0x380(%rbp), %rdi
callq 0x2240
jmp 0x39da
jmp 0x39bf
jmp 0x39bf
jmp 0x39bf
jmp 0x39bf
movq %rax, %rbx
leaq -0x5c0(%rbp), %rdi
callq 0x3c0c
leaq -0x350(%rbp), %rdi
callq 0x3c0c
leaq -0xa98(%rbp), %rdi
callq 0x2070
leaq -0x7f0(%rbp), %rdi
callq 0x2240
leaq -0x180(%rbp), %rdi
callq 0x3cbc
leaq -0x148(%rbp), %rdi
callq 0x3cbc
leaq -0xb0(%rbp), %rdi
callq 0x41b2
leaq -0xd0(%rbp), %rdi
callq 0x41b2
movq %rbx, %rdi
callq 0x22d0