// File: /workspace/github_cpp_makefile_star2_O3/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 0x6790
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 0xfcb6
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 0xfd7a
callq 0x1418a
andl $0x1ff, %r15d           # imm = 0x1FF
cmpq %rax, %r15
jbe 0xfd1a
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 0xfe6c
shlq $0x5, %rsi
addq %rsi, %rdi
callq 0x1418a
cmpq %rax, %r15
jbe 0xfd8c
movq 0x30(%r14), %rsi
cmpq %rsi, 0x38(%r14)
je 0xfe5a
movq %rbx, %rdi
callq 0x12de0
movq 0x30(%r14), %rsi
movq 0x38(%r14), %rdx
subq %rsi, %rdx
sarq $0x5, %rdx
cmpq $0x2, %rdx
jb 0xfe60
addq $0x20, %rsi
movq %rbx, %rdi
callq 0x12de0
movq 0x30(%r14), %rsi
movq 0x38(%r14), %rdx
subq %rsi, %rdx
sarq $0x5, %rdx
cmpq $0x2, %rdx
jbe 0xfe67
addq $0x40, %rsi
movq %rbx, %rdi
callq 0x12de0
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 0xfd7a
movl $0x3, %r13d
movl $0x20, %ebp
leaq 0x8(%rsp), %r12
addq %rbp, %rsi
movq %r12, %rdi
callq 0x14122
movq %r12, %rdi
callq 0x1418a
cmpq %rax, %r15
jbe 0xfdf1
movq %r12, %rdi
callq 0x14116
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 0xfdad
jmp 0xfd7a
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x12de0
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 0x12de0
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 0x12de0
leaq 0x8(%rsp), %rdi
callq 0x14116
jmp 0xfd7a
xorl %esi, %esi
xorl %edx, %edx
jmp 0xfe6c
movl $0x1, %esi
jmp 0xfe6c
movl $0x2, %esi
leaq 0x7278(%rip), %rdi      # 0x170eb
xorl %eax, %eax
callq 0x33c0
jmp 0xfe86
movq %rax, %rdi
callq 0x6499
jmp 0xfe95
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x14116
jmp 0xfe98
movq %rax, %r14
movq %rbx, %rdi
callq 0xbaf6
movq %r14, %rdi
callq 0x3450