LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/attractivechaos[P]udb2/unordered_dense/./unordered_dense.h
// Function: ankerl::unordered_dense::v4_1_2::detail::table<unsigned int, unsigned int, Hash32, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int, unsigned int>>, ankerl::unordered_dense::v4_1_2::bucket_type::standard, false>::erase(__gnu_cxx::__normal_iterator<std::pair<unsigned int, unsigned int>*, std::vector<std::pair<unsigned int, unsigned int>, std::allocator<std::pair<unsigned int, unsigned int>>>>)
auto erase(iterator it) -> iterator {
        auto hash = mixed_hash(get_key(*it));
        auto bucket_idx = bucket_idx_from_hash(hash);

        auto const value_idx_to_remove = static_cast<value_idx_type>(it - cbegin());
        while (at(m_buckets, bucket_idx).m_value_idx != value_idx_to_remove) {
            bucket_idx = next(bucket_idx);
        }

        do_erase(bucket_idx);
        return begin() + static_cast<difference_type>(value_idx_to_remove);
    }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl (%rsi), %eax
movabsq $-0x61c8864680b583eb, %rcx # imm = 0x9E3779B97F4A7C15
mulq %rcx
xorq %rax, %rdx
movb 0x36(%rdi), %cl
shrq %cl, %rdx
subq (%rdi), %r14
sarq $0x3, %r14
movq 0x18(%rdi), %rax
movq 0x20(%rdi), %rcx
xorl %esi, %esi
movl %edx, %edi
cmpl %r14d, 0x4(%rax,%rdi,8)
je 0x1638
incl %edx
cmpq %rdx, %rcx
cmovel %esi, %edx
jmp 0x1625
movq %rbx, %rdi
movl %edx, %esi
callq 0x1bce
movl %r14d, %eax
shlq $0x3, %rax
addq (%rbx), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/attractivechaos[P]udb2/unordered_dense/./unordered_dense.h
// Function: ankerl::unordered_dense::v4_1_2::detail::table<unsigned int, unsigned int, Hash32, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int, unsigned int>>, ankerl::unordered_dense::v4_1_2::bucket_type::standard, false>::do_erase(unsigned int)
void do_erase(value_idx_type bucket_idx) {
        auto const value_idx_to_remove = at(m_buckets, bucket_idx).m_value_idx;

        // shift down until either empty or an element with correct spot is found
        auto next_bucket_idx = next(bucket_idx);
        while (at(m_buckets, next_bucket_idx).m_dist_and_fingerprint >= Bucket::dist_inc * 2) {
            at(m_buckets, bucket_idx) = {dist_dec(at(m_buckets, next_bucket_idx).m_dist_and_fingerprint),
                                         at(m_buckets, next_bucket_idx).m_value_idx};
            bucket_idx = std::exchange(next_bucket_idx, next(next_bucket_idx));
        }
        at(m_buckets, bucket_idx) = {};

        // update m_values
        if (value_idx_to_remove != m_values.size() - 1) {
            // no luck, we'll have to replace the value with the last one and update the index accordingly
            auto& val = m_values[value_idx_to_remove];
            val = std::move(m_values.back());

            // update the values_idx of the moved entry. No need to play the info game, just look until we find the values_idx
            auto mh = mixed_hash(get_key(val));
            bucket_idx = bucket_idx_from_hash(mh);

            auto const values_idx_back = static_cast<value_idx_type>(m_values.size() - 1);
            while (values_idx_back != at(m_buckets, bucket_idx).m_value_idx) {
                bucket_idx = next(bucket_idx);
            }
            at(m_buckets, bucket_idx).m_value_idx = value_idx_to_remove;
        }
        m_values.pop_back();
    }

