// File: /workspace/github_cpp_makefile_star2_O3/cpearce[P]OggIndex/src/Validate.cpp
// Function: ValidateIndexedOgg(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool ValidateIndexedOgg(const string& filename) {
  ifstream input(filename.c_str(), ios::in | ios::binary);
  ogg_sync_state state;
  ogg_int32_t ret = ogg_sync_init(&state);
  assert(ret==0);

  VerifyDecoderMap decoders;
  ogg_page page;
  memset(&page, 0, sizeof(ogg_page));
  ogg_uint64_t bytesRead = 0;
  Theora* theora = 0;
  Vorbis* vorbis = 0;
  Kate* kate = 0;
  Skeleton* skeleton = 0;
  bool index_valid = true;
  ogg_uint64_t contentOffset = 0;
  
  while (!ReadAllHeaders(theora, vorbis, kate, skeleton) && 
         ReadPage(&state, &page, input, bytesRead))
  {
    contentOffset += page.header_len + page.body_len;
    int serialno = ogg_page_serialno(&page);
    VerifyDecoder* decoder = 0;
    if (ogg_page_bos(&page)) {
      if (page.body_len > 8 &&
          strncmp("theora", (const char*)page.body+1, 6) == 0)
      {
        theora = new Theora(serialno);
        decoders[serialno] = theora;
      } else if (page.body_len > 8 &&
                 strncmp("vorbis", (const char*)page.body+1, 6) == 0)
      {
        vorbis = new Vorbis(serialno);
        decoders[serialno] = vorbis;
#ifdef HAVE_KATE
      } else if (page.body_len > 8 &&
                 memcmp("kate\0\0\0", (const char*)page.body+1, 7) == 0)
      {
        kate = new Kate(serialno);
        decoders[serialno] = kate;
#endif
      } else if (page.body_len > 8 &&
                 strncmp("fishead", (const char*)page.body, 8) == 0)
      {
        skeleton = new Skeleton(serialno);
        decoders[serialno] = skeleton;
      }
    }
    decoder = decoders[serialno];
    if (!decoder) {
      cout << "WARNING: Unknown stream type, serialno=" << serialno << endl;
      continue;
    }
    ogg_int64_t ignore;
    if (!decoder->Decode(&page, ignore)) {
      index_valid = false;
    }
  }

  if (!skeleton) {
    cerr << "FAIL: No skeleton track so therefore no keyframe indexes!" << endl;
    return false;
  }

  if (skeleton->mContentOffset != contentOffset) {
    cerr << "FAIL: skeleton header's reported content offset (" << skeleton->mContentOffset
         << ") does not match actual content offset (" << contentOffset << ")" << endl;
    index_valid = false;
  }

  ogg_int64_t fileLength = FileLength(filename.c_str());
  if (skeleton->mFileLength != fileLength) {
    cerr << "FAIL: index's reported file length (" << skeleton->mFileLength
         << ") doesn't match file's actual length (" << fileLength << ")" << endl;
    index_valid = false;
  }

  KeyFrameIndex::iterator itr = skeleton->mIndex.begin();
  if (itr == skeleton->mIndex.end()) {
    cerr << "WARNING: No tracks in skeleton index." << endl;
  }

  while (itr != skeleton->mIndex.end()) {
    vector<KeyFrameInfo>* v = itr->second;
    ogg_uint32_t serialno = itr->first;
    itr++;
    VerifyDecoder* decoder = decoders[serialno];

    if (!decoder) {
      cerr << "WARNING: No decoder for track s="
           << serialno << endl;
      continue;
    }

    if (v->size() == 0) {
      cerr << "WARNING: " << decoder->Type() << "/" <<  serialno
           << " index has no keyframes" << endl;
      continue;
    }

    cout << decoder->Type() << "/" << serialno
         << " index has " << v->size() << " keypoints." << endl;

    bool valid = true;
    for (ogg_uint32_t i=0; i<v->size(); i++) {
    
      KeyFrameInfo& keypoint = v->at(i);
      if (keypoint.mOffset > INT_MAX) {
        cerr << "WARNING: Only verified up to 2^31 bytes into the file." << endl;
        break;
      }
      
      if (keypoint.mOffset > fileLength) {
        valid = false;
        cerr << "FAIL: Keypoint " << i << " offset of " << keypoint.mOffset
             << " out of file range." << endl;
        break;
      }

      // Check that the checksum of the page here matches, and that the
      // presentation time of the stream matches what's reported in the index.
      ogg_sync_reset(&state);
      if (input.eof()) {
        // Probably hit eof while reading pages for previous keypoint.
        input.close();
        input.clear();        
        input.open(filename.c_str(), ios::in | ios::binary);
      }
      input.seekg(keypoint.mOffset);
      if (!input.good()) {
        cerr << "FAIL: Can't seek to keypoint at byte offset " << keypoint.mOffset << endl;
        return false;
      }
      decoder->Reset();
      ogg_int64_t pres_time = -1;
      ogg_int64_t page_offset = keypoint.mOffset;
      ogg_int64_t end_time = -1;
      while (pres_time  == -1) {
        int skip = 0;
        if ((skip = PageSeek(&state, &page, input, bytesRead)) != 0) {
          if (skip == -1) {
            cerr << "FAIL: Can't read page at offset " << page_offset << endl;
            return false;
          }
          assert(skip > 0);
          cerr << "FAIL: There's no page at offset " << page_offset
               << " as reported by keypoint. Next page is at offset "
               << (page_offset + skip) << endl;
          return false;
        }
        page_offset += page.header_len + page.body_len;
        // Extract the presentation time. Decode() returns -1 if it needs
        // another page.
        if ((ogg_uint32_t)ogg_page_serialno(&page) != decoder->mSerial) {
          // Skip until we read another page on this stream.
          continue;
        }
        pres_time = decoder->Decode(&page, end_time);
        // Vorbis decoders should never return -1 for prestime, it should be
        // calculable from only one page.
        assert(decoder != vorbis || pres_time != -1);
      }

      // We consider a theora the key point is invalid if it's reported time
      // doesn't match the presentation time of the first keyframe which
      // can be decoded from this page.
      if (decoder == theora && keypoint.mTime != pres_time) {
        cerr << "FAIL: theora keypoint " << i << " for page at offset "
             << keypoint.mOffset << " reports start time of "
             << keypoint.mTime << " but should be " << pres_time << endl;
        valid = false;
      }

      // A vorbis keypoint is considered invalid if lies before the start time
      // of this page, or after the end time.
      if (decoder == vorbis &&
          (keypoint.mTime < pres_time || keypoint.mTime > end_time))
      {
        cerr << "FAIL: vorbis keypoint " << i << " for page at offset "
             << keypoint.mOffset << " reports start time of "
             << keypoint.mTime << " but should lie in the range ["
             << pres_time << "," << end_time << "]" << endl;
        valid = false;
      }

#ifdef HAVE_KATE
      if (decoder == kate) {
        // We get the granpos of the page linked to, and check that the base part of the granpos
        // is higher or equal to the time of the keypoint
        ogg_int64_t base_time = kate->GetBaseTime(&page);
        if (base_time > pres_time) {
          cerr << "FAIL: kate keypoint " << i << " for page at offset "
               << keypoint.mOffset << " reports start time of "
               << keypoint.mTime << " but should be greater of equal to "
               << base_time << endl;
          valid = false;
        }
      }
#endif
    }
    if (valid) {
      cout << decoder->Type() << "/" << serialno
           << " index is accurate." << endl;
    } else {
      cout << "FAIL: " << decoder->Type() << "/" << serialno
           << " index is NOT accurate." << endl;
      index_valid = false;
    }
  }

  ogg_sync_clear(&state);
  
  return index_valid;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2d8, %rsp            # imm = 0x2D8
