// File: /workspace/github_cpp_makefile_star2_O1/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
je 0x628e
movq 0x8(%rsp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %r14
movq 0x268(%rdi), %rax
cmpq 0x260(%rdi), %rax
je 0x627a
movq 0x240(%r14), %r13
cmpq $0x2, %r13
jle 0x64b5
movq 0x260(%r14), %rax
cmpq %rax, 0x268(%r14)
je 0x627a
decq %r13
movq $-0x7fffffff, (%rsp)    # imm = 0x80000001
xorl %ebp, %ebp
movabsq $-0x5555555555555555, %r15 # imm = 0xAAAAAAAAAAAAAAAB
movq $-0x7fffffff, %rcx      # imm = 0x80000001
xorl %ebx, %ebx
movq 0x248(%r14), %rdx
movq 0x250(%r14), %r8
subq %rdx, %r8
sarq $0x4, %r8
cmpq %r8, %rbx
setl %r9b
jge 0x6458
leaq (,%rbp,2), %rsi
addq %rbp, %rsi
movq (%rax,%rsi,8), %rdi
movq %rbx, %r11
shlq $0x4, %r11
movslq 0x8(%rdx,%r11), %r10
addq %r13, %r10
cmpq %rdi, %r10
jge 0x6358
leaq (%rdx,%r11), %r9
addq $0x18, %r9
leaq -0x1(%r8), %r11
cmpq %rbx, %r11
je 0x6458
movq %r10, %r13
movslq (%r9), %r10
addq %r13, %r10
addq $0x10, %r9
incq %rbx
cmpq %rdi, %r10
jl 0x6333
cmpq %r8, %rbx
setl %r9b
testb %r9b, %r9b
je 0x6458
cmpq %rdi, %r13
jge 0x6477
movq %rbx, %r8
shlq $0x4, %r8
movslq 0x8(%rdx,%r8), %r9
addq %r13, %r9
cmpq %rdi, %r9
jl 0x6477
cmpq %rcx, %rbx
je 0x642f
leaq (%rax,%rsi,8), %rax
addq %r8, %rdx
movq (%rdx), %rcx
movq %rcx, 0x10(%rsp)
movq 0x8(%rax), %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 0x6496
leaq 0x11036(%rip), %rax     # 0x17420
movslq 0x48(%rax), %rax
addq (%rsp), %rax
cmpq %rax, %r12
jle 0x642c
movq 0x280(%r14), %rsi
cmpq 0x288(%r14), %rsi
je 0x6419
movups 0x18(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x280(%r14)
jmp 0x6428
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x6bb4
movq %r12, (%rsp)
movq %rbx, %rcx
incl %ebp
movq 0x260(%r14), %rax
movq 0x268(%r14), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
imulq %r15, %rdx
cmpq %rbp, %rdx
ja 0x62e2
jmp 0x627a
leaq 0xa1e5(%rip), %rdi      # 0x10644
leaq 0x9ba7(%rip), %rsi      # 0x1000d
leaq 0xa195(%rip), %rcx      # 0x10602
movl $0xad, %edx
callq 0x4210
leaq 0xa1eb(%rip), %rdi      # 0x10669
leaq 0x9b88(%rip), %rsi      # 0x1000d
leaq 0xa176(%rip), %rcx      # 0x10602
movl $0xaf, %edx
callq 0x4210
leaq 0xa225(%rip), %rdi      # 0x106c2
leaq 0x9b69(%rip), %rsi      # 0x1000d
leaq 0xa157(%rip), %rcx      # 0x10602
movl $0xb8, %edx
callq 0x4210
leaq 0xa130(%rip), %rdi      # 0x105ec
leaq 0x9b4a(%rip), %rsi      # 0x1000d
leaq 0xa138(%rip), %rcx      # 0x10602
movl $0x9f, %edx
callq 0x4210