// File: /workspace/github_cpp_makefile_star2_O1/cpearce[P]OggIndex/src/OggIndex.cpp
// Function: main
int main(int argc, char** argv) 
{
  if (!gOptions.Parse(argc, argv)) {
    return -1;
  }

  string filename = gOptions.GetInputFilename();
  ifstream input(filename.c_str(), ios::in | ios::binary);
  ogg_sync_state state;
  ogg_int32_t ret = ogg_sync_init(&state);
  assert(ret==0);
 
  DecoderMap decoders;
  
  ogg_page page;
  memset(&page, 0, sizeof(ogg_page));

  ogg_uint64_t bytesRead = 0;
  ogg_int64_t offset = 0;
  ogg_uint32_t pageNumber = 0;
  bool gotAllHeaders = false;
  ogg_uint64_t endOfHeaders = 0;
  ogg_uint64_t oldSkeletonLength = 0;

  
  // We store all non-skeleton header pages in the order in which we read them,
  // so that we can rewrite them easily.
  vector<ogg_page*> headerPages;

  while (ReadPage(&state, &page, input, bytesRead)) {
    assert(IsPageAtOffset(filename, offset, &page));
    pageNumber++;
    ogg_uint32_t serial = ogg_page_serialno(&page);
    Decoder* decoder = 0;
    if (ogg_page_bos(&page)) {
      decoder = Decoder::Create(&page);
      decoders[serial] = decoder;
    } else {
      decoder = decoders[serial];
    }
    if (!decoder) {
      cerr << "FAIL: Unhandled stream type, serialno="
           << serial << " aborting indexing!" << endl;
      return -1;
    }

    ogg_uint32_t length = page.body_len + page.header_len;

    if (gOptions.GetDumpPages()) {
      ogg_int64_t granulepos = ogg_page_granulepos(&page);
      cout << "[" << decoder->TypeStr() << "] page @" << offset
           << " length=" << length << " granulepos=" << granulepos 
           << " end_time=" << decoder->GranuleposToTime(granulepos) << "ms"
           << " s=" << serial << " packet_starts=" << CountPacketStarts(&page)
           << " packet_ends=" << ogg_page_packets(&page)
           << " checksum=" << GetChecksum(&page) << endl;
    }

    decoder->Decode(&page, offset);
    
    if (!gotAllHeaders) {
      gotAllHeaders = true;
      DecoderMap::iterator itr = decoders.begin();
      while (itr != decoders.end()) {
        Decoder* d = itr->second;
        if (!d->GotAllHeaders()) {
          gotAllHeaders = false;
          break;
        }
        itr++;
      }
      if (decoder->Type() == TYPE_SKELETON) {
        oldSkeletonLength += length;
      } else {
        // Record all header pages except skeleton. We'll just rewrite the
        // skeleton, and the skeleton decoder will remember its packets.
        headerPages.push_back(Clone(&page));
      }
      if (gotAllHeaders) {
        endOfHeaders = offset + length;
      }
    }

    offset += length;
    memset(&page, 0, sizeof(ogg_page));
  }
  if (!gotAllHeaders) {
    // We've not completely read all the headers, assume the end of the last
    // page we've read is the end of headers. This will turn into the content
    // offset. The input file is probably corrupt.
    cout << "WARNING: Couldn't successfully read all header packets!" << endl;
    endOfHeaders = offset;
  }

  const ogg_int64_t fileLength = bytesRead;
  assert(input.eof());
  if (offset != fileLength) {
    cerr << "WARNING: Ogg page lengths don't sum to file length!" << endl;
  }  
  
  assert(fileLength == InputFileLength());
  
  ogg_sync_clear(&state);
  
  SkeletonEncoder encoder(decoders, fileLength, oldSkeletonLength, endOfHeaders);

  // Reopen the file so we can write it out with the index.
  input.close();
  input.clear();
  input.open(filename.c_str(), ios::in | ios::binary);
  assert(input.good());
  
  // Open output file.
  ofstream output(gOptions.GetOutputFilename().c_str(), ios::out | ios::binary);
  
  // Encode the new skeleton track.
  encoder.Encode();
  
  // Write out the new skeleton BOS page.
  encoder.WriteBosPage(output);
  if (!output.good()) {
    cerr << "ERROR: Failed to write new skeleton BOS page." << endl;
    return -1;
  }
  
  // Write out all the other tracks' header pages.
  for (ogg_uint32_t i=0; i<headerPages.size(); i++) {
    WritePage(output, *headerPages[i]);
    if (!output.good()) {
      cerr << "ERROR: Failed to write other tracks' header pages." << endl;
      return -1;
    }
    FreeClone(headerPages[i]);
  }

  // Write out remaining skeleton pages.
  encoder.WritePages(output);
  if (!output.good()) {
    cerr << "ERROR: Failed to write new skeleton index pages." << endl;
    return -1;
  }

  assert(encoder.ContentOffset() == output.tellp());

  // Copy content pages.
  input.seekg((std::streamoff)endOfHeaders);
  CopyFileData(input, output, fileLength - endOfHeaders);
  if (!output.good()) {
    cerr << "ERROR: Failed to write remaining content pages." << endl;
    return -1;
  }
  
  output.close();
  input.close();

  ogg_int64_t trackLength = encoder.GetTrackLength();
  cout << "Skeleton " << SKELETON_VERSION_MAJOR << "." << SKELETON_VERSION_MINOR 
       << " track with keyframe indexes uses " << trackLength << " bytes, "
       << ((float)trackLength / (float)(fileLength + trackLength)) * 100.0
       << "% overhead" << endl;

  int retval = 0;
  if (gOptions.GetVerifyIndex()) {
    cout << "Validating keyframe indexes..." << endl;
    if (!ValidateIndexedOgg(gOptions.GetOutputFilename())) {
      cerr << "FAIL: Verification of the index failed!" << endl;
      retval = -1;
    } else {
      cout << "SUCCESS: index is valid." << endl;
    }
  }

  return retval;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x568, %rsp            # imm = 0x568
movq %rsi, %rdx
movl %edi, %esi
leaq 0xf9b7(%rip), %rdi      # 0x17420
callq 0x9100
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testb %al, %al
je 0x830a
leaq 0xf99e(%rip), %rsi      # 0x17420
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
callq 0x8c02
movq (%rbx), %rsi
leaq 0x360(%rsp), %rdi
movl $0xc, %edx
callq 0x4730
leaq 0x140(%rsp), %rdi
callq 0x4180
testl %eax, %eax
jne 0x85c8
leaq 0x88(%rsp), %rax
movl $0x0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
xorpd %xmm0, %xmm0
leaq 0xb0(%rsp), %r14
movapd %xmm0, 0x10(%r14)
movapd %xmm0, (%r14)
leaq 0x58(%rsp), %rax
movq %rcx, (%rax)
leaq 0x10(%rsp), %rdx
movl $0x0, %eax
movq %rax, 0x8(%rsp)
movq %rcx, 0x10(%rdx)
movapd %xmm0, (%rdx)
movq $0x0, 0x50(%rsp)
movl $0x0, 0x4(%rsp)
xorl %r12d, %r12d
movl $0x0, (%rsp)
leaq 0x140(%rsp), %rdi
movq %r14, %rsi
leaq 0x360(%rsp), %rdx
leaq 0x58(%rsp), %rcx
callq 0xc3c8
testb %al, %al
je 0x7f3e
leaq 0x60(%rsp), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0xc6d1
testb %al, %al
je 0x85a9
movq %r14, %rdi
callq 0x42d0
movl %eax, 0xd0(%rsp)
movq %r14, %rdi
callq 0x46f0
testl %eax, %eax
je 0x7ba7
movq %r14, %rdi
callq 0x5304
movq %rax, %rbp
leaq 0x80(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x8772
movq %rbp, (%rax)
jmp 0x7bbf
leaq 0x80(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x8772
movq (%rax), %rbp
testq %rbp, %rbp
je 0x7c4a
movq %r12, %r13
movq 0xb8(%rsp), %rbx
addq 0xc8(%rsp), %rbx
leaq 0xf83e(%rip), %rdi      # 0x17420
callq 0x8c52
movq %r14, %r12
testb %al, %al
je 0x7e55
movq %r12, %rdi
callq 0x4620
movq %rax, %r14
movl $0x1, %edx
movq 0xf3c7(%rip), %rdi      # 0x16fd0
leaq 0xa09e(%rip), %rsi      # 0x11cae
callq 0x4410
movq (%rbp), %rax
movq %rbp, %rdi
callq *0x30(%rax)
movq %rax, %r15
testq %rax, %rax
je 0x7cbf
movq %r15, %rdi
callq 0x4170
movq 0xf396(%rip), %rdi      # 0x16fd0
movq %r15, %rsi
movq %rax, %rdx
callq 0x4410
jmp 0x7cdd
movl $0x26, %edx
movq 0xf39a(%rip), %rdi      # 0x16ff0
leaq 0x8caa(%rip), %rsi      # 0x10907
callq 0x4410
movl 0xd0(%rsp), %esi
movq 0xf380(%rip), %rdi      # 0x16ff0
callq 0x4240
movq %rax, %rbx
movl $0x13, %edx
movq %rax, %rdi
leaq 0x8ca7(%rip), %rsi      # 0x1092e
callq 0x4410
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4360
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
movq %rax, %rdi
callq 0x4250
jmp 0x7f30
movq 0xf30a(%rip), %rcx      # 0x16fd0
movq (%rcx), %rax
movq -0x18(%rax), %rax
leaq (%rcx,%rax), %rdi
movl 0x20(%rcx,%rax), %esi
orl $0x1, %esi
callq 0x4690
movl $0x8, %edx
movq 0xf2e7(%rip), %rdi      # 0x16fd0
leaq 0x8c52(%rip), %rsi      # 0x10942
callq 0x4410
movq 0xf2d4(%rip), %rdi      # 0x16fd0
movq %r13, %rsi
callq 0x4340
movq %rax, %r15
movl $0x8, %edx
movq %rax, %rdi
leaq 0x8c35(%rip), %rsi      # 0x1094b
callq 0x4410
movl %ebx, %esi
movq %r15, %rdi
callq 0x4240
movq %rax, %r15
movl $0xc, %edx
movq %rax, %rdi
leaq 0x889d(%rip), %rsi      # 0x105d4
callq 0x4410
movq %r15, %rdi
movq %r14, %rsi
callq 0x4340
movq %rax, %r15
movl $0xa, %edx
movq %rax, %rdi
leaq 0x8bfb(%rip), %rsi      # 0x10954
callq 0x4410
movq (%rbp), %rax
movq %rbp, %rdi
movq %r14, %rsi
callq *0x38(%rax)
movq %r15, %rdi
movq %rax, %rsi
callq 0x4340
movq %rax, %r14
movl $0x2, %edx
movq %rax, %rdi
leaq 0x93a6(%rip), %rsi      # 0x1112e
callq 0x4410
movl $0x3, %edx
movq %r14, %rdi
leaq 0x9d2b(%rip), %rsi      # 0x11ac7
callq 0x4410
movl 0xd0(%rsp), %esi
movq %r14, %rdi
callq 0x4240
movq %rax, %r14
movl $0xf, %edx
movq %rax, %rdi
leaq 0x8b9d(%rip), %rsi      # 0x1095f
callq 0x4410
movq %r12, %rdi
callq 0xcad7
movq %r14, %rdi
movl %eax, %esi
callq 0x46a0
movq %rax, %r14
movl $0xd, %edx
movq %rax, %rdi
leaq 0x8b84(%rip), %rsi      # 0x1096f
callq 0x4410
movq %r12, %rdi
callq 0x4710
movq %r14, %rdi
movl %eax, %esi
callq 0x46a0
movq %rax, %r14
movl $0xa, %edx
movq %rax, %rdi
leaq 0x8b69(%rip), %rsi      # 0x1097d
callq 0x4410
movq %r12, %rdi
callq 0xc9f0
movl %eax, %esi
movq %r14, %rdi
callq 0x4240
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4360
movsbl %al, %esi
movq %r14, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4250
movq (%rbp), %rax
movq %rbp, %rdi
movq %r12, %r14
movq %r12, %rsi
movq %r13, %rdx
callq *0x10(%rax)
testb $0x1, 0x4(%rsp)
je 0x7e77
movq %r13, %r12
jmp 0x7f15
movb $0x1, %al
movl %eax, 0x4(%rsp)
movq 0x98(%rsp), %r14
leaq 0x88(%rsp), %rax
cmpq %rax, %r14
je 0x7ebd
movq 0x28(%r14), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movl %eax, %r15d
testb %al, %al
je 0x7eb0
movq %r14, %rdi
callq 0x4260
movq %rax, %r14
jmp 0x7eb8
movl $0x0, 0x4(%rsp)
testb %r15b, %r15b
jne 0x7e85
movq (%rbp), %rax
movq %rbp, %rdi
callq *0x28(%rax)
movq %r12, %r14
cmpl $0x4, %eax
movq %r13, %r12
jne 0x7edb
movl %ebx, %eax
addq %rax, 0x50(%rsp)
jmp 0x7efd
movq %r14, %rdi
callq 0xc130
movq %rax, 0x160(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0x8a2c
movl %ebx, %eax
addq %r12, %rax
testb $0x1, 0x4(%rsp)
movq 0x8(%rsp), %rcx
cmovneq %rax, %rcx
movq %rcx, 0x8(%rsp)
movl %ebx, %eax
addq %rax, %r12
xorpd %xmm0, %xmm0
movapd %xmm0, 0xc0(%rsp)
movapd %xmm0, 0xb0(%rsp)
testq %rbp, %rbp
jne 0x7b2a
jmp 0x82bb
testb $0x1, 0x4(%rsp)
movq 0x8(%rsp), %r13
jne 0x7f93
movq 0xf07f(%rip), %r14      # 0x16fd0
leaq 0x8a30(%rip), %rsi      # 0x10988
movl $0x37, %edx
movq %r14, %rdi
callq 0x4410
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x4360
movsbl %al, %esi
movq 0xf04d(%rip), %rdi      # 0x16fd0
callq 0x4040
movq %rax, %rdi
callq 0x4250
movq %r12, %r13
movq 0x360(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x380(%rsp,%rax)
movl (%rsp), %ebx
je 0x85e7
movq 0x58(%rsp), %r15
cmpq %r15, %r12
je 0x8000
movq 0xf02f(%rip), %r14      # 0x16ff0
leaq 0x8a04(%rip), %rsi      # 0x109cc
movl $0x33, %edx
movq %r14, %rdi
callq 0x4410
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x4360
movsbl %al, %esi
movq 0xeffd(%rip), %rdi      # 0x16ff0
callq 0x4040
movq %rax, %rdi
callq 0x4250
leaq 0xf419(%rip), %rsi      # 0x17420
leaq 0x160(%rsp), %rdi
callq 0x8c02
movq 0x160(%rsp), %rdi
callq 0xc2d0
movq %rax, %r14
leaq 0x170(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8045
movq 0x170(%rsp), %rsi
incq %rsi
callq 0x43a0
cmpq %r14, %r15
jne 0x8606
leaq 0x140(%rsp), %rdi
callq 0x4760
leaq 0xd0(%rsp), %rdi
leaq 0x80(%rsp), %rsi
movq %r15, %rdx
movq 0x50(%rsp), %rcx
movq %r13, %r8
callq 0x96fc
leaq 0x360(%rsp), %r14
movq %r14, %rdi
callq 0x40a0
movq 0x360(%rsp), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x4690
movq 0x60(%rsp), %rsi
leaq 0x360(%rsp), %rdi
movl $0xc, %edx
callq 0x4200
movq 0x360(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x380(%rsp,%rax)
jne 0x8625
leaq 0xf347(%rip), %rsi      # 0x17420
leaq 0x30(%rsp), %rdi
callq 0x8c26
movq 0x30(%rsp), %rsi
leaq 0x160(%rsp), %rdi
movl $0x14, %edx
callq 0x43e0
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8115
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x43a0
leaq 0xd0(%rsp), %rdi
callq 0x9ad8
leaq 0xd0(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0xaff4
movq 0x160(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x180(%rsp,%rax)
je 0x819d
movl $0x2d, %edx
leaq 0x88d4(%rip), %rsi      # 0x10a2d
movq 0xee90(%rip), %rbx      # 0x16ff0
movq %rbx, %rdi
callq 0x4410
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x4360
movsbl %al, %esi
movq 0xee6a(%rip), %rdi      # 0x16ff0
callq 0x4040
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq %rax, %rdi
callq 0x4250
jmp 0x8273
movq 0x10(%rsp), %rax
cmpq %rax, 0x18(%rsp)
setne %bpl
je 0x8269
movq %r13, %r12
movl $0x1, %ebx
xorl %r13d, %r13d
leaq 0x160(%rsp), %r14
movq (%rax,%r13,8), %rsi
movq %r14, %rdi
callq 0xc2a3
movq 0x160(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x180(%rsp,%rax)
jne 0x821b
movq 0x10(%rsp), %rax
movq (%rax,%r13,8), %rdi
callq 0xc284
movl %ebx, %r13d
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
incl %ebx
cmpq %r13, %rcx
seta %bpl
ja 0x81c4
movl (%rsp), %ebx
movq %r12, %r13
jmp 0x8269
movq 0xedce(%rip), %rbx      # 0x16ff0
leaq 0x8832(%rip), %rsi      # 0x10a5b
movl $0x32, %edx
movq %rbx, %rdi
callq 0x4410
movq %r12, %r13
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x4360
movsbl %al, %esi
movq 0xed99(%rip), %rdi      # 0x16ff0
callq 0x4040
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq %rax, %rdi
callq 0x4250
testb $0x1, %bpl
je 0x831e
movl %ebx, (%rsp)
movq 0xed4b(%rip), %rax      # 0x16fc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x168(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x160(%rsp,%rcx)
callq 0x42e0
leaq 0x258(%rsp), %rdi
callq 0x4120
leaq 0xd0(%rsp), %rdi
callq 0x9874
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x82d2
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x43a0
leaq 0x80(%rsp), %rdi
callq 0x87d6
leaq 0x360(%rsp), %rdi
callq 0x40c0
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
movl (%rsp), %ebx
je 0x830a
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x43a0
movl %ebx, %eax
addq $0x568, %rsp            # imm = 0x568
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd0(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0xb02c
movq 0x160(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x180(%rsp,%rax)
je 0x835a
movl $0x30, %edx
leaq 0x8739(%rip), %rsi      # 0x10a8e
jmp 0x8159
movq 0x138(%rsp), %rbx
leaq 0x160(%rsp), %rdi
callq 0x42f0
cmpq %rax, %rbx
jne 0x8644
leaq 0x360(%rsp), %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x4480
movq %r15, %rdx
subq %r13, %rdx
leaq 0x360(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0xc8c1
movq 0x160(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x180(%rsp,%rax)
je 0x83e9
movq 0xec2e(%rip), %rdi      # 0x16ff0
leaq 0x8720(%rip), %rsi      # 0x10ae9
movl $0x2f, %edx
callq 0x4410
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0xec11(%rip), %rdi      # 0x16ff0
callq 0x41c0
jmp 0x8273
leaq 0x160(%rsp), %rdi
callq 0x4500
leaq 0x360(%rsp), %rdi
callq 0x40a0
leaq 0xd0(%rsp), %rdi
callq 0xafa2
movq %rax, %rbx
movq 0xebb6(%rip), %rdi      # 0x16fd0
leaq 0x87a5(%rip), %rsi      # 0x10bc6
movl $0x9, %edx
callq 0x4410
movq 0xeb9e(%rip), %rdi      # 0x16fd0
movl $0x4, %esi
callq 0x46a0
movq %rax, %r14
leaq 0x8727(%rip), %rsi      # 0x10b6d
movl $0x1, %edx
movq %rax, %rdi
callq 0x4410
movq %r14, %rdi
xorl %esi, %esi
callq 0x46a0
movq %rax, %r14
leaq 0x86b2(%rip), %rsi      # 0x10b19
movl $0x22, %edx
movq %rax, %rdi
callq 0x4410
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4340
movq %rax, %r14
leaq 0x86b3(%rip), %rsi      # 0x10b3c
movl $0x8, %edx
movq %rax, %rdi
callq 0x4410
cvtsi2ss %rbx, %xmm0
addq %rbx, %r15
cvtsi2ss %r15, %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0x83f5(%rip), %xmm0     # 0x108a8
movq %r14, %rdi
callq 0x4610
movq %rax, %rbx
leaq 0x8680(%rip), %rsi      # 0x10b45
movl $0xa, %edx
movq %rax, %rdi
callq 0x4410
movq %rbx, %rdi
callq 0x41c0
leaq 0xef3f(%rip), %rdi      # 0x17420
callq 0x8c4a
xorl %ebx, %ebx
testb %al, %al
je 0x8273
movq 0xead9(%rip), %rdi      # 0x16fd0
leaq 0x8652(%rip), %rsi      # 0x10b50
movl $0x1e, %edx
callq 0x4410
movq 0xeac1(%rip), %rdi      # 0x16fd0
callq 0x41c0
leaq 0xef05(%rip), %rsi      # 0x17420
leaq 0x30(%rsp), %rdi
callq 0x8c26
leaq 0x30(%rsp), %rdi
callq 0xd044
movl %eax, %ebp
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x854d
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x43a0
testb %bpl, %bpl
je 0x857b
movq 0xea77(%rip), %rdi      # 0x16fd0
leaq 0x8637(%rip), %rsi      # 0x10b97
movl $0x18, %edx
callq 0x4410
movq 0xea5f(%rip), %rdi      # 0x16fd0
callq 0x41c0
jmp 0x8273
movq 0xea6e(%rip), %rdi      # 0x16ff0
leaq 0x85e6(%rip), %rsi      # 0x10b6f
movl $0x27, %edx
callq 0x4410
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0xea51(%rip), %rdi      # 0x16ff0
callq 0x41c0
jmp 0x8273
leaq 0x832f(%rip), %rdi      # 0x108df
leaq 0x8300(%rip), %rsi      # 0x108b7
leaq 0x830a(%rip), %rcx      # 0x108c8
movl $0x5a, %edx
callq 0x4210
leaq 0x82e1(%rip), %rdi      # 0x108b0
leaq 0x82e1(%rip), %rsi      # 0x108b7
leaq 0x82eb(%rip), %rcx      # 0x108c8
movl $0x46, %edx
callq 0x4210
leaq 0x83d2(%rip), %rdi      # 0x109c0
leaq 0x82c2(%rip), %rsi      # 0x108b7
leaq 0x82cc(%rip), %rcx      # 0x108c8
movl $0x9b, %edx
callq 0x4210
leaq 0x83f3(%rip), %rdi      # 0x10a00
leaq 0x82a3(%rip), %rsi      # 0x108b7
leaq 0x82ad(%rip), %rcx      # 0x108c8
movl $0xa0, %edx
callq 0x4210
leaq 0x83f4(%rip), %rdi      # 0x10a20
leaq 0x8284(%rip), %rsi      # 0x108b7
leaq 0x828e(%rip), %rcx      # 0x108c8
movl $0xaa, %edx
callq 0x4210
leaq 0x8474(%rip), %rdi      # 0x10abf
leaq 0x8265(%rip), %rsi      # 0x108b7
leaq 0x826f(%rip), %rcx      # 0x108c8
movl $0xca, %edx
callq 0x4210
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x86f0
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x43a0
jmp 0x86f0
jmp 0x86ed
jmp 0x86ed
jmp 0x86ed
jmp 0x86ed
jmp 0x86ed
movq %rax, %rbx
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x86fd
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x43a0
jmp 0x86fd
jmp 0x86e4
jmp 0x871a
movq %rax, %rbx
leaq 0x170(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x871d
movq 0x170(%rsp), %rsi
incq %rsi
callq 0x43a0
jmp 0x871d
movq %rax, %rbx
jmp 0x8741
movq %rax, %rbx
jmp 0x874e
jmp 0x871a
movq %rax, %rbx
jmp 0x86fd
jmp 0x871a
jmp 0x86ed
movq %rax, %rbx
leaq 0x160(%rsp), %rdi
callq 0x4530
leaq 0xd0(%rsp), %rdi
callq 0x9874
jmp 0x871d
jmp 0x871a
jmp 0x871a
jmp 0x871a
jmp 0x871a
jmp 0x871a
jmp 0x871a
jmp 0x871a
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x8734
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x43a0
leaq 0x80(%rsp), %rdi
callq 0x87d6
leaq 0x360(%rsp), %rdi
callq 0x40c0
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8769
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x43a0
movq %rbx, %rdi
callq 0x46e0
nop