// File: adamnovak[P]rlcsa/parallel_build.cpp
// Function: main
int
main(int argc, char** argv)
{
  std::cout << "Parallel RLCSA builder" << std::endl;
  if(argc < 3)
  {
    std::cout << "Usage: parallel_build [-f|-n] listname output [threads]" << std::endl;
    std::cout << "  -f   use fast algorithm with larger memory usage" << std::endl;
    std::cout << "  -n   do not merge the indexes" << std::endl;
    return 1;
  }

  int list_parameter = 1, output_parameter = 2, threads_parameter = 3;
  bool do_merge = true;
  bool fast_algorithm = false;
  if(argv[1][0] == '-')
  {
    if(argv[1][1] == 'f')
    {
      list_parameter++; output_parameter++; threads_parameter++;
      fast_algorithm = true;
      std::cout << "Using fast algorithm." << std::endl;
    }
    else if(argv[1][1] == 'n')
    {
      list_parameter++; output_parameter++; threads_parameter++;
      do_merge = false;
      std::cout << "Option '-n' specified. Partial indexes will not be merged." << std::endl;
    }
  }

  std::ifstream filelist(argv[list_parameter], std::ios_base::binary);
  if(!filelist)
  {
    std::cerr << "Error opening file list!" << std::endl;
    return 2;
  }
  std::vector<std::string> files;
  readRows(filelist, files, true);
  filelist.close();
  std::cout << "Input files: " << files.size() << std::endl;

  std::string base_name = argv[output_parameter];
  std::cout << "Output: " << base_name << std::endl;

  usint threads = 1;
  if(argc > threads_parameter)
  {
    threads = std::min(MAX_THREADS, std::max(atoi(argv[threads_parameter]), 1));
  }
  std::cout << "Threads: " << threads << std::endl; 
  std::cout << std::endl;

  std::string parameters_name = base_name + PARAMETERS_EXTENSION;
  Parameters parameters;
  parameters.set(RLCSA_BLOCK_SIZE);
  parameters.set(SAMPLE_RATE);
  parameters.set(SUPPORT_LOCATE);
  parameters.set(SUPPORT_DISPLAY);
  parameters.set(WEIGHTED_SAMPLES);
  parameters.read(parameters_name);
  parameters.print();

  double start = readTimer();
  double megabytes = 0.0, build_time = 0.0;
  RLCSABuilder builder(parameters.get(RLCSA_BLOCK_SIZE), parameters.get(SAMPLE_RATE), 0, threads);

  if(fast_algorithm)
  {
    for(std::vector<std::string>::iterator iter = files.begin(); iter != files.end(); ++iter)
    {
      double mark = readTimer();
      std::cout << "Increment: " << *iter; std::cout.flush();
      builder.insertCollection(*iter);
      std::cout << " (" << (readTimer() - mark) << " seconds)" << std::endl;
    }
    std::cout << std::endl;
    megabytes = getRLCSA(builder, base_name);
  }
  else
  {
    megabytes = indexParts(files, threads, parameters, build_time);
    if(do_merge)
    {
      std::cout << "Phase 2: Merging the indexes" << std::endl;
      for(std::vector<std::string>::iterator iter = files.begin(); iter != files.end(); ++iter)
      {
        double mark = readTimer();
        std::cout << "Increment: " << *iter; std::cout.flush();
        builder.insertFromFile(*iter);
        std::cout << " (" << (readTimer() - mark) << " seconds)" << std::endl;
      }
      std::cout << std::endl;
      megabytes = getRLCSA(builder, base_name);
    }
  }

  double stop = readTimer();
  std::cout << megabytes << " megabytes indexed in " << (stop - start) << " seconds (" << (megabytes / (stop - start)) << " MB/s)." << std::endl;
  if(do_merge)
  {
    std::cout << "Build time:    " << build_time + builder.getBuildTime() << " seconds" << std::endl;
    std::cout << "Search time:   " << builder.getSearchTime() << " seconds" << std::endl;
    std::cout << "Sort time:     " << builder.getSortTime() << " seconds" << std::endl;
    std::cout << "Merge time:    " << builder.getMergeTime() << " seconds" << std::endl;
  }
  std::cout << "Memory usage:  " << memoryUsage() << " kB" << std::endl;
  std::cout << std::endl;

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x540, %rsp            # imm = 0x540
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0x35db0(%rip), %rdi     # 0x3afd0
leaq 0x25e8f(%rip), %rsi     # 0x2b0b6
callq 0x32a0
movq %rax, %rdi
movq 0x35d7a(%rip), %rsi     # 0x3afb0
callq 0x3300
cmpl $0x3, -0x8(%rbp)
jge 0x52b3
movq 0x35d88(%rip), %rdi     # 0x3afd0
leaq 0x25e7e(%rip), %rsi     # 0x2b0cd
callq 0x32a0
movq %rax, %rdi
movq 0x35d52(%rip), %rsi     # 0x3afb0
callq 0x3300
movq 0x35d66(%rip), %rdi     # 0x3afd0
leaq 0x25e94(%rip), %rsi     # 0x2b105
callq 0x32a0
movq %rax, %rdi
movq 0x35d30(%rip), %rsi     # 0x3afb0
callq 0x3300
movq 0x35d44(%rip), %rdi     # 0x3afd0
leaq 0x25ea5(%rip), %rsi     # 0x2b138
callq 0x32a0
movq %rax, %rdi
movq 0x35d0e(%rip), %rsi     # 0x3afb0
callq 0x3300
movl $0x1, -0x4(%rbp)
jmp 0x6040
movl $0x1, -0x14(%rbp)
movl $0x2, -0x18(%rbp)
movl $0x3, -0x1c(%rbp)
movb $0x1, -0x1d(%rbp)
movb $0x0, -0x1e(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x538e
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl 0x1(%rax), %eax
cmpl $0x66, %eax
jne 0x5338
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movb $0x1, -0x1e(%rbp)
movq 0x35cb5(%rip), %rdi     # 0x3afd0
leaq 0x25e36(%rip), %rsi     # 0x2b158
callq 0x32a0
movq %rax, %rdi
movq 0x35c7f(%rip), %rsi     # 0x3afb0
callq 0x3300
jmp 0x538c
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl 0x1(%rax), %eax
cmpl $0x6e, %eax
jne 0x538a
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movb $0x0, -0x1d(%rbp)
movq 0x35c61(%rip), %rdi     # 0x3afd0
leaq 0x25df8(%rip), %rsi     # 0x2b16e
callq 0x32a0
movq %rax, %rdi
movq 0x35c2b(%rip), %rsi     # 0x3afb0
callq 0x3300
jmp 0x538c
jmp 0x538e
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x228(%rbp), %rdi
movl $0x4, %edx
callq 0x3550
movq -0x228(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x228(%rbp,%rax), %rdi
callq 0x3150
movb %al, -0x369(%rbp)
jmp 0x53cb
movb -0x369(%rbp), %al
testb $0x1, %al
jne 0x53d7
jmp 0x5435
movq 0x35c12(%rip), %rdi     # 0x3aff0
leaq 0x25dc4(%rip), %rsi     # 0x2b1a9
callq 0x32a0
movq %rax, -0x378(%rbp)
jmp 0x53f3
movq -0x378(%rbp), %rdi
movq 0x35baf(%rip), %rsi     # 0x3afb0
callq 0x3300
jmp 0x5408
movl $0x2, -0x4(%rbp)
movl $0x1, -0x238(%rbp)
jmp 0x6024
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0x6032
leaq -0x250(%rbp), %rdi
movq %rdi, -0x380(%rbp)
callq 0x69f0
movq -0x380(%rbp), %rsi
leaq -0x228(%rbp), %rdi
movl $0x1, %edx
callq 0x260f0
jmp 0x5462
leaq -0x228(%rbp), %rdi
callq 0x30b0
jmp 0x5470
movq 0x35b59(%rip), %rdi     # 0x3afd0
leaq 0x25d44(%rip), %rsi     # 0x2b1c2
callq 0x32a0
movq %rax, -0x388(%rbp)
jmp 0x548c
leaq -0x250(%rbp), %rdi
callq 0x6a10
movq -0x388(%rbp), %rdi
movq %rax, %rsi
callq 0x30c0
movq %rax, -0x390(%rbp)
jmp 0x54b0
movq -0x390(%rbp), %rdi
movq 0x35af2(%rip), %rsi     # 0x3afb0
callq 0x3300
jmp 0x54c5
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x3a0(%rbp)
leaq -0x271(%rbp), %rdi
movq %rdi, -0x398(%rbp)
callq 0x3530
movq -0x3a0(%rbp), %rsi
movq -0x398(%rbp), %rdx
leaq -0x270(%rbp), %rdi
callq 0x6720
jmp 0x5507
leaq -0x271(%rbp), %rdi
callq 0x3320
movq 0x35ab6(%rip), %rdi     # 0x3afd0
leaq 0x25caf(%rip), %rsi     # 0x2b1d0
callq 0x32a0
movq %rax, -0x3a8(%rbp)
jmp 0x552f
movq -0x3a8(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0x3280
movq %rax, -0x3b0(%rbp)
jmp 0x554b
movq -0x3b0(%rbp), %rdi
movq 0x35a57(%rip), %rsi     # 0x3afb0
callq 0x3300
jmp 0x5560
movl $0x1, -0x278(%rbp)
movl -0x8(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jle 0x5631
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x34a0
movl %eax, -0x27c(%rbp)
movl $0x1, -0x280(%rbp)
leaq -0x27c(%rbp), %rdi
leaq -0x280(%rbp), %rsi
callq 0x6a70
movq %rax, -0x3b8(%rbp)
jmp 0x55b3
movq -0x3b8(%rbp), %rsi
leaq 0x25d8f(%rip), %rdi     # 0x2b350
callq 0x6a30
movq %rax, -0x3c0(%rbp)
jmp 0x55cf
movq -0x3c0(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x278(%rbp)
jmp 0x5631
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0x6016
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
leaq -0x271(%rbp), %rdi
callq 0x3320
jmp 0x6016
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0x600a
movq 0x35998(%rip), %rdi     # 0x3afd0
leaq 0x25b9a(%rip), %rsi     # 0x2b1d9
callq 0x32a0
movq %rax, -0x3c8(%rbp)
jmp 0x564d
movq -0x3c8(%rbp), %rdi
movl -0x278(%rbp), %esi
callq 0x33f0
movq %rax, -0x3d0(%rbp)
jmp 0x5668
movq -0x3d0(%rbp), %rdi
movq 0x3593a(%rip), %rsi     # 0x3afb0
callq 0x3300
jmp 0x567d
movq 0x3594c(%rip), %rdi     # 0x3afd0
movq 0x35925(%rip), %rsi     # 0x3afb0
callq 0x3300
jmp 0x5692
leaq 0x35cef(%rip), %rdx     # 0x3b388
leaq -0x2a0(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0x6ab0
jmp 0x56ae
leaq -0x2d0(%rbp), %rdi
callq 0x6b30
jmp 0x56bc
leaq 0x35d45(%rip), %rsi     # 0x3b408
leaq -0x2d0(%rbp), %rdi
callq 0x241c0
jmp 0x56d1
leaq 0x35d58(%rip), %rsi     # 0x3b430
leaq -0x2d0(%rbp), %rdi
callq 0x241c0
jmp 0x56e6
leaq 0x35d6b(%rip), %rsi     # 0x3b458
leaq -0x2d0(%rbp), %rdi
callq 0x241c0
jmp 0x56fb
leaq 0x35d7e(%rip), %rsi     # 0x3b480
leaq -0x2d0(%rbp), %rdi
callq 0x241c0
jmp 0x5710
leaq 0x35d91(%rip), %rsi     # 0x3b4a8
leaq -0x2d0(%rbp), %rdi
callq 0x241c0
jmp 0x5725
leaq -0x2d0(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x24500
jmp 0x573a
leaq -0x2d0(%rbp), %rdi
callq 0x24650
jmp 0x5748
callq 0x26480
movsd %xmm0, -0x3d8(%rbp)
jmp 0x5757
movsd -0x3d8(%rbp), %xmm0
movsd %xmm0, -0x2d8(%rbp)
movq $0x0, -0x2e0(%rbp)
movq $0x0, -0x2e8(%rbp)
leaq 0x35c84(%rip), %rsi     # 0x3b408
leaq -0x2d0(%rbp), %rdi
callq 0x24150
movl %eax, -0x3dc(%rbp)
jmp 0x5798
leaq 0x35c91(%rip), %rsi     # 0x3b430
leaq -0x2d0(%rbp), %rdi
callq 0x24150
movl %eax, -0x3e0(%rbp)
jmp 0x57b3
movl -0x3e0(%rbp), %edx
movl -0x3dc(%rbp), %esi
movl -0x278(%rbp), %r8d
xorl %ecx, %ecx
movl %ecx, %r9d
leaq -0x330(%rbp), %rdi
callq 0x13a40
jmp 0x57d9
testb $0x1, -0x1e(%rbp)
je 0x59d8
leaq -0x250(%rbp), %rdi
callq 0x6b50
movq %rax, -0x338(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x6bc0
movq %rax, -0x340(%rbp)
leaq -0x338(%rbp), %rdi
leaq -0x340(%rbp), %rsi
callq 0x6b80
testb $0x1, %al
jne 0x5825
jmp 0x5991
callq 0x26480
movsd %xmm0, -0x3e8(%rbp)
jmp 0x5834
movsd -0x3e8(%rbp), %xmm0
movsd %xmm0, -0x348(%rbp)
movq 0x35785(%rip), %rdi     # 0x3afd0
leaq 0x25991(%rip), %rsi     # 0x2b1e3
callq 0x32a0
movq %rax, -0x3f0(%rbp)
jmp 0x5860
leaq -0x338(%rbp), %rdi
callq 0x6bf0
movq -0x3f0(%rbp), %rdi
movq %rax, %rsi
callq 0x3280
jmp 0x587d
movq 0x3574c(%rip), %rdi     # 0x3afd0
callq 0x31c0
jmp 0x588b
leaq -0x338(%rbp), %rdi
callq 0x6bf0
movq %rax, %rsi
leaq -0x330(%rbp), %rdi
callq 0x142e0
jmp 0x58a8
movq 0x35721(%rip), %rdi     # 0x3afd0
leaq 0x2597f(%rip), %rsi     # 0x2b235
callq 0x32a0
movq %rax, -0x3f8(%rbp)
jmp 0x58c4
callq 0x26480
movsd %xmm0, -0x400(%rbp)
jmp 0x58d3
movq -0x3f8(%rbp), %rdi
movsd -0x400(%rbp), %xmm0
movsd -0x348(%rbp), %xmm1
subsd %xmm1, %xmm0
callq 0x3560
movq %rax, -0x408(%rbp)
jmp 0x58fc
movq -0x408(%rbp), %rdi
leaq 0x258e5(%rip), %rsi     # 0x2b1ef
callq 0x32a0
movq %rax, -0x410(%rbp)
jmp 0x5918
movq -0x410(%rbp), %rdi
movq 0x3568a(%rip), %rsi     # 0x3afb0
callq 0x3300
jmp 0x592d
jmp 0x592f
leaq -0x338(%rbp), %rdi
callq 0x6c10
jmp 0x57f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0x5ffe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0x5ff2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
leaq -0x330(%rbp), %rdi
callq 0x13b90
jmp 0x5ff2
movq 0x35638(%rip), %rdi     # 0x3afd0
movq 0x35611(%rip), %rsi     # 0x3afb0
callq 0x3300
jmp 0x59a6
leaq -0x330(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0x6060
movsd %xmm0, -0x418(%rbp)
jmp 0x59c3
movsd -0x418(%rbp), %xmm0
movsd %xmm0, -0x2e0(%rbp)
jmp 0x5bee
movl -0x278(%rbp), %esi
leaq -0x250(%rbp), %rdi
leaq -0x2d0(%rbp), %rdx
leaq -0x2e8(%rbp), %rcx
callq 0x6110
movsd %xmm0, -0x420(%rbp)
jmp 0x5a02
movsd -0x420(%rbp), %xmm0
movsd %xmm0, -0x2e0(%rbp)
testb $0x1, -0x1d(%rbp)
je 0x5bec
movq 0x355ad(%rip), %rdi     # 0x3afd0
leaq 0x257cf(%rip), %rsi     # 0x2b1f9
callq 0x32a0
movq %rax, -0x428(%rbp)
jmp 0x5a38
movq -0x428(%rbp), %rdi
movq 0x3556a(%rip), %rsi     # 0x3afb0
callq 0x3300
jmp 0x5a4d
leaq -0x250(%rbp), %rdi
callq 0x6b50
movq %rax, -0x350(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x6bc0
movq %rax, -0x358(%rbp)
leaq -0x350(%rbp), %rdi
leaq -0x358(%rbp), %rsi
callq 0x6b80
testb $0x1, %al
jne 0x5a8f
jmp 0x5baa
callq 0x26480
movsd %xmm0, -0x430(%rbp)
jmp 0x5a9e
movsd -0x430(%rbp), %xmm0
movsd %xmm0, -0x360(%rbp)
movq 0x3551b(%rip), %rdi     # 0x3afd0
leaq 0x25727(%rip), %rsi     # 0x2b1e3
callq 0x32a0
movq %rax, -0x438(%rbp)
jmp 0x5aca
leaq -0x350(%rbp), %rdi
callq 0x6bf0
movq -0x438(%rbp), %rdi
movq %rax, %rsi
callq 0x3280
jmp 0x5ae7
movq 0x354e2(%rip), %rdi     # 0x3afd0
callq 0x31c0
jmp 0x5af5
leaq -0x350(%rbp), %rdi
callq 0x6bf0
movq %rax, %rsi
leaq -0x330(%rbp), %rdi
callq 0x13f60
jmp 0x5b12
movq 0x354b7(%rip), %rdi     # 0x3afd0
leaq 0x25715(%rip), %rsi     # 0x2b235
callq 0x32a0
movq %rax, -0x440(%rbp)
jmp 0x5b2e
callq 0x26480
movsd %xmm0, -0x448(%rbp)
jmp 0x5b3d
movq -0x440(%rbp), %rdi
movsd -0x448(%rbp), %xmm0
movsd -0x360(%rbp), %xmm1
subsd %xmm1, %xmm0
callq 0x3560
movq %rax, -0x450(%rbp)
jmp 0x5b66
movq -0x450(%rbp), %rdi
leaq 0x2567b(%rip), %rsi     # 0x2b1ef
callq 0x32a0
movq %rax, -0x458(%rbp)
jmp 0x5b82
movq -0x458(%rbp), %rdi
movq 0x35420(%rip), %rsi     # 0x3afb0
callq 0x3300
jmp 0x5b97
jmp 0x5b99
leaq -0x350(%rbp), %rdi
callq 0x6c10
jmp 0x5a60
movq 0x3541f(%rip), %rdi     # 0x3afd0
movq 0x353f8(%rip), %rsi     # 0x3afb0
callq 0x3300
jmp 0x5bbf
leaq -0x330(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0x6060
movsd %xmm0, -0x460(%rbp)
jmp 0x5bdc
movsd -0x460(%rbp), %xmm0
movsd %xmm0, -0x2e0(%rbp)
jmp 0x5bee
callq 0x26480
movsd %xmm0, -0x468(%rbp)
jmp 0x5bfd
movsd -0x468(%rbp), %xmm0
movsd %xmm0, -0x368(%rbp)
movsd -0x2e0(%rbp), %xmm0
movq 0x353b4(%rip), %rdi     # 0x3afd0
callq 0x3560
movq %rax, -0x470(%rbp)
jmp 0x5c2a
movq -0x470(%rbp), %rdi
leaq 0x255de(%rip), %rsi     # 0x2b216
callq 0x32a0
movq %rax, -0x478(%rbp)
jmp 0x5c46
movq -0x478(%rbp), %rdi
movsd -0x368(%rbp), %xmm0
movsd -0x2d8(%rbp), %xmm1
subsd %xmm1, %xmm0
callq 0x3560
movq %rax, -0x480(%rbp)
jmp 0x5c6f
movq -0x480(%rbp), %rdi
leaq 0x255b0(%rip), %rsi     # 0x2b22d
callq 0x32a0
movq %rax, -0x488(%rbp)
jmp 0x5c8b
movq -0x488(%rbp), %rdi
movsd -0x2e0(%rbp), %xmm0
movsd -0x368(%rbp), %xmm1
movsd -0x2d8(%rbp), %xmm2
subsd %xmm2, %xmm1
divsd %xmm1, %xmm0
callq 0x3560
movq %rax, -0x490(%rbp)
jmp 0x5cc0
movq -0x490(%rbp), %rdi
leaq 0x2556a(%rip), %rsi     # 0x2b238
callq 0x32a0
movq %rax, -0x498(%rbp)
jmp 0x5cdc
movq -0x498(%rbp), %rdi
movq 0x352c6(%rip), %rsi     # 0x3afb0
callq 0x3300
jmp 0x5cf1
testb $0x1, -0x1d(%rbp)
je 0x5f19
movq 0x352ce(%rip), %rdi     # 0x3afd0
leaq 0x25537(%rip), %rsi     # 0x2b240
callq 0x32a0
movq %rax, -0x4a0(%rbp)
jmp 0x5d17
movsd -0x2e8(%rbp), %xmm0
movsd %xmm0, -0x4b0(%rbp)
leaq -0x330(%rbp), %rdi
callq 0x14c80
movsd %xmm0, -0x4a8(%rbp)
jmp 0x5d3d
movq -0x4a0(%rbp), %rdi
movsd -0x4a8(%rbp), %xmm1
movsd -0x4b0(%rbp), %xmm0
addsd %xmm1, %xmm0
callq 0x3560
movq %rax, -0x4b8(%rbp)
jmp 0x5d66
movq -0x4b8(%rbp), %rdi
leaq 0x254dc(%rip), %rsi     # 0x2b250
callq 0x32a0
movq %rax, -0x4c0(%rbp)
jmp 0x5d82
movq -0x4c0(%rbp), %rdi
movq 0x35220(%rip), %rsi     # 0x3afb0
callq 0x3300
jmp 0x5d97
movq 0x35232(%rip), %rdi     # 0x3afd0
leaq 0x254b4(%rip), %rsi     # 0x2b259
callq 0x32a0
movq %rax, -0x4c8(%rbp)
jmp 0x5db3
leaq -0x330(%rbp), %rdi
callq 0x14ca0
movsd %xmm0, -0x4d0(%rbp)
jmp 0x5dc9
movsd -0x4d0(%rbp), %xmm0
movq -0x4c8(%rbp), %rdi
callq 0x3560
movq %rax, -0x4d8(%rbp)
jmp 0x5de6
movq -0x4d8(%rbp), %rdi
leaq 0x2545c(%rip), %rsi     # 0x2b250
callq 0x32a0
movq %rax, -0x4e0(%rbp)
jmp 0x5e02
movq -0x4e0(%rbp), %rdi
movq 0x351a0(%rip), %rsi     # 0x3afb0
callq 0x3300
jmp 0x5e17
movq 0x351b2(%rip), %rdi     # 0x3afd0
leaq 0x25444(%rip), %rsi     # 0x2b269
callq 0x32a0
movq %rax, -0x4e8(%rbp)
jmp 0x5e33
leaq -0x330(%rbp), %rdi
callq 0x14cc0
movsd %xmm0, -0x4f0(%rbp)
jmp 0x5e49
movsd -0x4f0(%rbp), %xmm0
movq -0x4e8(%rbp), %rdi
callq 0x3560
movq %rax, -0x4f8(%rbp)
jmp 0x5e66
movq -0x4f8(%rbp), %rdi
leaq 0x253dc(%rip), %rsi     # 0x2b250
callq 0x32a0
movq %rax, -0x500(%rbp)
jmp 0x5e82
movq -0x500(%rbp), %rdi
movq 0x35120(%rip), %rsi     # 0x3afb0
callq 0x3300
jmp 0x5e97
movq 0x35132(%rip), %rdi     # 0x3afd0
leaq 0x253d4(%rip), %rsi     # 0x2b279
callq 0x32a0
movq %rax, -0x508(%rbp)
jmp 0x5eb3
leaq -0x330(%rbp), %rdi
callq 0x14ce0
movsd %xmm0, -0x510(%rbp)
jmp 0x5ec9
movsd -0x510(%rbp), %xmm0
movq -0x508(%rbp), %rdi
callq 0x3560
movq %rax, -0x518(%rbp)
jmp 0x5ee6
movq -0x518(%rbp), %rdi
leaq 0x2535c(%rip), %rsi     # 0x2b250
callq 0x32a0
movq %rax, -0x520(%rbp)
jmp 0x5f02
movq -0x520(%rbp), %rdi
movq 0x350a0(%rip), %rsi     # 0x3afb0
callq 0x3300
jmp 0x5f17
jmp 0x5f19
movq 0x350b0(%rip), %rdi     # 0x3afd0
leaq 0x25362(%rip), %rsi     # 0x2b289
callq 0x32a0
movq %rax, -0x528(%rbp)
jmp 0x5f35
callq 0x264a0
movl %eax, -0x52c(%rbp)
jmp 0x5f42
movl -0x52c(%rbp), %esi
movq -0x528(%rbp), %rdi
callq 0x33f0
movq %rax, -0x538(%rbp)
jmp 0x5f5d
movq -0x538(%rbp), %rdi
leaq 0x2532e(%rip), %rsi     # 0x2b299
callq 0x32a0
movq %rax, -0x540(%rbp)
jmp 0x5f79
movq -0x540(%rbp), %rdi
movq 0x35029(%rip), %rsi     # 0x3afb0
callq 0x3300
jmp 0x5f8e
movq 0x3503b(%rip), %rdi     # 0x3afd0
movq 0x35014(%rip), %rsi     # 0x3afb0
callq 0x3300
jmp 0x5fa3
movl $0x0, -0x4(%rbp)
movl $0x1, -0x238(%rbp)
leaq -0x330(%rbp), %rdi
callq 0x13b90
leaq -0x2d0(%rbp), %rdi
callq 0x6c30
leaq -0x2a0(%rbp), %rdi
callq 0x35c8
leaq -0x270(%rbp), %rdi
callq 0x35c8
leaq -0x250(%rbp), %rdi
callq 0x6c50
jmp 0x6024
leaq -0x2d0(%rbp), %rdi
callq 0x6c30
leaq -0x2a0(%rbp), %rdi
callq 0x35c8
leaq -0x270(%rbp), %rdi
callq 0x35c8
leaq -0x250(%rbp), %rdi
callq 0x6c50
jmp 0x6032
leaq -0x228(%rbp), %rdi
callq 0x30d0
jmp 0x6040
leaq -0x228(%rbp), %rdi
callq 0x30d0
jmp 0x604c
movl -0x4(%rbp), %eax
addq $0x540, %rsp            # imm = 0x540
popq %rbp
retq
movq -0x230(%rbp), %rdi
callq 0x3520
nopl (%rax,%rax)