// Assembly:
movq 0x18(%rdi), %r8
movq 0x20(%rdi), %r9
movl %esi, %eax
movl 0x4(%r8,%rax,8), %r10d
xorl %eax, %eax
movl %esi, %ecx
incl %esi
cmpq %rsi, %r9
cmovel %eax, %esi
movl (%r8,%rsi,8), %edx
cmpl $0x200, %edx            # imm = 0x200
jb 0x1c0b
addl $0xffffff00, %edx       # imm = 0xFFFFFF00
movl 0x4(%r8,%rsi,8), %r11d
movl %edx, (%r8,%rcx,8)
movl %r11d, 0x4(%r8,%rcx,8)
jmp 0x1bdf
andq $0x0, (%r8,%rcx,8)
movq (%rdi), %rcx
movq 0x8(%rdi), %rsi
movq %rsi, %r11
subq %rcx, %r11
sarq $0x3, %r11
leaq -0x1(%r11), %rax
cmpq %r10, %rax
je 0x1c6c
movl -0x8(%rsi), %eax
movl %eax, (%rcx,%r10,8)
movl -0x4(%rsi), %edx
movl %edx, 0x4(%rcx,%r10,8)
movabsq $-0x61c8864680b583eb, %rcx # imm = 0x9E3779B97F4A7C15
mulq %rcx
xorq %rax, %rdx
movb 0x36(%rdi), %cl
shrq %cl, %rdx
decl %r11d
xorl %eax, %eax
movl %edx, %edx
cmpl 0x4(%r8,%rdx,8), %r11d
je 0x1c67
incl %edx
cmpq %rdx, %r9
cmovel %eax, %edx
jmp 0x1c54
movl %r10d, 0x4(%r8,%rdx,8)
addq $-0x8, %rsi
movq %rsi, 0x8(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/MP1Node.cpp
// Function: MP1Node::MP1Node(Member*, Params*, EmulNet*, Log*, Address*)
MP1Node::MP1Node(Member *member, Params *params, EmulNet *emul, Log *log, Address *address) {
    for( int i = 0; i < 6; i++ ) {
        NULLADDR[i] = 0;
    }
    this->memberNode = member;
    this->emulNet = emul;
    this->log = log;
    this->par = params;
    this->memberNode->addr = *address;
    this->broadcast = 0;
    this->tobedeleted = new std::map<int, int>;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x17491(%rip), %rax     # 0x1ac38
movq %rax, (%rdi)
pushq $-0x6
popq %rax
testq %rax, %rax
je 0x37bc
movb $0x0, 0x2e(%rbx,%rax)
incq %rax
jmp 0x37ad
movq %rsi, 0x20(%rbx)
movq %rcx, 0x8(%rbx)
movq %r8, 0x10(%rbx)
movq %rdx, 0x18(%rbx)
addq $0x8, %rsi
movq %rsi, %rdi
movq %r9, %rsi
callq 0x9f22
andl $0x0, 0x30(%rbx)
pushq $0x30
popq %rdi
callq 0x3260
andl $0x0, 0x8(%rax)
andq $0x0, 0x10(%rax)
leaq 0x8(%rax), %rcx
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
andq $0x0, 0x28(%rax)
movq %rax, 0x38(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/MP1Node.cpp
// Function: MP1Node::initThisNode(Address*)
int MP1Node::initThisNode(Address *my_addr) {
    memberNode->bFailed = false;
    memberNode->inited = true;
    memberNode->inGroup = false;
    // node is up!
    memberNode->nnb = 0;
    memberNode->heartbeat = 0;
    memberNode->pingCounter = TFAIL;
    memberNode->timeOutCounter = -1;
    initMemberListTable(memberNode);

    return 0;
}

// Assembly:
movq 0x20(%rdi), %rax
movb $0x0, 0x10(%rax)
movw $0x1, 0xe(%rax)
andl $0x0, 0x14(%rax)
andq $0x0, 0x18(%rax)
movabsq $-0xfffffffb, %rcx      # imm = 0xFFFFFFFF00000005
movq %rcx, 0x20(%rax)
movq 0x28(%rax), %rcx
cmpq %rcx, 0x30(%rax)
je 0x38cf
movq %rcx, 0x30(%rax)
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/MP1Node.cpp
// Function: MP1Node::introduceSelfToGroup(Address*)
int MP1Node::introduceSelfToGroup(Address *joinaddr) {
    MessageHdr *msg;
#ifdef DEBUGLOG
    static char s[1024];
#endif

    if ( 0 == memcmp((char *)&(memberNode->addr.addr), (char *)&(joinaddr->addr), sizeof(memberNode->addr.addr))) {
        // I am the group booter (first process to join the group). Boot up the group
#ifdef DEBUGLOG
        log->LOG(&memberNode->addr, "Starting up group...");
#endif
        memberNode->inGroup = true;
    }
    else {

        // member node in group only after receiving JOINREP

        size_t msgsize = sizeof(MessageHdr) + sizeof(joinaddr->addr) + sizeof(long);
        msg = (MessageHdr *) malloc(msgsize * sizeof(char));

        // create JOINREQ message: format of data is {struct Address myaddr}
        msg->msgType = JOINREQ;
        memcpy((char *)(msg+1), &memberNode->addr.addr, sizeof(memberNode->addr.addr));
        memcpy((char *)(msg+1) + sizeof(memberNode->addr.addr), &memberNode->heartbeat, sizeof(long));

#ifdef DEBUGLOG
        sprintf(s, "Trying to join...");
        log->LOG(&memberNode->addr, s);
#endif

        // send JOINREQ message to introducer member
        emulNet->ENsend(&memberNode->addr, joinaddr, (char *)msg, msgsize);

        free(msg);
    }

    // add self to memberlist; self is ALWAYS the first member
    int id = 0;
    short port;
    memcpy(&id, &(memberNode->addr.addr[0]), sizeof(int));
    memcpy(&port, &(memberNode->addr.addr[4]), sizeof(short));
    MemberListEntry *newEntry = new MemberListEntry(id, port, 0, par->getcurrtime());
    memberNode->memberList.push_back(*newEntry);

    return 1;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x20(%rdi), %r13
leaq 0x8(%r13), %r15
pushq $0x6
popq %rdx
movq %r15, %rdi
callq 0x3280
testl %eax, %eax
je 0x3948
pushq $0x12
popq %rdi
callq 0x3330
movq %rax, %r12
andl $0x0, (%rax)
movl (%r15), %eax
movl %eax, 0x4(%r12)
movzwl 0x4(%r15), %eax
movw %ax, 0x8(%r12)
movq 0x18(%r13), %rax
movq %rax, 0xa(%r12)
movq 0x8(%rbx), %rdi
pushq $0x12
popq %r8
movq %r15, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0x56ee
movq %r12, %rdi
callq 0x32f0
movq 0x20(%rbx), %r13
jmp 0x394d
movb $0x1, 0xf(%r13)
movl 0x8(%r13), %ebp
movzwl 0xc(%r13), %r15d
pushq $0x18
popq %rdi
callq 0x3260
movq %rax, %r14
movq 0x18(%rbx), %rdi
callq 0x9f08
movslq %eax, %r8
movswl %r15w, %edx
movq %r14, %rdi
movl %ebp, %esi
xorl %ecx, %ecx
callq 0x9f42
movq 0x20(%rbx), %rdi
addq $0x28, %rdi
movq %r14, %rsi
callq 0x49e8
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
pushq $0x18
popq %rsi
movq %r14, %rdi
callq 0x3270
movq %rbx, %rdi
callq 0x3420
nop
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/MP1Node.cpp
// Function: MP1Node::logNodeAddWrapper(Member*, int, short)
void MP1Node::logNodeAddWrapper(Member *memberNode, int id, short port) {
    Address address;
    string _address = to_string(id) + ":" + to_string(port);
    address = Address(_address);
    log->logNodeAdd(&memberNode->addr, &address);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xa8, %rsp
movl %ecx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x88(%rsp), %r15
movq %r15, %rdi
movl %edx, %esi
callq 0x4a9a
leaq 0xebad(%rip), %rdx      # 0x12cb1
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x4a7b
movswl %bp, %esi
leaq 0x48(%rsp), %rdi
callq 0x4a9a
leaq 0x68(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x4a14
leaq 0x48(%rsp), %rdi
callq 0x3110
leaq 0x8(%rsp), %rdi
callq 0x3110
leaq 0x88(%rsp), %rdi
callq 0x3110
leaq 0x28(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x3340
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x4af4
leaq 0x2(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x9f22
leaq 0x28(%rsp), %rdi
callq 0x3110
movq 0x10(%r14), %rdi
addq $0x8, %rbx
leaq 0x2(%rsp), %rdx
movq %rbx, %rsi
callq 0x96f6
leaq 0x68(%rsp), %rdi
callq 0x3110
addq $0xa8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x41b9
movq %rax, %rbx
jmp 0x41f6
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x3110
jmp 0x41d0
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3110
jmp 0x41df
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
jmp 0x41fb
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3110
leaq 0x68(%rsp), %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3420
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/MP1Node.cpp
// Function: MP1Node::handleMEMBERLIST(void*, char*, int)
void MP1Node::handleMEMBERLIST(void *env, char *data, int size) {
    #ifdef DEBUG_MEMBERLIST
        cout << "just got a member list" << endl;
    #endif

    int entry_num = (size - 4)/ (6+8);
    int currentOffset = 4;
    char addr[6];
    int id = 0;
    short port;
    long heartbeat = 0;

    MessageHdr *msg = (MessageHdr *)data;

    // if, during the process of to be deleted, a heartbeat from that node is received,
    // the node entry should be removed from to be deleted map and member list entry
    // should be re-activated
    // how to tell: the first entry in message is the node's source
    memcpy(&addr, (char *)(msg)+currentOffset, 6);
    memcpy(&id, &addr[0], sizeof(int));
    if (this->tobedeleted->count(id) != 0) {
        std::map<int, int>::iterator it = this->tobedeleted->begin();
    
        while(it != this->tobedeleted->end()) {
            if (it->first == id) {
                this->tobedeleted->erase(it);
                break;
            }
            ++it;
        }
    } // then updateEntry will do the normal update

    // for every addr and heartbeat in the incoming member list
    for (int i = 0; i < entry_num; ++i)
    {
        // extract id and port
        memcpy(&addr, (char *)(msg)+currentOffset, 6);
        currentOffset += 6;
        memcpy(&id, &addr[0], sizeof(int));
        memcpy(&port, &addr[4], sizeof(short));
        
        // heartbeat
        memcpy(&heartbeat, (char *)(msg)+currentOffset, 8);
        currentOffset += 8;

        updateEntry(memberNode, id, port, heartbeat);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
leal -0x4(%rcx), %eax
pushq $0xe
popq %rcx
cltd
idivl %ecx
movl %eax, %ebp
movl 0x4(%rbx), %eax
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
movq 0x38(%rdi), %rdi
callq 0x4ba2
testq %rax, %rax
je 0x45d5
movq 0x38(%r14), %r15
movq 0x18(%r15), %rax
leaq 0x8(%r15), %r12
movl 0x4(%rsp), %r13d
cmpq %r12, %rax
je 0x45d5
cmpl %r13d, 0x20(%rax)
je 0x45ca
movq %rax, %rdi
callq 0x31a0
jmp 0x45b5
movq %r15, %rdi
movq %rax, %rsi
callq 0x52d8
xorl %r15d, %r15d
testl %ebp, %ebp
cmovgl %ebp, %r15d
addq $0xa, %rbx
subl $0x1, %r15d
jb 0x4608
movl -0x6(%rbx), %edx
movswl -0x2(%rbx), %ecx
movl %edx, 0x4(%rsp)
movq (%rbx), %r8
movq 0x20(%r14), %rsi
movq %r14, %rdi
callq 0x4618
addq $0xe, %rbx
jmp 0x45e2
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/MP1Node.cpp
// Function: MP1Node::updateEntry(Member*, int, short, long)
void MP1Node::updateEntry(Member *memberNode, int id, short port, long heartbeat) {
    // if this node (with id) is already in to be deleted map, just ignore it
    auto alreadyintobedeletedlist = this->tobedeleted->count(id);
    if (alreadyintobedeletedlist != 0) {
        // already in to be deleted map
        // cout << "already in tobedeleted map, ignore the update" <<endl;
        return;
    }

    // if it is not to be deleted, then update/insert normally
    bool found = false;
    for (MemberListEntry memberListEntry: memberNode->memberList) {
        if (memberListEntry.getid() == id && memberListEntry.getport() == port) {
            found = true;
            // the incoming heartbeat is more latest
            if (memberListEntry.getheartbeat() < heartbeat) {
                // cout << "doing heartbeat update for " << id <<endl;
                memberListEntry.setheartbeat(heartbeat);
                memberListEntry.settimestamp(par->getcurrtime());
            }
            break;
        }
    }

    if (!found) {
        MemberListEntry *newEntry = new MemberListEntry(id, port, heartbeat, par->getcurrtime());
        memberNode->memberList.push_back(*newEntry);

        logNodeAddWrapper(memberNode, id, port);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, %r14
movl %ecx, %ebp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0xc(%rsp), %rsi
movl %edx, (%rsi)
movq 0x38(%rdi), %rdi
callq 0x4ba2
testq %rax, %rax
jne 0x46e5
movq %r14, 0x10(%rsp)
leaq 0x28(%r15), %rax
movq %rax, 0x18(%rsp)
movq 0x28(%r15), %r13
movq 0x30(%r15), %r14
leaq 0x20(%rsp), %r12
cmpq %r14, %r13
je 0x4696
movq %r12, %rdi
movq %r13, %rsi
callq 0x9f5a
movq %r12, %rdi
callq 0x9f90
cmpl 0xc(%rsp), %eax
jne 0x4690
movq %r12, %rdi
callq 0x9f94
cmpw %bp, %ax
je 0x46f4
addq $0x18, %r13
jmp 0x4665
pushq $0x18
popq %rdi
callq 0x3260
movq %rax, %r12
movl 0xc(%rsp), %r13d
movq 0x18(%rbx), %rdi
callq 0x9f08
movslq %eax, %r8
movswl %bp, %ebp
movq %r12, %rdi
movl %r13d, %esi
movl %ebp, %edx
movq 0x10(%rsp), %rcx
callq 0x9f42
movq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x49e8
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %ecx
callq 0x40d6
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x20(%rsp), %rdi
callq 0x9f9a
movq 0x10(%rsp), %rsi
cmpq %rsi, %rax
jge 0x46e5
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x9fb0
movq 0x18(%rbx), %rdi
callq 0x9f08
movslq %eax, %rsi
movq %r15, %rdi
callq 0x9fb6
jmp 0x46e5
movq %rax, %rbx
pushq $0x18
popq %rsi
movq %r12, %rdi
callq 0x3270
movq %rbx, %rdi
callq 0x3420
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/MP1Node.cpp
// Function: isEntryInvalid(Member*, MemberListEntry&)
bool isEntryInvalid(Member *memberNode, MemberListEntry& memberListEntry) {
    long entry_timestamp = memberListEntry.gettimestamp();
    long node_timestamp = memberNode->memberList[0].gettimestamp();

    if (node_timestamp - entry_timestamp > TFAIL) {
        return true;
    }
    return false;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x9fa0
movq %rax, %r14
movq 0x28(%rbx), %rdi
callq 0x9fa0
subq %r14, %rax
cmpq $0x6, %rax
setge %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/Application.cpp
// Function: Application::run()
int Application::run()
{
	int i;
	int timeWhenAllNodesHaveJoined = 0;
	// boolean indicating if all nodes have joined
	bool allNodesJoined = false;
	srand(time(NULL));

	// As time runs along
	for( par->globaltime = 0; par->globaltime < TOTAL_RUNNING_TIME; ++par->globaltime ) {
		// Run the membership protocol
		mp1Run();

		// Wait for all nodes to join
		if ( par->allNodesJoined == nodeCount && !allNodesJoined ) {
			timeWhenAllNodesHaveJoined = par->getcurrtime();
			allNodesJoined = true;
		}
		if ( par->getcurrtime() > timeWhenAllNodesHaveJoined + 50 ) {
			// Call the KV store functionalities
			mp2Run();
		}
		// Fail some nodes
		//fail();
	}

	// Clean up
	en->ENcleanup();
	en1->ENcleanup();

	for(i=0;i<=par->EN_GPSZ-1;i++) {
		 mp1[i]->finishUpThisNode();
	}

	return SUCCESS;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r12d, %r12d
xorl %edi, %edi
callq 0x3210
movl %eax, %edi
callq 0x3230
movq 0x50(%rbx), %rax
andl $0x0, 0x28(%rax)
xorl %r14d, %r14d
xorl %r15d, %r15d
cmpl $0x2bb, %r12d           # imm = 0x2BB
jg 0x5ce1
movq %rbx, %rdi
callq 0x6084
movq 0x50(%rbx), %rdi
movl 0x2c(%rdi), %eax
cmpl 0x155e6(%rip), %eax     # 0x1b288
setne %al
orb %r15b, %al
testb $0x1, %al
jne 0x5cbb
callq 0x9f08
movl %eax, %r14d
movq 0x50(%rbx), %rdi
movb $0x1, %r15b
callq 0x9f08
leal 0x32(%r14), %ecx
cmpl %ecx, %eax
jle 0x5cd0
movq %rbx, %rdi
callq 0x61fc
movq 0x50(%rbx), %rax
movl 0x28(%rax), %r12d
incl %r12d
movl %r12d, 0x28(%rax)
jmp 0x5c84
movq 0x28(%rbx), %rdi
callq 0x59bc
movq 0x30(%rbx), %rdi
callq 0x59bc
xorl %r14d, %r14d
movq 0x50(%rbx), %rax
movslq 0x18(%rax), %rax
cmpq %rax, %r14
jge 0x5d15
movq 0x40(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x39b6
incq %r14
jmp 0x5cf6
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/Application.cpp
// Function: Application::~Application()
Application::~Application() {
	delete log;
	delete en;
	delete en1;
	for ( int i = 0; i < par->EN_GPSZ; i++ ) {
		delete mp1[i];
		delete mp2[i];
	}
	free(mp1);
	free(mp2);
	delete par;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x14d01(%rip), %rax     # 0x1acc8
movq %rax, (%rdi)
movq 0x38(%rdi), %rdi
testq %rdi, %rdi
je 0x5fd9
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x5fe8
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x5ff7
movq (%rdi), %rax
callq *0x8(%rax)
xorl %r15d, %r15d
movq 0x40(%rbx), %rdi
movq 0x50(%rbx), %rax
movslq 0x18(%rax), %rax
cmpq %rax, %r15
jge 0x6041
movq (%rdi,%r15,8), %rdi
testq %rdi, %rdi
je 0x601a
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x48(%rbx), %rax
movq (%rax,%r15,8), %r14
testq %r14, %r14
je 0x602f
movq %r14, %rdi
callq 0xc022
movl $0xc0, %esi
movq %r14, %rdi
callq 0x3270
incq %r15
jmp 0x5ffa
callq 0x32f0
movq 0x48(%rbx), %rdi
callq 0x32f0
movq 0x50(%rbx), %rdi
pushq $0x38
popq %rsi
callq 0x3270
addq $0x58, %rbx
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x8c66
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/Application.cpp
// Function: Application::findARandomNodeThatIsAlive()
int Application::findARandomNodeThatIsAlive() {
	int number;
	do {
		number = (rand()%par->EN_GPSZ);
	}while (mp2[number]->getMemberNode()->bFailed);
	return number;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x30a0
movq 0x48(%rbx), %rcx
movq 0x50(%rbx), %rsi
cltd
idivl 0x18(%rsi)
movslq %edx, %rax
movq (%rcx,%rax,8), %rax
movq 0x50(%rax), %rax
cmpb $0x0, 0x10(%rax)
jne 0x8600
movl %edx, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/Log.cpp
// Function: Log::logCreateSuccess(Address*, bool, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Log::logCreateSuccess(Address * address, bool isCoordinator, int transID, string key, string value){
	static char stdstring[100];
	string str;
	if (isCoordinator)
		str = "coordinator";
	else
		str = "server";
	sprintf(stdstring, "%s: create success at time %d, transID=%d, key=%s, value=%s", str.c_str(), par->getcurrtime(), transID, key.c_str(), value.c_str());
    LOG(address, stdstring);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r15
movq %r8, %r12
movl %ecx, %ebp
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rsi, %rbx
movq %rdi, %r14
movb $0x0, (%rax)
leaq 0x911d(%rip), %rax      # 0x1293f
leaq 0x9122(%rip), %rsi      # 0x1294b
testl %edx, %edx
cmovneq %rax, %rsi
leaq 0x8(%rsp), %rdi
callq 0x3460
movq 0x8(%rsp), %r13
movq 0x8(%r14), %rdi
callq 0x9f08
movq (%r12), %r9
movq (%r15), %rcx
movq %rcx, (%rsp)
leaq 0x190a7(%rip), %r15     # 0x22900
leaq 0x90f2(%rip), %rsi      # 0x12952
movq %r15, %rdi
movq %r13, %rdx
movl %eax, %ecx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x3070
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x9452
leaq 0x8(%rsp), %rdi
callq 0x3110
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3420
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/Log.cpp
// Function: Log::logReadSuccess(Address*, bool, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Log::logReadSuccess(Address * address, bool isCoordinator, int transID, string key, string value){
    static char stdstring[100];
	string str;
	if (isCoordinator)
		str = "coordinator";
	else
		str = "server";
	sprintf(stdstring, "%s: read success at time %d, transID=%d, key=%s, value=%s", str.c_str(), par->getcurrtime(), transID, key.c_str(), value.c_str());
    LOG(address, stdstring);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r15
movq %r8, %r12
movl %ecx, %ebp
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rsi, %rbx
movq %rdi, %r14
movb $0x0, (%rax)
leaq 0x905b(%rip), %rax      # 0x1293f
leaq 0x9060(%rip), %rsi      # 0x1294b
testl %edx, %edx
cmovneq %rax, %rsi
leaq 0x8(%rsp), %rdi
callq 0x3460
movq 0x8(%rsp), %r13
movq 0x8(%r14), %rdi
callq 0x9f08
movq (%r12), %r9
movq (%r15), %rcx
movq %rcx, (%rsp)
leaq 0x19055(%rip), %r15     # 0x22970
leaq 0x906c(%rip), %rsi      # 0x1298e
movq %r15, %rdi
movq %r13, %rdx
movl %eax, %ecx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x3070
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x9452
leaq 0x8(%rsp), %rdi
callq 0x3110
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3420
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/Log.cpp
// Function: Log::logDeleteSuccess(Address*, bool, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Log::logDeleteSuccess(Address * address, bool isCoordinator, int transID, string key){
    static char stdstring[100];
	string str;
	if (isCoordinator)
		str = "coordinator";
	else
		str = "server";
	sprintf(stdstring, "%s: delete success at time %d, transID=%d, key=%s", str.c_str(), par->getcurrtime(), transID, key.c_str());
    LOG(address, stdstring);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %r8, %r15
movl %ecx, %ebp
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rsi, %rbx
movq %rdi, %r14
movb $0x0, (%rax)
leaq 0x8edc(%rip), %rax      # 0x1293f
leaq 0x8ee1(%rip), %rsi      # 0x1294b
testl %edx, %edx
cmovneq %rax, %rsi
movq %rsp, %rdi
callq 0x3460
movq (%rsp), %r12
movq 0x8(%r14), %rdi
callq 0x9f08
movq (%r15), %r9
leaq 0x18fc1(%rip), %r15     # 0x22a50
leaq 0x8f6e(%rip), %rsi      # 0x12a04
movq %r15, %rdi
movq %r12, %rdx
movl %eax, %ecx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x3070
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x9452
movq %rsp, %rdi
callq 0x3110
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3420
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/Log.cpp
// Function: Log::logReadFail(Address*, bool, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Log::logReadFail(Address * address, bool isCoordinator, int transID, string key){
    static char stdstring[100];
	string str;
	if (isCoordinator)
		str = "coordinator";
	else
		str = "server";
	sprintf(stdstring, "%s: read fail at time %d, transID=%d, key=%s", str.c_str(), par->getcurrtime(), transID, key.c_str());
    LOG(address, stdstring);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %r8, %r15
movl %ecx, %ebp
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rsi, %rbx
movq %rdi, %r14
movb $0x0, (%rax)
leaq 0x8d6e(%rip), %rax      # 0x1293f
leaq 0x8d73(%rip), %rsi      # 0x1294b
testl %edx, %edx
cmovneq %rax, %rsi
movq %rsp, %rdi
callq 0x3460
movq (%rsp), %r12
movq 0x8(%r14), %rdi
callq 0x9f08
movq (%r15), %r9
leaq 0x18f33(%rip), %r15     # 0x22b30
leaq 0x8e6b(%rip), %rsi      # 0x12a6f
movq %r15, %rdi
movq %r12, %rdx
movl %eax, %ecx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x3070
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x9452
movq %rsp, %rdi
callq 0x3110
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3420
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/Log.cpp
// Function: Log::logUpdateFail(Address*, bool, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Log::logUpdateFail(Address * address, bool isCoordinator, int transID, string key, string newValue){
    static char stdstring[100];
	string str;
	if (isCoordinator)
		str = "coordinator";
	else
		str = "server";
	sprintf(stdstring, "%s: update fail at time %d, transID=%d, key=%s, value=%s", str.c_str(), par->getcurrtime(), transID, key.c_str(), newValue.c_str());
    LOG(address, stdstring);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r15
movq %r8, %r12
movl %ecx, %ebp
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rsi, %rbx
movq %rdi, %r14
movb $0x0, (%rax)
leaq 0x8cbd(%rip), %rax      # 0x1293f
leaq 0x8cc2(%rip), %rsi      # 0x1294b
testl %edx, %edx
cmovneq %rax, %rsi
leaq 0x8(%rsp), %rdi
callq 0x3460
movq 0x8(%rsp), %r13
movq 0x8(%r14), %rdi
callq 0x9f08
movq (%r12), %r9
movq (%r15), %rcx
movq %rcx, (%rsp)
leaq 0x18ee7(%rip), %r15     # 0x22ba0
leaq 0x8ddc(%rip), %rsi      # 0x12a9c
movq %r15, %rdi
movq %r13, %rdx
movl %eax, %ecx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x3070
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x9452
leaq 0x8(%rsp), %rdi
callq 0x3110
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3420
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/Log.cpp
// Function: Log::logDeleteFail(Address*, bool, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Log::logDeleteFail(Address * address, bool isCoordinator, int transID, string key){
    static char stdstring[100];
	string str;
	if (isCoordinator)
		str = "coordinator";
	else
		str = "server";
	sprintf(stdstring, "%s: delete fail at time %d, transID=%d, key=%s", str.c_str(), par->getcurrtime(), transID, key.c_str());
    LOG(address, stdstring);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %r8, %r15
movl %ecx, %ebp
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rsi, %rbx
movq %rdi, %r14
movb $0x0, (%rax)
leaq 0x8c00(%rip), %rax      # 0x1293f
leaq 0x8c05(%rip), %rsi      # 0x1294b
testl %edx, %edx
cmovneq %rax, %rsi
movq %rsp, %rdi
callq 0x3460
movq (%rsp), %r12
movq 0x8(%r14), %rdi
callq 0x9f08
movq (%r15), %r9
leaq 0x18ea5(%rip), %r15     # 0x22c10
leaq 0x8d63(%rip), %rsi      # 0x12ad5
movq %r15, %rdi
movq %r12, %rdx
movl %eax, %ecx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x3070
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x9452
movq %rsp, %rdi
callq 0x3110
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3420
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/Params.cpp
// Function: Params::setparams(char*)
void Params::setparams(char *config_file) {
	//trace.funcEntry("Params::setparams");
	char CRUD[10];
	FILE *fp = fopen(config_file,"r");

	fscanf(fp,"MAX_NNB: %d", &MAX_NNB);
	fscanf(fp,"\nSINGLE_FAILURE: %d", &SINGLE_FAILURE);
	fscanf(fp,"\nDROP_MSG: %d", &DROP_MSG);
	fscanf(fp,"\nMSG_DROP_PROB: %lf", &MSG_DROP_PROB);
	fscanf(fp,"\nCRUD_TEST: %s", CRUD);

	if ( 0 == strcmp(CRUD, "CREATE") ) {
		this->CRUDTEST = CREATE_TEST;
	}
	else if ( 0 == strcmp(CRUD, "READ") ) {
		this->CRUDTEST = READ_TEST;
	}
	else if ( 0 == strcmp(CRUD, "UPDATE") ) {
		this->CRUDTEST = UPDATE_TEST;
	}
	else if ( 0 == strcmp(CRUD, "DELETE") ) {
		this->CRUDTEST = DELETE_TEST;
	}

	//printf("Parameters of the test case: %d %d %d %lf\n", MAX_NNB, SINGLE_FAILURE, DROP_MSG, MSG_DROP_PROB);

	EN_GPSZ = MAX_NNB;
	STEP_RATE=.25;
	MAX_MSG_SIZE = 4000;
	globaltime = 0;
	dropmsg = 0;
	allNodesJoined = 0;
	for ( unsigned int i = 0; i < EN_GPSZ; i++ ) {
		allNodesJoined += i;
	}
	fclose(fp);
	//trace.funcExit("Params::setparams", SUCCESS);
	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rax
movq %rdi, %rbx
leaq 0x8b75(%rip), %rsi      # 0x12950
movq %rax, %rdi
callq 0x32e0
movq %rax, %r14
leaq 0x8d1c(%rip), %rsi      # 0x12b09
xorl %ebp, %ebp
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3440
leaq 0x4(%rbx), %rdx
leaq 0x8d0e(%rip), %rsi      # 0x12b15
movq %r14, %rdi
xorl %eax, %eax
callq 0x3440
leaq 0x20(%rbx), %rdx
leaq 0x8d0d(%rip), %rsi      # 0x12b29
movq %r14, %rdi
xorl %eax, %eax
callq 0x3440
leaq 0x8(%rbx), %rdx
leaq 0x8d06(%rip), %rsi      # 0x12b37
movq %r14, %rdi
xorl %eax, %eax
callq 0x3440
leaq 0x8d09(%rip), %rsi      # 0x12b4b
leaq 0xe(%rsp), %r15
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x3440
leaq 0x8cff(%rip), %rsi      # 0x12b5a
pushq $0x7
popq %rdx
movq %r15, %rdi
callq 0x3280
testl %eax, %eax
je 0x9ebd
leaq 0x8cf0(%rip), %rsi      # 0x12b61
leaq 0xe(%rsp), %rdi
pushq $0x5
popq %rdx
callq 0x3280
testl %eax, %eax
je 0x9eb6
leaq 0x8cdd(%rip), %rsi      # 0x12b66
leaq 0xe(%rsp), %rdi
pushq $0x7
popq %rdx
callq 0x3280
testl %eax, %eax
je 0x9eba
leaq 0x8ccc(%rip), %rsi      # 0x12b6d
leaq 0xe(%rsp), %rdi
pushq $0x7
popq %rdx
callq 0x3280
testl %eax, %eax
jne 0x9ec0
pushq $0x3
jmp 0x9ebc
pushq $0x1
jmp 0x9ebc
pushq $0x2
popq %rbp
movl %ebp, 0x34(%rbx)
movl (%rbx), %eax
movl %eax, 0x18(%rbx)
movabsq $0x3fd0000000000000, %rcx # imm = 0x3FD0000000000000
movq %rcx, 0x10(%rbx)
movl $0xfa0, 0x1c(%rbx)      # imm = 0xFA0
andq $0x0, 0x24(%rbx)
andl $0x0, 0x2c(%rbx)
xorl %ecx, %ecx
xorl %edx, %edx
cmpl %edx, %eax
je 0x9ef4
addl %edx, %ecx
movl %ecx, 0x2c(%rbx)
incl %edx
jmp 0x9ee7
movq %r14, %rdi
callq 0x3250
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/MP2Node.cpp
// Function: MP2Node::MP2Node(Member*, Params*, EmulNet*, Log*, Address*)
MP2Node::MP2Node(Member *memberNode, Params *par, EmulNet *emulNet, Log *log, Address *address) {
    this->memberNode = memberNode;
    this->par = par;
    this->emulNet = emulNet;
    this->log = log;
    ht = new HashTable();
    this->memberNode->addr = *address;
    this->lowestTransID = 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r9, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
andq $0x0, 0x80(%rdi)
movups %xmm0, 0x70(%rdi)
andl $0x0, 0x98(%rdi)
leaq 0x98(%rdi), %rax
andq $0x0, 0xa0(%rdi)
movups %xmm0, (%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x30(%rdi)
andq $0x0, 0x40(%rdi)
movq %rax, 0xa8(%rdi)
movq %rax, 0xb0(%rdi)
andq $0x0, 0xb8(%rdi)
movq %rsi, 0x50(%rdi)
movq %rdx, 0x58(%rdi)
movq %rcx, 0x60(%rdi)
movq %r8, 0x68(%rdi)
pushq $0x38
popq %rdi
callq 0x3260
movq %rax, %r15
movq %rax, %rdi
callq 0xfb3c
movq %r15, 0x48(%rbx)
movq 0x50(%rbx), %rdi
addq $0x8, %rdi
movq %r14, %rsi
callq 0x9f22
andl $0x0, 0x88(%rbx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %r14
pushq $0x38
popq %rsi
movq %r15, %rdi
callq 0x3270
jmp 0xbfe1
movq %rax, %r14
leaq 0x70(%rbx), %r15
leaq 0x30(%rbx), %r12
leaq 0x18(%rbx), %r13
leaq 0x90(%rbx), %rdi
callq 0xe836
movq %r15, %rdi
callq 0x894c
movq %r12, %rdi
callq 0x894c
movq %r13, %rdi
callq 0x894c
movq %rbx, %rdi
callq 0x894c
movq %r14, %rdi
callq 0x3420
nop
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/MP2Node.cpp
// Function: MP2Node::updateRing()
void MP2Node::updateRing() {
    vector<Node> curMemList;

    /*
     *  Step 1. Get the current membership list from Membership Protocol / MP1
     */
    curMemList = getMembershipList();

    /*
     * Step 2: Construct the ring
     */
    // Sort the list based on the hashCode
    sort(curMemList.begin(), curMemList.end());

    /*
     * Step 3: Run the stabilization protocol IF REQUIRED
     */
    // Run stabilization protocol if the hash table size is greater than zero and if there has been changes in the ring

    // if stabilization protocol needs to be run, cache the list (now the old list and new list are both present)
    // and then let the stabilization protocol do the work

    // for testing purpose
    // this->ring = curMemList;

    if (this->ring.size() == 0) {
        this->ring = curMemList;
        return;
    }

    // first compare the size
    if (this->ring.size() != curMemList.size()) {
        this->new_ring = curMemList;
        this->stabilizationProtocol();
        return;
    }

    // compare every node hash
    for (int i = 0; i < this->ring.size(); ++i) {
        if (this->ring[i].nodeHashCode != curMemList[i].nodeHashCode) {
            this->new_ring = curMemList;
            this->stabilizationProtocol();
            return;
        }
    }

    // it doesn't change
    return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
andq $0x0, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
movq %rbx, %rsi
callq 0xc16a
movq %rsp, %r14
leaq 0x18(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x9200
movq %r15, %rdi
callq 0x894c
movq (%r14), %rdi
movq 0x8(%r14), %rsi
callq 0xe959
movq 0x30(%rbx), %rax
movq 0x38(%rbx), %rsi
movq %rsi, %rcx
subq %rax, %rcx
subq %rax, %rsi
je 0xc11b
movq (%rsp), %rdx
movq 0x8(%rsp), %rdi
subq %rdx, %rdi
cmpq %rdi, %rsi
jne 0xc12c
sarq $0x5, %rcx
incq %rcx
pushq $0x10
popq %rsi
decq %rcx
je 0xc140
movq (%rax,%rsi), %rdi
leaq 0x20(%rsi), %r8
cmpq (%rdx,%rsi), %rdi
movq %r8, %rsi
je 0xc0ef
leaq 0x70(%rbx), %rdi
movq %rsp, %rsi
callq 0xe560
movq %rbx, %rdi
callq 0xc256
jmp 0xc140
addq $0x30, %rbx
movq %rsp, %rsi
movq %rbx, %rdi
callq 0xe560
jmp 0xc140
leaq 0x70(%rbx), %rdi
movq %rsp, %rsi
callq 0xe560
movq %rbx, %rdi
callq 0xc256
movq %rsp, %rdi
callq 0x894c
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0xc156
jmp 0xc156
movq %rax, %rbx
movq %rsp, %rdi
callq 0x894c
movq %rbx, %rdi
callq 0x3420
nop
// File: /workspace/github_cpp_makefile_star2_O2/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, %r15
movq %rdi, %rbx
leaq 0x28(%rsp), %r14
movq %r14, %rdi
movq %rdx, %rsi
callq 0x3340
movq %r14, %rsi
callq 0xc612
movq %rax, %r12
movq %r14, %rdi
callq 0x3110
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
movq 0x38(%r15), %rax
subq 0x30(%r15), %rax
cmpq $0x41, %rax
jb 0xcae4
leaq 0x30(%r15), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x8996
movq %rax, %rdi
callq 0xfb20
cmpq %rax, %r12
jbe 0xcaa3
movq 0x38(%r15), %rsi
subq 0x30(%r15), %rsi
sarq $0x5, %rsi
decq %rsi
movq %r14, %rdi
callq 0x8996
movq %rax, %rdi
callq 0xfb20
cmpq %rax, %r12
jbe 0xcaf6
movq %r14, %rdi
xorl %esi, %esi
callq 0x8996
movq %rbx, %rdi
movq %rax, %rsi
callq 0xe790
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x8996
movq %rbx, %rdi
movq %rax, %rsi
callq 0xe790
pushq $0x2
popq %rsi
movq %r14, %rdi
callq 0x8996
movq %rbx, %rdi
movq %rax, %rsi
callq 0xe790
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x3
popq %rbp
leaq 0x8(%rsp), %r13
leaq -0x2(%rbp), %rsi
movq 0x38(%r15), %rax
subq 0x30(%r15), %rax
sarq $0x5, %rax
cmpq %rsi, %rax
jbe 0xcae4
movq %r14, %rdi
callq 0x8996
movq %r13, %rdi
movq %rax, %rsi
callq 0xfab8
movq %r13, %rdi
callq 0xfb20
cmpq %rax, %r12
jbe 0xcb40
movq %r13, %rdi
callq 0xfaae
incq %rbp
jmp 0xcafe
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0xe790
leal -0x1(%rbp), %eax
movq 0x38(%r15), %rcx
subq 0x30(%r15), %rcx
sarq $0x5, %rcx
xorl %edx, %edx
divq %rcx
movq %r14, %rdi
movq %rdx, %rsi
callq 0x8996
movq %rbx, %rdi
movq %rax, %rsi
callq 0xe790
movl %ebp, %eax
movq 0x38(%r15), %rcx
subq 0x30(%r15), %rcx
sarq $0x5, %rcx
xorl %edx, %edx
divq %rcx
movq %r14, %rdi
movq %rdx, %rsi
callq 0x8996
movq %rbx, %rdi
movq %rax, %rsi
callq 0xe790
leaq 0x8(%rsp), %rdi
callq 0xfaae
jmp 0xcae4
jmp 0xcbb1
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0xfaae
jmp 0xcbc5
jmp 0xcbc2
movq %rax, %r14
movq %rbx, %rdi
callq 0x894c
movq %r14, %rdi
callq 0x3420
nop
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/MP2Node.cpp
// Function: MP2Node::handleReply(int, bool)
void MP2Node::handleReply(int transID, bool success) {
    if (success) {
        transID2Bundle[transID]->success_responses++;
    } else {
        transID2Bundle[transID]->failure_responses++;
    }
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebx
leaq 0xc(%rsp), %rax
movl %esi, (%rax)
addq $0x90, %rdi
movq %rax, %rsi
callq 0xe728
movq (%rax), %rax
testl %ebx, %ebx
je 0xd246
incl (%rax)
jmp 0xd249
incl 0x4(%rax)
addq $0x10, %rsp
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/MP2Node.cpp
// Function: MP2Node::handleReadReply(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
void MP2Node::handleReadReply(string value, int transID) {
    if (!value.empty()) {
        transID2Bundle[transID]->success_responses++;
        // @TODO: here we are assuming all responses are latest
        transID2Bundle[transID]->value = value;
    } else {
        transID2Bundle[transID]->failure_responses++;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xc(%rsp), %rsi
movl %edx, (%rsi)
movq 0x8(%rbx), %r15
addq $0x90, %r14
movq %r14, %rdi
callq 0xe728
movq (%rax), %rax
testq %r15, %r15
je 0xd2a1
incl (%rax)
leaq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0xe728
movq (%rax), %rdi
addq $0x30, %rdi
movq %rbx, %rsi
callq 0x3150
jmp 0xd2a4
incl 0x4(%rax)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/MP2Node.cpp
// Function: MP2Node::createKeyValue(Address, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, ReplicaType, int, MessageType)
bool MP2Node::createKeyValue(Address fromAddr, string key, string value, ReplicaType replica, int transID, MessageType t) {
    // Insert key, value, replicaType into the hash table
    // the transID is used for logging and response
    this->ht->create(key, value);
    // create must will succeed
    log->logCreateSuccess(&(this->memberNode->addr), false, transID, key, value);

    // reply
    Message *message = new Message(transID, this->memberNode->addr, REPLY, true);
    string _string = message->toString();
    emulNet->ENsend(&(this->memberNode->addr), &fromAddr, (char *)_string.c_str(), _string.size());

    delete message;

    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movl %r9d, %ebp
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, 0x10(%rsp)
movq %rdi, %r14
movq 0x48(%rdi), %rbx
leaq 0x78(%rsp), %rdi
movq %rdx, %rsi
callq 0x3340
leaq 0x58(%rsp), %rdi
movq %r15, %rsi
callq 0x3340
leaq 0x78(%rsp), %rsi
leaq 0x58(%rsp), %rdx
movq %rbx, %rdi
callq 0xfb8c
leaq 0x58(%rsp), %rdi
callq 0x3110
leaq 0x78(%rsp), %rdi
callq 0x3110
movq 0x50(%r14), %r13
movq 0x68(%r14), %rbx
leaq 0x38(%rsp), %rdi
movq %r12, %rsi
callq 0x3340
leaq 0x18(%rsp), %rdi
movq %r15, %rsi
callq 0x3340
addq $0x8, %r13
leaq 0x38(%rsp), %r8
leaq 0x18(%rsp), %r9
movq %rbx, %rdi
movq %r13, %rsi
xorl %edx, %edx
movl %ebp, %ecx
callq 0x97ee
leaq 0x18(%rsp), %rdi
callq 0x3110
leaq 0x38(%rsp), %rdi
callq 0x3110
pushq $0x78
popq %rdi
callq 0x3260
movq %rax, %r15
movq 0x50(%r14), %rsi
addq $0x8, %rsi
leaq 0xa(%rsp), %rdi
callq 0x9f14
leaq 0xa(%rsp), %rdx
pushq $0x4
popq %rcx
pushq $0x1
popq %r8
movq %r15, %rdi
movl %ebp, %esi
callq 0x10e3a
leaq 0x98(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x10fb8
movq 0x50(%r14), %rsi
movq 0x60(%r14), %rdi
addq $0x8, %rsi
movq (%rbx), %rcx
movl 0x8(%rbx), %r8d
movq 0x10(%rsp), %rdx
callq 0x56ee
movq %r15, %rdi
callq 0xe704
pushq $0x78
popq %rsi
movq %r15, %rdi
callq 0x3270
leaq 0x98(%rsp), %rdi
callq 0x3110
movb $0x1, %al
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
jmp 0xd43b
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x3110
jmp 0xd41d
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
jmp 0xd43b
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x3110
jmp 0xd436
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x3110
jmp 0xd450
movq %rax, %rbx
pushq $0x78
popq %rsi
movq %r15, %rdi
callq 0x3270
movq %rbx, %rdi
callq 0x3420
// File: /workspace/github_cpp_makefile_star2_O2/zkl94[P]distributed-key-value-store/MP2Node.cpp
// Function: MP2Node::deletekey(Address, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, MessageType)
bool MP2Node::deletekey(Address fromAddr, string key, int transID, MessageType t) {
    // Delete the key from the local hash table
    bool success = this->ht->deleteKey(key);
    Message *message;
    if (success) {
        log->logDeleteSuccess(&(this->memberNode->addr), false, transID, key);
        message = new Message(transID, this->memberNode->addr, REPLY, true);
    } else {
        log->logDeleteFail(&(this->memberNode->addr), false, transID, key);
        message = new Message(transID, this->memberNode->addr, REPLY, false);
    }

    string _string = message->toString();
    emulNet->ENsend(&(this->memberNode->addr), &fromAddr, (char *)_string.c_str(), _string.size());

    delete message;

    return success;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %ecx, %ebp
movq %rdx, %r12
movq %rsi, 0x10(%rsp)
movq %rdi, %r15
movq 0x48(%rdi), %rbx
leaq 0x78(%rsp), %r14
movq %r14, %rdi
movq %rdx, %rsi
callq 0x3340
movq %rbx, %rdi
movq %r14, %rsi
callq 0xfc7a
movl %eax, %ebx
leaq 0x78(%rsp), %rdi
callq 0x3110
movq 0x50(%r15), %r13
movq 0x68(%r15), %r14
addq $0x8, %r13
movb %bl, 0x3(%rsp)
testb %bl, %bl
je 0xd9f4
leaq 0x58(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3340
movq %r14, %rdi
movq %r13, %rsi
xorl %edx, %edx
movl %ebp, %ecx
movq %rbx, %r8
callq 0x9a34
leaq 0x58(%rsp), %rdi
callq 0x3110
pushq $0x78
popq %rdi
callq 0x3260
movq %rax, %r12
movq 0x50(%r15), %rsi
addq $0x8, %rsi
leaq 0xa(%rsp), %rdi
callq 0x9f14
leaq 0xa(%rsp), %rdx
pushq $0x4
popq %rcx
pushq $0x1
popq %r8
movq %r12, %rdi
movl %ebp, %esi
callq 0x10e3a
jmp 0xda52
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3340
movq %r14, %rdi
movq %r13, %rsi
xorl %edx, %edx
movl %ebp, %ecx
movq %rbx, %r8
callq 0x9d10
leaq 0x38(%rsp), %rdi
callq 0x3110
pushq $0x78
popq %rdi
callq 0x3260
movq %rax, %r12
movq 0x50(%r15), %rsi
addq $0x8, %rsi
leaq 0x4(%rsp), %rdi
callq 0x9f14
leaq 0x4(%rsp), %rdx
pushq $0x4
popq %rcx
movq %r12, %rdi
movl %ebp, %esi
xorl %r8d, %r8d
callq 0x10e3a
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x10fb8
movq 0x50(%r15), %rsi
movq 0x60(%r15), %rdi
addq $0x8, %rsi
movq (%rbx), %rcx
movl 0x8(%rbx), %r8d
movq 0x10(%rsp), %rdx
callq 0x56ee
movq %r12, %rdi
callq 0xe704
pushq $0x78
popq %rsi
movq %r12, %rdi
callq 0x3270
leaq 0x18(%rsp), %rdi
callq 0x3110
movb 0x3(%rsp), %al
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
jmp 0xdaea
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
jmp 0xdaea
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
jmp 0xdaea
jmp 0xdad2
movq %rax, %rbx
pushq $0x78
popq %rsi
movq %r12, %rdi
callq 0x3270
jmp 0xdaef
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3420
nop