// File: /workspace/github_cpp_makefile_star2_O3/cpearce[P]OggIndex/src/Utils.cpp
// Function: IsPageAtOffset(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, long, ogg_page*)
bool
IsPageAtOffset(const string& filename, ogg_int64_t offset, ogg_page* page)
{
  ifstream file(filename.c_str(), ios::in | ios::binary);
  assert(file);
  file.seekg((std::streamoff)offset, ios_base::beg);
  char* buf = new char[max(page->body_len, page->header_len)];
  file.read(buf, page->header_len);
  assert(file.gcount() == page->header_len);
  if (memcmp(buf, page->header, page->header_len) != 0) {
    cerr << "Incorrect page offset calculation for page at offset "
         << offset << endl;
    delete[] buf;
    return false;
  }
  
  file.read(buf, page->body_len);
  assert(file.gcount() == page->body_len);
  if (memcmp(buf, page->body, page->body_len) != 0) {
    cerr << "Incorrect page offset calculation for page at offset "
         << offset << endl;
    delete[] buf;
    return false;
  }

  delete[] buf;
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
movq %rdx, %r15
movq %rsi, %r14
movq (%rdi), %rsi
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movl $0xc, %edx
callq 0x4720
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x28(%rsp,%rax)
jne 0xc5c3
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x44b0
movq 0x8(%r15), %r12
movq 0x18(%r15), %rdi
cmpq %r12, %rdi
cmovleq %r12, %rdi
callq 0x4030
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x4470
movq 0x10(%rsp), %rdx
cmpq 0x8(%r15), %rdx
jne 0xc5e2
movq (%r15), %rsi
movq %rbx, %rdi
callq 0x43b0
testl %eax, %eax
je 0xc517
movq 0xab12(%rip), %rdi      # 0x16ff0
leaq 0x51a8(%rip), %rsi      # 0x1168d
movl $0x35, %edx
callq 0x4410
movq 0xaafa(%rip), %rdi      # 0x16ff0
movq %r14, %rsi
callq 0x4340
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4360
jmp 0xc585
movq 0x18(%r15), %rdx
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x4470
movq 0x10(%rsp), %rdx
cmpq 0x18(%r15), %rdx
jne 0xc601
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0x43b0
testl %eax, %eax
je 0xc5be
movq 0xaaa2(%rip), %rdi      # 0x16ff0
leaq 0x5138(%rip), %rsi      # 0x1168d
movl $0x35, %edx
callq 0x4410
movq 0xaa8a(%rip), %rdi      # 0x16ff0
movq %r14, %rsi
callq 0x4340
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
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x4490
leaq 0x8(%rsp), %rdi
callq 0x40c0
movl %ebp, %eax
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %bpl
jmp 0xc59a
leaq 0x4985(%rip), %rdi      # 0x10f4f
leaq 0x4ece(%rip), %rsi      # 0x1149f
leaq 0x5056(%rip), %rcx      # 0x1162e
movl $0xc1, %edx
callq 0x4210
leaq 0x5082(%rip), %rdi      # 0x1166b
leaq 0x4eaf(%rip), %rsi      # 0x1149f
leaq 0x5037(%rip), %rcx      # 0x1162e
movl $0xc5, %edx
callq 0x4210
leaq 0x50bb(%rip), %rdi      # 0x116c3
leaq 0x4e90(%rip), %rsi      # 0x1149f
leaq 0x5018(%rip), %rcx      # 0x1162e
movl $0xce, %edx
callq 0x4210
jmp 0xc622
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x40c0
movq %rbx, %rdi
callq 0x46d0