// File: /workspace/github_cpp_makefile_star2_O1/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 0x4730
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x28(%rsp,%rax)
jne 0xc84d
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 0x8(%r15), %rdx
cmpq %rdx, 0x10(%rsp)
jne 0xc86c
movq (%r15), %rsi
movq %rbx, %rdi
callq 0x43b0
testl %eax, %eax
je 0xc7a1
movq 0xa888(%rip), %rdi      # 0x16ff0
leaq 0x4f2e(%rip), %rsi      # 0x1169d
movl $0x35, %edx
callq 0x4410
movq 0xa870(%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 0xc80f
movq 0x18(%r15), %rdx
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x4470
movq 0x18(%r15), %rdx
cmpq %rdx, 0x10(%rsp)
jne 0xc88b
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0x43b0
testl %eax, %eax
je 0xc848
movq 0xa818(%rip), %rdi      # 0x16ff0
leaq 0x4ebe(%rip), %rsi      # 0x1169d
movl $0x35, %edx
callq 0x4410
movq 0xa800(%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 0xc824
leaq 0x4710(%rip), %rdi      # 0x10f64
leaq 0x4c54(%rip), %rsi      # 0x114af
leaq 0x4ddc(%rip), %rcx      # 0x1163e
movl $0xc1, %edx
callq 0x4210
leaq 0x4e08(%rip), %rdi      # 0x1167b
leaq 0x4c35(%rip), %rsi      # 0x114af
leaq 0x4dbd(%rip), %rcx      # 0x1163e
movl $0xc5, %edx
callq 0x4210
leaq 0x4e41(%rip), %rdi      # 0x116d3
leaq 0x4c16(%rip), %rsi      # 0x114af
leaq 0x4d9e(%rip), %rcx      # 0x1163e
movl $0xce, %edx
callq 0x4210
jmp 0xc8ac
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x40c0
movq %rbx, %rdi
callq 0x46e0