// File: /workspace/github_cpp_makefile_star2_O1/ashlall[P]StreamStats/ChiSquareExperiments/VaryMemoryReal.cpp
// Function: main
int main(int argc, char* argv[])
{
  if (argc < 6)
  {
    cout << "usage: VaryMemoryReal lower-memory upper-memory filename1 filename2 num_bins\n";
    exit(1);
  }

  double lower = atof(argv[1]), upper = atof(argv[2]);
  char *filename1 = argv[3], *filename2 = argv[4];
  int num_buckets = atoi(argv[5]);

  if (lower <=0 || upper <= 0)
  {
    cout << "The memory must be greater than 0.\n";
    exit(1);
  }
  if (num_buckets <= 0)
  {
    cout << "The number of buckets must be greater than 0.\n";
    exit(1);
  }

  // finds the number of times the experiment will run
  double memory_percent;
  int repeats = 0;
  double mem = lower;
  while (mem <= (upper + 0.0000001)) // accounts for rounding error
  {
    repeats++;
    mem *= sqrt(10);
  }

  double actual_values[repeats];
  double GK_values[repeats];
  double QD_values[repeats];
  double RS_values[repeats];
  double percents[repeats];
  std::vector<double> data1, data2;

  // 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;

  std::default_random_engine generator(1);
  std::uniform_real_distribution<double> distribution(0.0, 1.0);

  input_file.open(filename1);
  while (!input_file.eof())
  {
    input_file >> output;
    data1.push_back(atof(output) + (distribution(generator) * 0.000000001));
    stream_size1++;
  }
  input_file.close();

  input_file.open(filename2);
  while (!input_file.eof())
  {
    input_file >> output;
    data2.push_back(atof(output) + (distribution(generator) * 0.000000001));
    stream_size2++;
  }
  input_file.close();

  data_file << filename1 << endl << filename2 << endl;
  data_file << "num_buckets: " << num_buckets << endl;
  data_file << "stream 1 size: " << stream_size1 << endl;
  data_file << "stream 2 size: " << stream_size2 << endl;
  memory_percent = lower;
  int i = 0;
  while (memory_percent <= (upper + 0.00000001)) //accounts for rounding
  {
    data_file << "memory percent: " << memory_percent << endl;
    percents[i] = memory_percent;
    int sample_size1 = memory_percent * stream_size1;
    int sample_size2 = memory_percent * stream_size2;

    // calculates GK statistic
    ChiSquareContinuous GK_sketch1(sample_size1,1);
    for (std::vector<double>::iterator j = data1.begin(); j != data1.end();j++)
      GK_sketch1.insert(*j);
    ChiSquareContinuous GK_sketch2(sample_size2,1);
    for (std::vector<double>::iterator j = data2.begin(); j != data2.end();j++)
      GK_sketch2.insert(*j);
    
    double GK_stat = GK_sketch1.two_sample_statistic(GK_sketch2, num_buckets);
    GK_values[i] = GK_stat;
    data_file << "GK = " << GK_stat << endl;

    // calculates real statistic
    double *upper_intervals = GK_sketch1.get_upper();
    double *lower_intervals = GK_sketch1.get_lower();
    double constant_1 = sqrt((double)stream_size2/stream_size1);
    double constant_2 = sqrt((double)stream_size1/stream_size2);
    double chi_squared = 0;

    for (int i = 0; i < num_buckets; i++)
    {
      double frequency1 = 0, frequency2 = 0;
      for (std::vector<double>::iterator j = data1.begin(); j!=data1.end();j++)
	{
        if (*j <= upper_intervals[i+1] && *j > lower_intervals[i+1])
          frequency1++;
      }
      for (std::vector<double>::iterator j = data2.begin(); j!=data2.end();j++)
      {
        if (*j <= upper_intervals[i+1] && *j > lower_intervals[i+1])
	  frequency2++;
      }

      double lambda = frequency1 * constant_1 - frequency2 * constant_2;
      chi_squared += (lambda * lambda) / (frequency1 + frequency2);
    }

    actual_values[i] = chi_squared;
    data_file << "actual = " << chi_squared << endl;

    memory_percent *= sqrt(10);
    i++;
  }
  data_file.close();

  // creates pvalue 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 extra file
  ofstream data3_file;
  name_file(str, argv, 2);
  data3_file.open(str);

  int deg_freedom = num_buckets;
  if (stream_size1 != stream_size2)
    deg_freedom--;
  for (int i = 0; i < repeats; i++)
  {
    // adds values to the table
    data2_file << percents[i] * 100 << "\t";
    double error = abs(pochisq(GK_values[i], deg_freedom) - pochisq(actual_values[i], deg_freedom));
    data2_file << error << endl;

    // adds values to pvalue file
    data_file << pochisq(actual_values[i], deg_freedom) << " actual" << endl;
    data_file << pochisq(GK_values[i], deg_freedom) << " GK" << endl;

    // adds values to extra file
    data3_file << percents[i] * 100 << "\t";
    error = abs(GK_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 $0x9b8, %rsp            # imm = 0x9B8
cmpl $0x5, %edi
jle 0x5bf0
movq %rsi, %rbx
movq 0x8(%rsi), %rdi
callq 0x2280
movsd %xmm0, -0x38(%rbp)
movq 0x10(%rbx), %rdi
callq 0x2280
movsd %xmm0, -0x58(%rbp)
movq 0x18(%rbx), %r12
movq 0x20(%rbx), %r15
movq 0x28(%rbx), %rdi
callq 0x22f0
movsd -0x58(%rbp), %xmm1
movl %eax, -0x2c(%rbp)
xorpd %xmm0, %xmm0
ucomisd -0x38(%rbp), %xmm0
jae 0x5c00
ucomisd %xmm1, %xmm0
jae 0x5c00
cmpl $0x0, -0x2c(%rbp)
jle 0x5c10
movsd 0x325c(%rip), %xmm0     # 0x8168
addsd -0x58(%rbp), %xmm0
xorl %eax, %eax
ucomisd -0x38(%rbp), %xmm0
jb 0x4f35
xorl %eax, %eax
movsd 0x324c(%rip), %xmm1     # 0x8170
movsd -0x38(%rbp), %xmm2
incl %eax
mulsd %xmm1, %xmm2
ucomisd %xmm2, %xmm0
jae 0x4f29
movq %rbx, -0x68(%rbp)
movl %eax, -0xb4(%rbp)
movl %eax, %eax
movq %rsp, %rcx
movq %rax, -0x100(%rbp)
leaq 0xf(,%rax,8), %rax
andq $-0x10, %rax
subq %rax, %rcx
movq %rcx, -0xc0(%rbp)
movq %rcx, %rsp
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0xc8(%rbp)
movq %rcx, %rsp
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0xd0(%rbp)
movq %rcx, %rsp
xorl %eax, %eax
movq %rax, -0x90(%rbp)
xorpd %xmm0, %xmm0
movapd %xmm0, -0xa0(%rbp)
movq %rax, -0x70(%rbp)
movapd %xmm0, -0x80(%rbp)
leaq -0x508(%rbp), %rdi
callq 0x2360
leaq -0x570(%rbp), %r14
movq %r14, %rdi
movq -0x68(%rbp), %rsi
xorl %edx, %edx
callq 0x5cdd
leaq -0x508(%rbp), %rdi
movq %r14, %rsi
movl $0x10, %edx
callq 0x2060
leaq -0x308(%rbp), %rdi
callq 0x2250
movq $0x1, -0xd8(%rbp)
leaq -0x308(%rbp), %rdi
movq %r12, -0x40(%rbp)
movq %r12, %rsi
movl $0x8, %edx
callq 0x2160
movq %r15, -0xb0(%rbp)
movq -0x308(%rbp), %rax
movq -0x18(%rax), %rax
xorl %r15d, %r15d
testb $0x2, -0x2e8(%rbp,%rax)
jne 0x5147
xorl %r15d, %r15d
leaq -0x308(%rbp), %r12
leaq -0x9e0(%rbp), %r14
leaq -0xd8(%rbp), %r13
movq -0x2f8(%rbp,%rax), %rbx
movl $0x64, %edx
movq %r12, %rdi
movq %r14, %rsi
callq 0x2380
movq -0x308(%rbp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, -0x2e8(%rbp,%rax)
jne 0x508e
addq $-0x65, %rbx
cmpq $-0x65, %rbx
ja 0x508e
movq -0x220(%rbp,%rax), %rdi
movq 0x10(%rdi), %rax
cmpq 0x18(%rdi), %rax
jae 0x5112
movq %r14, %rdi
callq 0x2280
movsd %xmm0, -0x50(%rbp)
movq %r13, %rdi
callq 0x7726
addsd 0x30e5(%rip), %xmm0     # 0x8190
mulsd 0x30c5(%rip), %xmm0     # 0x8178
addsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x770(%rbp)
movq -0x98(%rbp), %rsi
cmpq -0x90(%rbp), %rsi
je 0x50e1
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, -0x98(%rbp)
jmp 0x50f4
leaq -0xa0(%rbp), %rdi
leaq -0x770(%rbp), %rdx
callq 0x7868
incl %r15d
movq -0x308(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x2, -0x2e8(%rbp,%rax)
je 0x5041
jmp 0x5147
movq (%rdi), %rax
callq *0x48(%rax)
cmpl $-0x1, %eax
jne 0x508e
movq -0x308(%rbp), %rax
movq -0x18(%rax), %rax
leaq (%rax,%rbp), %rdi
addq $-0x308, %rdi           # imm = 0xFCF8
movl 0x20(%rdi), %esi
orl $0x2, %esi
callq 0x2350
jmp 0x508e
leaq -0x308(%rbp), %rdi
callq 0x2090
movq -0xb0(%rbp), %rsi
leaq -0x308(%rbp), %rdi
movl $0x8, %edx
callq 0x2160
movq -0x308(%rbp), %rax
movq -0x18(%rax), %rax
xorl %r12d, %r12d
testb $0x2, -0x2e8(%rbp,%rax)
jne 0x5292
xorl %r12d, %r12d
leaq -0x9e0(%rbp), %r13
leaq -0xd8(%rbp), %r14
movq -0x2f8(%rbp,%rax), %rbx
movl $0x64, %edx
leaq -0x308(%rbp), %rdi
movq %r13, %rsi
callq 0x2380
movq -0x308(%rbp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, -0x2e8(%rbp,%rax)
jne 0x51e5
addq $-0x65, %rbx
cmpq $-0x65, %rbx
ja 0x51e5
movq -0x220(%rbp,%rax), %rdi
movq 0x10(%rdi), %rax
cmpq 0x18(%rdi), %rax
jae 0x525d
movq %r13, %rdi
callq 0x2280
movsd %xmm0, -0x50(%rbp)
movq %r14, %rdi
callq 0x7726
addsd 0x2f8e(%rip), %xmm0     # 0x8190
mulsd 0x2f6e(%rip), %xmm0     # 0x8178
addsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x770(%rbp)
movq -0x78(%rbp), %rsi
cmpq -0x70(%rbp), %rsi
je 0x522f
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, -0x78(%rbp)
jmp 0x523f
leaq -0x80(%rbp), %rdi
leaq -0x770(%rbp), %rdx
callq 0x7868
incl %r12d
movq -0x308(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x2, -0x2e8(%rbp,%rax)
je 0x5198
jmp 0x5292
movq (%rdi), %rax
callq *0x48(%rax)
cmpl $-0x1, %eax
jne 0x51e5
movq -0x308(%rbp), %rax
movq -0x18(%rax), %rax
leaq (%rax,%rbp), %rdi
addq $-0x308, %rdi           # imm = 0xFCF8
movl 0x20(%rdi), %esi
orl $0x2, %esi
callq 0x2350
jmp 0x51e5
leaq -0x308(%rbp), %rdi
callq 0x2090
movq -0xb0(%rbp), %rbx
movq -0x40(%rbp), %r14
testq %r14, %r14
je 0x52ca
movq %r14, %rdi
callq 0x2100
leaq -0x508(%rbp), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x2260
jmp 0x52eb
movq -0x508(%rbp), %rax
movq -0x18(%rax), %rax
leaq (%rax,%rbp), %rdi
addq $-0x508, %rdi           # imm = 0xFAF8
movl 0x20(%rdi), %esi
orl $0x1, %esi
callq 0x2350
movq -0x508(%rbp), %rax
leaq -0x508(%rbp), %rdi
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x2220
movsbl %al, %esi
leaq -0x508(%rbp), %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
movq %rax, %r14
testq %rbx, %rbx
je 0x533e
movq %rbx, %rdi
callq 0x2100
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2260
jmp 0x5358
movq (%r14), %rax
movq -0x18(%rax), %rax
movq %r14, %rdi
addq %rax, %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x2350
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2220
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
leaq 0x2fb7(%rip), %rsi      # 0x833d
leaq -0x508(%rbp), %rdi
movl $0xd, %edx
callq 0x2260
leaq -0x508(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0x2390
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2220
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
leaq 0x2f74(%rip), %rsi      # 0x834b
leaq -0x508(%rbp), %rdi
movl $0xf, %edx
callq 0x2260
leaq -0x508(%rbp), %rdi
movl %r15d, %esi
callq 0x2390
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2220
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
leaq 0x2f33(%rip), %rsi      # 0x835b
leaq -0x508(%rbp), %rdi
movl $0xf, %edx
callq 0x2260
leaq -0x508(%rbp), %rdi
movl %r12d, %esi
callq 0x2390
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2220
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
movl %r15d, -0x5c(%rbp)
movsd -0x58(%rbp), %xmm0
addsd 0x2cfd(%rip), %xmm0     # 0x8180
movsd %xmm0, -0x58(%rbp)
ucomisd -0x38(%rbp), %xmm0
jb 0x584a
xorps %xmm0, %xmm0
cvtsi2sdl -0x5c(%rbp), %xmm0
cvtsi2sd %r12d, %xmm1
movapd %xmm1, %xmm2
divsd %xmm0, %xmm2
movsd %xmm0, -0xf8(%rbp)
movsd %xmm1, -0xf0(%rbp)
divsd %xmm1, %xmm0
movl -0x2c(%rbp), %eax
cmpl $0x2, %eax
movl $0x1, %ebx
cmovgel %eax, %ebx
xorl %r15d, %r15d
movsd %xmm2, -0xb0(%rbp)
xorps %xmm1, %xmm1
sqrtsd %xmm2, %xmm1
movsd %xmm1, -0xe8(%rbp)
movsd %xmm0, -0x40(%rbp)
sqrtsd %xmm0, %xmm0
movsd %xmm0, -0xe0(%rbp)
movl $0x10, %edx
leaq -0x508(%rbp), %rdi
leaq 0x2e63(%rip), %rsi      # 0x836b
callq 0x2260
leaq -0x508(%rbp), %rdi
movsd -0x38(%rbp), %xmm0
callq 0x2300
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2220
movsbl %al, %esi
movq %r13, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
movl %r12d, %r14d
movq -0xd0(%rbp), %rax
movsd -0x38(%rbp), %xmm0
movsd %xmm0, (%rax,%r15,8)
mulsd -0xf8(%rbp), %xmm0
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
leaq -0x770(%rbp), %rdi
movl $0x1, %esi
callq 0x42da
movq -0xa0(%rbp), %r12
cmpq -0x98(%rbp), %r12
je 0x55b1
movq -0x750(%rbp), %r13
movsd (%r12), %xmm0
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
addq $0x8, %r12
cmpq -0x98(%rbp), %r12
jne 0x5595
movsd -0x38(%rbp), %xmm0
mulsd -0xf0(%rbp), %xmm0
cvttsd2si %xmm0, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
leaq -0x970(%rbp), %rdi
movl $0x1, %esi
callq 0x42da
movq -0x80(%rbp), %r12
cmpq -0x78(%rbp), %r12
je 0x5604
movq -0x950(%rbp), %r13
movsd (%r12), %xmm0
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
addq $0x8, %r12
cmpq -0x78(%rbp), %r12
jne 0x55eb
leaq -0x770(%rbp), %rdi
leaq -0x970(%rbp), %rsi
movl -0x2c(%rbp), %edx
callq 0x4bb6
movq -0xc8(%rbp), %rax
movsd %xmm0, (%rax,%r15,8)
movl $0x5, %edx
leaq -0x508(%rbp), %rdi
leaq 0x2d42(%rip), %rsi      # 0x837c
movsd %xmm0, -0x50(%rbp)
callq 0x2260
movsd -0x50(%rbp), %xmm0
leaq -0x508(%rbp), %rdi
callq 0x2300
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2220
movsbl %al, %esi
movq %r13, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
movq -0x760(%rbp), %r13
movq -0x758(%rbp), %r12
movsd -0xb0(%rbp), %xmm0
ucomisd 0x2af3(%rip), %xmm0     # 0x8190
movsd -0xe8(%rbp), %xmm5
jae 0x56b8
movsd -0xb0(%rbp), %xmm0
callq 0x21b0
movapd %xmm0, %xmm5
movsd -0x40(%rbp), %xmm0
ucomisd 0x2acb(%rip), %xmm0     # 0x8190
movsd -0xe0(%rbp), %xmm0
jae 0x56e3
movsd -0x40(%rbp), %xmm0
movsd %xmm5, -0x50(%rbp)
callq 0x21b0
movsd -0x50(%rbp), %xmm5
movq -0xa0(%rbp), %rax
movq -0x98(%rbp), %rcx
movq -0x80(%rbp), %rdx
movq -0x78(%rbp), %rsi
xorpd %xmm6, %xmm6
xorl %edi, %edi
xorpd %xmm1, %xmm1
cmpq %rcx, %rax
je 0x5737
movsd 0x8(%r13,%rdi,8), %xmm2
movq %rax, %r8
movsd (%r8), %xmm3
ucomisd %xmm3, %xmm2
jb 0x572e
ucomisd 0x8(%r12,%rdi,8), %xmm3
jbe 0x572e
addsd 0x28e2(%rip), %xmm1     # 0x8010
addq $0x8, %r8
cmpq %rcx, %r8
jne 0x5712
cmpq %rsi, %rdx
je 0x5771
movsd 0x8(%r13,%rdi,8), %xmm3
xorpd %xmm2, %xmm2
movq %rdx, %r8
movsd (%r8), %xmm4
ucomisd %xmm4, %xmm3
jb 0x5766
ucomisd 0x8(%r12,%rdi,8), %xmm4
jbe 0x5766
addsd 0x28aa(%rip), %xmm2     # 0x8010
addq $0x8, %r8
cmpq %rsi, %r8
jne 0x574a
jmp 0x5775
xorpd %xmm2, %xmm2
movapd %xmm0, %xmm3
mulsd %xmm2, %xmm3
movapd %xmm1, %xmm4
mulsd %xmm5, %xmm4
subsd %xmm3, %xmm4
mulsd %xmm4, %xmm4
addsd %xmm2, %xmm1
divsd %xmm1, %xmm4
addsd %xmm4, %xmm6
incq %rdi
cmpq %rbx, %rdi
jne 0x56ff
movq -0xc0(%rbp), %rax
movsd %xmm6, (%rax,%r15,8)
movl $0x9, %edx
leaq -0x508(%rbp), %rdi
leaq 0x2bbd(%rip), %rsi      # 0x8382
movsd %xmm6, -0x50(%rbp)
callq 0x2260
leaq -0x508(%rbp), %rdi
movsd -0x50(%rbp), %xmm0
callq 0x2300
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2220
movsbl %al, %esi
movq %r13, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
movsd -0x38(%rbp), %xmm0
mulsd 0x2959(%rip), %xmm0     # 0x8170
movsd %xmm0, -0x38(%rbp)
incq %r15
leaq -0x970(%rbp), %rdi
callq 0x447a
leaq -0x770(%rbp), %rdi
callq 0x447a
movsd -0x58(%rbp), %xmm0
ucomisd -0x38(%rbp), %xmm0
movl %r14d, %r12d
jae 0x54f5
leaq -0x508(%rbp), %rdi
callq 0x22b0
leaq -0x570(%rbp), %r14
movq %r14, %rdi
movq -0x68(%rbp), %rsi
movl $0x3, %edx
callq 0x5cdd
leaq -0x508(%rbp), %rdi
movq %r14, %rsi
movl $0x10, %edx
callq 0x2060
leaq -0x770(%rbp), %rdi
callq 0x2360
movl -0x5c(%rbp), %ebx
movq %r14, %rdi
movq -0x68(%rbp), %rsi
movl $0x1, %edx
callq 0x5cdd
leaq -0x770(%rbp), %rdi
movq %r14, %rsi
movl $0x10, %edx
callq 0x2060
leaq -0x970(%rbp), %rdi
callq 0x2360
movq %r14, %rdi
movq -0x68(%rbp), %rsi
movl $0x2, %edx
callq 0x5cdd
leaq -0x970(%rbp), %rdi
movq %r14, %rsi
movl $0x10, %edx
callq 0x2060
xorl %eax, %eax
cmpl %r12d, %ebx
setne %cl
cmpl $0x0, -0xb4(%rbp)
je 0x5af6
movb %cl, %al
subl %eax, -0x2c(%rbp)
xorl %ebx, %ebx
leaq 0x2a82(%rip), %r15      # 0x838c
leaq -0x508(%rbp), %r12
leaq -0x970(%rbp), %r13
movq -0xd0(%rbp), %rax
movsd (%rax,%rbx,8), %xmm0
mulsd 0x285c(%rip), %xmm0     # 0x8188
leaq -0x770(%rbp), %rdi
movsd %xmm0, -0x40(%rbp)
callq 0x2300
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2260
movq -0xc8(%rbp), %rax
movsd (%rax,%rbx,8), %xmm0
movaps %xmm0, -0x50(%rbp)
movl -0x2c(%rbp), %r14d
movl %r14d, %edi
callq 0x3e54
movaps %xmm0, -0xb0(%rbp)
movq -0xc0(%rbp), %rax
movsd (%rax,%rbx,8), %xmm0
movsd %xmm0, -0x38(%rbp)
movl %r14d, %edi
callq 0x3e54
movapd -0xb0(%rbp), %xmm1
subsd %xmm0, %xmm1
andpd 0x2823(%rip), %xmm1     # 0x81c0
movapd %xmm1, %xmm0
leaq -0x770(%rbp), %rdi
callq 0x2300
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2220
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
movsd -0x38(%rbp), %xmm0
movl -0x2c(%rbp), %edi
callq 0x3e54
movq %r12, %rdi
callq 0x2300
movq %rax, %r14
movl $0x7, %edx
movq %rax, %rdi
leaq 0x2990(%rip), %rsi      # 0x838e
callq 0x2260
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2220
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
movapd -0x50(%rbp), %xmm0
movl -0x2c(%rbp), %edi
callq 0x3e54
movq %r12, %rdi
callq 0x2300
movq %rax, %r14
movl $0x3, %edx
movq %rax, %rdi
leaq 0x2945(%rip), %rsi      # 0x8396
callq 0x2260
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2220
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
movq %r13, %rdi
movsd -0x40(%rbp), %xmm0
callq 0x2300
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2260
movapd -0x50(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
subsd %xmm1, %xmm0
andpd 0x2710(%rip), %xmm0     # 0x81c0
divsd %xmm1, %xmm0
movq %r13, %rdi
callq 0x2300
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2220
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
incq %rbx
cmpq %rbx, -0x100(%rbp)
jne 0x5918
leaq -0x970(%rbp), %r15
movq %r15, %rdi
callq 0x22b0
leaq -0x770(%rbp), %r14
movq %r14, %rdi
callq 0x22b0
leaq -0x508(%rbp), %rbx
movq %rbx, %rdi
callq 0x22b0
movq 0x649e(%rip), %rax      # 0xbfc8
movq (%rax), %r12
movq 0x18(%rax), %r13
leaq -0x968(%rbp), %rdi
movq %r12, -0x8(%rdi)
movq -0x18(%r12), %rax
movq %r13, -0x970(%rbp,%rax)
callq 0x21e0
movl $0xf8, %eax
addq %rax, %r15
movq %r15, %rdi
callq 0x20d0
leaq -0x768(%rbp), %rdi
movq %r12, -0x8(%rdi)
movq -0x18(%r12), %rax
movq %r13, -0x770(%rbp,%rax)
callq 0x21e0
movl $0xf8, %r15d
addq %r15, %r14
movq %r14, %rdi
callq 0x20d0
leaq -0x308(%rbp), %rdi
callq 0x20a0
leaq -0x500(%rbp), %rdi
movq %r12, -0x8(%rdi)
movq -0x18(%r12), %rax
movq %r13, -0x508(%rbp,%rax)
callq 0x21e0
addq %r15, %rbx
movq %rbx, %rdi
callq 0x20d0
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x5bce
callq 0x2210
movq -0xa0(%rbp), %rdi
testq %rdi, %rdi
je 0x5bdf
callq 0x2210
xorl %eax, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x63d9(%rip), %rdi      # 0xbfd0
leaq 0x269e(%rip), %rsi      # 0x829c
jmp 0x5c1e
movq 0x63c9(%rip), %rdi      # 0xbfd0
leaq 0x26dc(%rip), %rsi      # 0x82ea
jmp 0x5c1e
movq 0x63b9(%rip), %rdi      # 0xbfd0
leaq 0x26f0(%rip), %rsi      # 0x830e
callq 0x2230
movl $0x1, %edi
callq 0x2270
jmp 0x5c83
jmp 0x5c31
movq %rax, %rbx
jmp 0x5c92
jmp 0x5c5a
jmp 0x5c3a
movq %rax, %rbx
jmp 0x5caa
movq %rax, %rbx
jmp 0x5cb6
jmp 0x5c5a
jmp 0x5c83
jmp 0x5c72
jmp 0x5c5a
jmp 0x5c5a
jmp 0x5c5a
jmp 0x5c5a
jmp 0x5c5a
jmp 0x5c5a
jmp 0x5c83
jmp 0x5c61
movq %rax, %rbx
jmp 0x5c9e
jmp 0x5c61
movq %rax, %rbx
leaq -0x970(%rbp), %rdi
callq 0x447a
jmp 0x5c75
movq %rax, %rbx
leaq -0x770(%rbp), %rdi
callq 0x447a
jmp 0x5c9e
movq %rax, %rbx
leaq -0x970(%rbp), %rdi
callq 0x22d0
leaq -0x770(%rbp), %rdi
callq 0x22d0
leaq -0x308(%rbp), %rdi
callq 0x20a0
leaq -0x508(%rbp), %rdi
callq 0x22d0
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x5cc4
callq 0x2210
movq -0xa0(%rbp), %rdi
testq %rdi, %rdi
je 0x5cd5
callq 0x2210
movq %rbx, %rdi
callq 0x23b0