movq %rdi, 0x60(%rsp)
movq (%rdi), %rsi
leaq 0xd0(%rsp), %rdi
movl $0xc, %edx
callq 0x4720
leaq 0xb0(%rsp), %rdi
callq 0x4180
testl %eax, %eax
jne 0xdcf4
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)
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %rax
movaps %xmm0, 0x10(%rax)
movaps %xmm0, (%rax)
leaq 0x78(%rsp), %r13
movq %rcx, (%r13)
movb $0x1, %al
movl %eax, 0x4(%rsp)
xorl %ebx, %ebx
movq $0x0, 0x8(%rsp)
xorl %ebp, %ebp
movq $0x0, 0x20(%rsp)
cmpq $0x0, 0x8(%rsp)
jne 0xce65
testq %rbp, %rbp
jne 0xce65
cmpq $0x0, 0x20(%rsp)
je 0xceb0
cmpq $0x0, 0x20(%rsp)
je 0xce78
movq 0x20(%rsp), %rax
cmpb $0x1, 0xc(%rax)
jne 0xceb0
testq %rbp, %rbp
je 0xce95
movb 0xc(%rbp), %al
cmpq $0x0, 0x8(%rsp)
je 0xce8c
testb %al, %al
jne 0xcea1
testb %al, %al
je 0xceb0
jmp 0xd11f
cmpq $0x0, 0x8(%rsp)
je 0xdad6
movq 0x8(%rsp), %rax
cmpb $0x0, 0xc(%rax)
jne 0xd12b
leaq 0xb0(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0xd0(%rsp), %rdx
movq %r13, %rcx
callq 0xc184
testb %al, %al
je 0xd11f
addq 0x48(%rsp), %rbx
addq 0x58(%rsp), %rbx
leaq 0x40(%rsp), %r14
movq %r14, %rdi
callq 0x42d0
movl %eax, %r15d
movq %r14, %rdi
callq 0x46e0
testl %eax, %eax
je 0xd085
cmpq $0x9, 0x58(%rsp)
jl 0xd085
movq %r13, %r14
movq 0x50(%rsp), %r12
leaq 0x1(%r12), %r13
movl $0x6, %edx
leaq 0x37b3(%rip), %rdi      # 0x106d7
movq %r13, %rsi
callq 0x41a0
testl %eax, %eax
je 0xd010
movl $0x6, %edx
leaq 0x38db(%rip), %rdi      # 0x1081b
movq %r13, %rsi
callq 0x41a0
testl %eax, %eax
je 0xd050
movl $0x8, %edx
leaq 0x3270(%rip), %rdi      # 0x101cc
movq %r12, %rsi
callq 0x41a0
testl %eax, %eax
movq %r14, %r13
jne 0xd085
movl $0x1e8, %edi            # imm = 0x1E8
callq 0x4380
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %r12
leaq 0x9d26(%rip), %rax      # 0x16cb0
movq %rax, (%r12)
movl %r15d, 0x8(%r12)
movb $0x0, 0xc(%r12)
leaq 0x10(%r12), %rdi
movl %r15d, %esi
callq 0x4710
leaq 0x9d8b(%rip), %rax      # 0x16d38
movq %rax, (%r12)
movq %r12, %rax
addq $0x1b0, %rax            # imm = 0x1B0
movl $0x0, 0x1b0(%r12)
xorl %ecx, %ecx
movq %rcx, 0x1b8(%r12)
movq %rax, 0x1c0(%r12)
movq %rax, 0x1c8(%r12)
movq %rcx, 0x1d0(%r12)
movq $-0x1, 0x1d8(%r12)
movl %r15d, 0x18(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xde60
movq %r12, (%rax)
jmp 0xd085
movl $0x240, %edi            # imm = 0x240
callq 0x4380
movq %rax, 0x20(%rsp)
movq %r14, %r13
movq 0x20(%rsp), %rdi
movl %r15d, %esi
callq 0xddae
movl %r15d, 0x18(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xde60
movq 0x20(%rsp), %rcx
movq %rcx, (%rax)
jmp 0xd085
movl $0x358, %edi            # imm = 0x358
callq 0x4380
movq %rax, %rbp
movq %r14, %r13
movq %rax, %rdi
movl %r15d, %esi
callq 0xdec6
movl %r15d, 0x18(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xde60
movq %rbp, (%rax)
movl %r15d, 0x18(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xde60
movq (%rax), %rdi
testq %rdi, %rdi
jne 0xd0fa
movl $0x27, %edx
movq 0x9f20(%rip), %rdi      # 0x16fd0
leaq 0x48c7(%rip), %rsi      # 0x1197e
callq 0x4410
movq 0x9f0d(%rip), %rdi      # 0x16fd0
movl %r15d, %esi
callq 0x4690
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4360
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4250
jmp 0xce50
movq (%rdi), %rax
leaq 0x40(%rsp), %rsi
leaq 0x18(%rsp), %rdx
callq *0x10(%rax)
testq %rax, %rax
setne %al
movl 0x4(%rsp), %ecx
andb %al, %cl
movl %ecx, 0x4(%rsp)
jmp 0xce50
cmpq $0x0, 0x8(%rsp)
je 0xdad6
movq 0x8(%rsp), %rax
cmpq %rbx, 0x1e0(%rax)
je 0xd1d5
movq 0x9eac(%rip), %rdi      # 0x16ff0
leaq 0x4895(%rip), %rsi      # 0x119e0
movl $0x31, %edx
callq 0x4410
movq 0x8(%rsp), %rax
movq 0x1e0(%rax), %rsi
movq 0x9e88(%rip), %rdi      # 0x16ff0
callq 0x4240
movq %rax, %r14
leaq 0x489b(%rip), %rsi      # 0x11a12
movl $0x28, %edx
movq %rax, %rdi
callq 0x4410
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4240
movq %rax, %rbx
leaq 0x47e3(%rip), %rsi      # 0x1197c
movl $0x1, %edx
movq %rax, %rdi
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
movq %rax, %rdi
callq 0x4250
movl $0x0, 0x4(%rsp)
movq 0x60(%rsp), %rax
movq (%rax), %rdi
callq 0xc08c
movq %rax, 0x38(%rsp)
movq 0x8(%rsp), %rbx
movq 0x38(%rsp), %rax
cmpq %rax, 0x1d8(%rbx)
je 0xd29d
movq 0x9deb(%rip), %rdi      # 0x16ff0
leaq 0x482f(%rip), %rsi      # 0x11a3b
movl $0x24, %edx
callq 0x4410
movq 0x8(%rsp), %rax
movq 0x1d8(%rax), %rsi
movq 0x9dc7(%rip), %rdi      # 0x16ff0
callq 0x4340
movq %rax, %rbx
leaq 0x4828(%rip), %rsi      # 0x11a60
movl $0x26, %edx
movq %rax, %rdi
callq 0x4410
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
callq 0x4340
movq %rax, %rbx
leaq 0x4720(%rip), %rsi      # 0x1197c
movl $0x1, %edx
movq %rax, %rdi
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
movq %rax, %rdi
callq 0x4250
movl $0x0, 0x4(%rsp)
movq 0x8(%rsp), %rbx
movq 0x1c0(%rbx), %rdi
addq $0x1b0, %rbx            # imm = 0x1B0
cmpq %rbx, %rdi
je 0xdb6d
movq %rbp, 0x68(%rsp)
movq 0x9d30(%rip), %r13      # 0x16ff0
movq %rbx, 0x8(%rsp)
movq 0x28(%rdi), %r12
movl 0x20(%rdi), %eax
movl %eax, 0x14(%rsp)
callq 0x4260
movq %rax, 0x70(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x14(%rsp), %rsi
callq 0xdf2e
movq (%rax), %r14
testq %r14, %r14
je 0xd333
movq 0x8(%r12), %rax
cmpq (%r12), %rax
je 0xd36f
movq (%r14), %rax
movq %r14, %rdi
callq *0x20(%rax)
movq %rax, %r15
testq %rax, %rax
je 0xd3b3
movq %r15, %rdi
callq 0x4170
movq 0x9cad(%rip), %rdi      # 0x16fd0
movq %r15, %rsi
movq %rax, %rdx
callq 0x4410
jmp 0xd3d1
movl $0x20, %edx
movq %r13, %rdi
leaq 0x476b(%rip), %rsi      # 0x11aad
callq 0x4410
movl 0x14(%rsp), %esi
movq %r13, %rdi
callq 0x4240
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4360
jmp 0xd852
movl $0x9, %edx
movq %r13, %rdi
leaq 0x4750(%rip), %rsi      # 0x11ace
callq 0x4410
movq (%r14), %rax
movq %r14, %rdi
callq *0x20(%rax)
movq %rax, %r14
testq %rax, %rax
je 0xd7ee
movq %r14, %rdi
callq 0x4170
movq %r13, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x4410
jmp 0xd807
movq 0x9c16(%rip), %rcx      # 0x16fd0
movq (%rcx), %rax
movq -0x18(%rax), %rax
leaq (%rcx,%rax), %rdi
movl 0x20(%rcx,%rax), %esi
orl $0x1, %esi
callq 0x4680
movl $0x1, %edx
movq 0x9bf3(%rip), %rdi      # 0x16fd0
leaq 0x3d02(%rip), %rsi      # 0x110e6
callq 0x4410
movl 0x14(%rsp), %esi
movq 0x9bdc(%rip), %rdi      # 0x16fd0
callq 0x4240
movq %rax, %r15
movl $0xb, %edx
movq %rax, %rdi
leaq 0x46e5(%rip), %rsi      # 0x11af0
callq 0x4410
movq 0x8(%r12), %rsi
subq (%r12), %rsi
sarq $0x4, %rsi
movq %r15, %rdi
callq 0x4240
movq %rax, %r15
movl $0xb, %edx
movq %rax, %rdi
leaq 0x46c5(%rip), %rsi      # 0x11afc
callq 0x4410
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4360
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4250
movq (%r12), %rbx
cmpq %rbx, 0x8(%r12)
je 0xd8b1
movb $0x1, %al
movl %eax, 0x2c(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x30(%rsp)
movq %rcx, %rax
shlq $0x4, %rax
movq (%rbx,%rax), %rcx
movl $0x80000000, %edx       # imm = 0x80000000
cmpq %rdx, %rcx
jge 0xd86a
addq %rax, %rbx
cmpq 0x38(%rsp), %rcx
jg 0xd97a
leaq 0xb0(%rsp), %rdi
callq 0x4190
movq 0xd0(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0xf0(%rsp,%rax)
je 0xd50e
leaq 0xd0(%rsp), %rdi
callq 0x40a0
movq 0xd0(%rsp), %rax
movq -0x18(%rax), %rdi
leaq 0xd0(%rsp), %rax
addq %rax, %rdi
xorl %esi, %esi
callq 0x4680
movq 0x60(%rsp), %rax
movq (%rax), %rsi
leaq 0xd0(%rsp), %rdi
movl $0xc, %edx
callq 0x4200
movq (%rbx), %rsi
leaq 0xd0(%rsp), %rdi
xorl %edx, %edx
callq 0x4480
movq 0xd0(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0xf0(%rsp,%rax)
jne 0xdc7f
movq (%r14), %rax
movq %r14, %rdi
callq *0x18(%rax)
movq (%rbx), %r13
movq $-0x1, 0x18(%rsp)
leaq 0xb0(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0xd0(%rsp), %rdx
leaq 0x78(%rsp), %rcx
callq 0xc2db
movl %eax, %ebp
testl %eax, %eax
jne 0xdb21
addq 0x48(%rsp), %r13
addq 0x58(%rsp), %r13
leaq 0x40(%rsp), %rdi
callq 0x42d0
movq $-0x1, %r15
cmpl 0x8(%r14), %eax
jne 0xd5c6
movq (%r14), %rax
movq %r14, %rdi
leaq 0x40(%rsp), %rsi
leaq 0x18(%rsp), %rdx
callq *0x10(%rax)
movq %rax, %r15
movq %r14, %rax
xorq 0x68(%rsp), %rax
movq %r15, %rcx
notq %rcx
orq %rax, %rcx
je 0xdcd5
cmpq $-0x1, %r15
je 0xd54f
cmpq 0x20(%rsp), %r14
movq 0x9a18(%rip), %r13      # 0x16ff0
jne 0xd6ad
cmpq %r15, 0x8(%rbx)
je 0xd6ad
movl $0x16, %edx
movq %r13, %rdi
leaq 0x4647(%rip), %rsi      # 0x11c3e
callq 0x4410
movq 0x99ed(%rip), %rdi      # 0x16ff0
movq 0x30(%rsp), %rsi
callq 0x4240
movq %rax, %r13
movl $0x14, %edx
movq %rax, %rdi
leaq 0x408f(%rip), %rsi      # 0x116ae
callq 0x4410
movq (%rbx), %rsi
movq %r13, %rdi
callq 0x4340
movq %rax, %r13
movl $0x17, %edx
movq %rax, %rdi
leaq 0x4614(%rip), %rsi      # 0x11c55
callq 0x4410
movq 0x8(%rbx), %rsi
movq %r13, %rdi
callq 0x4340
movq %rax, %r13
movl $0xf, %edx
movq %rax, %rdi
leaq 0x4609(%rip), %rsi      # 0x11c6d
callq 0x4410
movq %r13, %rdi
movq %r15, %rsi
callq 0x4340
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x4360
movsbl %al, %esi
movq %r13, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4250
movl $0x0, 0x2c(%rsp)
movq 0x9943(%rip), %r13      # 0x16ff0
cmpq 0x68(%rsp), %r14
jne 0xd7c9
movq 0x8(%rbx), %rax
cmpq %r15, %rax
jl 0xd6cc
cmpq 0x18(%rsp), %rax
jle 0xd7c9
movl $0x16, %edx
movq %r13, %rdi
leaq 0x45a2(%rip), %rsi      # 0x11c7d
callq 0x4410
movq 0x9909(%rip), %rdi      # 0x16ff0
movq 0x30(%rsp), %rsi
callq 0x4240
movq %rax, %r13
movl $0x14, %edx
movq %rax, %rdi
leaq 0x3fab(%rip), %rsi      # 0x116ae
callq 0x4410
movq (%rbx), %rsi
movq %r13, %rdi
callq 0x4340
movq %rax, %r13
movl $0x17, %edx
movq %rax, %rdi
leaq 0x4530(%rip), %rsi      # 0x11c55
callq 0x4410
movq 0x8(%rbx), %rsi
movq %r13, %rdi
callq 0x4340
movq %rax, %r13
movl $0x1e, %edx
movq %rax, %rdi
leaq 0x454c(%rip), %rsi      # 0x11c94
callq 0x4410
movq %r13, %rdi
movq %r15, %rsi
callq 0x4340
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x39a4(%rip), %rsi      # 0x1110e
callq 0x4410
movq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x4340
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x29fd(%rip), %rsi      # 0x1018b
callq 0x4410
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4360
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4250
movl $0x0, 0x2c(%rsp)
movq 0x9827(%rip), %r13      # 0x16ff0
movq 0x30(%rsp), %rcx
incl %ecx
movq (%r12), %rbx
movq 0x8(%r12), %rax
subq %rbx, %rax
sarq $0x4, %rax
cmpq %rcx, %rax
ja 0xd47a
jmp 0xd8a6
movq (%r13), %rax
movq -0x18(%rax), %rax
leaq (%rax,%r13), %rdi
movl 0x20(%r13,%rax), %esi
orl $0x1, %esi
callq 0x4680
movl $0x1, %edx
movq %r13, %rdi
leaq 0x38d0(%rip), %rsi      # 0x110e6
callq 0x4410
movl 0x14(%rsp), %esi
movq %r13, %rdi
callq 0x4240
movq %rax, %r14
movl $0x17, %edx
movq %rax, %rdi
leaq 0x429f(%rip), %rsi      # 0x11ad8
callq 0x4410
movq (%r14), %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
jmp 0xd967
movl $0x36, %edx
movq %r13, %rdi
leaq 0x428f(%rip), %rsi      # 0x11b08
callq 0x4410
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x4360
movsbl %al, %esi
movq %r13, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4250
testb $0x1, 0x2c(%rsp)
je 0xd9fb
movq (%r14), %rax
movq %r14, %rdi
callq *0x20(%rax)
movq 0x8(%rsp), %rbx
movq %rax, %r14
testq %rax, %rax
je 0xd8e3
movq %r14, %rdi
callq 0x4170
movq 0x96fa(%rip), %rdi      # 0x16fd0
movq %r14, %rsi
movq %rax, %rdx
callq 0x4410
jmp 0xd901
movq 0x96e6(%rip), %rcx      # 0x16fd0
movq (%rcx), %rax
movq -0x18(%rax), %rax
leaq (%rcx,%rax), %rdi
movl 0x20(%rcx,%rax), %esi
orl $0x1, %esi
callq 0x4680
movl $0x1, %edx
movq 0x96c3(%rip), %rdi      # 0x16fd0
leaq 0x37d2(%rip), %rsi      # 0x110e6
callq 0x4410
movl 0x14(%rsp), %esi
movq 0x96ac(%rip), %rdi      # 0x16fd0
callq 0x4240
movq %rax, %r14
movl $0x13, %edx
movq %rax, %rdi
leaq 0x4378(%rip), %rsi      # 0x11cb3
callq 0x4410
movq (%r14), %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 0x70(%rsp), %rdi
cmpq %rbx, %rdi
jne 0xd2c5
jmp 0xdbb3
movl $0xf, %edx
movq %r13, %rdi
leaq 0x41b6(%rip), %rsi      # 0x11b3f
callq 0x4410
movq 0x30(%rsp), %rsi
movq %r13, %rdi
callq 0x4240
movq %rax, %r15
movl $0xb, %edx
movq %rax, %rdi
leaq 0x41a2(%rip), %rsi      # 0x11b4f
callq 0x4410
movq (%rbx), %rsi
movq %r15, %rdi
callq 0x4340
movq %rax, %r15
movl $0x13, %edx
movq %rax, %rdi
leaq 0x418c(%rip), %rsi      # 0x11b5b
callq 0x4410
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4360
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4250
movl $0x6, %edx
movq 0x95c9(%rip), %rdi      # 0x16fd0
leaq 0x42b9(%rip), %rsi      # 0x11cc7
callq 0x4410
movq 0x8(%rsp), %rbx
movq (%r14), %rax
movq %r14, %rdi
callq *0x20(%rax)
movq %rax, %r14
testq %rax, %rax
je 0xda45
movq %r14, %rdi
callq 0x4170
movq 0x9598(%rip), %rdi      # 0x16fd0
movq %r14, %rsi
movq %rax, %rdx
callq 0x4410
jmp 0xda63
movq 0x9584(%rip), %rcx      # 0x16fd0
movq (%rcx), %rax
movq -0x18(%rax), %rax
leaq (%rcx,%rax), %rdi
movl 0x20(%rcx,%rax), %esi
orl $0x1, %esi
callq 0x4680
movl $0x1, %edx
movq 0x9561(%rip), %rdi      # 0x16fd0
leaq 0x3670(%rip), %rsi      # 0x110e6
callq 0x4410
movl 0x14(%rsp), %esi
movq 0x954a(%rip), %rdi      # 0x16fd0
callq 0x4240
movq %rax, %r14
movl $0x17, %edx
movq %rax, %rdi
leaq 0x4231(%rip), %rsi      # 0x11cce
callq 0x4410
movq (%r14), %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
movl $0x0, 0x4(%rsp)
jmp 0xd967
movq 0x9513(%rip), %rbx      # 0x16ff0
leaq 0x3ec2(%rip), %rsi      # 0x119a6
movl $0x39, %edx
movq %rbx, %rdi
callq 0x4410
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x4360
movsbl %al, %esi
movq 0x94e1(%rip), %rdi      # 0x16ff0
callq 0x4040
movq %rax, %rdi
callq 0x4250
jmp 0xdc45
cmpl $-0x1, %ebp
jne 0xdbc5
movq 0x94bf(%rip), %rdi      # 0x16ff0
leaq 0x4064(%rip), %rsi      # 0x11b9c
movl $0x20, %edx
callq 0x4410
movq 0x94a7(%rip), %rdi      # 0x16ff0
movq %r13, %rsi
callq 0x4340
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4360
jmp 0xdc32
movq 0x947c(%rip), %rbx      # 0x16ff0
leaq 0x3f0c(%rip), %rsi      # 0x11a87
movl $0x25, %edx
movq %rbx, %rdi
callq 0x4410
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x4360
movsbl %al, %esi
movq 0x944a(%rip), %rdi      # 0x16ff0
callq 0x4040
movq %rax, %rdi
callq 0x4250
leaq 0xb0(%rsp), %rdi
callq 0x4750
jmp 0xdc4d
testl %ebp, %ebp
jle 0xdd13
movq 0x941c(%rip), %rdi      # 0x16ff0
leaq 0x3feb(%rip), %rsi      # 0x11bc6
movl $0x20, %edx
callq 0x4410
movq 0x9404(%rip), %rdi      # 0x16ff0
movq %r13, %rsi
callq 0x4340
movq %rax, %rbx
leaq 0x3fe9(%rip), %rsi      # 0x11be7
movl $0x31, %edx
movq %rax, %rdi
callq 0x4410
movl %ebp, %eax
addq %rax, %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x4340
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4360
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4250
movl $0x0, 0x4(%rsp)
leaq 0x80(%rsp), %rdi
callq 0xef5c
leaq 0xd0(%rsp), %rdi
callq 0x40c0
movl 0x4(%rsp), %eax
andb $0x1, %al
addq $0x2d8, %rsp            # imm = 0x2D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x936a(%rip), %rdi      # 0x16ff0
leaq 0x3ee2(%rip), %rsi      # 0x11b6f
movl $0x2c, %edx
callq 0x4410
movq (%rbx), %rsi
movq 0x934f(%rip), %rdi      # 0x16ff0
callq 0x4340
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4360
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4250
jmp 0xdc45
leaq 0x3f3d(%rip), %rdi      # 0x11c19
leaq 0x3c62(%rip), %rsi      # 0x11945
leaq 0x3c6c(%rip), %rcx      # 0x11956
movl $0x2bb, %edx            # imm = 0x2BB
callq 0x4210
leaq 0x2bb5(%rip), %rdi      # 0x108b0
leaq 0x3c43(%rip), %rsi      # 0x11945
leaq 0x3c4d(%rip), %rcx      # 0x11956
movl $0x21f, %edx            # imm = 0x21F
callq 0x4210
leaq 0x3ea3(%rip), %rdi      # 0x11bbd
leaq 0x3c24(%rip), %rsi      # 0x11945
leaq 0x3c2e(%rip), %rcx      # 0x11956
movl $0x2ab, %edx            # imm = 0x2AB
callq 0x4210
jmp 0xdd89
jmp 0xdd89
jmp 0xdd89
jmp 0xdd89
movq %rax, %rbx
jmp 0xdd99
jmp 0xdd89
jmp 0xdd89
movq %rax, %rbx
movl $0x1e8, %esi            # imm = 0x1E8
movq %r12, %rdi
jmp 0xdd76
jmp 0xdd89
jmp 0xdd89
jmp 0xdd89
jmp 0xdd89
movq %rax, %rbx
movl $0x358, %esi            # imm = 0x358
movq %rbp, %rdi
jmp 0xdd76
jmp 0xdd89
jmp 0xdd89
movq %rax, %rbx
movl $0x240, %esi            # imm = 0x240
movq 0x20(%rsp), %rdi
callq 0x43a0
jmp 0xdd8c
jmp 0xdd89
jmp 0xdd89
jmp 0xdd89
jmp 0xdd89
jmp 0xdd89
jmp 0xdd89
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0xef5c
leaq 0xd0(%rsp), %rdi
callq 0x40c0
movq %rbx, %rdi
callq 0x46d0