// File: /workspace/github_cpp_makefile_star2_O2/ashlall[P]StreamStats/ChiSquareExperiments/VarySizeTwoSampleBoth.cpp
// Function: main
int main(int argc, char* argv[])
{
  if (argc < 12)
    {
      cout << "usage: VarySizeTwoSample lower-size upper-size num-stream(>0) [N|U|P|E] location1 scale1 location2 scale2 [0|1] memory-percent num-buckets" << endl;
      throw ParameterError();
    }

  double lower = atof (argv[1]);
  double upper = atof (argv[2]);
  int data_repeats = atoi (argv[3]);
  char distribution_type = argv[4][0];
  double location1 = atof (argv[5]);
  double scale1 = atof (argv[6]);
  double location2 = atof (argv[7]);
  double scale2 = atof (argv[8]);
  int all_quantiles = atoi (argv[9]);
  double memory_percent = atof (argv[10]);
  int num_buckets = atoi (argv[11]);
  int seed1 = 1;
  int seed2 = 2;

  // ensures that the parameters will not create error
  if (data_repeats <= 0)
    {
      cout << "The number of streams must be greater than zero.\n";
      throw ParameterError();
    }
  if (distribution_type != 'N' && distribution_type != 'U' && distribution_type != 'P' && distribution_type != 'E')
    {
      cout << "The distribution is either N, U, P, or E.\n";
      throw ParameterError();
    }
  if (lower <= 0)
    {
      cout << "The lower stream size must be greater than 0.\n";
      throw ParameterError();
    }
  if (memory_percent <= 0)
    {
      cout << "The memory percent must be greater than 0.\n";
      throw ParameterError();
    }
  if (num_buckets <= 0)
    {
      cout << "The number of bins must be greater than 0.\n";
      throw ParameterError();
    }

  // finds the number of different sizes the experiment will run on
  int stream_size;
  int num_sizes = 0, size = lower;
  while (size <= upper)
    {
      num_sizes++;
      size *= 10;
    }

  // creates the arrays that will hold the calculated statistics 
  double actual_values[data_repeats][num_sizes];
  double GK_values[data_repeats][num_sizes];
  double QD_values[data_repeats][num_sizes];
  double RS_values[data_repeats][num_sizes];
  int sizes[num_sizes];

  // creates and intializes the log file
  ofstream data_file;
  char str[150];
  name_file(str, argv, 0);
  data_file.open(str);
  data_file << "Distribution: " << distribution_type << endl;
  data_file << "location_1 = " << location1 << " scale_1 = " << scale1 << endl;
  data_file << "location_2 = " << location2 << " scale_2 = " << scale2 << endl;
  data_file << "number of bins = " << num_buckets << endl;
  data_file << "memory percent = " << memory_percent << endl;

  for (int i = 0; i < data_repeats; i++) // runs all test data_repeats times
    {
      int j = 0;
      stream_size = lower;
      data_file << "Pass " << i+1 << ":" << endl;
      while (stream_size <= upper)  // runs tests for every stream size
	{ 
	  int sample_size = memory_percent * stream_size;
	  if (!i)
	    sizes[j] = stream_size;
	  data_file << "stream_size = " << stream_size << endl;

	  // generates the data based on parameters
	  DataGenerator data1(distribution_type, stream_size, seed1, location1, scale1);
	  double *stream1 = data1.get_stream();
	  DataGenerator data2(distribution_type, stream_size, seed2, location2, scale2);
	  double *stream2 = data2.get_stream();

	  // computes GK estimate
	  ChiSquareContinuous GK_sketch1(sample_size, 1);
	  for (int k = 0; k < stream_size; k++)
	    GK_sketch1.insert(stream1[k]);
	  ChiSquareContinuous GK_sketch2(sample_size, 1);
	  for (int k = 0; k < stream_size; k++)
	    GK_sketch2.insert(stream2[k]);
	  double GK_stat = GK_sketch1.two_sample_statistic(GK_sketch2, num_buckets);
	  //double GK_stat = GK_sketch2.two_sample_statistic(GK_sketch1, num_buckets);
	  GK_values[i][j] = GK_stat;
	  data_file << "GK = " << GK_stat << endl;

	  if (all_quantiles)
	    {
	      // computes QDigest estimate
	      ChiSquareContinuous QD_sketch1(sample_size, 2);
	      for (int k = 0; k < stream_size; k++)
		QD_sketch1.insert(stream1[k]);
	      ChiSquareContinuous QD_sketch2(sample_size, 2);
	      for (int k = 0; k < stream_size; k++)
		QD_sketch2.insert(stream2[k]);
	      double QD_stat = QD_sketch1.two_sample_statistic(QD_sketch2, num_buckets);
	      QD_values[i][j] = QD_stat;
	      data_file << "QD = " << QD_stat << endl;

	      // computes Reservoir Sampling estimate
	      ChiSquareContinuous RS_sketch1(sample_size, 3);
	      for (int k = 0; k < stream_size; k++)
		RS_sketch1.insert(stream1[k]);
	      ChiSquareContinuous RS_sketch2(sample_size, 3);
	      for (int k = 0; k < stream_size; k++)
		RS_sketch2.insert(stream2[k]);
	      double RS_stat = RS_sketch1.two_sample_statistic(RS_sketch2, num_buckets);
	      RS_values[i][j]= RS_stat;
	      data_file << "RS = " << RS_stat<< endl;
	    }
       
	  // computes actual statistic
	  double *upper_interval = GK_sketch1.get_upper();
	  double *lower_interval = GK_sketch1.get_lower();
	  double actual = data2.get_stat_two_sample(data1, num_buckets, upper_interval, lower_interval);
	  actual_values[i][j] = actual;
	  data_file << "Real = " << actual << endl;

	  stream_size *= 10;
	  j++;
	}     
      seed1++;
      seed2++;
    }
  data_file.close();

  // creates pvalue file
  ofstream data2_file;
  char st[150];
  name_file(st, argv, 3);
  data2_file.open(st);

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

  int deg_freedom = num_buckets;
  for (int i = 0; i < num_sizes; i++)
  {
    data_file << sizes[i] << "\t";
    double error = 0;

    // adds pvalue error from the GK sketch to the table file
    for (int j = 0; j < data_repeats; j++)
      error += abs(pochisq(GK_values[j][i], deg_freedom) - pochisq(actual_values[j][i], deg_freedom));
    data_file << error / data_repeats;

    if (all_quantiles)
    {
      // adds pvalue error from the QDigest sketch to the table file
      error = 0;
      for (int j = 0; j < data_repeats; j++)
        error += abs(pochisq(QD_values[j][i], deg_freedom) - pochisq(actual_values[j][i], deg_freedom));
      data_file << "\t" << error / data_repeats << "\t";

      // adds pvalue error from the Reservoir Samplig sketch to the table file
      error = 0;
      for (int j = 0; j < data_repeats; j++)
        error += abs(pochisq(RS_values[j][i], deg_freedom) - pochisq(actual_values[j][i], deg_freedom));
      data_file << error / data_repeats;
    }
    data_file << endl;

    // adds all pvalues to the pvalue file
    data2_file << "stream_size = " << sizes[i] << endl;
    for (int j = 0; j < data_repeats; j++)
      {
        data2_file << pochisq(actual_values[j][i], deg_freedom) << " actual" << endl;
        data2_file << pochisq(GK_values[j][i], deg_freedom) << " GK" << endl;
        if (all_quantiles)
        {
          data2_file << pochisq(QD_values[j][i], deg_freedom) << " QD" << endl;
          data2_file << pochisq(RS_values[j][i], deg_freedom) << " RS" << endl;
        }
      }
  }
  data2_file.close();
  data_file.close();

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

  // adds actual statistics to the extra file
  for (int i = 0; i < num_sizes; i++)
    {
      for (int j = 0; j < data_repeats; j++)
	data_file << actual_values[j][i] << "\t";
    }
  data_file << endl;

  // adds GK statistics to the extra file
  for (int i = 0; i < num_sizes; i++)
    {
      for(int j = 0; j <data_repeats; j++)
	data_file << GK_values[j][i] << "\t";
    }
  data_file << endl;
  if (all_quantiles)
    {
      // adds QDigest statistics to the extra file
      for (int i = 0; i < num_sizes; i++)
	{
	  for(int j = 0; j <data_repeats; j++)
	    data_file << QD_values[j][i] << "\t";
	}
      data_file << endl;
      
      // adds Reservoir Sampling statistics to the extra file
      for (int i = 0; i < num_sizes; i++)
	{
	  for(int j = 0; j <data_repeats; j++)
	    data_file << RS_values[j][i] << "\t";
	}
      data_file << endl;
    }

  data_file << endl;
  data_file.close();
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x6e8, %rsp            # imm = 0x6E8
cmpl $0xb, %edi
jle 0x583e
movq %rsi, %rbx
movq 0x8(%rsi), %rdi
callq 0x21f0
movsd %xmm0, -0x50(%rbp)
movq 0x10(%rbx), %rdi
callq 0x21f0
movsd %xmm0, -0x98(%rbp)
movq 0x18(%rbx), %rdi
callq 0x2260
movl %eax, %r14d
movq 0x20(%rbx), %rax
movq 0x28(%rbx), %rdi
movzbl (%rax), %r15d
callq 0x21f0
movsd %xmm0, -0xf0(%rbp)
movq 0x30(%rbx), %rdi
callq 0x21f0
movsd %xmm0, -0xe8(%rbp)
movq 0x38(%rbx), %rdi
callq 0x21f0
movsd %xmm0, -0xe0(%rbp)
movq 0x40(%rbx), %rdi
callq 0x21f0
movsd %xmm0, -0xd8(%rbp)
movq 0x48(%rbx), %rdi
callq 0x2260
movl %eax, -0x54(%rbp)
movq 0x50(%rbx), %rdi
callq 0x21f0
movsd %xmm0, -0xb0(%rbp)
movq 0x58(%rbx), %rdi
callq 0x2260
testl %r14d, %r14d
jle 0x585b
movl %eax, %r13d
movq %r15, -0xd0(%rbp)
leal -0x45(%r15), %eax
cmpl $0x10, %eax
ja 0x589b
movl $0x10a01, %ecx          # imm = 0x10A01
btl %eax, %ecx
jae 0x589b
xorpd %xmm0, %xmm0
movsd -0x50(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jae 0x586b
ucomisd -0xb0(%rbp), %xmm0
jae 0x587b
testl %r13d, %r13d
jle 0x588b
cvttsd2si %xmm1, %ecx
movl %r14d, %eax
movq %rax, -0x50(%rbp)
xorl %eax, %eax
movq $0x0, -0x30(%rbp)
movl %ecx, -0xb8(%rbp)
movsd -0x98(%rbp), %xmm1
cvtsi2sd %ecx, %xmm0
ucomisd %xmm0, %xmm1
jb 0x4bd3
imull $0xa, %ecx, %ecx
incq -0x30(%rbp)
addq -0x50(%rbp), %rax
jmp 0x4bbc
movl %r14d, -0xb4(%rbp)
movq %rsp, %rcx
leaq 0xf(,%rax,8), %rax
andq $-0x10, %rax
subq %rax, %rcx
movq %rcx, -0xa8(%rbp)
movq %rcx, %rsp
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0xa0(%rbp)
movq %rcx, %rsp
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x90(%rbp)
movq %rcx, %rsp
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x88(%rbp)
movq %rcx, %rsp
movq %rsp, %rcx
movq -0x30(%rbp), %rax
leaq 0xf(,%rax,4), %rax
andq $-0x10, %rax
subq %rax, %rcx
movq %rcx, -0xc8(%rbp)
movq %rcx, %rsp
movq %rbx, %r15
leaq -0x3d8(%rbp), %rbx
movq %rbx, %rdi
callq 0x22c0
leaq -0x710(%rbp), %r14
movq %r14, %rdi
movq %r15, -0xc0(%rbp)
movq %r15, %rsi
xorl %edx, %edx
callq 0x59b0
pushq $0x10
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2050
movq -0xd0(%rbp), %rbx
leaq 0x37d1(%rip), %rsi      # 0x8460
leaq -0x3d8(%rbp), %rdi
callq 0x21b0
movsbl %bl, %esi
movq %rax, %rdi
callq 0x21d0
movq %rax, %rdi
callq 0x20d0
leaq 0x37ba(%rip), %rsi      # 0x846f
leaq -0x3d8(%rbp), %rdi
callq 0x21b0
movq %rax, %rdi
movsd -0xf0(%rbp), %xmm0
callq 0x2270
leaq 0x37a5(%rip), %rsi      # 0x847d
movq %rax, %rdi
callq 0x21b0
movq %rax, %rdi
movsd -0xe8(%rbp), %xmm0
callq 0x2270
movq %rax, %rdi
callq 0x20d0
leaq 0x378a(%rip), %rsi      # 0x8489
leaq -0x3d8(%rbp), %rdi
callq 0x21b0
movq %rax, %rdi
movsd -0xe0(%rbp), %xmm0
callq 0x2270
leaq 0x3775(%rip), %rsi      # 0x8497
movq %rax, %rdi
callq 0x21b0
movq %rax, %rdi
movsd -0xd8(%rbp), %xmm0
callq 0x2270
movq %rax, %rdi
callq 0x20d0
leaq 0x375a(%rip), %rsi      # 0x84a3
leaq -0x3d8(%rbp), %rdi
callq 0x21b0
movq %rax, %rdi
movl %r13d, %esi
callq 0x22e0
movq %rax, %rdi
callq 0x20d0
leaq 0x3746(%rip), %rsi      # 0x84b5
leaq -0x3d8(%rbp), %rdi
callq 0x21b0
movq %rax, %rdi
movsd -0xb0(%rbp), %xmm0
callq 0x2270
movq %rax, %rdi
callq 0x20d0
pushq $0x1
popq %rax
pushq $0x2
popq %rcx
xorl %edx, %edx
movl %ecx, -0x6c(%rbp)
movl %eax, -0x70(%rbp)
movl %r13d, -0x44(%rbp)
movq %rdx, -0x68(%rbp)
cmpq -0x50(%rbp), %rdx
je 0x526a
leaq -0x3d8(%rbp), %rdi
leaq 0x3706(%rip), %rsi      # 0x84c7
callq 0x21b0
movq -0x68(%rbp), %rcx
leaq 0x1(%rcx), %rsi
movq %rax, %rdi
movq %rsi, -0x118(%rbp)
callq 0x22e0
movq %rax, %rdi
leaq 0x36e6(%rip), %rsi      # 0x84cd
callq 0x21b0
movq %rax, %rdi
callq 0x20d0
movq -0x68(%rbp), %rax
imulq -0x30(%rbp), %rax
movq -0xa0(%rbp), %rcx
leaq (%rcx,%rax,8), %rcx
movq %rcx, -0x138(%rbp)
movq -0x90(%rbp), %rcx
leaq (%rcx,%rax,8), %rcx
movq %rcx, -0x128(%rbp)
movq -0x88(%rbp), %rcx
leaq (%rcx,%rax,8), %rcx
movq %rcx, -0x120(%rbp)
movq -0xa8(%rbp), %rcx
leaq (%rcx,%rax,8), %rax
movq %rax, -0x130(%rbp)
movq $0x0, -0x38(%rbp)
movl -0xb8(%rbp), %r14d
movl %r14d, -0x80(%rbp)
cvtsi2sd %r14d, %xmm1
movsd -0x98(%rbp), %xmm0
movsd %xmm1, -0x40(%rbp)
ucomisd %xmm1, %xmm0
jb 0x5258
cmpq $0x0, -0x68(%rbp)
movl -0x80(%rbp), %r15d
jne 0x4e8e
movq -0xc8(%rbp), %rax
movq -0x38(%rbp), %rcx
movl %r15d, (%rax,%rcx,4)
leaq -0x3d8(%rbp), %rdi
leaq 0x3633(%rip), %rsi      # 0x84cf
callq 0x21b0
movq %rax, %rdi
movl %r15d, %esi
callq 0x22e0
movq %rax, %rdi
callq 0x20d0
movsbl %bl, %esi
leaq -0x110(%rbp), %rdi
movl %r15d, %edx
movl -0x70(%rbp), %ecx
movsd -0xf0(%rbp), %xmm0
movsd -0xe8(%rbp), %xmm1
callq 0x248c
movq -0x110(%rbp), %r14
movsbl %bl, %esi
leaq -0x100(%rbp), %rdi
movl %r15d, %edx
movl -0x6c(%rbp), %ecx
movsd -0xe0(%rbp), %xmm0
movsd -0xd8(%rbp), %xmm1
callq 0x248c
movsd -0x40(%rbp), %xmm0
mulsd -0xb0(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movq -0x100(%rbp), %r12
cvtsi2sd %eax, %xmm0
leaq -0x670(%rbp), %rdi
movsd %xmm0, -0x40(%rbp)
pushq $0x1
popq %rsi
callq 0x4074
movl %r15d, %eax
movq -0x650(%rbp), %r13
testl %r15d, %r15d
movl $0x0, %r15d
cmovgl %eax, %r15d
xorl %ebx, %ebx
cmpq %rbx, %r15
je 0x4f67
movsd (%r14,%rbx,8), %xmm0
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
incq %rbx
jmp 0x4f4e
leaq -0x470(%rbp), %rdi
movsd -0x40(%rbp), %xmm0
pushq $0x1
popq %rsi
callq 0x4074
movq -0x450(%rbp), %r13
xorl %ebx, %ebx
cmpq %rbx, %r15
je 0x4f9d
movsd (%r12,%rbx,8), %xmm0
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
incq %rbx
jmp 0x4f84
leaq -0x670(%rbp), %rdi
leaq -0x470(%rbp), %rsi
movl -0x44(%rbp), %r13d
movl %r13d, %edx
callq 0x47ee
movq -0x38(%rbp), %rbx
movq -0x138(%rbp), %rax
movsd %xmm0, (%rax,%rbx,8)
leaq -0x3d8(%rbp), %rdi
leaq 0x3509(%rip), %rsi      # 0x84de
movsd %xmm0, -0x60(%rbp)
callq 0x21b0
movsd -0x60(%rbp), %xmm0
movq %rax, %rdi
callq 0x2270
movq %rax, %rdi
callq 0x20d0
cmpl $0x0, -0x54(%rbp)
je 0x51b0
leaq -0x1d8(%rbp), %rdi
movsd -0x40(%rbp), %xmm0
pushq $0x2
popq %rsi
callq 0x4074
movq -0x1b8(%rbp), %r13
xorl %ebx, %ebx
cmpq %rbx, %r15
je 0x5034
movsd (%r14,%rbx,8), %xmm0
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
incq %rbx
jmp 0x501b
leaq -0x1b0(%rbp), %rdi
movsd -0x40(%rbp), %xmm0
pushq $0x2
popq %rsi
callq 0x4074
movq -0x190(%rbp), %r13
xorl %ebx, %ebx
cmpq %rbx, %r15
je 0x506a
movsd (%r12,%rbx,8), %xmm0
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
incq %rbx
jmp 0x5051
leaq -0x1d8(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
movl -0x44(%rbp), %edx
callq 0x47ee
movq -0x38(%rbp), %rcx
movq -0x128(%rbp), %rax
movsd %xmm0, (%rax,%rcx,8)
leaq -0x3d8(%rbp), %rdi
leaq 0x3446(%rip), %rsi      # 0x84e4
movsd %xmm0, -0x60(%rbp)
callq 0x21b0
movsd -0x60(%rbp), %xmm0
movq %rax, %rdi
callq 0x2270
movq %rax, %rdi
callq 0x20d0
leaq -0x188(%rbp), %rdi
movsd -0x40(%rbp), %xmm0
pushq $0x3
popq %rsi
callq 0x4074
movq -0x168(%rbp), %r13
xorl %ebx, %ebx
cmpq %rbx, %r15
je 0x50f3
movsd (%r14,%rbx,8), %xmm0
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
incq %rbx
jmp 0x50da
leaq -0x160(%rbp), %rdi
movsd -0x40(%rbp), %xmm0
pushq $0x3
popq %rsi
callq 0x4074
movq -0x140(%rbp), %r13
xorl %ebx, %ebx
cmpq %rbx, %r15
je 0x5129
movsd (%r12,%rbx,8), %xmm0
movq (%r13), %rax
movq %r13, %rdi
callq *(%rax)
incq %rbx
jmp 0x5110
leaq -0x188(%rbp), %rdi
leaq -0x160(%rbp), %rsi
movl -0x44(%rbp), %r13d
movl %r13d, %edx
callq 0x47ee
movq -0x38(%rbp), %rbx
movq -0x120(%rbp), %rax
movsd %xmm0, (%rax,%rbx,8)
leaq -0x3d8(%rbp), %rdi
leaq 0x3389(%rip), %rsi      # 0x84ea
movsd %xmm0, -0x40(%rbp)
callq 0x21b0
movsd -0x40(%rbp), %xmm0
movq %rax, %rdi
callq 0x2270
movq %rax, %rdi
callq 0x20d0
leaq -0x160(%rbp), %rdi
callq 0x416a
leaq -0x188(%rbp), %rdi
callq 0x416a
leaq -0x1b0(%rbp), %rdi
callq 0x416a
leaq -0x1d8(%rbp), %rdi
callq 0x416a
movq -0x660(%rbp), %rcx
movq -0x658(%rbp), %r8
leaq -0x100(%rbp), %rdi
leaq -0x110(%rbp), %rsi
movl %r13d, %edx
callq 0x2748
movq -0x130(%rbp), %rax
movsd %xmm0, (%rax,%rbx,8)
leaq -0x3d8(%rbp), %rdi
leaq 0x3302(%rip), %rsi      # 0x84f0
movsd %xmm0, -0x40(%rbp)
callq 0x21b0
movsd -0x40(%rbp), %xmm0
movq %rax, %rdi
callq 0x2270
movq %rax, %rdi
callq 0x20d0
movl -0x80(%rbp), %r14d
imull $0xa, %r14d, %r14d
incq %rbx
movq %rbx, -0x38(%rbp)
leaq -0x470(%rbp), %rdi
callq 0x416a
leaq -0x670(%rbp), %rdi
callq 0x416a
leaq -0x100(%rbp), %rdi
callq 0x5dc2
leaq -0x110(%rbp), %rdi
callq 0x5dc2
movq -0xd0(%rbp), %rbx
jmp 0x4e54
incl -0x70(%rbp)
incl -0x6c(%rbp)
movq -0x118(%rbp), %rdx
jmp 0x4da5
leaq -0x3d8(%rbp), %rdi
callq 0x2220
leaq -0x670(%rbp), %rdi
callq 0x22c0
leaq -0x470(%rbp), %rbx
pushq $0x3
popq %rdx
movq %rbx, %rdi
movq -0xc0(%rbp), %r14
movq %r14, %rsi
callq 0x59b0
leaq -0x670(%rbp), %rdi
pushq $0x10
popq %rdx
movq %rbx, %rsi
callq 0x2050
leaq -0x710(%rbp), %rbx
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x59b0
leaq -0x3d8(%rbp), %rdi
pushq $0x10
popq %rdx
movq %rbx, %rsi
callq 0x2050
cvtsi2sdl -0xb4(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
xorl %ebx, %ebx
cmpq %rbx, -0x30(%rbp)
je 0x5628
movq -0xc8(%rbp), %rax
movl (%rax,%rbx,4), %esi
leaq -0x3d8(%rbp), %rdi
movl %esi, -0x98(%rbp)
callq 0x22e0
movq %rax, %rdi
leaq 0x31e2(%rip), %rsi      # 0x84f8
callq 0x21b0
movq -0xa0(%rbp), %rax
leaq (%rax,%rbx,8), %rax
movq %rax, -0x40(%rbp)
movq -0xa8(%rbp), %rax
movq %rbx, -0x60(%rbp)
leaq (%rax,%rbx,8), %r14
xorpd %xmm0, %xmm0
xorl %r15d, %r15d
leaq -0x670(%rbp), %rbx
cmpq -0x50(%rbp), %r15
je 0x539d
movq %r15, %r12
imulq -0x30(%rbp), %r12
movq -0x40(%rbp), %rax
movsd %xmm0, -0x38(%rbp)
movsd (%rax,%r12,8), %xmm0
movl %r13d, %edi
callq 0x3c58
movaps %xmm0, -0x80(%rbp)
movsd (%r14,%r12,8), %xmm0
movl %r13d, %edi
callq 0x3c58
movapd -0x80(%rbp), %xmm1
subsd %xmm0, %xmm1
movsd -0x38(%rbp), %xmm0
andpd 0x2e0c(%rip), %xmm1     # 0x81a0
addsd %xmm1, %xmm0
incq %r15
jmp 0x5347
divsd -0x68(%rbp), %xmm0
leaq -0x3d8(%rbp), %rdi
callq 0x2270
cmpl $0x0, -0x54(%rbp)
je 0x54e6
movq -0x90(%rbp), %rax
movq -0x60(%rbp), %rcx
leaq (%rax,%rcx,8), %r15
xorpd %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
xorl %r13d, %r13d
cmpq -0x50(%rbp), %r13
je 0x542d
movq %r13, %r12
imulq -0x30(%rbp), %r12
movsd (%r15,%r12,8), %xmm0
movl -0x44(%rbp), %ebx
movl %ebx, %edi
callq 0x3c58
movaps %xmm0, -0x80(%rbp)
movsd (%r14,%r12,8), %xmm0
movl %ebx, %edi
leaq -0x670(%rbp), %rbx
callq 0x3c58
movapd -0x80(%rbp), %xmm1
subsd %xmm0, %xmm1
andpd 0x2d86(%rip), %xmm1     # 0x81a0
movsd -0x38(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
incq %r13
jmp 0x53d3
leaq -0x3d8(%rbp), %rdi
leaq 0x30bd(%rip), %rsi      # 0x84f8
callq 0x21b0
movsd -0x38(%rbp), %xmm0
divsd -0x68(%rbp), %xmm0
movq %rax, %rdi
callq 0x2270
movq %rax, %rdi
leaq 0x309c(%rip), %rsi      # 0x84f8
callq 0x21b0
movq -0x88(%rbp), %rax
movq -0x60(%rbp), %rcx
leaq (%rax,%rcx,8), %r15
xorpd %xmm0, %xmm0
xorl %r12d, %r12d
cmpq -0x50(%rbp), %r12
je 0x54d1
movq %r12, %r13
imulq -0x30(%rbp), %r13
movsd %xmm0, -0x38(%rbp)
movsd (%r15,%r13,8), %xmm0
movl -0x44(%rbp), %ebx
movl %ebx, %edi
callq 0x3c58
movaps %xmm0, -0x80(%rbp)
movsd (%r14,%r13,8), %xmm0
movl %ebx, %edi
leaq -0x670(%rbp), %rbx
callq 0x3c58
movapd -0x80(%rbp), %xmm1
subsd %xmm0, %xmm1
movsd -0x38(%rbp), %xmm0
andpd 0x2cd8(%rip), %xmm1     # 0x81a0
addsd %xmm1, %xmm0
incq %r12
jmp 0x5477
divsd -0x68(%rbp), %xmm0
leaq -0x3d8(%rbp), %rdi
callq 0x2270
movl -0x44(%rbp), %r13d
leaq -0x3d8(%rbp), %rdi
callq 0x20d0
movq %rbx, %rdi
leaq 0x2fd3(%rip), %rsi      # 0x84cf
callq 0x21b0
movq %rax, %rdi
movl -0x98(%rbp), %esi
callq 0x22e0
movq %rax, %rdi
callq 0x20d0
movq -0x90(%rbp), %rax
movq -0x60(%rbp), %rcx
leaq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movq -0x88(%rbp), %rax
leaq (%rax,%rcx,8), %rax
movq %rax, -0x80(%rbp)
xorl %r12d, %r12d
cmpq -0x50(%rbp), %r12
je 0x561c
movq %r12, %r15
imulq -0x30(%rbp), %r15
movsd (%r14,%r15,8), %xmm0
movl %r13d, %edi
callq 0x3c58
movq %rbx, %rdi
callq 0x2270
movq %rax, %rdi
leaq 0x2f8c(%rip), %rsi      # 0x84fa
callq 0x21b0
movq %rax, %rdi
callq 0x20d0
movq -0x40(%rbp), %rax
movsd (%rax,%r15,8), %xmm0
movl %r13d, %edi
callq 0x3c58
movq %rbx, %rdi
callq 0x2270
movq %rax, %rdi
leaq 0x2f63(%rip), %rsi      # 0x8502
callq 0x21b0
movq %rax, %rdi
callq 0x20d0
cmpl $0x0, -0x54(%rbp)
je 0x5614
movq -0x38(%rbp), %rax
movsd (%rax,%r15,8), %xmm0
movl %r13d, %edi
callq 0x3c58
movq %rbx, %rdi
callq 0x2270
movq %rax, %rdi
leaq 0x2f30(%rip), %rsi      # 0x8506
callq 0x21b0
movq %rax, %rdi
callq 0x20d0
movq -0x80(%rbp), %rax
movsd (%rax,%r15,8), %xmm0
movl %r13d, %edi
callq 0x3c58
movq %rbx, %rdi
callq 0x2270
movq %rax, %rdi
leaq 0x2f03(%rip), %rsi      # 0x850a
callq 0x21b0
movq %rax, %rdi
callq 0x20d0
incq %r12
jmp 0x553c
movq -0x60(%rbp), %rbx
incq %rbx
jmp 0x52e6
leaq -0x670(%rbp), %rdi
callq 0x2220
leaq -0x3d8(%rbp), %rdi
callq 0x2220
leaq -0x710(%rbp), %rbx
pushq $0x2
popq %rdx
movq %rbx, %rdi
movq -0xc0(%rbp), %rsi
callq 0x59b0
leaq -0x3d8(%rbp), %rdi
pushq $0x10
popq %rdx
movq %rbx, %rsi
callq 0x2050
xorl %r15d, %r15d
leaq -0x3d8(%rbp), %rbx
leaq 0x2e7c(%rip), %r14      # 0x84f8
cmpq %r15, -0x30(%rbp)
je 0x56c1
movq -0xa8(%rbp), %rax
leaq (%rax,%r15,8), %r12
xorl %r13d, %r13d
cmpq -0x50(%rbp), %r13
je 0x56bc
movq %r13, %rax
imulq -0x30(%rbp), %rax
movsd (%r12,%rax,8), %xmm0
movq %rbx, %rdi
callq 0x2270
movq %rax, %rdi
movq %r14, %rsi
callq 0x21b0
incq %r13
jmp 0x5690
incq %r15
jmp 0x567c
leaq -0x3d8(%rbp), %rdi
callq 0x20d0
xorl %r15d, %r15d
leaq -0x3d8(%rbp), %rbx
leaq 0x2e1a(%rip), %r14      # 0x84f8
cmpq %r15, -0x30(%rbp)
je 0x5723
movq -0xa0(%rbp), %rax
leaq (%rax,%r15,8), %r12
xorl %r13d, %r13d
cmpq -0x50(%rbp), %r13
je 0x571e
movq %r13, %rax
imulq -0x30(%rbp), %rax
movsd (%r12,%rax,8), %xmm0
movq %rbx, %rdi
callq 0x2270
movq %rax, %rdi
movq %r14, %rsi
callq 0x21b0
incq %r13
jmp 0x56f2
incq %r15
jmp 0x56de
leaq -0x3d8(%rbp), %rdi
callq 0x20d0
cmpl $0x0, -0x54(%rbp)
je 0x57fd
xorl %r15d, %r15d
leaq -0x3d8(%rbp), %rbx
leaq 0x2dae(%rip), %r14      # 0x84f8
cmpq %r15, -0x30(%rbp)
je 0x578f
movq -0x90(%rbp), %rax
leaq (%rax,%r15,8), %r12
xorl %r13d, %r13d
cmpq -0x50(%rbp), %r13
je 0x578a
movq %r13, %rax
imulq -0x30(%rbp), %rax
movsd (%r12,%rax,8), %xmm0
movq %rbx, %rdi
callq 0x2270
movq %rax, %rdi
movq %r14, %rsi
callq 0x21b0
incq %r13
jmp 0x575e
incq %r15
jmp 0x574a
leaq -0x3d8(%rbp), %rdi
callq 0x20d0
xorl %r15d, %r15d
leaq -0x3d8(%rbp), %rbx
leaq 0x2d4c(%rip), %r14      # 0x84f8
cmpq %r15, -0x30(%rbp)
je 0x57f1
movq -0x88(%rbp), %rax
leaq (%rax,%r15,8), %r12
xorl %r13d, %r13d
cmpq -0x50(%rbp), %r13
je 0x57ec
movq %r13, %rax
imulq -0x30(%rbp), %rax
movsd (%r12,%rax,8), %xmm0
movq %rbx, %rdi
callq 0x2270
movq %rax, %rdi
movq %r14, %rsi
callq 0x21b0
incq %r13
jmp 0x57c0
incq %r15
jmp 0x57ac
leaq -0x3d8(%rbp), %rdi
callq 0x20d0
leaq -0x3d8(%rbp), %rdi
callq 0x20d0
leaq -0x3d8(%rbp), %rdi
callq 0x2220
leaq -0x670(%rbp), %rdi
callq 0x2240
leaq -0x3d8(%rbp), %rdi
callq 0x2240
xorl %eax, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x778b(%rip), %rdi      # 0xcfd0
leaq 0x2aa5(%rip), %rsi      # 0x82f1
callq 0x21b0
movq %rax, %rdi
callq 0x20d0
jmp 0x58ae
movq 0x776e(%rip), %rdi      # 0xcfd0
leaq 0x2b13(%rip), %rsi      # 0x837c
jmp 0x58a9
movq 0x775e(%rip), %rdi      # 0xcfd0
leaq 0x2b60(%rip), %rsi      # 0x83d9
jmp 0x58a9
movq 0x774e(%rip), %rdi      # 0xcfd0
leaq 0x2b7f(%rip), %rsi      # 0x8408
jmp 0x58a9
movq 0x773e(%rip), %rdi      # 0xcfd0
leaq 0x2b9b(%rip), %rsi      # 0x8434
jmp 0x58a9
movq 0x772e(%rip), %rdi      # 0xcfd0
leaq 0x2b05(%rip), %rsi      # 0x83ae
callq 0x21b0
pushq $0x1
popq %rdi
callq 0x20e0
leaq 0x73c3(%rip), %rsi      # 0xcc80
movq %rax, %rdi
xorl %edx, %edx
callq 0x22d0
jmp 0x5903
jmp 0x590f
jmp 0x590f
jmp 0x5903
jmp 0x590f
jmp 0x5903
jmp 0x590f
jmp 0x5931
jmp 0x5942
jmp 0x5953
jmp 0x5964
jmp 0x5975
jmp 0x5903
movq %rax, %rbx
jmp 0x5990
movq %rax, %rbx
jmp 0x5984
jmp 0x590f
jmp 0x590f
jmp 0x590f
jmp 0x590f
jmp 0x5920
jmp 0x5942
movq %rax, %rbx
jmp 0x599c
jmp 0x5964
jmp 0x5964
movq %rax, %rbx
leaq -0x670(%rbp), %rdi
callq 0x2240
jmp 0x599c
movq %rax, %rbx
leaq -0x160(%rbp), %rdi
callq 0x416a
jmp 0x5934
movq %rax, %rbx
leaq -0x188(%rbp), %rdi
callq 0x416a
jmp 0x5945
movq %rax, %rbx
leaq -0x1b0(%rbp), %rdi
callq 0x416a
jmp 0x5956
movq %rax, %rbx
leaq -0x1d8(%rbp), %rdi
callq 0x416a
jmp 0x5967
movq %rax, %rbx
leaq -0x470(%rbp), %rdi
callq 0x416a
jmp 0x5978
movq %rax, %rbx
leaq -0x670(%rbp), %rdi
callq 0x416a
leaq -0x100(%rbp), %rdi
callq 0x5dc2
leaq -0x110(%rbp), %rdi
callq 0x5dc2
leaq -0x3d8(%rbp), %rdi
callq 0x2240
movq %rbx, %rdi
callq 0x2300