LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/Membership.cpp
// Function: Membership::piggyMsg(Message, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Membership::piggyMsg( Message msg, std::string sender )
{
    std::string target = char42String(msg.carrierAdd);
    msg.type = MSG_PIGGY_PING;

    ipString2Char4(sender, msg.carrierAdd); //Original Sender as carrier

    sendUDP( sockfd,  target, port, (char*)&msg, sizeof(Message) );
    logFile << "Weired!: " << sender << " says that " << target << " did not responde..." << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x15(%rbp), %r15
leaq -0x40(%rbp), %rdi
movq %r15, %rsi
callq 0x112b0
movl $0x3, -0x5(%r15)
leaq -0x50(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0x60(%rbp), %rdi
callq 0x570a
leaq -0x60(%rbp), %rdi
movq %r15, %rsi
callq 0x1114c
leaq 0x10(%rbp), %r15
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0x893d
callq 0x4360
movl 0x298(%rbx), %edx
movl 0x29c(%rbx), %edi
leaq -0x40(%rbp), %rsi
movq %r15, %rcx
movl $0x14, %r8d
callq 0x115b6
leaq 0xae57(%rip), %rsi      # 0x137b9
movl $0x9, %edx
movq %rbx, %rdi
callq 0x43f0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
callq 0x43f0
movq %rax, %rbx
leaq 0xae3b(%rip), %rsi      # 0x137c3
movl $0xb, %edx
movq %rax, %rdi
callq 0x43f0
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq %rbx, %rdi
callq 0x43f0
movq %rax, %rbx
leaq 0xae20(%rip), %rsi      # 0x137cf
movl $0x14, %edx
movq %rax, %rdi
callq 0x43f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4380
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4260
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x89f5
callq 0x4360
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0x8a18
callq 0x4360
jmp 0x8a18
movq %rax, %rbx
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8a2a
callq 0x4360
movq %rbx, %rdi
callq 0x4630
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/Membership.cpp
// Function: Membership::piggyPingMsg(Message, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Membership::piggyPingMsg( Message msg, std::string sender )
{
    msg.type = MSG_PIGGY_ACK;
    //ipString2Char4(char42String(msg.carrierAdd), msg.carrierAdd); //Original Sender as carrier
    sendUDP( sockfd,  sender, port, (char*)&msg, sizeof(Message) );

    //Just in case, we can send the message back to the original sender
    // Because we can!
    std::string original = char42String(msg.carrierAdd);
    msg.type = MSG_ACK;
    sendUDP( sockfd,  original, port, (char*)&msg, sizeof(Message) );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
leaq 0x10(%rbp), %r14
movl $0x4, (%r14)
movl 0x298(%rdi), %edx
movl 0x29c(%rdi), %edi
movq %r14, %rcx
movl $0x14, %r8d
callq 0x115b6
leaq 0x15(%rbp), %r15
leaq -0x40(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x112b0
movl $0x1, -0x5(%r15)
movl 0x298(%rbx), %edx
movl 0x29c(%rbx), %edi
movq %r12, %rsi
movq %r14, %rcx
movl $0x14, %r8d
callq 0x115b6
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8ab3
callq 0x4360
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8ad5
callq 0x4360
movq %rbx, %rdi
callq 0x4630
nop
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/Membership.cpp
// Function: Membership::piggyAckMsg(Message, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Membership::piggyAckMsg( Message msg, std::string sender )
{
    std::string target = char42String(msg.carrierAdd);
    msg.type = MSG_ACK;

    ipString2Char4(sender, msg.carrierAdd); //Dont care, but meh

    sendUDP( sockfd,  target, port, (char*)&msg, sizeof(Message) );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x15(%rbp), %r14
leaq -0x60(%rbp), %rdi
movq %r14, %rsi
callq 0x112b0
movl $0x1, -0x5(%r14)
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0x40(%rbp), %rdi
callq 0x570a
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x1114c
leaq 0x10(%rbp), %r14
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x8b45
callq 0x4360
movl 0x298(%rbx), %edx
movl 0x29c(%rbx), %edi
leaq -0x60(%rbp), %rsi
movq %r14, %rcx
movl $0x14, %r8d
callq 0x115b6
leaq -0x50(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8b75
callq 0x4360
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x8b98
callq 0x4360
jmp 0x8b98
movq %rax, %rbx
leaq -0x50(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8baa
callq 0x4360
movq %rbx, %rdi
callq 0x4630
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/Membership.cpp
// Function: Membership::failMsg(Message, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Membership::failMsg( Message msg, std::string sender )
{
	std::string carrier = char42String(msg.carrierAdd);
/*
    if ( my_ip_str.compare(carrier) == 0) // THIS IS MY! I NEED TO REJOIN
    {
        std::cout <<"they are trying to kill me!" << std::endl;
        membersLock.lock();
        members.clear();
        membersLock.unlock();
        usleep( 2000*1000 ); // wait 2 second and rejoin
        bool joined = firstJoin();
        while( !isIntroducer && !joined)
        {   //introducer will firstJoin() once. Other node will keep firstJoin() until it enter the group.
            joined = firstJoin();
            usleep( 1000*1000 );
        }
        return;
    }
*/
    failMember(carrier, msg.timeStamp);
	logFile<<"failMsg: node "<<carrier<<" failed acording to " << sender << std::endl;
/*
    int select = rand()%10;

    if (select <= 7) // 1 and 2
    //if (true) // 1 and 2
    {
        Message justInCase;
        justInCase.type = MSG_FAIL;
        msg.TTL = 0;
        ipString2Char4(carrier, justInCase.carrierAdd);
        sendUDP( sockfd,  carrier, port, (char*)&justInCase, sizeof(Message) );
        // Just in case let the node know so it can rejoin
    }
*/
    if(msg.TTL==0)
    {
        return;
    }
    else{
    	msg.TTL--;
    	spreadMessage(msg);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x15(%rbp), %rsi
leaq -0x68(%rbp), %r15
movq %r15, %rdi
callq 0x112b0
leaq -0x38(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0x570a
leaq 0x10(%rbp), %r12
movl 0xc(%r12), %edx
leaq -0x48(%rbp), %rsi
movq %rbx, %rdi
callq 0x8040
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x8c17
callq 0x4360
leaq 0xab77(%rip), %rsi      # 0x13795
movl $0xe, %edx
movq %rbx, %rdi
callq 0x43f0
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq %rbx, %rdi
callq 0x43f0
movq %rax, %r15
leaq 0xab5f(%rip), %rsi      # 0x137a4
movl $0x14, %edx
movq %rax, %rdi
callq 0x43f0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r15, %rdi
callq 0x43f0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4380
movsbl %al, %esi
movq %r14, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4260
movb 0x10(%r12), %al
testb %al, %al
je 0x8cb7
decb %al
movb %al, 0x10(%r12)
movl 0x10(%r12), %eax
movl %eax, 0x10(%rsp)
movups (%r12), %xmm0
movups %xmm0, (%rsp)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7d06
leaq -0x58(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8cc9
callq 0x4360
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x8cee
callq 0x4360
jmp 0x8cee
movq %rax, %rbx
leaq -0x58(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8d00
callq 0x4360
movq %rbx, %rdi
callq 0x4630
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/Membership.cpp
// Function: Membership::leaveMsg(Message, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Membership::leaveMsg( Message msg, std::string sender )
{
    std::string carrier = char42String(msg.carrierAdd);

    if ( !checkMember(carrier) ) return; // Already deleted

	failMember(carrier, msg.timeStamp);
    
    logFile<<"leaveMsg: node "<<carrier<<" has left"<<std::endl;

    if(msg.TTL == 0)
    {
        return;
    }
    else{
        msg.TTL--;
        spreadMessage(msg);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
leaq 0x15(%rbp), %rsi
leaq -0x38(%rbp), %r14
movq %r14, %rdi
callq 0x112b0
leaq -0x68(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0x78(%rbp), %rdi
callq 0x570a
leaq -0x78(%rbp), %rsi
movq %rbx, %rdi
callq 0x9632
movl %eax, %r14d
movq -0x78(%rbp), %rdi
cmpq %r15, %rdi
je 0x8d66
callq 0x4360
testl %r14d, %r14d
je 0x8e37
leaq -0x48(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x38(%rbp), %rsi
movq -0x30(%rbp), %rdx
addq %rsi, %rdx
leaq -0x58(%rbp), %rdi
callq 0x570a
leaq 0x10(%rbp), %r15
movl 0xc(%r15), %edx
leaq -0x58(%rbp), %rsi
movq %rbx, %rdi
callq 0x8040
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
je 0x8dad
callq 0x4360
leaq 0xa9c7(%rip), %rsi      # 0x1377b
movl $0xf, %edx
movq %rbx, %rdi
callq 0x43f0
movq -0x38(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq %rbx, %rdi
callq 0x43f0
movq %rax, %r14
leaq 0xa9b0(%rip), %rsi      # 0x1378b
movl $0x9, %edx
movq %rax, %rdi
callq 0x43f0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4380
movsbl %al, %esi
movq %r14, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4260
movb 0x10(%r15), %al
testb %al, %al
je 0x8e37
decb %al
movb %al, 0x10(%r15)
movl 0x10(%r15), %eax
movl %eax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7d06
leaq -0x28(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8e49
callq 0x4360
addq $0x78, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
jne 0x8e6e
jmp 0x8e78
movq %rax, %rbx
movq -0x78(%rbp), %rdi
cmpq %r15, %rdi
je 0x8e78
callq 0x4360
jmp 0x8e78
movq %rax, %rbx
leaq -0x28(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8e8a
callq 0x4360
movq %rbx, %rdi
callq 0x4630
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/Membership.cpp
// Function: Membership::electionMsg(Message, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Membership::electionMsg( Message msg, std::string sender )
{
	logFile << "Election received! I am gonna bully that guy :)" << std::endl;
    msg.type = MSG_BULLY;
    ipString2Char4(sender, msg.carrierAdd); //Dont care, but meh

    sendUDP( sockfd,  sender, port, (char*)&msg, sizeof(Message) );

	runLeaderElection();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xa9cd(%rip), %rsi      # 0x1387d
movl $0x2f, %edx
callq 0x43f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4380
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4260
leaq 0x15(%rbp), %r15
movl $0xa, -0x5(%r15)
leaq -0x38(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %r12
movq %r12, %rdi
callq 0x570a
movq %r12, %rdi
movq %r15, %rsi
callq 0x1114c
leaq 0x10(%rbp), %r15
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x8f28
callq 0x4360
movl 0x298(%rbx), %edx
movl 0x29c(%rbx), %edi
movq %r14, %rsi
movq %r15, %rcx
movl $0x14, %r8d
callq 0x115b6
movq %rbx, %rdi
callq 0x9a04
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x8f6d
callq 0x4360
movq %rbx, %rdi
callq 0x4630
nop
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/Membership.cpp
// Function: Membership::checkLeader()
void Membership::checkLeader()
{
	logFile << "Checking leader... " << std::endl;

	if ( !leader.active)
	{
		logFile << "No leader! " << std::endl;
		runLeaderElection();
		return;
	}

	bool exist = false;

	membersLock.lock();

	for (int i = 0; i < members.size(); ++i)
	{
		if( leader.ip_str.compare(members.at(i).ip_str) == 0)
		{
			exist = true;
		}
	}

	membersLock.unlock();

	if (!exist)
	{
		leader.active = false;
		runLeaderElection();
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xa5cf(%rip), %rsi      # 0x1385d
movl $0x13, %edx
callq 0x43f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4380
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4260
cmpl $0x0, 0x294(%rbx)
je 0x9372
leaq 0x230(%rbx), %r14
movq %r14, %rdi
callq 0x44d0
testl %eax, %eax
jne 0x93d7
movq 0x258(%rbx), %rsi
cmpq %rsi, 0x260(%rbx)
je 0x93af
movq %r14, -0x30(%rbp)
leaq 0x270(%rbx), %r15
xorl %r12d, %r12d
xorl %r14d, %r14d
xorl %r13d, %r13d
addq %r12, %rsi
movq %r15, %rdi
callq 0x4050
testl %eax, %eax
movzbl %r13b, %r13d
movl $0x1, %eax
cmovel %eax, %r13d
incq %r14
movq 0x258(%rbx), %rsi
movq 0x260(%rbx), %rax
subq %rsi, %rax
sarq $0x3, %rax
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rcx, %rax
addq $0x28, %r12
cmpq %r14, %rax
ja 0x930b
movq -0x30(%rbp), %rdi
callq 0x42a0
testb $0x1, %r13b
je 0x93b7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa4f8(%rip), %rsi      # 0x13871
movl $0xb, %edx
movq %rbx, %rdi
callq 0x43f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4380
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4260
jmp 0x93c1
movq %r14, %rdi
callq 0x42a0
movl $0x0, 0x294(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9a04
movl %eax, %edi
callq 0x4240
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/Membership.cpp
// Function: Membership::printMember[abi:cxx11]()
std::string Membership::printMember(){

    std::stringstream ret;
    membersLock.lock();
    for(int i=0; i < members.size(); i++){
        ret<<"Member["<<i<<"]: "<<members[i].ip_str<<" "<<members[i].timeStamp<<" "<<members[i].active<<std::endl;
    }
    membersLock.unlock();  

    return ret.str();  
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rsi, %r14
movq %rdi, -0x38(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0x4270
leaq 0x230(%r14), %rdi
movq %rdi, -0x30(%rbp)
callq 0x44d0
testl %eax, %eax
jne 0x958c
movq 0x260(%r14), %rax
cmpq 0x258(%r14), %rax
je 0x953c
xorl %r12d, %r12d
leaq 0x9ee7(%rip), %r15      # 0x13322
xorl %r13d, %r13d
movl $0x7, %edx
leaq -0x1b0(%rbp), %rdi
leaq 0xa4f9(%rip), %rsi      # 0x1394a
callq 0x43f0
leaq -0x1b0(%rbp), %rdi
movl %r13d, %esi
callq 0x45f0
movq %rax, %rbx
movl $0x3, %edx
movq %rax, %rdi
leaq 0xa4db(%rip), %rsi      # 0x13952
callq 0x43f0
movq 0x258(%r14), %rax
movq (%rax,%r12), %rsi
movq 0x8(%rax,%r12), %rdx
movq %rbx, %rdi
callq 0x43f0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x43f0
movq 0x258(%r14), %rax
movl 0x20(%rax,%r12), %esi
movq %rbx, %rdi
callq 0x45f0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x43f0
movq 0x258(%r14), %rax
movl 0x24(%rax,%r12), %esi
movq %rbx, %rdi
callq 0x45f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4380
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4260
incq %r13
movq 0x260(%r14), %rax
subq 0x258(%r14), %rax
sarq $0x3, %rax
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rcx, %rax
addq $0x28, %r12
cmpq %r13, %rax
ja 0x943e
movq -0x30(%rbp), %rdi
callq 0x42a0
leaq -0x1a8(%rbp), %rsi
movq -0x38(%rbp), %rbx
movq %rbx, %rdi
callq 0x4540
movq 0xfa41(%rip), %rsi      # 0x18fa0
leaq -0x1c0(%rbp), %rdi
callq 0x4290
leaq -0x140(%rbp), %rdi
callq 0x4160
movq %rbx, %rax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x4240
jmp 0x9595
movq %rax, %rbx
movq 0xfa01(%rip), %rsi      # 0x18fa0
leaq -0x1c0(%rbp), %rdi
callq 0x4290
leaq -0x140(%rbp), %rdi
callq 0x4160
movq %rbx, %rdi
callq 0x4630
nop
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/Membership.cpp
// Function: Membership::ackMsgQueue()
bool Membership::ackMsgQueue(){
    bool acked = false;
    while(!msgQueueEmpty()){
        Message receive = popMsgQueue();
        if(receive.roundId==roundId)
            acked = true;
    }
    return acked;
}

// Assembly:
movq 0x2f8(%rdi), %rcx
movq 0x300(%rdi), %rdx
cmpq %rcx, %rdx
je 0x962c
pushq %rbp
movq %rsp, %rbp
movl 0x2c8(%rdi), %esi
addq $-0x14, %rdx
xorl %eax, %eax
movl $0x1, %r8d
movzbl 0x4(%rdx), %r9d
cmpl %r9d, %esi
movzbl %al, %eax
cmovel %r8d, %eax
movq %rdx, 0x300(%rdi)
leaq -0x14(%rdx), %r9
cmpq %rcx, %rdx
movq %r9, %rdx
jne 0x9607
popq %rbp
jmp 0x962e
xorl %eax, %eax
andb $0x1, %al
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/Membership.cpp
// Function: Membership::checkMember(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int Membership::checkMember(std::string ip_str){
    bool exist = false;
    
    membersLock.lock();
    
    for(int i=0; i<members.size(); i++){
        if( members[i].ip_str.compare( ip_str )==0 ){
            exist = true;
        }
    }

    membersLock.unlock();

    return exist;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
leaq 0x230(%rdi), %rbx
movq %rbx, %rdi
callq 0x44d0
testl %eax, %eax
jne 0x96ed
movq 0x258(%r15), %rdi
cmpq %rdi, 0x260(%r15)
je 0x96d0
movq %rbx, -0x30(%rbp)
xorl %r12d, %r12d
xorl %ebx, %ebx
xorl %r13d, %r13d
addq %r12, %rdi
movq %r14, %rsi
callq 0x4050
testl %eax, %eax
movzbl %r13b, %r13d
movl $0x1, %eax
cmovel %eax, %r13d
incq %rbx
movq 0x258(%r15), %rdi
movq 0x260(%r15), %rax
subq %rdi, %rax
sarq $0x3, %rax
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rcx, %rax
addq $0x28, %r12
cmpq %rbx, %rax
ja 0x9679
andb $0x1, %r13b
movzbl %r13b, %r14d
movq -0x30(%rbp), %rbx
jmp 0x96d3
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x42a0
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x4240
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/Membership.cpp
// Function: Membership::getMembershipList()
std::vector<Node> Membership::getMembershipList()
{

    membersLock.lock();
    std::vector<Node> ret = members;
    membersLock.unlock();

    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x230(%rsi), %r14
movq %r14, %rdi
callq 0x44d0
testl %eax, %eax
jne 0x99fd
addq $0x258, %r15            # imm = 0x258
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa586
movq %r14, %rdi
callq 0x42a0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x4240
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/Membership.cpp
// Function: Membership::checkMember(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
int Membership::checkMember(std::string ip_str, int timeStamp){
    bool exist = false;
    
    membersLock.lock();
    
    for(int i=0; i<members.size(); i++){
        if( members[i].ip_str.compare( ip_str )==0 && members[i].timeStamp == timeStamp){
            exist = true;
        }
    }

    membersLock.unlock();

    return exist;   
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, -0x2c(%rbp)
movq %rsi, %r15
movq %rdi, %r12
leaq 0x230(%rdi), %rbx
movq %rbx, %rdi
callq 0x44d0
testl %eax, %eax
jne 0x9ec9
movq 0x258(%r12), %rdi
cmpq %rdi, 0x260(%r12)
je 0x9eac
movq %rbx, -0x38(%rbp)
xorl %r13d, %r13d
xorl %ebx, %ebx
xorl %r14d, %r14d
addq %r13, %rdi
movq %r15, %rsi
callq 0x4050
testl %eax, %eax
jne 0x9e6d
movq 0x258(%r12), %rax
movl -0x2c(%rbp), %ecx
cmpl %ecx, 0x20(%rax,%r13)
movzbl %r14b, %r14d
movl $0x1, %eax
cmovel %eax, %r14d
incq %rbx
movq 0x258(%r12), %rdi
movq 0x260(%r12), %rax
subq %rdi, %rax
sarq $0x3, %rax
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rcx, %rax
addq $0x28, %r13
cmpq %rbx, %rax
ja 0x9e41
andb $0x1, %r14b
movzbl %r14b, %r14d
movq -0x38(%rbp), %rbx
jmp 0x9eaf
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x42a0
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x4240
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/Membership.cpp
// Function: Membership::msgQueueEmpty()
bool Membership::msgQueueEmpty(){
	bool empty;
	if(msgQueue.size()==0)
		empty = true;
	else
		empty = false;
	return empty;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x300(%rdi), %rax
cmpq 0x2f8(%rdi), %rax
sete %al
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/Membership.cpp
// Function: Membership::popMsgQueue()
Message Membership::popMsgQueue(){
	Message msg;
	msg.type= MSG_EMPTY;

	if(msgQueue.size()!=0){
		msg = msgQueue.back();
		msgQueue.pop_back();
	}
	
	return msg;
}

// Assembly:
movq %rdi, %rax
movl $0xd, (%rdi)
movq 0x300(%rsi), %rcx
cmpq 0x2f8(%rsi), %rcx
je 0x9f1e
pushq %rbp
movq %rsp, %rbp
leaq -0x14(%rcx), %rdx
movl -0x4(%rcx), %edi
movl %edi, 0x10(%rax)
movups -0x14(%rcx), %xmm0
movups %xmm0, (%rax)
movq %rdx, 0x300(%rsi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/Membership.cpp
// Function: Membership::failureDetected(Node)
void Membership::failureDetected(Node process) // This is the method we call when we detect a failure
{
    Message msg;
    msg.type = MSG_FAIL;
    msg.roundId = 0;
    ipString2Char4( process.ip_str, msg.carrierAdd );
    msg.timeStamp = process.timeStamp;
    msg.TTL = K_FORWARD;

    spreadMessage(msg);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x3b(%rbp), %r15
movl $0x5, -0x5(%r15)
movb $0x0, -0x1(%r15)
leaq -0x50(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%rsi), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0x60(%rbp), %r12
movq %r12, %rdi
callq 0x570a
movq %r12, %rdi
movq %r15, %rsi
callq 0x1114c
movq -0x60(%rbp), %rdi
cmpq %r13, %rdi
je 0x9f7f
callq 0x4360
movl 0x20(%r14), %eax
movl %eax, -0x34(%rbp)
movb $0x4, -0x30(%rbp)
movl -0x30(%rbp), %eax
movl %eax, 0x10(%rsp)
movups -0x40(%rbp), %xmm0
movups %xmm0, (%rsp)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7d06
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x60(%rbp), %rdi
cmpq %r13, %rdi
je 0x9fc3
callq 0x4360
movq %rbx, %rdi
callq 0x4630
nop
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/Membership.cpp
// Function: MemberUpdateMsg::operator=(MemberUpdateMsg const&)
MemberUpdateMsg & MemberUpdateMsg::operator=( MemberUpdateMsg const & msg){
    this->type = msg.type;
    this->node = msg.node;
    this->fileSystemRead = msg.fileSystemRead;
    return *this;   
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl (%rsi), %eax
movl %eax, (%rdi)
addq $0x8, %rsi
addq $0x8, %rdi
callq 0x4210
movq 0x28(%rbx), %rax
movq %rax, 0x28(%r14)
movb 0x30(%rbx), %al
movb %al, 0x30(%r14)
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/Membership.cpp
// Function: Membership::pullMsgFromFileSysQueue()
MemberUpdateMsg Membership::pullMsgFromFileSysQueue(){
    std::unique_lock<std::mutex> locker( fileSysMsgQueueLock );

    while( fileSysMsgQueue.size()==0 ){
        this->fileSysMsgQueueCV.wait( locker );
    }
    
    MemberUpdateMsg msg = fileSysMsgQueue[ 0 ];
    fileSysMsgQueue.erase( fileSysMsgQueue.begin() );
    
    return msg;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x370(%rsi), %rax
leaq -0x30(%rbp), %r15
movq %rax, (%r15)
movb $0x0, 0x8(%r15)
movq %r15, %rdi
callq 0xaf5e
movb $0x1, 0x8(%r15)
movq 0x358(%r14), %rsi
cmpq %rsi, 0x360(%r14)
jne 0xa13b
leaq 0x398(%r14), %r15
leaq -0x30(%rbp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x4130
movq 0x358(%r14), %rsi
cmpq %rsi, 0x360(%r14)
je 0xa120
movq %rbx, %rdi
callq 0xa030
movq 0x358(%r14), %rsi
addq $0x358, %r14            # imm = 0x358
movq %r14, %rdi
callq 0xb262
leaq -0x30(%rbp), %rdi
callq 0xa65e
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x8(%rbx), %rdi
addq $0x18, %rbx
cmpq %rbx, %rdi
je 0xa18c
callq 0x4360
jmp 0xa18c
movq %rax, %r14
leaq -0x30(%rbp), %rdi
callq 0xa65e
movq %r14, %rdi
callq 0x4630
nop
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/Membership.cpp
// Function: Membership::emptyFileSysQueue()
bool Membership::emptyFileSysQueue(){
    fileSysMsgQueueLock.lock();
    bool ret = fileSysMsgQueue.size();
    fileSysMsgQueueLock.unlock();
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
leaq 0x370(%rdi), %rbx
movq %rbx, %rdi
callq 0x44d0
testl %eax, %eax
jne 0xa1dd
movq 0x360(%r14), %rax
cmpq 0x358(%r14), %rax
setne %r14b
movq %rbx, %rdi
callq 0x42a0
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
movl %eax, %edi
callq 0x4240
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/FileSystem.cpp
// Function: FileSystem::FileSystem(int, Membership&)
FileSystem::FileSystem(int port, Membership& m) :
    membership(m), port(port)
{
	logFile.open("logFileSystem.log"); // we can make all the logs going to a single file, but nah.

    std::thread th2(&FileSystem::updateThread, this);
    ringUpdating.swap(th2);

    std::thread th1(&FileSystem::listeningThread, this);
    listening.swap(th1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r14
movl %esi, %r15d
movq %rdi, %rbx
callq 0x45c0
movl %r15d, 0x200(%rbx)
movq %r14, 0x208(%rbx)
leaq 0x210(%rbx), %r14
movq %r14, 0x218(%rbx)
movq %r14, 0x210(%rbx)
leaq 0x2a8(%rbx), %r12
xorps %xmm0, %xmm0
movups %xmm0, 0x220(%rbx)
movups %xmm0, 0x230(%rbx)
movups %xmm0, 0x240(%rbx)
movups %xmm0, 0x250(%rbx)
movups %xmm0, 0x260(%rbx)
movups %xmm0, 0x270(%rbx)
movups %xmm0, 0x280(%rbx)
movq %r12, 0x298(%rbx)
xorl %eax, %eax
movq %rax, 0x2a0(%rbx)
movb %al, 0x2a8(%rbx)
leaq 0x2d0(%rbx), %r13
movq %r13, 0x2c0(%rbx)
movq %rax, 0x2c8(%rbx)
movb %al, 0x2d0(%rbx)
leaq 0x2e8(%rbx), %r15
movups %xmm0, 0x2e8(%rbx)
leaq 0x866c(%rip), %rsi      # 0x13a7b
movq %rbx, %rdi
movl $0x10, %edx
callq 0x4060
leaq 0xf7(%rip), %rax        # 0xb51a
leaq -0x58(%rbp), %rsi
movq %rax, (%rsi)
movq $0x0, 0x8(%rsi)
leaq -0x40(%rbp), %rdx
movq %rbx, (%rdx)
leaq -0x30(%rbp), %rdi
callq 0xff5a
movq 0x2f0(%rbx), %rax
movq -0x30(%rbp), %rcx
movq %rcx, 0x2f0(%rbx)
movq %rax, -0x30(%rbp)
leaq 0x341(%rip), %rax       # 0xb7a0
leaq -0x58(%rbp), %rsi
movq %rax, (%rsi)
movq $0x0, 0x8(%rsi)
leaq -0x48(%rbp), %rdx
movq %rbx, (%rdx)
leaq -0x40(%rbp), %rdi
callq 0xff5a
movq (%r15), %rax
movq -0x40(%rbp), %rcx
movq %rcx, (%r15)
movq %rax, -0x40(%rbp)
testq %rax, %rax
jne 0xb515
cmpq $0x0, -0x30(%rbp)
jne 0xb515
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0xb4be
jmp 0xb515
jmp 0xb4ba
movq %rax, -0x38(%rbp)
cmpq $0x0, 0x2f0(%rbx)
jne 0xb515
cmpq $0x0, (%r15)
jne 0xb515
movq 0x2c0(%rbx), %rdi
cmpq %r13, %rdi
je 0xb4df
callq 0x4360
movq 0x298(%rbx), %rdi
cmpq %r12, %rdi
je 0xb4f0
callq 0x4360
leaq 0x250(%rbx), %rdi
callq 0xffec
movq %r14, %rdi
callq 0x10222
movq %rbx, %rdi
callq 0x46c8
movq -0x38(%rbp), %rdi
callq 0x4630
callq 0x4110
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/FileSystem.cpp
// Function: FileSystem::findPositionByKey(int)
int FileSystem::findPositionByKey( int key ){
    int position = 0;
    virtualRingLock.lock();
    for(int i=0; i < virtualRing.size(); i++){
        if(virtualRing[i].key >= key ){ //find the first virtual node with n.key >= key. If not, return the first Node.
            position = i;
            break;
        }
    }
    virtualRingLock.unlock();
    return position;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %r15
leaq 0x268(%rdi), %rbx
movq %rbx, %rdi
callq 0x44d0
testl %eax, %eax
jne 0xbc3d
movq 0x250(%r15), %rax
movq 0x258(%r15), %rdx
subq %rax, %rdx
je 0xbc24
sarq $0x3, %rdx
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rdx, %rcx
cmpq $0x1, %rcx
adcq $0x0, %rcx
addq $0x20, %rax
xorl %r15d, %r15d
cmpl %r14d, (%rax)
jge 0xbc27
incq %r15
addq $0x28, %rax
cmpq %r15, %rcx
jne 0xbc13
xorl %r15d, %r15d
movq %rbx, %rdi
callq 0x42a0
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x4240
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/FileSystem.cpp
// Function: FileSystem::deleteFromAddress(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool FileSystem::deleteFromAddress(std::string address, std::string remoteFile)
{
    int connectionToServer; //TCP connect to introducer/other nodes

    // printf("Local file: %s\n", localFile.c_str());
    // printf("Remote file: %s\n", remoteFile.c_str());

    logFile << "Deleting -  Connecting to "<< address << "..." << std::endl;

    int ret = connect_to_server(address.c_str(), port, &connectionToServer);
    if(ret!=0)
    {
        logFile <<"ERROR putToAddress: Cannot connect to "<<address<< std::endl;
        std::cout <<"ERROR putToAddress: Cannot connect to "<<address<< std::endl;
        return false;
    }
    else{

        Message_fs msg;
        msg.type = MSG_DELETE;

        memset(msg.filename, '\0', 200);
        remoteFile.copy(msg.filename, remoteFile.length());
        msg.filename[remoteFile.length()+1] = '\0';
        msg.size = 0;

        write(connectionToServer, &msg, sizeof(Message_fs) );   

        close(connectionToServer);
        return true;
    }   
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xf0, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %r12
leaq 0x79bf(%rip), %rsi      # 0x13c41
movl $0x1a, %edx
callq 0x43f0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r12, %rdi
callq 0x43f0
movq %rax, %rbx
leaq 0x753b(%rip), %rsi      # 0x137e0
movl $0x3, %edx
movq %rax, %rdi
callq 0x43f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4380
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4260
movq (%r14), %rdi
movl 0x200(%r12), %esi
leaq -0x24(%rbp), %rdx
callq 0x1179a
movl %eax, %ebx
testl %eax, %eax
je 0xc399
leaq 0x791c(%rip), %r15      # 0x13c1a
movl $0x26, %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x43f0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r12, %rdi
callq 0x43f0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x4380
movsbl %al, %esi
movq %r12, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4260
movq 0xcc72(%rip), %r12      # 0x18fc0
movl $0x26, %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x43f0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r12, %rdi
callq 0x43f0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4380
movsbl %al, %esi
movq %r14, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4260
jmp 0xc3f8
leaq -0x104(%rbp), %r14
movl $0x2, -0x4(%r14)
movl $0xc8, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x4220
movq 0x8(%r15), %rdx
movq %r15, %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x40a0
movq 0x8(%r15), %rax
leaq -0x108(%rbp), %rsi
movb $0x0, 0x5(%rax,%rsi)
movq $0x0, 0xcc(%r14)
movl -0x24(%rbp), %edi
movl $0xe0, %edx
callq 0x4170
movl -0x24(%rbp), %edi
callq 0x46b0
testl %ebx, %ebx
sete %al
addq $0xf0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/FileSystem.cpp
// Function: FileSystem::where(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void FileSystem::where(std::string remoteFile)
{    
    int fileKey = hashString(remoteFile);
    int position = findPositionByKey(fileKey);

    std::cout<< "Master Replica: " << virtualRing[position].ip_str << std::endl;
    std::cout<< "Second Replica: " << virtualRing[ (position+1) % virtualRing.size()].ip_str << std::endl;
    std::cout<< "Second Replica: " << virtualRing[ (position+2) % virtualRing.size()].ip_str << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq -0x38(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%rsi), %rax
movq 0x8(%rsi), %rdx
addq %rax, %rdx
leaq -0x48(%rbp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x570a
movq (%r14), %rdi
movq 0x8(%r14), %rsi
movl $0xc70f6907, %edx       # imm = 0xC70F6907
callq 0x40c0
movq %rax, %r14
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0xcd63
callq 0x4360
movl %r14d, %eax
imulq $0x10624dd3, %rax, %rax # imm = 0x10624DD3
shrq $0x26, %rax
imull $0x3e8, %eax, %eax      # imm = 0x3E8
subl %eax, %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0xbbbc
movl %eax, %r15d
movq 0xc231(%rip), %r14      # 0x18fc0
leaq 0x6d0a(%rip), %rsi      # 0x13aa0
movl $0x10, %edx
movq %r14, %rdi
callq 0x43f0
movslq %r15d, %r13
movq 0x250(%rbx), %rax
leaq (,%r13,4), %rcx
addq %r13, %rcx
movq (%rax,%rcx,8), %rsi
movq 0x8(%rax,%rcx,8), %rdx
movq %r14, %rdi
callq 0x43f0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4380
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4260
leaq 0x6cb7(%rip), %rsi      # 0x13ab1
movl $0x10, %edx
movq %r14, %rdi
callq 0x43f0
leal 0x1(%r13), %eax
cltq
movq 0x250(%rbx), %rcx
movq 0x258(%rbx), %rsi
subq %rcx, %rsi
sarq $0x3, %rsi
movabsq $-0x3333333333333333, %r15 # imm = 0xCCCCCCCCCCCCCCCD
imulq %r15, %rsi
xorl %edx, %edx
divq %rsi
leaq (%rdx,%rdx,4), %rax
movq (%rcx,%rax,8), %rsi
movq 0x8(%rcx,%rax,8), %rdx
movq %r14, %rdi
callq 0x43f0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x4380
movsbl %al, %esi
movq %r12, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4260
movl $0x10, %edx
movq %r14, %rdi
leaq 0x6c2e(%rip), %rsi      # 0x13ab1
callq 0x43f0
addl $0x2, %r13d
movslq %r13d, %rax
movq 0x250(%rbx), %rcx
movq 0x258(%rbx), %rsi
subq %rcx, %rsi
sarq $0x3, %rsi
imulq %r15, %rsi
xorl %edx, %edx
divq %rsi
leaq (%rdx,%rdx,4), %rax
movq (%rcx,%rax,8), %rsi
movq 0x8(%rcx,%rax,8), %rdx
movq %r14, %rdi
callq 0x43f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4380
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4260
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rdi
callq 0xa677
nop
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/FileSystem.cpp
// Function: inRange(int, int, int)
bool inRange(int key, int min, int max){
    if(min < max)
        return (min<key && key<=max);
    else
        return ( (0 <= key && key <= max) || (min < key && key <= RING_SIZE)  );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl %edx, %esi
jge 0xe53d
cmpl %edi, %esi
setl %cl
cmpl %edx, %edi
setle %al
jmp 0xe55b
testl %edi, %edi
setns %cl
cmpl %edx, %edi
setle %dl
movb $0x1, %al
testb %dl, %cl
jne 0xe55d
cmpl %edi, %esi
setl %cl
cmpl $0x3e9, %edi            # imm = 0x3E9
setl %al
andb %cl, %al
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/FileSystem.cpp
// Function: FileSystem::getFileList[abi:cxx11]()
std::string FileSystem::getFileList()
{
    std::stringstream ss;

    checkFiles();

    filesLock.lock();
    for (std::list<FileEntry>::iterator it=files.begin(); it != files.end(); ++it)
    {
        ss << (*it).filename << " " << (*it).key << std::endl;
    }
    filesLock.unlock();

    return ss.str();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rsi, %r15
movq %rdi, %rbx
leaq -0x1c0(%rbp), %rdi
callq 0x4270
movq %r15, %rdi
callq 0xcf04
movq %rbx, -0x38(%rbp)
leaq 0x228(%r15), %rdi
movq %rdi, -0x30(%rbp)
callq 0x44d0
testl %eax, %eax
jne 0xe675
addq $0x210, %r15            # imm = 0x210
leaq -0x1b0(%rbp), %r12
leaq 0x4d63(%rip), %r13      # 0x13322
movq %r15, %r14
movq (%r14), %r14
cmpq %r15, %r14
je 0xe625
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
movq %r12, %rdi
callq 0x43f0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x43f0
movl 0x30(%r14), %esi
movq %rbx, %rdi
callq 0x45f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4380
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4260
jmp 0xe5c2
movq -0x30(%rbp), %rdi
callq 0x42a0
leaq -0x1a8(%rbp), %rsi
movq -0x38(%rbp), %rbx
movq %rbx, %rdi
callq 0x4540
movq 0xa958(%rip), %rsi      # 0x18fa0
leaq -0x1c0(%rbp), %rdi
callq 0x4290
leaq -0x140(%rbp), %rdi
callq 0x4160
movq %rbx, %rax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x4240
jmp 0xe67e
movq %rax, %rbx
movq 0xa918(%rip), %rsi      # 0x18fa0
leaq -0x1c0(%rbp), %rdi
callq 0x4290
leaq -0x140(%rbp), %rdi
callq 0x4160
movq %rbx, %rdi
callq 0x4630
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/FileSystem.cpp
// Function: FileSystem::addToVirtualRing(Node)
int FileSystem::addToVirtualRing( Node n ){
    VirtualNode newNode;
    newNode.ip_str = n.ip_str;
    newNode.key = hashString(newNode.ip_str);

    virtualRingLock.lock();
    
    virtualRing.push_back(newNode);
    std::sort(virtualRing.begin(), virtualRing.end());
    myPosition = find( virtualRing.begin(), virtualRing.end(), myself ) - virtualRing.begin();
    int joinPosition = find( virtualRing.begin(), virtualRing.end(), newNode ) - virtualRing.begin();

    virtualRingLock.unlock();

    int positionClock = joinPosition - myPosition;
    if(positionClock < 0) 
        positionClock += virtualRing.size() + 1;

    return positionClock;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq -0x40(%rbp), %r13
movq %r13, -0x10(%r13)
movq $0x0, -0x8(%r13)
movb $0x0, (%r13)
leaq -0x50(%rbp), %rdi
callq 0x4210
leaq -0x60(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %rdi
callq 0x570a
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rsi
movl $0xc70f6907, %edx       # imm = 0xC70F6907
callq 0x40c0
movl %eax, %ecx
imulq $0x10624dd3, %rcx, %rcx # imm = 0x10624DD3
shrq $0x26, %rcx
imull $0x3e8, %ecx, %ecx      # imm = 0x3E8
subl %ecx, %eax
movl %eax, -0x30(%rbp)
movq -0x70(%rbp), %rdi
cmpq %r14, %rdi
je 0xeb1a
callq 0x4360
leaq 0x268(%rbx), %r14
movq %r14, %rdi
callq 0x44d0
testl %eax, %eax
jne 0xec34
leaq 0x250(%rbx), %rdi
leaq -0x50(%rbp), %rsi
callq 0x101c0
movq 0x250(%rbx), %r15
movq 0x258(%rbx), %r12
cmpq %r12, %r15
je 0xeb8f
movq %r12, %rax
subq %r15, %rax
sarq $0x3, %rax
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rax, %rcx
bsrq %rcx, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x10588
movq %r15, %rdi
movq %r12, %rsi
callq 0x10666
movq 0x250(%rbx), %rdi
movq 0x258(%rbx), %rsi
leaq 0x298(%rbx), %rdx
callq 0x10fef
movq 0x250(%rbx), %rdi
movq 0x258(%rbx), %rsi
subq %rdi, %rax
shrq $0x3, %rax
imull $0xcccccccd, %eax, %eax # imm = 0xCCCCCCCD
movl %eax, 0x290(%rbx)
leaq -0x50(%rbp), %rdx
callq 0x10fef
subq 0x250(%rbx), %rax
shrq $0x3, %rax
imull $0xcccccccd, %eax, %r15d # imm = 0xCCCCCCCD
movq %r14, %rdi
callq 0x42a0
subl 0x290(%rbx), %r15d
jns 0xec14
movq 0x258(%rbx), %rax
subq 0x250(%rbx), %rax
shrq $0x3, %rax
imull $0xcccccccd, %eax, %eax # imm = 0xCCCCCCCD
addl %eax, %r15d
incl %r15d
movq -0x50(%rbp), %rdi
cmpq %r13, %rdi
je 0xec22
callq 0x4360
movl %r15d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x4240
jmp 0xec47
jmp 0xec47
movq %rax, %rdi
callq 0xa677
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r13, %rdi
je 0xec58
callq 0x4360
movq %rbx, %rdi
callq 0x4630
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/FileSystem.cpp
// Function: FileSystem::deleteFromVirtualRing(Node)
int FileSystem::deleteFromVirtualRing( Node n ){
    // cout<<"detect leave: "<<n.ip_str<<endl;

    VirtualNode changeNode;
    changeNode.ip_str = n.ip_str;
    changeNode.key = hashString(changeNode.ip_str);

    // cout<<"leave virtual node: "<<changeNode.ip_str<<" "<<changeNode.key<<endl;

    virtualRingLock.lock();
    
    int myOldPosition = myPosition;

    int leavePosition = find( virtualRing.begin(), virtualRing.end(), changeNode ) - virtualRing.begin();

    // cout<<"leave node position: "<<leavePosition<<endl;

    virtualRing.erase( virtualRing.begin() + leavePosition );

    if( leavePosition == myOldPosition )
        myPosition = -1;
    else
        myPosition = find( virtualRing.begin(), virtualRing.end(), myself ) - virtualRing.begin();
    
    virtualRingLock.unlock();

    int positionClock = leavePosition - myOldPosition;
    if(positionClock < 0) 
        positionClock += virtualRing.size() + 1;

    return positionClock;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x50(%rbp), %rdi
callq 0x4210
leaq -0x60(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %rdi
callq 0x570a
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rsi
movl $0xc70f6907, %edx       # imm = 0xC70F6907
callq 0x40c0
movl %eax, %ecx
imulq $0x10624dd3, %rcx, %rcx # imm = 0x10624DD3
shrq $0x26, %rcx
imull $0x3e8, %ecx, %ecx      # imm = 0x3E8
subl %ecx, %eax
movl %eax, -0x30(%rbp)
movq -0x70(%rbp), %rdi
cmpq %r14, %rdi
je 0xece4
callq 0x4360
leaq 0x268(%rbx), %r15
movq %r15, %rdi
callq 0x44d0
testl %eax, %eax
jne 0xedd3
movl 0x290(%rbx), %r13d
movq 0x250(%rbx), %rdi
movq 0x258(%rbx), %rsi
leaq -0x50(%rbp), %rdx
callq 0x10fef
leaq 0x250(%rbx), %r12
movq (%r12), %rcx
subq %rcx, %rax
sarq $0x3, %rax
movabsq $-0x3333333333333333, %r14 # imm = 0xCCCCCCCCCCCCCCCD
imulq %rax, %r14
movslq %r14d, %rax
leaq (%rax,%rax,4), %rax
leaq (%rcx,%rax,8), %rsi
movq %r12, %rdi
callq 0x110b2
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %r13d, %r14d
je 0xed7e
movq 0x250(%rbx), %rdi
movq 0x258(%rbx), %rsi
leaq 0x298(%rbx), %rdx
callq 0x10fef
subq (%r12), %rax
shrq $0x3, %rax
imull $0xcccccccd, %eax, %eax # imm = 0xCCCCCCCD
movl %eax, 0x290(%rbx)
movq %r15, %rdi
callq 0x42a0
subl %r13d, %r14d
jns 0xedaf
movq 0x258(%rbx), %rax
subq 0x250(%rbx), %rax
shrq $0x3, %rax
imull $0xcccccccd, %eax, %eax # imm = 0xCCCCCCCD
addl %eax, %r14d
incl %r14d
leaq -0x40(%rbp), %rax
movq -0x50(%rbp), %rdi
cmpq %rax, %rdi
je 0xedc1
callq 0x4360
movl %r14d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x4240
jmp 0xede8
jmp 0xede8
jmp 0xede8
movq %rax, %rdi
callq 0xa677
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0xedfd
callq 0x4360
movq %rbx, %rdi
callq 0x4630
nop
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/FileSystem.cpp
// Function: FileSystem::printVirtualRing()
void FileSystem::printVirtualRing()
{
    virtualRingLock.lock();
    for(int i=0; i < virtualRing.size(); i++)
    {
        std::cout << virtualRing[i].ip_str << " " << virtualRing[i].key;
        if (virtualRing[i].key == myself.key)
            std::cout << " X ";
        std::cout << std::endl;
    }
    std::cout<<std::endl;
    virtualRingLock.unlock();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
addq $0x268, %rdi            # imm = 0x268
movq %rdi, -0x30(%rbp)
callq 0x44d0
testl %eax, %eax
jne 0xef54
movq 0x250(%r14), %rax
cmpq %rax, 0x258(%r14)
je 0xef0f
xorl %r13d, %r13d
movq 0xa173(%rip), %r15      # 0x18fc0
xorl %r12d, %r12d
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
movq %r15, %rdi
callq 0x43f0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x44af(%rip), %rsi      # 0x13322
callq 0x43f0
movq 0x250(%r14), %rax
movl 0x20(%rax,%r13), %esi
movq %rbx, %rdi
callq 0x45f0
movq 0x250(%r14), %rax
movl 0x20(%rax,%r13), %eax
cmpl 0x2b8(%r14), %eax
jne 0xeeb5
movl $0x3, %edx
movq %r15, %rdi
leaq 0x4e60(%rip), %rsi      # 0x13d10
callq 0x43f0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4380
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4260
incq %r12
movq 0x250(%r14), %rax
movq 0x258(%r14), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $-0x3333333333333333, %rdx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rdx, %rcx
addq $0x28, %r13
cmpq %r12, %rcx
ja 0xee50
movq 0xa0aa(%rip), %r14      # 0x18fc0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4380
movsbl %al, %esi
movq %r14, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4260
movq -0x30(%rbp), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x42a0
movl %eax, %edi
callq 0x4240
nop
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/FileSystem.cpp
// Function: FileSystem::nNodeLater(int, int)
FileSystem::VirtualNode FileSystem::nNodeLater(int n, int current)
{
    int position = current + n;
    while(position < 0)
        position += virtualRing.size();
    while(position >= virtualRing.size())
        position -= virtualRing.size();
    
    return virtualRing[position];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
addl %ecx, %edx
jns 0xf56d
movq 0x258(%rsi), %rax
subq 0x250(%rsi), %rax
shrq $0x3, %rax
imull $0xcccccccd, %eax, %eax # imm = 0xCCCCCCCD
addl %eax, %edx
js 0xf569
movq 0x250(%rsi), %r14
movq 0x258(%rsi), %rcx
subq %r14, %rcx
sarq $0x3, %rcx
movabsq $-0x3333333333333333, %rax # imm = 0xCCCCCCCCCCCCCCCD
imulq %rcx, %rax
movslq %edx, %rcx
movl %ecx, %edx
subl %eax, %edx
cmpq %rcx, %rax
jbe 0xf590
leaq (%rcx,%rcx,4), %r15
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq (%r14,%r15,8), %rsi
movq 0x8(%r14,%r15,8), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x570a
movl 0x20(%r14,%r15,8), %eax
movl %eax, 0x20(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/FileSystem.cpp
// Function: FileSystem::nNodeBefore(int, int)
FileSystem::VirtualNode FileSystem::nNodeBefore(int n, int current)
{
    int position = current - n;
    while(position < 0)
        position += virtualRing.size();
    while(position >= virtualRing.size())
        position -= virtualRing.size();
    
    return virtualRing[position];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
subl %edx, %ecx
jns 0xf5ff
movq 0x258(%rsi), %rax
subq 0x250(%rsi), %rax
shrq $0x3, %rax
imull $0xcccccccd, %eax, %eax # imm = 0xCCCCCCCD
addl %eax, %ecx
js 0xf5fb
movq 0x250(%rsi), %r14
movq 0x258(%rsi), %rdx
subq %r14, %rdx
sarq $0x3, %rdx
movabsq $-0x3333333333333333, %rax # imm = 0xCCCCCCCCCCCCCCCD
imulq %rdx, %rax
movslq %ecx, %rdx
movl %edx, %ecx
subl %eax, %ecx
cmpq %rdx, %rax
jbe 0xf622
leaq (%rdx,%rdx,4), %r15
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq (%r14,%r15,8), %rsi
movq 0x8(%r14,%r15,8), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x570a
movl 0x20(%r14,%r15,8), %eax
movl %eax, 0x20(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop