// File: /workspace/github_cpp_makefile_star2_O3/rocket323[P]fishdb/./iter.cpp
// Function: fishdb::Iterator::Seek(char const*)
void Iterator::Seek(const char *k)
{
    std::string key = k;
    auto now = m_btree->m_root;

    bool found_upper = false;
    while (now != NULL)
    {
        m_stack.push_back(now);
        auto iter = m_btree->LowerBound(now, key);
        size_t p = iter - now->kvs.begin();
        if (iter != now->kvs.end())
        {
            found_upper = true;
            m_kv_idx = p;
            now = m_btree->ReadPage(now->children[p]);
        }
        else if (!now->is_leaf)
        {
            now = m_btree->ReadPage(now->children[p]);
        }
        else
        {
            break;
        }
    }

    m_valid = found_upper;
    if (!m_valid)
        m_stack.clear();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
leaq -0x80(%rbp), %rdi
leaq -0x38(%rbp), %r14
movq %r14, %rdx
callq 0x20c0
movq (%rbx), %rcx
movq 0x70(%rcx), %rax
movq %rax, (%r14)
movq 0x78(%rcx), %rcx
movq %rcx, 0x8(%r14)
testq %rcx, %rcx
je 0x2bc2
movq 0x9420(%rip), %rdx      # 0xbfd0
cmpb $0x0, (%rdx)
je 0x2bba
incl 0x8(%rcx)
jmp 0x2bc2
lock
incl 0x8(%rcx)
movq -0x38(%rbp), %rax
testq %rax, %rax
je 0x2ce6
leaq 0x8(%rbx), %r14
xorl %r12d, %r12d
leaq -0x80(%rbp), %r13
movq %r14, %rdi
leaq -0x38(%rbp), %rsi
callq 0x311a
movq (%rbx), %rdi
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, -0x60(%rbp)
movq %rax, -0x58(%rbp)
testq %rax, %rax
je 0x2c0f
movq 0x93cf(%rip), %rcx      # 0xbfd0
cmpb $0x0, (%rcx)
je 0x2c0b
incl 0x8(%rax)
jmp 0x2c0f
lock
incl 0x8(%rax)
leaq -0x60(%rbp), %rsi
movq %r13, %rdx
callq 0x35ee
movq %rax, %r15
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0x2c2c
callq 0x277e
movq -0x38(%rbp), %rcx
movq %r15, %rax
subq 0x60(%rcx), %rax
sarq $0x6, %rax
cmpq 0x68(%rcx), %r15
je 0x2c93
movl %eax, 0x20(%rbx)
movq (%rbx), %rsi
movq 0x48(%rcx), %rcx
movq (%rcx,%rax,8), %rdx
leaq -0x50(%rbp), %rdi
callq 0x353c
movaps -0x50(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x50(%rbp)
movq -0x30(%rbp), %rdi
movups %xmm0, -0x38(%rbp)
testq %rdi, %rdi
je 0x2c83
callq 0x277e
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x2c83
callq 0x277e
movb $0x1, %r12b
cmpq $0x0, -0x38(%rbp)
jne 0x2bd6
jmp 0x2cda
cmpb $0x0, 0x79(%rcx)
jne 0x2cda
movq (%rbx), %rsi
movq 0x48(%rcx), %rcx
movq (%rcx,%rax,8), %rdx
leaq -0x50(%rbp), %rdi
callq 0x353c
movaps -0x50(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x50(%rbp)
movq -0x30(%rbp), %rdi
movups %xmm0, -0x38(%rbp)
testq %rdi, %rdi
je 0x2c86
callq 0x277e
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x2c86
callq 0x277e
jmp 0x2c86
andb $0x1, %r12b
movb %r12b, 0x24(%rbx)
je 0x2cea
jmp 0x2cf6
movb $0x0, 0x24(%rbx)
addq $0x8, %rbx
movq %rbx, %rdi
callq 0x3168
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x2d04
callq 0x277e
leaq -0x70(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2d16
callq 0x21b0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2d3c
jmp 0x2d3c
movq %rax, %rbx
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0x2d3f
callq 0x277e
jmp 0x2d3f
movq %rax, %rbx
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x2d4d
callq 0x277e
leaq -0x70(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2d5f
callq 0x21b0
movq %rbx, %rdi
callq 0x2300
nop