// File: rocket323[P]fishdb/./pager.cpp
// Function: fishdb::Pager::GetPage(long, bool)
std::shared_ptr<MemPage> Pager::GetPage(int64_t page_no, bool stick)
{
    assert(page_no > 0);
    auto iter = m_pages.find(page_no);
    std::shared_ptr<MemPage> mp;
    if (iter != m_pages.end())
    {
        mp = iter->second;
    }
    else
    {
        // read page(s) from file
        mp = ReadPage(page_no);
        assert(mp != nil);
        int64_t of_page_no = mp->header.of_page_no;
        while (of_page_no > 0)
        {
            auto of_mp = ReadPage(of_page_no);
            mp->Feed(of_mp->data.c_str(), of_mp->data.size());
            of_page_no = of_mp->header.of_page_no;
        }
        if (mp->header.type == TREE_PAGE)
        {
            mp->Parse();
            CachePage(mp);
        }
    }
    mp->stick |= stick;
    return mp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x98(%rbp)
movb %cl, %al
movq %rdi, %rcx
movq %rcx, -0x90(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x18(%rbp)
jle 0xe5a3
jmp 0xe5c2
leaq 0x3e69(%rip), %rdi      # 0x12413
leaq 0x3dd2(%rip), %rsi      # 0x12383
movl $0x66, %edx
leaq 0x3e62(%rip), %rcx      # 0x1241f
callq 0x2150
movq -0x88(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0xf380
movq -0x98(%rbp), %rdi
movq %rax, -0x28(%rbp)
movb $0x0, -0x29(%rbp)
callq 0x8b40
movq -0x88(%rbp), %rdi
callq 0xf3b0
movq %rax, -0x38(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xf3e0
testb $0x1, %al
jne 0xe609
jmp 0xe62a
leaq -0x28(%rbp), %rdi
callq 0xf410
movq -0x98(%rbp), %rdi
movq %rax, %rsi
addq $0x8, %rsi
callq 0x8120
jmp 0xe7f2
movq -0x88(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x48(%rbp), %rdi
callq 0xe870
jmp 0xe640
movq -0x98(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x41d0
leaq -0x48(%rbp), %rdi
callq 0x27e0
movq -0x98(%rbp), %rdi
leaq 0xcbc9(%rip), %rsi      # 0x1b230
callq 0x7df0
testb $0x1, %al
jne 0xe672
jmp 0xe674
jmp 0xe6a4
leaq 0x3a80(%rip), %rdi      # 0x120fb
leaq 0x3d01(%rip), %rsi      # 0x12383
movl $0x71, %edx
leaq 0x3d91(%rip), %rcx      # 0x1241f
callq 0x2150
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xe84f
movq -0x98(%rbp), %rdi
callq 0x4190
movq 0x18(%rax), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
jle 0xe777
movq -0x88(%rbp), %rsi
movq -0x60(%rbp), %rdx
leaq -0x70(%rbp), %rdi
callq 0xe870
jmp 0xe6d9
movq -0x98(%rbp), %rdi
callq 0x4190
movq %rax, -0xa8(%rbp)
leaq -0x70(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x4190
movq %rax, %rdi
addq $0x28, %rdi
callq 0x20d0
movq -0xb0(%rbp), %rdi
movq %rax, -0xa0(%rbp)
callq 0x4190
movq %rax, %rdi
addq $0x28, %rdi
callq 0x2170
movq -0xa8(%rbp), %rdi
movq -0xa0(%rbp), %rsi
movl %eax, %edx
callq 0x11470
jmp 0xe73e
leaq -0x70(%rbp), %rdi
callq 0x4190
movq 0x18(%rax), %rax
movq %rax, -0x60(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x27e0
jmp 0xe6b8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x27e0
jmp 0xe84f
movq -0x98(%rbp), %rdi
callq 0x4190
movsbl 0x8(%rax), %eax
cmpl $0x2, %eax
jne 0xe7f0
movq -0x98(%rbp), %rdi
callq 0x4190
movq %rax, %rdi
callq 0x11680
jmp 0xe7a2
movq -0x98(%rbp), %rsi
leaq -0x80(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x40f0
movq -0x88(%rbp), %rdi
movq -0xb8(%rbp), %rsi
callq 0xead0
jmp 0xe7ce
leaq -0x80(%rbp), %rdi
callq 0x27e0
jmp 0xe7f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x27e0
jmp 0xe84f
jmp 0xe7f2
movq -0x98(%rbp), %rdi
movb -0x19(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0xbc(%rbp)
callq 0x4190
movl -0xbc(%rbp), %edx
movb 0x78(%rax), %cl
andb $0x1, %cl
movzbl %cl, %ecx
orl %edx, %ecx
cmpl $0x0, %ecx
setne %cl
andb $0x1, %cl
movb %cl, 0x78(%rax)
movb $0x1, -0x29(%rbp)
testb $0x1, -0x29(%rbp)
jne 0xe83f
movq -0x98(%rbp), %rdi
callq 0x27e0
movq -0x90(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
movq -0x98(%rbp), %rdi
callq 0x27e0
movq -0x50(%rbp), %rdi
callq 0x2370
nopw %cs:(%rax,%rax)