// File: /workspace/github_cpp_makefile_star2_O3/adamnovak[P]rlcsa/sampler_test.cpp
// Function: main
int main(int argc, char** argv)
{
  std::cout << "Sampler test" << std::endl;
  std::cout << std::endl;

  // Handle command line parameters.
  double multiplier = 1.0, greediness = 0.0;
  bool greedy = false, forward = true, write = false;
  char* base_name = 0;
  char* weights_name = 0;
  usint threads = 1;
  for(int i = 1; i < argc; i++)
  {
    if(argv[i][0] == '-')
    {
      switch(argv[i][1])
      {
        case 'b':
          forward = false; break;
        case 'g':
          greediness = atof(argv[i] + 2); greedy = true; break;
        case 'm':
          multiplier = atof(argv[i] + 2); break;
        case 't':
          threads = atoi(argv[i] + 2); break;
        case 'w':
          write = true; break;
        default:
          std::cout << "Invalid option: " << argv[i] << std::endl << std::endl;
          printUsage();
          return 1;
      }
    }
    else if(base_name == 0)
    {
      base_name = argv[i];
    }
    else if(weights_name == 0)
    {
      weights_name = argv[i];
    }
  }
  if(weights_name == 0) { printUsage(); return 2; }

  std::cout << "Options:";
  greediness = std::min(1.0, std::max(0.0, greediness));
  threads = std::max(threads, (usint)1); threads = std::min(threads, (usint)64);
  if(!forward) { std::cout << " backward"; }
  if(greedy) { std::cout << " greediness=" << greediness; }
  if(multiplier < 0) { multiplier = 1.0; }
  if(multiplier != 1.0) { std::cout << " multiplier=" << multiplier; }
  std::cout << " threads=" << threads;
  if(write) { std::cout << " write"; }
  std::cout << std::endl;
  std::cout << "Base name: " << base_name << std::endl;
  std::cout << "Weights: " << weights_name << std::endl;
  std::cout << std::endl;

  // Determine index parameters.
  std::string parameters_name = std::string(base_name) + PARAMETERS_EXTENSION;
  Parameters parameters;
  parameters.set(RLCSA_BLOCK_SIZE);
  parameters.set(SAMPLE_RATE);
  parameters.read(parameters_name);
  parameters.set(SUPPORT_LOCATE.first, 1);
  parameters.set(SUPPORT_DISPLAY.first, 1);
  parameters.set(WEIGHTED_SAMPLES.first, 1);
  // parameters.print();


  std::ifstream weights_file(weights_name, std::ios_base::binary);
  if(!weights_file)
  {
    std::cerr << "Error opening weights file!" << std::endl;
    return 3;
  }

  usint n = fileSize(weights_file) / sizeof(weight_type);
  weight_type* weights = new weight_type[n];
  weights_file.read((char*)weights, n * sizeof(weight_type));
  weights_file.close();
  for(usint i = 0; i < n; i++)
  {
    if(weights[i] >= 0)
    {
      weights[i] = ceil(weights[i] * multiplier);
    }
    else
    {
      std::cerr << "Negative value found: weights[" << i << "] == " << weights[i] << "!" << std::endl;
      delete[] weights;
      return 4;
    }
  }
  std::cout << "Input size:   " << n << std::endl;
  std::cout << "Sample rate:  " << parameters.get(SAMPLE_RATE) << std::endl;
  std::cout << std::endl;


  // Do the actual sampling.
  double start = readTimer();
  Sampler* sampler = 0;
  if(!greedy)
  {
    WeightedSampler* wsampler = new WeightedSampler(weights, n, forward);
    if(!(wsampler->buildSamples(parameters.get(SAMPLE_RATE), parameters.get(INITIAL_ADJUSTMENT), threads)))
    {
      delete wsampler; wsampler = 0;
      return 5;
    }
    sampler = wsampler; wsampler = 0;
  }
  else
  {
    SemiGreedySampler* gsampler = new SemiGreedySampler(weights, n);
    if(!(gsampler->buildSamples(parameters.get(SAMPLE_RATE), greediness)))
    {
      delete gsampler; gsampler = 0;
      return 5;
    }
    sampler = gsampler; gsampler = 0;
  }
  double sampled = readTimer();
  usint memory = memoryUsage();


  // Write the samples or build RLCSA.
  double stop;
  if(write)
  {
    stop = readTimer();
    sampler->writeTo(base_name);
  }
  else
  {
    std::ifstream input_file(base_name, std::ios_base::binary);
    if(!input_file)
    {
      std::cerr << "Error opening input file " << base_name << "!" << std::endl;
      return 5;
    }
    uchar* data = new uchar[n];
    input_file.read((char*)data, n);
    input_file.close();
    RLCSA rlcsa(data, n, parameters.get(RLCSA_BLOCK_SIZE), parameters.get(SAMPLE_RATE), threads, sampler, true);
    stop = readTimer();
    if(rlcsa.isOk())
    {
      rlcsa.printInfo();
      rlcsa.reportSize(true);
      rlcsa.writeTo(base_name);
    }
  }
  usint total_memory = memoryUsage();


  double sampling_time = sampled - start;
  double time = stop - start;
  double megabytes = n / (double)MEGABYTE;
  std::cout << "Total: " << time << " seconds (" << (megabytes / time) << " MB/s), " << total_memory << " kB" << std::endl;
  std::cout << "Sampling: " << sampling_time << " seconds (" << (megabytes / sampling_time) << " MB/s), " << memory << " kB" << std::endl;
  std::cout << std::endl;

  delete sampler; sampler = 0;
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xcf8, %rsp            # imm = 0xCF8
movq %rsi, %r15
movl %edi, %ebx
movq 0x1b7fc(%rip), %r14     # 0x1ffd0
leaq 0x13a2d(%rip), %rsi     # 0x18208
movl $0xc, %edx
movq %r14, %rdi
callq 0x32b0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
cmpl $0x2, %ebx
jl 0x4ac7
movl %ebx, %ebp
movl $0x1, %r12d
xorps %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
movb $0x1, %al
movl %eax, 0x18(%rsp)
movsd 0x137aa(%rip), %xmm0    # 0x18008
movapd %xmm0, 0x20(%rsp)
movl $0x1, %r13d
movq $0x0, (%rsp)
movq $0x0, 0x40(%rsp)
xorl %ebx, %ebx
xorl %r14d, %r14d
movq (%r15,%r13,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x48ae
movzbl 0x1(%rdi), %eax
cmpl $0x6c, %eax
jle 0x48bc
cmpl $0x6d, %eax
je 0x48fe
cmpl $0x74, %eax
je 0x48e6
cmpl $0x77, %eax
jne 0x4fd9
movb $0x1, %al
movq %rax, 0x40(%rsp)
jmp 0x490d
testq %rbx, %rbx
je 0x48e1
testq %r14, %r14
cmoveq %rdi, %r14
jmp 0x490d
cmpl $0x62, %eax
je 0x48f4
cmpl $0x67, %eax
jne 0x4fd9
addq $0x2, %rdi
callq 0x32d0
movsd %xmm0, 0x8(%rsp)
movb $0x1, %al
movq %rax, (%rsp)
jmp 0x490d
movq %rdi, %rbx
jmp 0x490d
addq $0x2, %rdi
callq 0x3390
movl %eax, %r12d
jmp 0x490d
movl $0x0, 0x18(%rsp)
jmp 0x490d
addq $0x2, %rdi
callq 0x32d0
movapd %xmm0, 0x20(%rsp)
incq %r13
cmpq %r13, %rbp
jne 0x4880
testq %r14, %r14
je 0x4ac7
movq 0x1b6a7(%rip), %rdi     # 0x1ffd0
leaq 0x138f6(%rip), %rsi     # 0x18226
movl $0x8, %edx
callq 0x32b0
xorpd %xmm0, %xmm0
movsd 0x8(%rsp), %xmm1
maxsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
cmpl $0x1, %r12d
adcl $0x0, %r12d
cmpl $0x40, %r12d
movl $0x40, %ebp
cmovbl %r12d, %ebp
testb $0x1, 0x18(%rsp)
jne 0x4982
movq 0x1b65f(%rip), %rdi     # 0x1ffd0
leaq 0x138b7(%rip), %rsi     # 0x1822f
movl $0x9, %edx
callq 0x32b0
movsd 0x8(%rsp), %xmm0
minsd 0x13678(%rip), %xmm0    # 0x18008
movsd %xmm0, 0x8(%rsp)
testb $0x1, (%rsp)
je 0x49c5
movq 0x1b62d(%rip), %r15     # 0x1ffd0
leaq 0x1388f(%rip), %rsi     # 0x18239
movl $0xc, %edx
movq %r15, %rdi
callq 0x32b0
movq %r15, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x33c0
xorpd %xmm0, %xmm0
movapd 0x20(%rsp), %xmm2
movapd %xmm2, %xmm3
cmpltsd %xmm0, %xmm3
movsd 0x13628(%rip), %xmm0    # 0x18008
movapd %xmm3, %xmm1
andpd %xmm0, %xmm1
andnpd %xmm2, %xmm3
orpd %xmm1, %xmm3
ucomisd %xmm0, %xmm3
movapd %xmm3, 0x20(%rsp)
jne 0x49fe
jnp 0x4a27
movq 0x1b5cb(%rip), %r15     # 0x1ffd0
leaq 0x1383a(%rip), %rsi     # 0x18246
movl $0xc, %edx
movq %r15, %rdi
callq 0x32b0
movq %r15, %rdi
movapd 0x20(%rsp), %xmm0
callq 0x33c0
movq 0x1b5a2(%rip), %r15     # 0x1ffd0
leaq 0x1381e(%rip), %rsi     # 0x18253
movl $0x9, %edx
movq %r15, %rdi
callq 0x32b0
movl %ebp, %esi
movq %r15, %rdi
callq 0x3180
testb $0x1, 0x40(%rsp)
je 0x4a6b
movq 0x1b576(%rip), %rdi     # 0x1ffd0
leaq 0x137fc(%rip), %rsi     # 0x1825d
movl $0x6, %edx
callq 0x32b0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
leaq 0x137cb(%rip), %rsi     # 0x18264
movl $0xb, %edx
movq %r15, %rdi
callq 0x32b0
testq %rbx, %rbx
je 0x4ad6
movq %rbx, %rdi
callq 0x3110
movq 0x1b516(%rip), %rdi     # 0x1ffd0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x32b0
jmp 0x4aee
callq 0x464c
movl $0x2, %ebx
jmp 0x543b
movq (%r15), %rax
movq -0x18(%rax), %rax
leaq (%r15,%rax), %rdi
movl 0x20(%r15,%rax), %esi
orl $0x1, %esi
callq 0x3400
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
leaq 0x13754(%rip), %rsi     # 0x18270
movl $0x9, %edx
movq %r15, %rdi
callq 0x32b0
movq %r14, %rdi
callq 0x3110
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x32b0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
leaq 0x4c8(%rsp), %rdi
leaq 0x2c0(%rsp), %rdx
movq %rbx, %rsi
callq 0x5564
movq 0x1b754(%rip), %rsi     # 0x20300
movq 0x1b755(%rip), %rdx     # 0x20308
leaq 0x4c8(%rsp), %rdi
callq 0x30d0
leaq 0x58(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x4be7
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0x4bef
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x50(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x4d8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4c28
movq 0x4d8(%rsp), %rsi
incq %rsi
callq 0x3270
leaq 0x70(%rsp), %rax
movl $0x0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
leaq 0x1b734(%rip), %rsi     # 0x20380
leaq 0x68(%rsp), %rdi
callq 0x148aa
leaq 0x1b74b(%rip), %rsi     # 0x203a8
leaq 0x68(%rsp), %rdi
callq 0x148aa
leaq 0x68(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x14bb2
leaq 0x1b753(%rip), %rsi     # 0x203d0
leaq 0x68(%rsp), %rdi
movl $0x1, %edx
callq 0x1489e
leaq 0x1b765(%rip), %rsi     # 0x203f8
leaq 0x68(%rsp), %rdi
movl $0x1, %edx
callq 0x1489e
leaq 0x1b777(%rip), %rsi     # 0x20420
leaq 0x68(%rsp), %rdi
movl $0x1, %edx
callq 0x1489e
leaq 0x2c0(%rsp), %rdi
movq %r14, %rsi
movl $0x4, %edx
callq 0x3480
movq 0x2c0(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x2e0(%rsp,%rax)
je 0x4d33
movq 0x1b306(%rip), %rbx     # 0x1fff0
leaq 0x13589(%rip), %rsi     # 0x1827a
movl $0x1b, %edx
movq %rbx, %rdi
callq 0x32b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0x1b2d4(%rip), %rdi     # 0x1fff0
callq 0x3040
movl $0x3, %ebx
movq %rax, %rdi
callq 0x3190
jmp 0x5408
leaq 0x2c0(%rsp), %rdi
callq 0x15410
movq %rax, %r12
shrq $0x2, %r12
movl %r12d, %eax
movq %rax, 0x38(%rsp)
leaq (,%rax,4), %r14
movq %r14, %rdi
callq 0x3030
movq %rax, %r13
leaq 0x2c0(%rsp), %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x32e0
leaq 0x2c0(%rsp), %rdi
callq 0x3090
testl %r12d, %r12d
movapd 0x20(%rsp), %xmm1
je 0x4dc1
movl %r12d, %r14d
xorl %r15d, %r15d
movl (%r13,%r15,4), %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd %xmm1, %xmm0
callq 0x3080
movapd 0x20(%rsp), %xmm1
cvttsd2si %xmm0, %rax
movl %eax, (%r13,%r15,4)
incq %r15
cmpq %r15, %r14
jne 0x4d93
movq 0x1b208(%rip), %rdi     # 0x1ffd0
leaq 0x134c7(%rip), %rsi     # 0x18296
movl $0xe, %edx
callq 0x32b0
movq 0x1b1f0(%rip), %rdi     # 0x1ffd0
movq 0x38(%rsp), %rsi
callq 0x3180
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
movq 0x1b1b5(%rip), %rdi     # 0x1ffd0
leaq 0x13483(%rip), %rsi     # 0x182a5
movl $0xe, %edx
callq 0x32b0
leaq 0x1b575(%rip), %rsi     # 0x203a8
leaq 0x68(%rsp), %rdi
callq 0x14882
movl %eax, %esi
movq 0x1b18a(%rip), %r14     # 0x1ffd0
movq %r14, %rdi
callq 0x3180
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0x1b13a(%rip), %rdi     # 0x1ffd0
callq 0x3040
movq %rax, %rdi
callq 0x3190
callq 0x157ff
movsd %xmm0, 0x20(%rsp)
testb $0x1, (%rsp)
je 0x4ef2
movl $0x30, %edi
callq 0x3260
movq %rax, %r14
movq %rax, %rdi
movq %r13, %rsi
movl %r12d, %edx
callq 0xe60a
leaq 0x1b4d2(%rip), %rsi     # 0x203a8
leaq 0x68(%rsp), %rdi
callq 0x14882
movq %r14, %rdi
movl %eax, %esi
movsd 0x8(%rsp), %xmm0
callq 0xe748
jmp 0x4f49
movl $0x58, %edi
callq 0x3260
movq %rax, %r14
movzbl 0x18(%rsp), %ecx
andl $0x1, %ecx
movq %rax, %rdi
movq %r13, %rsi
movl %r12d, %edx
callq 0xd27e
leaq 0x1b48c(%rip), %rsi     # 0x203a8
leaq 0x68(%rsp), %rdi
callq 0x14882
movl %eax, %r15d
leaq 0x1b518(%rip), %rsi     # 0x20448
leaq 0x68(%rsp), %rdi
callq 0x14882
movq %r14, %rdi
movl %r15d, %esi
movl %eax, %edx
movl %ebp, %ecx
callq 0xd5a6
testb %al, %al
je 0x4fcb
callq 0x157ff
movsd %xmm0, 0x8(%rsp)
callq 0x15814
movl %eax, %r15d
testb $0x1, 0x40(%rsp)
je 0x5020
callq 0x157ff
movsd %xmm0, (%rsp)
leaq 0x4c8(%rsp), %rdi
leaq 0xb8(%rsp), %rdx
movq %rbx, %rsi
callq 0x5564
leaq 0x4c8(%rsp), %rsi
movq %r14, %rdi
callq 0xd0b6
movq 0x4c8(%rsp), %rdi
leaq 0x4d8(%rsp), %rax
cmpq %rax, %rdi
je 0x5236
movq 0x4d8(%rsp), %rsi
incq %rsi
callq 0x3270
jmp 0x5236
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
jmp 0x50a2
movq 0x1aff0(%rip), %rbx     # 0x1ffd0
leaq 0x1322e(%rip), %rsi     # 0x18215
movl $0x10, %edx
movq %rbx, %rdi
callq 0x32b0
movq (%r15,%r13,8), %r14
testq %r14, %r14
je 0x50ac
movq %r14, %rdi
callq 0x3110
movq 0x1afc0(%rip), %rdi     # 0x1ffd0
movq %r14, %rsi
movq %rax, %rdx
callq 0x32b0
jmp 0x50c3
leaq 0xb8(%rsp), %rdi
movq %rbx, %rsi
movl $0x4, %edx
callq 0x3480
movq 0xb8(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0xd8(%rsp,%rax)
je 0x5123
movq 0x1af9a(%rip), %rdi     # 0x1fff0
leaq 0x13257(%rip), %rsi     # 0x182b4
movl $0x19, %edx
callq 0x32b0
movq 0x1af82(%rip), %rdi     # 0x1fff0
movq %rbx, %rsi
callq 0x3240
movq %rax, %rbx
leaq 0x137f2(%rip), %rsi     # 0x18872
movl $0x1, %edx
movq %rax, %rdi
callq 0x32b0
movq %rbx, %rdi
callq 0x3120
leaq 0xb8(%rsp), %rdi
callq 0x30a0
movl $0x5, %ebx
jmp 0x5408
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x3400
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
callq 0x464c
movl $0x1, %ebx
jmp 0x543b
movq 0x38(%rsp), %rdi
callq 0x3030
movq %rax, (%rsp)
leaq 0xb8(%rsp), %rdi
movq (%rsp), %rsi
movq 0x38(%rsp), %rdx
callq 0x32e0
leaq 0xb8(%rsp), %rdi
callq 0x3090
leaq 0x1b225(%rip), %rsi     # 0x20380
leaq 0x68(%rsp), %rdi
callq 0x14882
movl %eax, %r13d
leaq 0x1b239(%rip), %rsi     # 0x203a8
leaq 0x68(%rsp), %rdi
callq 0x14882
leaq 0x4c8(%rsp), %rdi
movq (%rsp), %rsi
movl %r12d, %edx
movl %r13d, %ecx
movl %eax, %r8d
movl %ebp, %r9d
pushq $0x1
pushq %r14
callq 0x643a
addq $0x10, %rsp
callq 0x157ff
movsd %xmm0, (%rsp)
cmpb $0x1, 0x4c8(%rsp)
jne 0x521c
leaq 0x4c8(%rsp), %rdi
callq 0x8e02
leaq 0x4c8(%rsp), %rdi
movl $0x1, %esi
callq 0x8b5a
leaq 0x98(%rsp), %rdi
leaq 0x17(%rsp), %rdx
movq %rbx, %rsi
callq 0x5564
leaq 0x4c8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x6c90
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x521c
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x3270
leaq 0x4c8(%rsp), %rdi
callq 0x6bd6
leaq 0xb8(%rsp), %rdi
callq 0x30a0
movl %r15d, %ebp
callq 0x15814
movl %eax, %ebx
movq 0x1ad89(%rip), %rdi     # 0x1ffd0
leaq 0x13080(%rip), %rsi     # 0x182ce
movl $0x7, %edx
callq 0x32b0
movsd (%rsp), %xmm0
subsd 0x20(%rsp), %xmm0
movq 0x1ad66(%rip), %rdi     # 0x1ffd0
movsd %xmm0, (%rsp)
callq 0x33c0
movq %rax, %r12
leaq 0x13058(%rip), %rsi     # 0x182d6
movl $0xa, %edx
movq %rax, %rdi
callq 0x32b0
xorps %xmm0, %xmm0
cvtsi2sdq 0x38(%rsp), %xmm0
mulsd 0x12d73(%rip), %xmm0    # 0x18010
movsd %xmm0, 0x18(%rsp)
divsd (%rsp), %xmm0
movq %r12, %rdi
callq 0x33c0
movq %rax, %r15
leaq 0x13027(%rip), %rsi     # 0x182e1
movl $0x8, %edx
movq %rax, %rdi
callq 0x32b0
movl %ebx, %esi
movq %r15, %rdi
callq 0x3180
movq %rax, %rbx
leaq 0x1300f(%rip), %rsi     # 0x182ea
movl $0x3, %edx
movq %rax, %rdi
callq 0x32b0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
movq 0x1acba(%rip), %rdi     # 0x1ffd0
leaq 0x12fd1(%rip), %rsi     # 0x182ee
movl $0xa, %edx
callq 0x32b0
movsd 0x8(%rsp), %xmm0
subsd 0x20(%rsp), %xmm0
movq 0x1ac96(%rip), %rbx     # 0x1ffd0
movq %rbx, %rdi
movsd %xmm0, 0x8(%rsp)
callq 0x33c0
movq %rax, %r15
leaq 0x12f84(%rip), %rsi     # 0x182d6
movl $0xa, %edx
movq %rax, %rdi
callq 0x32b0
movsd 0x18(%rsp), %xmm0
divsd 0x8(%rsp), %xmm0
movq %r15, %rdi
callq 0x33c0
movq %rax, %r15
leaq 0x12f64(%rip), %rsi     # 0x182e1
movl $0x8, %edx
movq %rax, %rdi
callq 0x32b0
movl %ebp, %esi
movq %r15, %rdi
callq 0x3180
movq %rax, %r15
leaq 0x12f4c(%rip), %rsi     # 0x182ea
movl $0x3, %edx
movq %rax, %rdi
callq 0x32b0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0x1abe0(%rip), %rdi     # 0x1ffd0
callq 0x3040
movq %rax, %rdi
callq 0x3190
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
xorl %ebx, %ebx
leaq 0x2c0(%rsp), %rdi
callq 0x30a0
leaq 0x68(%rsp), %rdi
callq 0x55c8
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x543b
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3270
movl %ebx, %eax
addq $0xcf8, %rsp            # imm = 0xCF8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x547a
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x3270
jmp 0x547a
jmp 0x5477
movq %rax, %rbx
leaq 0x4c8(%rsp), %rdi
callq 0x6bd6
jmp 0x54e1
movq %rax, %rbx
movq 0x4c8(%rsp), %rdi
leaq 0x4d8(%rsp), %rax
cmpq %rax, %rdi
je 0x5529
movq 0x4d8(%rsp), %rsi
incq %rsi
jmp 0x54d7
jmp 0x5526
jmp 0x5526
jmp 0x5526
jmp 0x54de
jmp 0x54de
jmp 0x5526
jmp 0x5526
jmp 0x5526
movq %rax, %rbx
movl $0x58, %esi
jmp 0x54d4
movq %rax, %rbx
movl $0x30, %esi
movq %r14, %rdi
callq 0x3270
jmp 0x5529
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x30a0
jmp 0x5529
jmp 0x5526
jmp 0x5526
jmp 0x5526
jmp 0x5526
jmp 0x5521
movq %rax, %rbx
leaq 0x4d8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x555c
movq 0x4d8(%rsp), %rsi
jmp 0x5554
movq %rax, %rbx
jmp 0x555c
jmp 0x5526
jmp 0x5526
movq %rax, %rbx
jmp 0x5536
movq %rax, %rbx
leaq 0x2c0(%rsp), %rdi
callq 0x30a0
leaq 0x68(%rsp), %rdi
callq 0x55c8
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x555c
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3270
movq %rbx, %rdi
callq 0x3460