// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x308, %rsp            # imm = 0x308
movq %rsi, %rbx
movl %edi, %ebp
movq 0x1d577(%rip), %r14     # 0x21fd0
leaq 0x14651(%rip), %rsi     # 0x190b1
movl $0x16, %edx
movq %r14, %rdi
callq 0x3280
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3170
cmpl $0x2, %ebp
jg 0x4b58
leaq 0x14624(%rip), %rsi     # 0x190c8
movl $0x37, %edx
movq %r14, %rdi
callq 0x3280
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3170
leaq 0x14621(%rip), %rsi     # 0x19100
movl $0x32, %edx
movq %r14, %rdi
callq 0x3280
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3170
leaq 0x14619(%rip), %rsi     # 0x19133
movl $0x1f, %edx
movq %r14, %rdi
callq 0x3280
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3170
movl $0x1, %ebx
jmp 0x552e
movq 0x8(%rbx), %rcx
movl $0x1, %eax
movl $0x2, %r13d
movl $0x3, %r15d
movb $0x1, %dl
movl %edx, 0xc(%rsp)
cmpb $0x2d, (%rcx)
jne 0x4ba3
movzbl 0x1(%rcx), %ecx
cmpl $0x6e, %ecx
je 0x4ba8
cmpl $0x66, %ecx
jne 0x4ba3
movq 0x1d443(%rip), %rdi     # 0x21fd0
leaq 0x145bf(%rip), %rsi     # 0x19153
movl $0x15, %edx
callq 0x3280
movb $0x1, %r12b
jmp 0x4bc3
xorl %r12d, %r12d
jmp 0x4c00
movq 0x1d421(%rip), %rdi     # 0x21fd0
leaq 0x145b3(%rip), %rsi     # 0x19169
movl $0x3a, %edx
callq 0x3280
xorl %r12d, %r12d
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3170
movl $0x2, %eax
movl $0x3, %r13d
movl $0x4, %r15d
movl %r12d, 0xc(%rsp)
movq (%rbx,%rax,8), %rsi
leaq 0x100(%rsp), %r14
movq %r14, %rdi
movl $0x4, %edx
callq 0x3430
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x120(%rsp,%rax)
je 0x4c7a
movq 0x1d3bf(%rip), %rbx     # 0x21ff0
leaq 0x1456c(%rip), %rsi     # 0x191a4
movl $0x18, %edx
movq %rbx, %rdi
callq 0x3280
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq 0x1d38d(%rip), %rdi     # 0x21ff0
callq 0x3040
movl $0x2, %ebx
movq %rax, %rdi
callq 0x3170
jmp 0x5521
xorpd %xmm0, %xmm0
leaq 0x10(%rsp), %rsi
movapd %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
leaq 0x100(%rsp), %rdi
movl $0x1, %edx
callq 0x1696f
leaq 0x100(%rsp), %rdi
callq 0x3080
movq 0x1d31b(%rip), %rdi     # 0x21fd0
leaq 0x14501(%rip), %rsi     # 0x191bd
movl $0xd, %edx
callq 0x3280
movq 0x18(%rsp), %rsi
subq 0x10(%rsp), %rsi
sarq $0x5, %rsi
movq 0x1d2f5(%rip), %rdi     # 0x21fd0
callq 0x3160
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3170
movq (%rbx,%r13,8), %rsi
leaq 0x40(%rsp), %rdi
leaq 0xb8(%rsp), %rdx
callq 0x5b76
movq 0x1d2a9(%rip), %rdi     # 0x21fd0
leaq 0x1449d(%rip), %rsi     # 0x191cb
movl $0x8, %edx
callq 0x3280
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq 0x1d287(%rip), %rdi     # 0x21fd0
callq 0x3280
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3170
movl $0x1, %r14d
cmpl %ebp, %r15d
jae 0x4da7
movl %r15d, %eax
movq (%rbx,%rax,8), %rdi
callq 0x3350
cmpl $0x2, %eax
movl $0x1, %ecx
cmovgel %eax, %ecx
cmpl $0x40, %ecx
movl $0x40, %r14d
cmovll %ecx, %r14d
movq 0x1d222(%rip), %rdi     # 0x21fd0
leaq 0x1441f(%rip), %rsi     # 0x191d4
movl $0x9, %edx
callq 0x3280
movl %r14d, %esi
movq 0x1d207(%rip), %rbx     # 0x21fd0
movq %rbx, %rdi
callq 0x3160
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3170
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq 0x1d1b7(%rip), %rdi     # 0x21fd0
callq 0x3040
movq %rax, %rdi
callq 0x3170
leaq 0x1d4ab(%rip), %rdx     # 0x222d8
leaq 0x98(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x5bcf
leaq 0x68(%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 0x1d4f5(%rip), %rsi     # 0x22358
leaq 0x60(%rsp), %rdi
callq 0x15cfa
leaq 0x1d50c(%rip), %rsi     # 0x22380
leaq 0x60(%rsp), %rdi
callq 0x15cfa
leaq 0x1d523(%rip), %rsi     # 0x223a8
leaq 0x60(%rsp), %rdi
callq 0x15cfa
leaq 0x1d53a(%rip), %rsi     # 0x223d0
leaq 0x60(%rsp), %rdi
callq 0x15cfa
leaq 0x1d551(%rip), %rsi     # 0x223f8
leaq 0x60(%rsp), %rdi
callq 0x15cfa
leaq 0x60(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x16002
leaq 0x60(%rsp), %rdi
callq 0x160e6
callq 0x16c4f
movsd %xmm0, 0x90(%rsp)
movq $0x0, 0x38(%rsp)
leaq 0x1d46d(%rip), %rsi     # 0x22358
leaq 0x60(%rsp), %rdi
callq 0x15cd2
movl %eax, %ebx
leaq 0x1d482(%rip), %rsi     # 0x22380
leaq 0x60(%rsp), %rdi
callq 0x15cd2
leaq 0xb8(%rsp), %rdi
movl %ebx, %esi
movl %eax, %edx
xorl %ecx, %ecx
movl %r14d, %r8d
xorl %r9d, %r9d
callq 0xb648
testb %r12b, %r12b
je 0x5008
movq 0x10(%rsp), %r14
cmpq 0x18(%rsp), %r14
je 0x514f
movq 0x1d08f(%rip), %r15     # 0x21fd0
leaq 0xb8(%rsp), %r13
leaq 0x142e0(%rip), %rbp     # 0x19230
leaq 0x14293(%rip), %rbx     # 0x191ea
callq 0x16c4f
movsd %xmm0, (%rsp)
movl $0xb, %edx
movq %r15, %rdi
leaq 0x1426e(%rip), %rsi     # 0x191de
callq 0x3280
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r15, %rdi
callq 0x3280
movq %r15, %rdi
callq 0x3170
movq %r13, %rdi
movq %r14, %rsi
callq 0xbb5a
movl $0x2, %edx
movq %r15, %rdi
movq %rbp, %rsi
callq 0x3280
callq 0x16c4f
subsd (%rsp), %xmm0
movq %r15, %rdi
callq 0x3380
movq %rax, %r12
movl $0x9, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x3280
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %r12, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3170
addq $0x20, %r14
cmpq 0x18(%rsp), %r14
jne 0x4f57
jmp 0x514f
leaq 0x10(%rsp), %rdi
leaq 0x60(%rsp), %rdx
leaq 0x38(%rsp), %rcx
movl %r14d, %esi
callq 0x5659
movsd %xmm0, 0x30(%rsp)
cmpb $0x0, 0xc(%rsp)
je 0x5196
movq 0x1cf99(%rip), %rbx     # 0x21fd0
leaq 0x141b6(%rip), %rsi     # 0x191f4
movl $0x1c, %edx
movq %rbx, %rdi
callq 0x3280
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq 0x1cf67(%rip), %rdi     # 0x21fd0
callq 0x3040
movq %rax, %rdi
callq 0x3170
movq 0x10(%rsp), %r14
cmpq 0x18(%rsp), %r14
je 0x514f
movq 0x1cf43(%rip), %r15     # 0x21fd0
leaq 0xb8(%rsp), %r13
leaq 0x14194(%rip), %rbp     # 0x19230
leaq 0x14147(%rip), %rbx     # 0x191ea
callq 0x16c4f
movsd %xmm0, (%rsp)
movl $0xb, %edx
movq %r15, %rdi
leaq 0x14122(%rip), %rsi     # 0x191de
callq 0x3280
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r15, %rdi
callq 0x3280
movq %r15, %rdi
callq 0x3170
movq %r13, %rdi
movq %r14, %rsi
callq 0xb94e
movl $0x2, %edx
movq %r15, %rdi
movq %rbp, %rsi
callq 0x3280
callq 0x16c4f
subsd (%rsp), %xmm0
movq %r15, %rdi
callq 0x3380
movq %rax, %r12
movl $0x9, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x3280
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %r12, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3170
addq $0x20, %r14
cmpq 0x18(%rsp), %r14
jne 0x50a3
movq 0x1ce7a(%rip), %rdi     # 0x21fd0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq 0x1ce5f(%rip), %rdi     # 0x21fd0
callq 0x3040
movq %rax, %rdi
callq 0x3170
leaq 0xb8(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x55db
movsd %xmm0, 0x30(%rsp)
callq 0x16c4f
movsd %xmm0, (%rsp)
movq 0x1ce29(%rip), %rdi     # 0x21fd0
movsd 0x30(%rsp), %xmm0
callq 0x3380
movq %rax, %rbx
leaq 0x14055(%rip), %rsi     # 0x19211
movl $0x16, %edx
movq %rax, %rdi
callq 0x3280
movsd (%rsp), %xmm0
subsd 0x90(%rsp), %xmm0
movq %rbx, %rdi
movsd %xmm0, (%rsp)
callq 0x3380
movq %rax, %rbx
leaq 0x1403a(%rip), %rsi     # 0x19228
movl $0xa, %edx
movq %rax, %rdi
callq 0x3280
movsd 0x30(%rsp), %xmm0
divsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x3380
movq %rax, %rbx
leaq 0x1401b(%rip), %rsi     # 0x19233
movl $0x7, %edx
movq %rax, %rdi
callq 0x3280
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3170
cmpb $0x0, 0xc(%rsp)
je 0x542b
movq 0x1cd72(%rip), %rdi     # 0x21fd0
leaq 0x13fd6(%rip), %rsi     # 0x1923b
movl $0xf, %edx
callq 0x3280
movsd 0x38(%rsp), %xmm0
movsd %xmm0, (%rsp)
leaq 0xb8(%rsp), %rdi
callq 0xc0aa
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movq 0x1cd39(%rip), %rdi     # 0x21fd0
movapd %xmm1, %xmm0
callq 0x3380
movq %rax, %rbx
leaq 0x13fa1(%rip), %rsi     # 0x1924b
movl $0x8, %edx
movq %rax, %rdi
callq 0x3280
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3170
movq 0x1cceb(%rip), %rdi     # 0x21fd0
leaq 0x13f68(%rip), %rsi     # 0x19254
movl $0xf, %edx
callq 0x3280
leaq 0xb8(%rsp), %rdi
callq 0xc0b0
movq 0x1ccc6(%rip), %rdi     # 0x21fd0
callq 0x3380
movq %rax, %rbx
leaq 0x13f32(%rip), %rsi     # 0x1924b
movl $0x8, %edx
movq %rax, %rdi
callq 0x3280
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3170
movq 0x1cc7c(%rip), %rdi     # 0x21fd0
leaq 0x13f09(%rip), %rsi     # 0x19264
movl $0xf, %edx
callq 0x3280
leaq 0xb8(%rsp), %rdi
callq 0xc0b6
movq 0x1cc57(%rip), %rdi     # 0x21fd0
callq 0x3380
movq %rax, %rbx
leaq 0x13ec3(%rip), %rsi     # 0x1924b
movl $0x8, %edx
movq %rax, %rdi
callq 0x3280
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3170
movq 0x1cc0d(%rip), %rdi     # 0x21fd0
leaq 0x13eaa(%rip), %rsi     # 0x19274
movl $0xf, %edx
callq 0x3280
leaq 0xb8(%rsp), %rdi
callq 0xc0bc
movq 0x1cbe8(%rip), %rdi     # 0x21fd0
callq 0x3380
movq %rax, %rbx
leaq 0x13e54(%rip), %rsi     # 0x1924b
movl $0x8, %edx
movq %rax, %rdi
callq 0x3280
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3170
movq 0x1cb9e(%rip), %rdi     # 0x21fd0
leaq 0x13e4b(%rip), %rsi     # 0x19284
movl $0xf, %edx
callq 0x3280
callq 0x16c64
movl %eax, %esi
movq 0x1cb7f(%rip), %rbx     # 0x21fd0
movq %rbx, %rdi
callq 0x3160
movq %rax, %r14
leaq 0x13e31(%rip), %rsi     # 0x19294
movl $0x3, %edx
movq %rax, %rdi
callq 0x3280
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3170
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq 0x1cb1b(%rip), %rdi     # 0x21fd0
callq 0x3040
movq %rax, %rdi
callq 0x3170
leaq 0xb8(%rsp), %rdi
callq 0xb6d6
leaq 0x60(%rsp), %rdi
callq 0x5c94
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x54fa
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x3240
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5515
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3240
leaq 0x10(%rsp), %rdi
callq 0x5c2a
xorl %ebx, %ebx
leaq 0x100(%rsp), %rdi
callq 0x3090
movl %ebx, %eax
addq $0x308, %rsp            # imm = 0x308
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5553
jmp 0x555d
jmp 0x5558
jmp 0x5553
jmp 0x5566
jmp 0x555d
movq %rax, %rbx
jmp 0x55c6
movq %rax, %rbx
jmp 0x5576
movq %rax, %rbx
jmp 0x55bc
movq %rax, %rbx
jmp 0x55a1
jmp 0x5566
jmp 0x5566
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0xb6d6
leaq 0x60(%rsp), %rdi
callq 0x5c94
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x55a1
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x3240
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x55bc
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3240
leaq 0x10(%rsp), %rdi
callq 0x5c2a
leaq 0x100(%rsp), %rdi
callq 0x3090
movq %rbx, %rdi
callq 0x3410