// File: /workspace/github_cpp_makefile_star2_O1/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), %rax
movq 0x70(%rax), %rcx
movq %rcx, (%r14)
movq 0x78(%rax), %rax
movq %rax, 0x8(%r14)
testq %rax, %rax
je 0x2bb6
movq 0x9428(%rip), %rcx      # 0xbfd0
cmpb $0x0, (%rcx)
je 0x2bb2
incl 0x8(%rax)
jmp 0x2bb6
lock
incl 0x8(%rax)
leaq 0x8(%rbx), %r14
xorl %r12d, %r12d
leaq -0x80(%rbp), %r13
cmpq $0x0, -0x38(%rbp)
je 0x2cd3
movq %r14, %rdi
leaq -0x38(%rbp), %rsi
callq 0x30f6
movq (%rbx), %rdi
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, -0x60(%rbp)
movq %rax, -0x58(%rbp)
testq %rax, %rax
je 0x2c05
movq 0x93d9(%rip), %rcx      # 0xbfd0
cmpb $0x0, (%rcx)
je 0x2c01
incl 0x8(%rax)
jmp 0x2c05
lock
incl 0x8(%rax)
leaq -0x60(%rbp), %rsi
movq %r13, %rdx
callq 0x35cc
movq %rax, %r15
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0x2c22
callq 0x277e
movq -0x38(%rbp), %rcx
movq %r15, %rax
subq 0x60(%rcx), %rax
sarq $0x6, %rax
cmpq 0x68(%rcx), %r15
je 0x2c88
movl %eax, 0x20(%rbx)
movq (%rbx), %rsi
movq 0x48(%rcx), %rcx
movq (%rcx,%rax,8), %rdx
leaq -0x50(%rbp), %rdi
callq 0x351a
movaps -0x50(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x50(%rbp)
movq -0x30(%rbp), %rdi
movups %xmm0, -0x38(%rbp)
testq %rdi, %rdi
je 0x2c6b
callq 0x277e
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x2c79
callq 0x277e
movb $0x1, %r12b
movb $0x1, %al
testb %al, %al
jne 0x2bc1
jmp 0x2cd3
cmpb $0x0, 0x79(%rcx)
je 0x2c92
xorl %eax, %eax
jmp 0x2c7e
movq (%rbx), %rsi
movq 0x48(%rcx), %rcx
movq (%rcx,%rax,8), %rdx
leaq -0x50(%rbp), %rdi
callq 0x351a
movaps -0x50(%rbp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, -0x50(%rbp)
movq -0x30(%rbp), %rdi
movups %xmm0, -0x38(%rbp)
testq %rdi, %rdi
je 0x2cc3
callq 0x277e
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x2c7c
callq 0x277e
jmp 0x2c7c
andb $0x1, %r12b
movb %r12b, 0x24(%rbx)
jne 0x2ce5
movq %r14, %rdi
callq 0x313c
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x2cf3
callq 0x277e
leaq -0x70(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2d05
callq 0x21b0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2d2b
jmp 0x2d2b
movq %rax, %rbx
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0x2d2e
callq 0x277e
jmp 0x2d2e
movq %rax, %rbx
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x2d3c
callq 0x277e
leaq -0x70(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2d4e
callq 0x21b0
movq %rbx, %rdi
callq 0x2300