// File: /workspace/github_cpp_makefile_star2_O1/zkl94[P]distributed-key-value-store/MP2Node.cpp
// Function: MP2Node::findNodes(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
vector<Node> MP2Node::findNodes(string key) {
    size_t pos = hashFunction(key);
    vector<Node> addr_vec;
    if (ring.size() >= 3) {
        // if pos <= min || pos > max, the leader is the min
        if (pos <= ring.at(0).getHashCode() || pos > ring.at(ring.size() - 1).getHashCode()) {
            addr_vec.emplace_back(ring.at(0));
            addr_vec.emplace_back(ring.at(1));
            addr_vec.emplace_back(ring.at(2));
        } else {
            // go through the ring until pos <= node
            for (int i = 1; i < ring.size(); i++) {
                Node addr = ring.at(i);
                if (pos <= addr.getHashCode()) {
                    addr_vec.emplace_back(addr);
                    addr_vec.emplace_back(ring.at((i + 1) % ring.size()));
                    addr_vec.emplace_back(ring.at((i + 2) % ring.size()));
                    break;
                }
            }
        }
    }
    return addr_vec;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rdx), %rsi
movq 0x8(%rdx), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x6810
movq (%r15), %rdi
movq 0x8(%r15), %rsi
movl $0xc70f6907, %edx       # imm = 0xC70F6907
callq 0x3090
movq %rax, %r15
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x1001c
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3280
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
movq 0x30(%r14), %rdi
movq 0x38(%r14), %rax
subq %rdi, %rax
cmpq $0x41, %rax
jb 0x100e0
callq 0x1440e
andl $0x1ff, %r15d           # imm = 0x1FF
cmpq %rax, %r15
jbe 0x10080
movq 0x30(%r14), %rdi
movq 0x38(%r14), %rax
movq %rax, %rdx
subq %rdi, %rdx
sarq $0x5, %rdx
leaq -0x1(%rdx), %rsi
cmpq %rdi, %rax
je 0x101d2
shlq $0x5, %rsi
addq %rsi, %rdi
callq 0x1440e
cmpq %rax, %r15
jbe 0x100f2
movq 0x30(%r14), %rsi
cmpq %rsi, 0x38(%r14)
je 0x101c0
movq %rbx, %rdi
callq 0x13086
movq 0x30(%r14), %rsi
movq 0x38(%r14), %rdx
subq %rsi, %rdx
sarq $0x5, %rdx
cmpq $0x2, %rdx
jb 0x101c6
addq $0x20, %rsi
movq %rbx, %rdi
callq 0x13086
movq 0x30(%r14), %rsi
movq 0x38(%r14), %rdx
subq %rsi, %rdx
sarq $0x5, %rdx
cmpq $0x2, %rdx
jbe 0x101cd
addq $0x40, %rsi
movq %rbx, %rdi
callq 0x13086
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x30(%r14), %rsi
movq 0x38(%r14), %rax
subq %rsi, %rax
cmpq $0x21, %rax
jb 0x100e0
movl $0x3, %r13d
movl $0x20, %ebp
leaq 0x8(%rsp), %r12
addq %rbp, %rsi
movq %r12, %rdi
callq 0x143a6
movq %r12, %rdi
callq 0x1440e
cmpq %rax, %r15
jbe 0x10157
movq %r12, %rdi
callq 0x1439a
movq 0x30(%r14), %rsi
movq 0x38(%r14), %rax
subq %rsi, %rax
sarq $0x5, %rax
leaq 0x1(%r13), %rcx
addq $0x20, %rbp
decq %r13
cmpq %r13, %rax
movq %rcx, %r13
ja 0x10113
jmp 0x100e0
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x13086
leal -0x1(%r13), %eax
movq 0x30(%r14), %rsi
movq 0x38(%r14), %rcx
subq %rsi, %rcx
sarq $0x5, %rcx
xorl %edx, %edx
divq %rcx
shlq $0x5, %rdx
addq %rdx, %rsi
movq %rbx, %rdi
callq 0x13086
movl %r13d, %eax
movq 0x30(%r14), %rsi
movq 0x38(%r14), %rcx
subq %rsi, %rcx
sarq $0x5, %rcx
xorl %edx, %edx
divq %rcx
shlq $0x5, %rdx
addq %rdx, %rsi
movq %rbx, %rdi
callq 0x13086
leaq 0x8(%rsp), %rdi
callq 0x1439a
jmp 0x100e0
xorl %esi, %esi
xorl %edx, %edx
jmp 0x101d2
movl $0x1, %esi
jmp 0x101d2
movl $0x2, %esi
leaq 0x6f12(%rip), %rdi      # 0x170eb
xorl %eax, %eax
callq 0x33c0
jmp 0x101ec
movq %rax, %rdi
callq 0x651f
jmp 0x101fb
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x1439a
jmp 0x101fe
movq %rax, %r14
movq %rbx, %rdi
callq 0xbc10
movq %r14, %rdi
callq 0x3450