// File: /workspace/github_cpp_makefile_star2_O3/cpearce[P]OggIndex/src/Decoder.cpp
// Function: TheoraDecoder::GetKeyframes()
virtual const vector<KeyFrameInfo>& GetKeyframes() {
    // Construct list of keyframes from page and frame info lists.
    // Need to determine frame start offsets and fill key points array.

    if (mKeyFrames.size() > 0 || mFrames.size() == 0) {
      return mKeyFrames;
    }

    // Packetno of the last packet which has started.
    ogg_int64_t started_packetno = mFirstPacketno - 1;
    // Must at least have header packets.
    assert(started_packetno >= 2);
    ogg_int64_t pageno = 0;
    ogg_int64_t prev_keyframe_pageno = -INT_MAX;
    ogg_int64_t prev_keyframe_start_time = -INT_MAX;
    for (unsigned f=0; f<mFrames.size(); f++) {
      Frame& frame = mFrames[f];
      ogg_int64_t packetno = frame.packetno;

      while (pageno < (ogg_int64_t) mPages.size() &&
             started_packetno + mPages[pageno].num_packets < packetno)
      {
        started_packetno += mPages[pageno].num_packets;
        pageno++;  
      } // pages
      assert(pageno < (ogg_int64_t) mPages.size());
      assert(started_packetno < packetno &&
             started_packetno + mPages[pageno].num_packets >= packetno);

      if (pageno == prev_keyframe_pageno) {
        // Only consider the pages' first key point.
        continue;
      }

      KeyFrameInfo k(mPages[pageno].offset,
                     StartTime(frame.granulepos));
      assert(k.mTime >= 0);

      // Only add the keyframe to the list if it's far enough after the
      // previous keyframe.
      if (k.mTime > prev_keyframe_start_time + gOptions.GetKeyPointInterval()) {
        prev_keyframe_start_time = k.mTime;
        mKeyFrames.push_back(k);
      }
      prev_keyframe_pageno = pageno;

    } // for each frame

    return mKeyFrames;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
leaq 0x278(%rdi), %rax
movq %rax, 0x8(%rsp)
movq 0x280(%rdi), %rax
cmpq 0x278(%rdi), %rax
jne 0x638b
movq %rdi, %r14
movq 0x260(%rdi), %rax
movq 0x268(%rdi), %rcx
cmpq %rax, %rcx
je 0x638b
movq 0x240(%r14), %r13
cmpq $0x2, %r13
jle 0x63fc
decq %r13
movq $-0x7fffffff, (%rsp)    # imm = 0x80000001
xorl %ebp, %ebp
movabsq $-0x5555555555555555, %r15 # imm = 0xAAAAAAAAAAAAAAAB
movq $-0x7fffffff, %rdx      # imm = 0x80000001
xorl %ebx, %ebx
movq 0x248(%r14), %r8
movq 0x250(%r14), %rsi
subq %r8, %rsi
sarq $0x4, %rsi
cmpq %rsi, %rbx
jge 0x639f
leaq (,%rbp,2), %rdi
addq %rbp, %rdi
leaq (%rax,%rdi,8), %rdi
movq (%rdi), %r9
movq %rbx, %r10
shlq $0x4, %r10
addq %r10, %r8
addq $0x8, %r8
movslq (%r8), %r10
addq %r13, %r10
cmpq %r9, %r10
jge 0x62b4
incq %rbx
addq $0x10, %r8
movq %r10, %r13
cmpq %rbx, %rsi
jne 0x6295
jmp 0x639f
cmpq %r9, %r13
jge 0x63be
cmpq %rbx, %rdx
je 0x6372
movq -0x8(%r8), %rax
movq %rax, 0x10(%rsp)
movq 0x8(%rdi), %rsi
movq 0x220(%r14), %rdi
callq 0x40b0
movl 0x1d4(%r14), %ecx
movl 0x1d8(%r14), %edx
imulq %rax, %rdx
imulq $0x3e8, %rdx, %rax      # imm = 0x3E8
cqto
idivq %rcx
movq %rax, %r12
movq 0x10(%rsp), %rax
movq %rax, 0x18(%rsp)
movq %r12, 0x20(%rsp)
testq %r12, %r12
js 0x63dd
leaq 0x110f1(%rip), %rax     # 0x17410
movslq 0x48(%rax), %rax
addq (%rsp), %rax
cmpq %rax, %r12
jle 0x6361
movq 0x280(%r14), %rsi
cmpq 0x288(%r14), %rsi
je 0x634e
movups 0x18(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x280(%r14)
jmp 0x635d
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x6af4
movq %r12, (%rsp)
movq 0x260(%r14), %rax
movq 0x268(%r14), %rcx
movq %rbx, %rdx
incl %ebp
movq %rcx, %rsi
subq %rax, %rsi
sarq $0x3, %rsi
imulq %r15, %rsi
cmpq %rbp, %rsi
ja 0x6257
movq 0x8(%rsp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa29e(%rip), %rdi      # 0x10644
leaq 0x9c60(%rip), %rsi      # 0x1000d
leaq 0xa24e(%rip), %rcx      # 0x10602
movl $0xad, %edx
callq 0x4210
leaq 0xa2a4(%rip), %rdi      # 0x10669
leaq 0x9c41(%rip), %rsi      # 0x1000d
leaq 0xa22f(%rip), %rcx      # 0x10602
movl $0xaf, %edx
callq 0x4210
leaq 0xa2de(%rip), %rdi      # 0x106c2
leaq 0x9c22(%rip), %rsi      # 0x1000d
leaq 0xa210(%rip), %rcx      # 0x10602
movl $0xb8, %edx
callq 0x4210
leaq 0xa1e9(%rip), %rdi      # 0x105ec
leaq 0x9c03(%rip), %rsi      # 0x1000d
leaq 0xa1f1(%rip), %rcx      # 0x10602
movl $0x9f, %edx
callq 0x4210
nop