// File: /workspace/github_cpp_makefile_star2_O2/ashlall[P]StreamStats/ChiSquareExperiments/VarySizeOneSample.cpp
// Function: main
int main(int argc, char* argv[])
{
  if (argc < 10)
  {
    cout << "usage: VarySize lower-size upper-size num-streams(>0) [N|U|P|E] location scale [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 location = atof (argv[5]);
  double scale = atof (argv[6]);
  int all_quantiles = atoi (argv[7]);
  double memory_percent = atof (argv[8]);
  int num_buckets = atoi(argv[9]);
  int seed = 1; 

  // ensures that the parameters will not create error
  if (data_repeats <= 0)
  {
    cout << "The number of streams must be greater than zero." << endl;
    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." << endl;
    throw ParameterError();
  }
  if (lower <= 0)
  {
    cout << "The lower stream size must be greater than 0." << endl;
    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];
  long times[data_repeats][num_sizes];
  long times2[data_repeats][num_sizes];

  // creates and initializes the log file
  ofstream data_file;
  char str[150];
  name_file(str, argv, 0);
  data_file.open(str);
  data_file << "Distribution: " << distribution_type << ", location = " << location << ", scale = " << scale << endl;

  for (int i = 0; i < data_repeats; i++) // runs all tests data_repeats times
  {
    stream_size = lower;
    int j = 0;
    data_file << "Stream " << i+1 << ":" << endl;
    while (stream_size <= upper)  // runs tests for every stream size
    {
      int sample_size = memory_percent * stream_size;
      if (i == 0)
        sizes[j] = stream_size;
      data_file << "stream_size = " << stream_size << endl;
      
      // generates the data based on inputed parameters
      DataGenerator data(distribution_type, stream_size, seed, location, scale);
      double *stream = data.get_stream();

      // computes GK estimate
      ChiSquareContinuous sketch1(sample_size, 1); 

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

      for (int i = 0; i < stream_size; i++)
	      sketch1.insert(stream[i]);

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

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


      double GK_stat = get_estimate(&sketch1, distribution_type, num_buckets, location, scale);
      GK_values[i][j] = GK_stat;
      data_file << "GK = " << GK_stat << endl;

      if (all_quantiles)
      {
      	// computes QDigest estimate
	ChiSquareContinuous sketch2(sample_size, 2);
	for (int i = 0; i < stream_size; i++)
          sketch2.insert(stream[i]);
	double QD_stat = get_estimate(&sketch2, distribution_type, num_buckets, location, scale);
	QD_values[i][j] = QD_stat;
        data_file << "QDigest = " << QD_stat << endl;

	// computes ReservoirSampling estimate
	ChiSquareContinuous sketch3(sample_size, 3);
	for (int i = 0; i < stream_size; i++)
	  sketch3.insert(stream[i]);
	double RS_stat = get_estimate(&sketch3, distribution_type, num_buckets, location, scale);
	RS_values[i][j] = RS_stat;
        data_file << "Reservoir Sampling = " << RS_stat << endl;
      }

      // computes actual statistic
      double *upper_interval = sketch1.get_upper();
      double *lower_interval = sketch1.get_lower();
      double actual = data.get_stat_one_sample(num_buckets, upper_interval, lower_interval);
      actual_values[i][j] = actual;
      data_file << "Real = " << actual << endl;

      stream_size *= 10;
      j++;
    }
    seed++; // changes seed for next repeat?
  }
  data_file.close();

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

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

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

  int deg_freedom = num_buckets - get_DOF(distribution_type);
  for (int i = 0; i < num_sizes; i++)
  {
    data_file << sizes[i] << "\t";
	time_file << sizes[i] << "\t";

    // adds pvalue error from the GK sketch to the table file
    double error = 0;
    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;

	// adds times to the time table
	long double avg_time = 0.0;
	for (int j = 0; j < data_repeats; j++)
		avg_time += times[j][i] + times2[j][i]/1000000.0;// diffSeconds + diffUSeconds/1000000.0
	time_file << avg_time / data_repeats << endl;

    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 Sampling 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 << "streamsize = " << 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();
  time_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 statistcs 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.close();
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x908, %rsp            # imm = 0x908
cmpl $0x9, %edi
jle 0x57ff
movq %rsi, %rbx
movq 0x8(%rsi), %rdi
callq 0x2200
movsd %xmm0, -0x30(%rbp)
movq 0x10(%rbx), %rdi
callq 0x2200
movsd %xmm0, -0xb8(%rbp)
movq 0x18(%rbx), %rdi
callq 0x2270
movl %eax, %r14d
movq 0x20(%rbx), %rax
movq 0x28(%rbx), %rdi
movzbl (%rax), %r15d
callq 0x2200
movsd %xmm0, -0x70(%rbp)
movq 0x30(%rbx), %rdi
callq 0x2200
movsd %xmm0, -0x50(%rbp)
movq 0x38(%rbx), %rdi
callq 0x2270
movl %eax, -0x54(%rbp)
movq 0x40(%rbx), %rdi
callq 0x2200
movsd %xmm0, -0xf0(%rbp)
movq 0x48(%rbx), %rdi
callq 0x2270
movq %rax, -0x40(%rbp)
testl %r14d, %r14d
jle 0x580f
leal -0x45(%r15), %eax
cmpl $0x10, %eax
ja 0x5854
movl $0x10a01, %ecx          # imm = 0x10A01
btl %eax, %ecx
jae 0x5854
xorpd %xmm0, %xmm0
movsd -0x30(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jae 0x581f
ucomisd -0xf0(%rbp), %xmm0
jae 0x582f
movq %r15, -0x38(%rbp)
cmpl $0x0, -0x40(%rbp)
jle 0x583f
cvttsd2si %xmm1, %ecx
movl %r14d, -0xc4(%rbp)
movl %r14d, %r13d
xorl %eax, %eax
movq $0x0, -0x30(%rbp)
movl %ecx, -0xc8(%rbp)
movsd -0xb8(%rbp), %xmm1
cvtsi2sd %ecx, %xmm0
ucomisd %xmm0, %xmm1
jb 0x4bcc
imull $0xa, %ecx, %ecx
incq -0x30(%rbp)
addq %r13, %rax
jmp 0x4bb6
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, -0x98(%rbp)
movq %rcx, %rsp
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x90(%rbp)
movq %rcx, %rsp
movq %rsp, %rdx
movq -0x30(%rbp), %rcx
leaq 0xf(,%rcx,4), %rcx
andq $-0x10, %rcx
subq %rcx, %rdx
movq %rdx, -0xe8(%rbp)
movq %rdx, %rsp
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0xe0(%rbp)
movq %rcx, %rsp
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0xd8(%rbp)
movq %rcx, %rsp
movq %rbx, %r15
leaq -0x358(%rbp), %rbx
movq %rbx, %rdi
callq 0x22e0
leaq -0x930(%rbp), %r14
movq %r14, %rdi
movq %r15, -0x88(%rbp)
movq %r15, %rsi
xorl %edx, %edx
callq 0x592d
pushq $0x10
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2050
leaq 0x37b8(%rip), %rsi      # 0x8452
leaq -0x358(%rbp), %rdi
callq 0x21c0
movsbl -0x38(%rbp), %esi
movq %rax, %rdi
callq 0x21e0
leaq 0x37a8(%rip), %rsi      # 0x8461
movq %rax, %rdi
callq 0x21c0
movq %rax, %rdi
movsd -0x70(%rbp), %xmm0
callq 0x2280
leaq 0x379a(%rip), %rsi      # 0x846f
movq %rax, %rdi
callq 0x21c0
movq %rax, %rdi
movsd -0x50(%rbp), %xmm0
callq 0x2280
movq %rax, %rdi
callq 0x20d0
pushq $0x1
popq %rax
xorl %ebx, %ebx
movl %eax, -0x7c(%rbp)
movq %r13, -0xc0(%rbp)
cmpq %r13, %rbx
je 0x510d
leaq -0x358(%rbp), %rdi
leaq 0x3762(%rip), %rsi      # 0x847a
callq 0x21c0
leaq 0x1(%rbx), %rsi
movq %rax, %rdi
movq %rsi, -0xf8(%rbp)
callq 0x2300
movq %rax, %rdi
leaq 0x3748(%rip), %rsi      # 0x8482
callq 0x21c0
movq %rax, %rdi
callq 0x20d0
movq %rbx, -0x130(%rbp)
movq %rbx, %rax
imulq -0x30(%rbp), %rax
movq -0xe0(%rbp), %rcx
leaq (%rcx,%rax,8), %rcx
movq %rcx, -0x128(%rbp)
movq -0xd8(%rbp), %rcx
leaq (%rcx,%rax,8), %rcx
movq %rcx, -0x120(%rbp)
movq -0xa0(%rbp), %rcx
leaq (%rcx,%rax,8), %rcx
movq %rcx, -0x118(%rbp)
movq -0x98(%rbp), %rcx
leaq (%rcx,%rax,8), %rcx
movq %rcx, -0x108(%rbp)
movq -0x90(%rbp), %rcx
leaq (%rcx,%rax,8), %rcx
movq %rcx, -0x100(%rbp)
movq -0xa8(%rbp), %rcx
leaq (%rcx,%rax,8), %rax
movq %rax, -0x110(%rbp)
xorl %r12d, %r12d
movl -0xc8(%rbp), %ebx
cvtsi2sd %ebx, %xmm1
movsd -0xb8(%rbp), %xmm0
movsd %xmm1, -0x48(%rbp)
ucomisd %xmm1, %xmm0
jb 0x50fe
cmpq $0x0, -0x130(%rbp)
jne 0x4dfb
movq -0xe8(%rbp), %rax
movl %ebx, (%rax,%r12,4)
leaq -0x358(%rbp), %rdi
leaq 0x367b(%rip), %rsi      # 0x8484
callq 0x21c0
movq -0x38(%rbp), %r14
movq %rax, %rdi
movl %ebx, %esi
callq 0x2300
movq %rax, %rdi
callq 0x20d0
movsbl %r14b, %esi
leaq -0x3f0(%rbp), %rdi
movl %ebx, %edx
movl -0x7c(%rbp), %ecx
movsd -0x70(%rbp), %xmm0
movsd -0x50(%rbp), %xmm1
callq 0x24ac
movsd -0x48(%rbp), %xmm0
mulsd -0xf0(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movq -0x3f0(%rbp), %r14
cvtsi2sd %eax, %xmm0
leaq -0x890(%rbp), %rdi
movsd %xmm0, -0x48(%rbp)
pushq $0x1
popq %rsi
callq 0x4094
leaq -0x158(%rbp), %rdi
xorl %esi, %esi
callq 0x2290
testl %ebx, %ebx
movl $0x0, %r15d
cmovgl %ebx, %r15d
xorl %r13d, %r13d
cmpq %r13, %r15
je 0x4eac
movsd (%r14,%r13,8), %xmm0
movq -0x870(%rbp), %rdi
movq (%rdi), %rax
callq *(%rax)
incq %r13
jmp 0x4e90
leaq -0x148(%rbp), %rdi
xorl %esi, %esi
callq 0x2290
movq -0x148(%rbp), %rax
movq -0x140(%rbp), %rcx
subq -0x158(%rbp), %rax
subq -0x150(%rbp), %rcx
movq -0x128(%rbp), %rdx
movq %rax, (%rdx,%r12,8)
movq -0x120(%rbp), %rax
movq %rcx, (%rax,%r12,8)
movsbl -0x38(%rbp), %esi
leaq -0x890(%rbp), %rdi
movq -0x40(%rbp), %rdx
movsd -0x70(%rbp), %xmm0
movsd -0x50(%rbp), %xmm1
callq 0x5b58
movq -0x118(%rbp), %rax
movsd %xmm0, (%rax,%r12,8)
leaq -0x358(%rbp), %rdi
leaq 0x356e(%rip), %rsi      # 0x8493
movsd %xmm0, -0x78(%rbp)
callq 0x21c0
movsd -0x78(%rbp), %xmm0
movq %rax, %rdi
callq 0x2280
movq %rax, %rdi
callq 0x20d0
cmpl $0x0, -0x54(%rbp)
je 0x507c
leaq -0x690(%rbp), %rdi
movsd -0x48(%rbp), %xmm0
pushq $0x2
popq %rsi
callq 0x4094
xorl %r13d, %r13d
cmpq %r13, %r15
je 0x4f81
movsd (%r14,%r13,8), %xmm0
movq -0x670(%rbp), %rdi
movq (%rdi), %rax
callq *(%rax)
incq %r13
jmp 0x4f65
movsbl -0x38(%rbp), %esi
leaq -0x690(%rbp), %rdi
movq -0x40(%rbp), %rdx
movsd -0x70(%rbp), %xmm0
movsd -0x50(%rbp), %xmm1
callq 0x5b58
movq -0x108(%rbp), %rax
movsd %xmm0, (%rax,%r12,8)
leaq -0x358(%rbp), %rdi
leaq 0x34df(%rip), %rsi      # 0x8499
movsd %xmm0, -0x78(%rbp)
callq 0x21c0
movsd -0x78(%rbp), %xmm0
movq %rax, %rdi
callq 0x2280
movq %rax, %rdi
callq 0x20d0
leaq -0x490(%rbp), %rdi
movsd -0x48(%rbp), %xmm0
pushq $0x3
popq %rsi
callq 0x4094
xorl %r13d, %r13d
cmpq %r13, %r15
je 0x500c
movsd (%r14,%r13,8), %xmm0
movq -0x470(%rbp), %rdi
movq (%rdi), %rax
callq *(%rax)
incq %r13
jmp 0x4ff0
movsbl -0x38(%rbp), %esi
leaq -0x490(%rbp), %rdi
movq -0x40(%rbp), %rdx
movsd -0x70(%rbp), %xmm0
movsd -0x50(%rbp), %xmm1
callq 0x5b58
movq -0x100(%rbp), %rax
movsd %xmm0, (%rax,%r12,8)
leaq -0x358(%rbp), %rdi
leaq 0x345f(%rip), %rsi      # 0x84a4
movsd %xmm0, -0x48(%rbp)
callq 0x21c0
movsd -0x48(%rbp), %xmm0
movq %rax, %rdi
callq 0x2280
movq %rax, %rdi
callq 0x20d0
leaq -0x490(%rbp), %rdi
callq 0x418a
leaq -0x690(%rbp), %rdi
callq 0x418a
movq -0x880(%rbp), %rdx
movq -0x878(%rbp), %rcx
leaq -0x3f0(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x26ce
movq -0x110(%rbp), %rax
movsd %xmm0, (%rax,%r12,8)
leaq -0x358(%rbp), %rdi
leaq 0x3405(%rip), %rsi      # 0x84ba
movsd %xmm0, -0x48(%rbp)
callq 0x21c0
movsd -0x48(%rbp), %xmm0
movq %rax, %rdi
callq 0x2280
movq %rax, %rdi
callq 0x20d0
imull $0xa, %ebx, %ebx
incq %r12
leaq -0x890(%rbp), %rdi
callq 0x418a
leaq -0x3f0(%rbp), %rdi
callq 0x5d34
movq -0xc0(%rbp), %r13
jmp 0x4dcb
incl -0x7c(%rbp)
movq -0xf8(%rbp), %rbx
jmp 0x4d01
leaq -0x358(%rbp), %rdi
callq 0x2230
leaq -0x930(%rbp), %rbx
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq -0x88(%rbp), %rsi
callq 0x592d
leaq -0x358(%rbp), %rdi
pushq $0x10
popq %rdx
movq %rbx, %rsi
callq 0x2050
leaq -0x890(%rbp), %rdi
callq 0x22e0
leaq -0x490(%rbp), %rbx
pushq $0x5
popq %rdx
movq %rbx, %rdi
movq -0x88(%rbp), %rsi
callq 0x592d
leaq -0x890(%rbp), %rdi
pushq $0x10
popq %rdx
movq %rbx, %rsi
callq 0x2050
leaq -0x690(%rbp), %rdi
callq 0x22e0
leaq -0x3f0(%rbp), %rbx
pushq $0x3
popq %rdx
movq %rbx, %rdi
movq -0x88(%rbp), %rsi
callq 0x592d
leaq -0x690(%rbp), %rdi
pushq $0x10
popq %rdx
movq %rbx, %rsi
callq 0x2050
xorl %eax, %eax
cmpl $0x45, -0x38(%rbp)
sete %al
movl -0xc4(%rbp), %ecx
cvtsi2sd %ecx, %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x40(%rbp), %rdx
leal (%rax,%rdx), %r12d
addl $-0x3, %r12d
movl %ecx, -0xcc(%rbp)
xorl %ebx, %ebx
fildl -0xcc(%rbp)
fstpt -0xb8(%rbp)
cmpq %rbx, -0x30(%rbp)
je 0x55c5
movq -0xe8(%rbp), %rax
movl (%rax,%rbx,4), %r14d
leaq -0x358(%rbp), %rdi
movl %r14d, %esi
callq 0x2300
movq %rax, %rdi
leaq 0x32aa(%rip), %rsi      # 0x84c2
callq 0x21c0
leaq -0x890(%rbp), %rdi
movl %r14d, %esi
callq 0x2300
movq %rax, %rdi
leaq 0x328c(%rip), %rsi      # 0x84c2
callq 0x21c0
movl %r14d, -0x78(%rbp)
movq -0xa0(%rbp), %rax
leaq (%rax,%rbx,8), %rax
movq %rax, -0x38(%rbp)
movq -0xa8(%rbp), %rax
movq %rbx, -0x50(%rbp)
leaq (%rax,%rbx,8), %r14
xorpd %xmm0, %xmm0
xorl %ebx, %ebx
cmpq %r13, %rbx
je 0x52b8
movq %rbx, %r15
imulq -0x30(%rbp), %r15
movq -0x38(%rbp), %rax
movsd %xmm0, -0x40(%rbp)
movsd (%rax,%r15,8), %xmm0
movl %r12d, %edi
callq 0x3c78
movaps %xmm0, -0x70(%rbp)
movsd (%r14,%r15,8), %xmm0
movl %r12d, %edi
callq 0x3c78
movapd -0x70(%rbp), %xmm1
subsd %xmm0, %xmm1
movsd -0x40(%rbp), %xmm0
andpd 0x2ef1(%rip), %xmm1     # 0x81a0
addsd %xmm1, %xmm0
incq %rbx
jmp 0x5263
divsd -0x48(%rbp), %xmm0
leaq -0x358(%rbp), %rdi
callq 0x2280
movq -0xe0(%rbp), %rax
movq -0x50(%rbp), %rbx
leaq (%rax,%rbx,8), %rax
movq -0xd8(%rbp), %rcx
leaq (%rcx,%rbx,8), %rcx
xorl %edx, %edx
fldz
movsd 0x2e79(%rip), %xmm2     # 0x8168
cmpq %r13, %rdx
je 0x5323
movq %rdx, %rsi
imulq -0x30(%rbp), %rsi
cvtsi2sdq (%rax,%rsi,8), %xmm0
cvtsi2sdq (%rcx,%rsi,8), %xmm1
divsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, -0x138(%rbp)
faddl -0x138(%rbp)
incq %rdx
jmp 0x52ef
fldt -0xb8(%rbp)
fdivrp %st, %st(1)
subq $0x10, %rsp
fstpt (%rsp)
leaq -0x890(%rbp), %rdi
callq 0x2100
popq %rcx
popq %rdx
movq %rax, %rdi
callq 0x20d0
cmpl $0x0, -0x54(%rbp)
je 0x5478
movq -0x98(%rbp), %rax
leaq (%rax,%rbx,8), %rbx
xorpd %xmm0, %xmm0
movsd %xmm0, -0x40(%rbp)
xorl %r15d, %r15d
cmpq %r13, %r15
je 0x53c1
movq %r15, %r13
imulq -0x30(%rbp), %r13
movsd (%rbx,%r13,8), %xmm0
movl %r12d, %edi
callq 0x3c78
movaps %xmm0, -0x70(%rbp)
movsd (%r14,%r13,8), %xmm0
movq -0xc0(%rbp), %r13
movl %r12d, %edi
callq 0x3c78
movapd -0x70(%rbp), %xmm1
subsd %xmm0, %xmm1
andpd 0x2df2(%rip), %xmm1     # 0x81a0
movsd -0x40(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
incq %r15
jmp 0x5369
leaq -0x358(%rbp), %rdi
leaq 0x30f3(%rip), %rsi      # 0x84c2
callq 0x21c0
movq -0x50(%rbp), %rbx
movsd -0x40(%rbp), %xmm0
divsd -0x48(%rbp), %xmm0
movq %rax, %rdi
callq 0x2280
movq %rax, %rdi
leaq 0x30ce(%rip), %rsi      # 0x84c2
callq 0x21c0
movq -0x90(%rbp), %rax
leaq (%rax,%rbx,8), %rbx
xorpd %xmm0, %xmm0
xorl %r15d, %r15d
cmpq %r13, %r15
je 0x5463
movq %r15, %r13
imulq -0x30(%rbp), %r13
movsd %xmm0, -0x40(%rbp)
movsd (%rbx,%r13,8), %xmm0
movl %r12d, %edi
callq 0x3c78
movaps %xmm0, -0x70(%rbp)
movsd (%r14,%r13,8), %xmm0
movq -0xc0(%rbp), %r13
movl %r12d, %edi
callq 0x3c78
movapd -0x70(%rbp), %xmm1
subsd %xmm0, %xmm1
movsd -0x40(%rbp), %xmm0
andpd 0x2d46(%rip), %xmm1     # 0x81a0
addsd %xmm1, %xmm0
incq %r15
jmp 0x540b
divsd -0x48(%rbp), %xmm0
leaq -0x358(%rbp), %rdi
callq 0x2280
movq -0x50(%rbp), %rbx
leaq -0x358(%rbp), %rdi
callq 0x20d0
leaq -0x690(%rbp), %rdi
leaq 0x3032(%rip), %rsi      # 0x84c4
callq 0x21c0
movq %rax, %rdi
movl -0x78(%rbp), %esi
callq 0x2300
movq %rax, %rdi
callq 0x20d0
movq -0x98(%rbp), %rax
leaq (%rax,%rbx,8), %rax
movq %rax, -0x40(%rbp)
movq -0x90(%rbp), %rax
leaq (%rax,%rbx,8), %rax
movq %rax, -0x70(%rbp)
xorl %ebx, %ebx
cmpq %r13, %rbx
je 0x55b9
movq %rbx, %r15
imulq -0x30(%rbp), %r15
movsd (%r14,%r15,8), %xmm0
movl %r12d, %edi
callq 0x3c78
leaq -0x690(%rbp), %rdi
callq 0x2280
movq %rax, %rdi
leaq 0x2fd3(%rip), %rsi      # 0x84d2
callq 0x21c0
movq %rax, %rdi
callq 0x20d0
movq -0x38(%rbp), %rax
movsd (%rax,%r15,8), %xmm0
movl %r12d, %edi
callq 0x3c78
leaq -0x690(%rbp), %rdi
callq 0x2280
movq %rax, %rdi
leaq 0x2fa6(%rip), %rsi      # 0x84da
callq 0x21c0
movq %rax, %rdi
callq 0x20d0
cmpl $0x0, -0x54(%rbp)
je 0x55b1
movq -0x40(%rbp), %rax
movsd (%rax,%r15,8), %xmm0
movl %r12d, %edi
callq 0x3c78
leaq -0x690(%rbp), %rdi
callq 0x2280
movq %rax, %rdi
leaq 0x2f6f(%rip), %rsi      # 0x84de
callq 0x21c0
movq %rax, %rdi
callq 0x20d0
movq -0x70(%rbp), %rax
movsd (%rax,%r15,8), %xmm0
movl %r12d, %edi
callq 0x3c78
leaq -0x690(%rbp), %rdi
callq 0x2280
movq %rax, %rdi
leaq 0x2f3e(%rip), %rsi      # 0x84e2
callq 0x21c0
movq %rax, %rdi
callq 0x20d0
incq %rbx
jmp 0x54ca
movq -0x50(%rbp), %rbx
incq %rbx
jmp 0x51ea
leaq -0x690(%rbp), %rdi
callq 0x2230
leaq -0x358(%rbp), %rdi
callq 0x2230
leaq -0x890(%rbp), %rdi
callq 0x2230
leaq -0x930(%rbp), %rbx
pushq $0x2
popq %rdx
movq %rbx, %rdi
movq -0x88(%rbp), %rsi
callq 0x592d
leaq -0x358(%rbp), %rdi
pushq $0x10
popq %rdx
movq %rbx, %rsi
callq 0x2050
xorl %ecx, %ecx
leaq -0x358(%rbp), %rbx
leaq 0x2e9e(%rip), %r14      # 0x84c2
cmpq %rcx, -0x30(%rbp)
je 0x5670
movq -0xa8(%rbp), %rax
movq %rcx, -0x38(%rbp)
leaq (%rax,%rcx,8), %r12
xorl %r15d, %r15d
cmpq %r13, %r15
je 0x5667
movq %r15, %rax
imulq -0x30(%rbp), %rax
movsd (%r12,%rax,8), %xmm0
movq %rbx, %rdi
callq 0x2280
movq %rax, %rdi
movq %r14, %rsi
callq 0x21c0
incq %r15
jmp 0x563c
movq -0x38(%rbp), %rcx
incq %rcx
jmp 0x5624
leaq -0x358(%rbp), %rdi
callq 0x20d0
xorl %ecx, %ecx
leaq -0x358(%rbp), %rbx
leaq 0x2e36(%rip), %r14      # 0x84c2
cmpq %rcx, -0x30(%rbp)
je 0x56d8
movq -0xa0(%rbp), %rax
movq %rcx, -0x38(%rbp)
leaq (%rax,%rcx,8), %r12
xorl %r15d, %r15d
cmpq %r13, %r15
je 0x56cf
movq %r15, %rax
imulq -0x30(%rbp), %rax
movsd (%r12,%rax,8), %xmm0
movq %rbx, %rdi
callq 0x2280
movq %rax, %rdi
movq %r14, %rsi
callq 0x21c0
incq %r15
jmp 0x56a4
movq -0x38(%rbp), %rcx
incq %rcx
jmp 0x568c
leaq -0x358(%rbp), %rdi
callq 0x20d0
cmpl $0x0, -0x54(%rbp)
je 0x57be
xorl %ecx, %ecx
leaq -0x358(%rbp), %rbx
leaq 0x2dc4(%rip), %r14      # 0x84c2
cmpq %rcx, -0x30(%rbp)
je 0x574a
movq -0x98(%rbp), %rax
movq %rcx, -0x38(%rbp)
leaq (%rax,%rcx,8), %r12
xorl %r15d, %r15d
cmpq %r13, %r15
je 0x5741
movq %r15, %rax
imulq -0x30(%rbp), %rax
movsd (%r12,%rax,8), %xmm0
movq %rbx, %rdi
callq 0x2280
movq %rax, %rdi
movq %r14, %rsi
callq 0x21c0
incq %r15
jmp 0x5716
movq -0x38(%rbp), %rcx
incq %rcx
jmp 0x56fe
leaq -0x358(%rbp), %rdi
callq 0x20d0
xorl %ecx, %ecx
leaq -0x358(%rbp), %rbx
leaq 0x2d5c(%rip), %r14      # 0x84c2
cmpq %rcx, -0x30(%rbp)
je 0x57b2
movq -0x90(%rbp), %rax
movq %rcx, -0x38(%rbp)
leaq (%rax,%rcx,8), %r12
xorl %r15d, %r15d
cmpq %r13, %r15
je 0x57a9
movq %r15, %rax
imulq -0x30(%rbp), %rax
movsd (%r12,%rax,8), %xmm0
movq %rbx, %rdi
callq 0x2280
movq %rax, %rdi
movq %r14, %rsi
callq 0x21c0
incq %r15
jmp 0x577e
movq -0x38(%rbp), %rcx
incq %rcx
jmp 0x5766
leaq -0x358(%rbp), %rdi
callq 0x20d0
leaq -0x358(%rbp), %rdi
callq 0x2230
leaq -0x690(%rbp), %rdi
callq 0x2250
leaq -0x890(%rbp), %rdi
callq 0x2250
leaq -0x358(%rbp), %rdi
callq 0x2250
xorl %eax, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x77ca(%rip), %rdi      # 0xcfd0
leaq 0x2af4(%rip), %rsi      # 0x8301
jmp 0x5862
movq 0x77ba(%rip), %rdi      # 0xcfd0
leaq 0x2b54(%rip), %rsi      # 0x8371
jmp 0x5862
movq 0x77aa(%rip), %rdi      # 0xcfd0
leaq 0x2b9f(%rip), %rsi      # 0x83cc
jmp 0x5862
movq 0x779a(%rip), %rdi      # 0xcfd0
leaq 0x2bbd(%rip), %rsi      # 0x83fa
jmp 0x584d
movq 0x778a(%rip), %rdi      # 0xcfd0
leaq 0x2bd9(%rip), %rsi      # 0x8426
callq 0x21c0
jmp 0x586f
movq 0x7775(%rip), %rdi      # 0xcfd0
leaq 0x2b40(%rip), %rsi      # 0x83a2
callq 0x21c0
movq %rax, %rdi
callq 0x20d0
pushq $0x1
popq %rdi
callq 0x20e0
leaq 0x7402(%rip), %rsi      # 0xcc80
movq %rax, %rdi
xorl %edx, %edx
callq 0x22f0
jmp 0x58bf
jmp 0x588c
movq %rax, %rbx
jmp 0x58ce
jmp 0x58b6
jmp 0x58bf
jmp 0x58b6
jmp 0x58bf
jmp 0x58bf
jmp 0x58b6
jmp 0x58bf
jmp 0x58ed
jmp 0x58fe
jmp 0x58b6
movq %rax, %rbx
jmp 0x590d
jmp 0x58bf
jmp 0x58bf
jmp 0x58bf
jmp 0x58bf
jmp 0x58dc
jmp 0x58ed
movq %rax, %rbx
jmp 0x5919
jmp 0x58fe
jmp 0x58fe
movq %rax, %rbx
leaq -0x690(%rbp), %rdi
callq 0x2250
leaq -0x890(%rbp), %rdi
callq 0x2250
jmp 0x5919
movq %rax, %rbx
leaq -0x490(%rbp), %rdi
callq 0x418a
jmp 0x58f0
movq %rax, %rbx
leaq -0x690(%rbp), %rdi
callq 0x418a
jmp 0x5901
movq %rax, %rbx
leaq -0x890(%rbp), %rdi
callq 0x418a
leaq -0x3f0(%rbp), %rdi
callq 0x5d34
leaq -0x358(%rbp), %rdi
callq 0x2250
movq %rbx, %rdi
callq 0x2320