LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/FileSystem.cpp
// Function: FileSystem::myselfLeave(Node)
bool FileSystem::myselfLeave( Node myNodeToChange ){
    deleteFromVirtualRing( myNodeToChange );
    
    filesLock.lock();
    files.clear();
    //system("rm files/*");
    filesLock.unlock();

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rsi), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %r15
movq %r15, %rdi
callq 0x570a
movq 0x20(%r14), %rax
movq %rax, 0x20(%r15)
movq %rbx, %rdi
movq %r15, %rsi
callq 0xec60
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0xfec7
callq 0x4360
leaq 0x228(%rbx), %r14
movq %r14, %rdi
callq 0x44d0
testl %eax, %eax
jne 0xff19
leaq 0x210(%rbx), %r15
movq %r15, %rdi
callq 0x10222
movq %r15, 0x218(%rbx)
movq %r15, 0x210(%rbx)
movq $0x0, 0x220(%rbx)
movq %r14, %rdi
callq 0x42a0
movb $0x1, %al
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x4240
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0xff31
callq 0x4360
movq %rbx, %rdi
callq 0x4630
nop
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/connections.cpp
// Function: ipString2Char4(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char*)
void ipString2Char4(std::string ip, char* buf) // buf must be size 4
{
    ip.replace(ip.find("."),1," ");
    ip.replace(ip.find("."),1," ");
    ip.replace(ip.find("."),1," ");
    
    std::stringstream ssip(ip);
    int a;
    ssip >> a; buf[0] = (char)a; 
    ssip >> a; buf[1] = (char)a; 
    ssip >> a; buf[2] = (char)a; 
    ssip >> a; buf[3] = (char)a; 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x190, %rsp            # imm = 0x190
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x2677(%rip), %r15      # 0x137e2
movl $0x1, %ecx
movq %r15, %rsi
xorl %edx, %edx
callq 0x4610
leaq 0x21a1(%rip), %r12      # 0x13322
movl $0x1, %edx
movl $0x1, %r8d
movq %r14, %rdi
movq %rax, %rsi
movq %r12, %rcx
callq 0x43d0
movl $0x1, %ecx
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x4610
movl $0x1, %edx
movl $0x1, %r8d
movq %r14, %rdi
movq %rax, %rsi
movq %r12, %rcx
callq 0x43d0
movl $0x1, %ecx
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x4610
movl $0x1, %edx
movl $0x1, %r8d
movq %r14, %rdi
movq %rax, %rsi
movq %r12, %rcx
callq 0x43d0
leaq -0x1b0(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
movl $0x18, %edx
callq 0x4550
leaq -0x24(%rbp), %rsi
movq %r15, %rdi
callq 0x4230
leaq -0x24(%rbp), %rsi
movb (%rsi), %al
movb %al, (%rbx)
leaq -0x1b0(%rbp), %rdi
callq 0x4230
leaq -0x24(%rbp), %rsi
movb (%rsi), %al
movb %al, 0x1(%rbx)
leaq -0x1b0(%rbp), %rdi
callq 0x4230
leaq -0x24(%rbp), %rsi
movb (%rsi), %al
movb %al, 0x2(%rbx)
leaq -0x1b0(%rbp), %rdi
callq 0x4230
movb -0x24(%rbp), %al
movb %al, 0x3(%rbx)
movq 0x7d42(%rip), %rsi      # 0x18fa0
leaq -0x1b0(%rbp), %rdi
callq 0x4290
leaq -0x130(%rbp), %rdi
callq 0x4160
addq $0x190, %rsp            # imm = 0x190
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x7d10(%rip), %rsi      # 0x18fa0
leaq -0x1b0(%rbp), %rdi
callq 0x4290
leaq -0x130(%rbp), %rdi
callq 0x4160
movq %rbx, %rdi
callq 0x4630
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/connections.cpp
// Function: char42String[abi:cxx11](char*)
std::string char42String(char* buf) // buf must be size 4
{
    std::stringstream aux;
    aux << (unsigned int) ((uint8_t)buf[0]) << ".";
    aux << (unsigned int) ((uint8_t)buf[1]) << ".";
    aux << (unsigned int) ((uint8_t)buf[2]) << ".";
    aux << (unsigned int) ((uint8_t)buf[3]);

    return aux.str();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x1a0(%rbp), %rdi
callq 0x4270
leaq -0x190(%rbp), %r15
movzbl (%r14), %esi
movq %r15, %rdi
callq 0x4250
leaq 0x24f6(%rip), %rsi      # 0x137e2
movl $0x1, %edx
movq %rax, %rdi
callq 0x43f0
movzbl 0x1(%r14), %esi
movq %r15, %rdi
callq 0x4250
leaq 0x24d5(%rip), %rsi      # 0x137e2
movl $0x1, %edx
movq %rax, %rdi
callq 0x43f0
movzbl 0x2(%r14), %esi
movq %r15, %rdi
callq 0x4250
leaq 0x24b4(%rip), %rsi      # 0x137e2
movl $0x1, %edx
movq %rax, %rdi
callq 0x43f0
movzbl 0x3(%r14), %esi
movq %r15, %rdi
callq 0x4250
leaq -0x188(%rbp), %rsi
movq %rbx, %rdi
callq 0x4540
movq 0x7c42(%rip), %rsi      # 0x18fa0
leaq -0x1a0(%rbp), %rdi
callq 0x4290
leaq -0x120(%rbp), %rdi
callq 0x4160
movq %rbx, %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x7c0f(%rip), %rsi      # 0x18fa0
leaq -0x1a0(%rbp), %rdi
callq 0x4290
leaq -0x120(%rbp), %rdi
callq 0x4160
movq %rbx, %rdi
callq 0x4630
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/connections.cpp
// Function: getOwnIPAddr[abi:cxx11]()
std::string getOwnIPAddr(){
    struct ifaddrs * ifAddrStruct=NULL;
    struct ifaddrs * ifa=NULL;
    void * tmpAddrPtr=NULL;

    getifaddrs(&ifAddrStruct);
    std::string result;

    int i=0;
    for (ifa = ifAddrStruct; ifa != NULL; ifa = ifa->ifa_next) {
        if (!ifa->ifa_addr) {
            continue;
        }
        i++;
        if(i==4){
            tmpAddrPtr=&((struct sockaddr_in *)ifa->ifa_addr)->sin_addr;
            char addressBuffer[INET_ADDRSTRLEN];
            inet_ntop(AF_INET, tmpAddrPtr, addressBuffer, INET_ADDRSTRLEN);
            result = addressBuffer;
        }
    }
    
    if (ifAddrStruct!=NULL) freeifaddrs(ifAddrStruct);
    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorl %r15d, %r15d
leaq -0x30(%rbp), %r14
movq %r15, (%r14)
movq %r14, %rdi
callq 0x4690
leaq 0x10(%rbx), %r12
movq %r12, (%rbx)
movq %r15, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq (%r14), %r13
testq %r13, %r13
je 0x11448
leaq -0x40(%rbp), %r14
movq 0x18(%r13), %rsi
testq %rsi, %rsi
je 0x1143f
incl %r15d
cmpl $0x4, %r15d
jne 0x1143f
addq $0x4, %rsi
movl $0x2, %edi
movq %r14, %rdx
movl $0x10, %ecx
callq 0x43b0
movq 0x8(%rbx), %r15
movq %r14, %rdi
callq 0x41a0
movq %rbx, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %r14, %rcx
movq %rax, %r8
callq 0x4510
movl $0x4, %r15d
movq (%r13), %r13
testq %r13, %r13
jne 0x113f2
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x11456
callq 0x4620
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0x11478
callq 0x4360
movq %r14, %rdi
callq 0x4630
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/connections.cpp
// Function: bindSocket(int)
int bindSocket(int port)
{
    struct sockaddr_in svrAdd, clntAdd;
    
    //create socket
    int sockfd = socket(AF_INET, SOCK_DGRAM, 0);

    if(sockfd < 0)
    {
        std::cout << "Cannot open socket" << std::endl;
        exit(1);
    }
    
    memset((char*) &svrAdd,0, sizeof(svrAdd));
    
    svrAdd.sin_family = AF_INET;
    svrAdd.sin_addr.s_addr = INADDR_ANY;
    svrAdd.sin_port = htons(port);
    
    //bind socket
    int ret = ::bind(sockfd, (struct sockaddr *)&svrAdd, sizeof(svrAdd));
    if( ret < 0)
    {
        std::cout << "open_socket: Cannot bind" << std::endl;
        exit(1);
    }
    // printf("UDP Listening at port %d...\n", port);

    return sockfd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edi, %r14d
movl $0x2, %edi
movl $0x2, %esi
xorl %edx, %edx
callq 0x40e0
testl %eax, %eax
js 0x114f8
movl %eax, %ebx
xorps %xmm0, %xmm0
leaq -0x20(%rbp), %rsi
movaps %xmm0, (%rsi)
movw $0x2, (%rsi)
movl $0x0, 0x4(%rsi)
rolw $0x8, %r14w
movw %r14w, 0x2(%rsi)
movl %eax, %edi
movl $0x10, %edx
callq 0x40b0
testl %eax, %eax
js 0x11508
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq 0x7ac1(%rip), %rdi      # 0x18fc0
leaq 0x2894(%rip), %rsi      # 0x13d9a
jmp 0x11516
movq 0x7ab1(%rip), %rdi      # 0x18fc0
leaq 0x2897(%rip), %rsi      # 0x13dad
callq 0x4390
movq %rax, %rdi
callq 0x41e0
movl $0x1, %edi
callq 0x4400
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/connections.cpp
// Function: receiveUDP(int, char*, unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
int receiveUDP(int sockfd, char* buf, uint32_t len, std::string& sender)
{
    struct sockaddr addr;
    socklen_t fromlen = sizeof addr;

    int byte_count = recvfrom(sockfd, buf, len, 0, &addr, &fromlen);

    if (byte_count == -1)
    {
        printf("ERROR RECEIVING!!!\n");
        exit(-1);
    }

    struct sockaddr_in *sin = (struct sockaddr_in *) &addr;

    sender = inet_ntoa(sin->sin_addr);

    UDPreceived++;

    return byte_count;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rcx, %rbx
leaq -0x24(%rbp), %r9
movl $0x10, (%r9)
movl %edx, %edx
leaq -0x34(%rbp), %r8
xorl %ecx, %ecx
callq 0x42b0
movq %rax, %r14
cmpl $-0x1, %r14d
je 0x115a0
movl -0x30(%rbp), %edi
callq 0x41b0
movq %rax, %r15
movq 0x8(%rbx), %r12
movq %rax, %rdi
callq 0x41a0
movq %rbx, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %r15, %rcx
movq %rax, %r8
callq 0x4510
incl 0x8004(%rip)            # 0x19594
movl %r14d, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x287a(%rip), %rdi      # 0x13e21
callq 0x4500
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x4400
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/connections.cpp
// Function: sendUDP(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, int, char*, unsigned int)
void sendUDP(int sockfd, std::string& add, int port, char* buf, uint32_t len)
{
    struct sockaddr_in servaddr,cliaddr;
    struct hostent *server;

    server = gethostbyname(add.c_str());

    if(server == NULL)
    {
        std::cout << "Host does not exist" << std::endl;
        exit(1);
    }

    memset((char *) &servaddr,0, sizeof(servaddr));
    servaddr.sin_family = AF_INET;
    memcpy((char *) &servaddr.sin_addr.s_addr,(char *) server -> h_addr, server -> h_length);
    servaddr.sin_port = htons(port);
/*
    //int random = rand() % 100;
    //if ((random) <= 10 ) return; 

    static int counter = 1;
    if ((counter++) % 4 == 0 ){
        //std::cout << "Drop message: " << (unsigned int) (((Message* )(buf))->type) << " " << add << std::endl;
        return; 
    } 
*/

    int ret = sendto(sockfd,buf, len, 0, (struct sockaddr *)&servaddr,sizeof(servaddr));

    if (ret == -1)
    {
        printf("Error in sendUDP: cannot send\n");
        return;
    }
    UDPsent++;
    //printf("Message sent\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, %r15d
movq %rcx, %rbx
movl %edx, %r12d
movl %edi, %r14d
movq (%rsi), %rdi
callq 0x43e0
testq %rax, %rax
je 0x11652
xorps %xmm0, %xmm0
leaq -0x3c(%rbp), %r13
movaps %xmm0, -0x4(%r13)
movw $0x2, -0x4(%r13)
movq 0x18(%rax), %rcx
movq (%rcx), %rsi
movslq 0x14(%rax), %rdx
movq %r13, %rdi
callq 0x42d0
rolw $0x8, %r12w
movw %r12w, -0x2(%r13)
movl %r15d, %edx
leaq -0x40(%rbp), %r8
movl %r14d, %edi
movq %rbx, %rsi
xorl %ecx, %ecx
movl $0x10, %r9d
callq 0x4070
cmpl $-0x1, %eax
jne 0x1163d
leaq 0x27fe(%rip), %rdi      # 0x13e34
callq 0x4500
jmp 0x11643
incl 0x7f4d(%rip)            # 0x19590
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x7967(%rip), %rdi      # 0x18fc0
leaq 0x2766(%rip), %rsi      # 0x13dc6
callq 0x4390
movq %rax, %rdi
callq 0x41e0
movl $0x1, %edi
callq 0x4400
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/connections.cpp
// Function: open_socket(int)
int open_socket(int port)
{
    struct sockaddr_in svrAdd, clntAdd;
    int listenFd;
    
    //create socket
    listenFd = socket(AF_INET, SOCK_STREAM, 0);
    int yes = 1;

    if (setsockopt(listenFd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) == -1) 
    {
        printf("setsockopt\n");
        exit(1);
    }
    
    if(listenFd < 0)
    {
        std::cout << "Cannot open socket" << std::endl;
        exit(1);
    }
    
    memset((char*) &svrAdd,0, sizeof(svrAdd));
    
    svrAdd.sin_family = AF_INET;
    svrAdd.sin_addr.s_addr = INADDR_ANY;
    svrAdd.sin_port = htons(port);
    
    //bind socket

    int ret = ::bind(listenFd, (struct sockaddr *)&svrAdd, sizeof(svrAdd));
    if(ret < 0)
    {
        std::cout << "open_socket: Cannot bind" << std::endl;
        exit(1);
    }
    // printf("TCP Listening at port %d...\n", port);

    return listenFd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movl %edi, %r14d
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x40e0
movl %eax, %ebx
leaq -0x14(%rbp), %rcx
movl $0x1, (%rcx)
movl %eax, %edi
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x4640
cmpl $-0x1, %eax
je 0x116fd
testl %ebx, %ebx
js 0x1170b
xorps %xmm0, %xmm0
leaq -0x30(%rbp), %rsi
movaps %xmm0, (%rsi)
movw $0x2, (%rsi)
movl $0x0, 0x4(%rsi)
rolw $0x8, %r14w
movw %r14w, 0x2(%rsi)
movl %ebx, %edi
movl $0x10, %edx
callq 0x40b0
testl %eax, %eax
js 0x1171b
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x274e(%rip), %rdi      # 0x13e52
callq 0x4500
jmp 0x11736
movq 0x78ae(%rip), %rdi      # 0x18fc0
leaq 0x2681(%rip), %rsi      # 0x13d9a
jmp 0x11729
movq 0x789e(%rip), %rdi      # 0x18fc0
leaq 0x2684(%rip), %rsi      # 0x13dad
callq 0x4390
movq %rax, %rdi
callq 0x41e0
movl $0x1, %edi
callq 0x4400
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/connections.cpp
// Function: listen_socket(int)
int listen_socket(int listenFd)
{

    socklen_t len; //store size of the address
    int connFd;
    struct sockaddr_in clntAdd;

    listen(listenFd, 5);
    
    len = sizeof(clntAdd);

    //this is where client connects. svr will hang in this mode until client conn
    connFd = accept(listenFd, (struct sockaddr *)&clntAdd, &len);

    if (connFd < 0)
    {
        std::cout << "Cannot accept connection" << std::endl;
        exit(1);
    }
    else
    {
        //std::cout << "Server Connection successful " << std::endl;
    }

    return connFd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
movl %edi, %ebx
movl $0x5, %esi
callq 0x43c0
leaq -0xc(%rbp), %rdx
movl $0x10, (%rdx)
leaq -0x1c(%rbp), %rsi
movl %ebx, %edi
callq 0x4150
testl %eax, %eax
js 0x11775
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
movq 0x7844(%rip), %rdi      # 0x18fc0
leaq 0x2657(%rip), %rsi      # 0x13dda
callq 0x4390
movq %rax, %rdi
callq 0x41e0
movl $0x1, %edi
callq 0x4400
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/connections.cpp
// Function: connect_to_server(char const*, int, int*)
int connect_to_server(const char* add, int port, int* connectionFd)
{
    struct sockaddr_in svrAdd;
    struct hostent *server;
    
    if((port > 65535) || (port < 2000))
    {
        std::cout<<"Please enter port number between 2000 - 65535"<<std::endl;
        exit(1);
    }       
    
    //create client skt
    *connectionFd = socket(AF_INET, SOCK_STREAM, 0);
        int iSetOption = 1;
    setsockopt(*connectionFd, SOL_SOCKET, SO_REUSEADDR, (char*)&iSetOption,
        sizeof(iSetOption));
    
    if(*connectionFd < 0)
    {
        std::cout << "Cannot open socket" << std::endl;
        exit(1);
    }
    else{
        //std::cout << "Socket opened" << std::endl;
    }
    
    server = gethostbyname(add);
    
    if(server == NULL)
    {
        std::cout << "Host does not exist" << std::endl;
        exit(1);
    }
    
    memset((char *) &svrAdd,0, sizeof(svrAdd));
    svrAdd.sin_family = AF_INET;
    
    memcpy((char *) &svrAdd.sin_addr.s_addr,(char *) server -> h_addr, server -> h_length);
    
    svrAdd.sin_port = htons(port);
    
    int checker = connect(*connectionFd,(struct sockaddr *) &svrAdd, sizeof(svrAdd));
    
    if (checker < 0)
    {
        //printf("Cannot connect to: %s \n",add);
        return -1;
        //exit(1);
    }
    else{
        return 0;
        //std::cout << "Client Connection Successful" << std::endl;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %esi, %r14d
leal -0x10000(%r14), %eax
cmpl $0xffff07cf, %eax       # imm = 0xFFFF07CF
jbe 0x11856
movq %rdx, %rbx
movq %rdi, %r15
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x40e0
movl %eax, (%rbx)
leaq -0x1c(%rbp), %rcx
movl $0x1, (%rcx)
movl %eax, %edi
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x4640
cmpl $0x0, (%rbx)
js 0x11866
movq %r15, %rdi
callq 0x43e0
testq %rax, %rax
je 0x11876
xorps %xmm0, %xmm0
leaq -0x2c(%rbp), %r15
movaps %xmm0, -0x4(%r15)
movw $0x2, -0x4(%r15)
movq 0x18(%rax), %rcx
movq (%rcx), %rsi
movslq 0x14(%rax), %rdx
movq %r15, %rdi
callq 0x42d0
rolw $0x8, %r14w
movw %r14w, -0x2(%r15)
movl (%rbx), %edi
leaq -0x30(%rbp), %rsi
movl $0x10, %edx
callq 0x42e0
sarl $0x1f, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x7763(%rip), %rdi      # 0x18fc0
leaq 0x258f(%rip), %rsi      # 0x13df3
jmp 0x11884
movq 0x7753(%rip), %rdi      # 0x18fc0
leaq 0x2526(%rip), %rsi      # 0x13d9a
jmp 0x11884
movq 0x7743(%rip), %rdi      # 0x18fc0
leaq 0x2542(%rip), %rsi      # 0x13dc6
callq 0x4390
movq %rax, %rdi
callq 0x41e0
movl $0x1, %edi
callq 0x4400
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/connections.cpp
// Function: robustRead(int, char*, int)
int robustRead(int connFd, char * buffer, int length){
    int count = 0, add = 0;
    while(count < length){
        if( (add = read(connFd, buffer, length)) > 0 ){
            count += add;
            buffer += add;
        }
        else if( add < 0 ){
            return -10;
        }
        else if(add == 0){
            break;
        }
    }
    return count;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testl %edx, %edx
jle 0x118e1
movl %edx, %r14d
movq %rsi, %r15
movl %edi, %r12d
movl %edx, %r13d
xorl %ebx, %ebx
movl %r12d, %edi
movq %r15, %rsi
movq %r13, %rdx
callq 0x44b0
testl %eax, %eax
jle 0x118e5
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq %rcx, %r15
addl %eax, %ebx
cmpl %r14d, %ebx
jl 0x118bb
jmp 0x118ed
xorl %ebx, %ebx
jmp 0x118ed
movl $0xfffffff6, %eax       # imm = 0xFFFFFFF6
cmovnel %eax, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/connections.cpp
// Function: robustWrite(int, char*, int)
int robustWrite(int connFd, char * buffer, int length){
    int count = 0, add = 0;
    while(count < length){
        if( ( add = write(connFd, buffer, length)) > 0 ){
            count += add;
            buffer += add;
        }
        else if( add < 0 ){
            return -1;
        }
    }
    return count;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testl %edx, %edx
jle 0x11946
movl %edx, %ebx
movq %rsi, %r15
movl %edi, %r12d
movl %edx, %r13d
xorl %r14d, %r14d
movl %r12d, %edi
movq %r15, %rsi
movq %r13, %rdx
callq 0x4170
testl %eax, %eax
jle 0x1193d
addl %eax, %r14d
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
addq %rax, %r15
jmp 0x1193f
js 0x1194b
cmpl %ebx, %r14d
jl 0x1191e
jmp 0x11951
xorl %r14d, %r14d
jmp 0x11951
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/connections.cpp
// Function: splitWrite(int, char*, unsigned long)
size_t splitWrite( int connFd, char * data, size_t size ){
    
    int msg_num = size / BUFFER_MAX + 1;
    int rest = size % ((int)BUFFER_MAX);
    
    //store the should-be message sizes
    message *msgs = new message[msg_num];
    for(int i=1; i < msg_num; i++){
        msgs[i].begin = msgs[i-1].begin + BUFFER_MAX;
    }
    msgs[msg_num-1].length = rest;

    char writeSuccess = 0;
    for(int i=0; i < msg_num; i++){
        //write each message, max size is BUFFER_MAX
        robustWrite( connFd, data + msgs[i].begin, msgs[i].length );
        
        //cout<<"Server: sent " << msgs[i].length << endl;
        //usleep(200*1000);
        
        //make sure client do got the data
        robustRead( connFd, &writeSuccess, 1 );
        
        //cout<<"Server: recv "<<(int)writeSuccess<<endl;
        //usleep(200*1000);

        //if package failed, send again
        if(writeSuccess==0) i--;
    }
    return size;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, -0x40(%rbp)
movl %edi, %r15d
movq %rdx, %r13
shrq $0x17, %r13
leal 0x1(%r13), %eax
movq %rdx, -0x38(%rbp)
movl %edx, %ebx
movl %eax, -0x30(%rbp)
movslq %eax, %r14
leaq (,%r14,8), %rax
testl %r14d, %r14d
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0x4030
movq %rax, %r12
movl %r13d, %eax
incl %eax
je 0x119d4
leaq (%r12,%r14,8), %rax
movabsq $0x80000000000000, %rcx # imm = 0x80000000000000
movq %r12, %rdx
movq %rcx, (%rdx)
addq $0x8, %rdx
cmpq %rax, %rdx
jne 0x119c8
andl $0x7fffff, %ebx         # imm = 0x7FFFFF
cmpl $0x2, -0x30(%rbp)
jl 0x119fd
movl $0x1, %eax
movl $0x800000, %ecx         # imm = 0x800000
movl -0x8(%r12,%rax,8), %edx
addl %ecx, %edx
movl %edx, (%r12,%rax,8)
incq %rax
cmpq %rax, %r14
jne 0x119ea
movslq %r13d, %rax
movl %ebx, 0x4(%r12,%rax,8)
movb $0x0, -0x29(%rbp)
cmpl $0x7ffffffe, %r13d      # imm = 0x7FFFFFFE
ja 0x11a67
xorl %r14d, %r14d
movslq %r14d, %rax
movslq (%r12,%rax,8), %rsi
addq -0x40(%rbp), %rsi
movl 0x4(%r12,%rax,8), %edx
movl %r15d, %edi
callq 0x118fe
xorl %ebx, %ebx
leaq -0x29(%rbp), %r13
movl $0x1, %edx
movl %r15d, %edi
movq %r13, %rsi
callq 0x44b0
testl %eax, %eax
jle 0x11a56
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq %rcx, %r13
addl %eax, %ebx
jle 0x11a33
cmpb $0x1, -0x29(%rbp)
sbbl $0x0, %r14d
incl %r14d
cmpl -0x30(%rbp), %r14d
jl 0x11a15
movq -0x38(%rbp), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/connections.cpp
// Function: splitRead(int, char*, unsigned long)
size_t splitRead( int connFd, char * data, size_t size ){
    
    int msg_num = size / BUFFER_MAX + 1;
    int rest = size % ((int)BUFFER_MAX);
    
    //store the should-be message sizes
    message *msgs = new message[msg_num];
    for(int i=1; i < msg_num; i++){
        msgs[i].begin = msgs[i-1].begin + BUFFER_MAX;
    }
    msgs[msg_num-1].length = rest;

    char readSuccess = 0;
    int readSize;

    for(int i=0; i < msg_num; i++){

        //read message from socket. max size BUFFER_MAX
        readSize = robustRead( connFd, data + msgs[i].begin, msgs[i].length );
        
        //cout<<"client recv size :" << readSize << endl;
        //usleep(200*1000);

        //check if reading success or not
        if(readSize == msgs[i].length)  readSuccess = 1;
        else    readSuccess = 0;

        //tell server the data transmission status (good or fail)
        robustWrite( connFd, &readSuccess, 1);
        
        //cout<<"Client: sent "<<endl;
        //usleep(200*1000);
        
        //if reading faile, read again
        if(readSuccess==0) i--;
    }
    return size;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, -0x50(%rbp)
movl %edi, %r15d
movq %rdx, %rbx
shrq $0x17, %rbx
leal 0x1(%rbx), %eax
movq %rdx, -0x40(%rbp)
movl %edx, %r14d
movl %eax, -0x30(%rbp)
movslq %eax, %r13
leaq (,%r13,8), %rax
testl %r13d, %r13d
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0x4030
movq %rax, %r12
movl %ebx, %eax
incl %eax
je 0x11aea
leaq (%r12,%r13,8), %rax
movabsq $0x80000000000000, %rcx # imm = 0x80000000000000
movq %r12, %rdx
movq %rcx, (%rdx)
addq $0x8, %rdx
cmpq %rax, %rdx
jne 0x11ade
andl $0x7fffff, %r14d        # imm = 0x7FFFFF
cmpl $0x2, -0x30(%rbp)
jl 0x11b14
movl $0x1, %eax
movl $0x800000, %ecx         # imm = 0x800000
movl -0x8(%r12,%rax,8), %edx
addl %ecx, %edx
movl %edx, (%r12,%rax,8)
incq %rax
cmpq %rax, %r13
jne 0x11b01
movslq %ebx, %rax
movl %r14d, 0x4(%r12,%rax,8)
movb $0x0, -0x29(%rbp)
cmpl $0x7ffffffe, %ebx       # imm = 0x7FFFFFFE
ja 0x11b9e
xorl %r14d, %r14d
movq %r12, -0x48(%rbp)
movslq %r14d, %rbx
movslq (%r12,%rbx,8), %rsi
addq -0x50(%rbp), %rsi
movl 0x4(%r12,%rbx,8), %edx
movl %r15d, %edi
callq 0x1189b
movl 0x4(%r12,%rbx,8), %r12d
movl %eax, -0x34(%rbp)
cmpl %r12d, %eax
sete -0x29(%rbp)
xorl %r13d, %r13d
leaq -0x29(%rbp), %rbx
movl $0x1, %edx
movl %r15d, %edi
movq %rbx, %rsi
callq 0x4170
testl %eax, %eax
jle 0x11b7e
addl %eax, %r13d
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
addq %rax, %rbx
jmp 0x11b80
js 0x11b85
testl %r13d, %r13d
jle 0x11b5d
xorl %eax, %eax
cmpl %r12d, -0x34(%rbp)
setne %al
subl %eax, %r14d
incl %r14d
cmpl -0x30(%rbp), %r14d
movq -0x48(%rbp), %r12
jl 0x11b2f
movq -0x40(%rbp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/ChronoCpu.cpp
// Function: ChronoCpu::doTic()
void ChronoCpu::doTic(void)
{
	lastTicTime = ticTime;

#ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time
	clock_serv_t cclock;
	mach_timespec_t mts;
	host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
	clock_get_time(cclock, &mts);
	mach_port_deallocate(mach_task_self(), cclock);
	ticTime.tv_sec = mts.tv_sec;
	ticTime.tv_nsec = mts.tv_nsec;

#else
	if (clock_gettime(CLOCK_REALTIME, &ticTime) != 0){
		++errors;
		cerr << "ChronoCpu::doTic - " << name << ": clock_gettime() failed!" << endl;
		return;
	}
#endif

	++ticCounter;

	if (ticCounter > 1){
		float period_s = (float)(ticTime.tv_sec - lastTicTime.tv_sec);
		float period_ns = (float)(ticTime.tv_nsec - lastTicTime.tv_nsec);
		periodStats.lastTime_ms = period_s * 1e3f + period_ns / 1e6f;
		updateStats(periodStats);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0xc0(%rdi), %rsi
movups 0xc0(%rdi), %xmm0
movups %xmm0, 0xb0(%rdi)
xorl %edi, %edi
callq 0x4330
testl %eax, %eax
je 0x11cb8
incl 0x2c(%rbx)
movq 0x739e(%rip), %r14      # 0x18ff0
leaq 0x220f(%rip), %rsi      # 0x13e68
movl $0x13, %edx
movq %r14, %rdi
callq 0x43f0
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
movq %r14, %rdi
callq 0x43f0
movq %rax, %rbx
leaq 0x21fc(%rip), %rsi      # 0x13e7c
movl $0x19, %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
popq %rbx
popq %r14
popq %rbp
jmp 0x4260
movl 0xe0(%rbx), %eax
incl %eax
movl %eax, 0xe0(%rbx)
cmpl $0x2, %eax
jb 0x11d20
movq 0xc0(%rbx), %rax
subq 0xb0(%rbx), %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
movq 0xc8(%rbx), %rax
subq 0xb8(%rbx), %rax
cvtsi2ss %rax, %xmm1
divss 0x2164(%rip), %xmm1     # 0x13e60
mulss 0x2160(%rip), %xmm0     # 0x13e64
addss %xmm1, %xmm0
leaq 0x70(%rbx), %rsi
movss %xmm0, 0xa4(%rbx)
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x1265c
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/ChronoCpu.cpp
// Function: ChronoCpu::doTac()
void ChronoCpu::doTac(void)
{
#ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time
	clock_serv_t cclock;
	mach_timespec_t mts;
	host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
	clock_get_time(cclock, &mts);
	mach_port_deallocate(mach_task_self(), cclock);
	tacTime.tv_sec = mts.tv_sec;
	tacTime.tv_nsec = mts.tv_nsec;

#else
	if (clock_gettime(CLOCK_REALTIME, &tacTime) != 0){
		++errors;
		cerr << "ChronoCpu::doTac - " << name << ": clock_gettime() failed!" << endl;
		return;
	}
#endif

	float elapsed_s = (float)(tacTime.tv_sec - ticTime.tv_sec);
	float elapsed_ns = (float)(tacTime.tv_nsec - ticTime.tv_nsec);
	elapsedStats.lastTime_ms = elapsed_s * 1e3f + elapsed_ns / 1e6f;
	updateStats(elapsedStats);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0xd0(%rdi), %rsi
xorl %edi, %edi
callq 0x4330
testl %eax, %eax
je 0x11db2
incl 0x2c(%rbx)
movq 0x72a4(%rip), %r14      # 0x18ff0
leaq 0x2143(%rip), %rsi      # 0x13e96
movl $0x13, %edx
movq %r14, %rdi
callq 0x43f0
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
movq %r14, %rdi
callq 0x43f0
movq %rax, %rbx
leaq 0x2102(%rip), %rsi      # 0x13e7c
movl $0x19, %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
popq %rbx
popq %r14
popq %rbp
jmp 0x4260
movq 0xd0(%rbx), %rax
subq 0xc0(%rbx), %rax
cvtsi2ss %rax, %xmm0
movq 0xd8(%rbx), %rax
subq 0xc8(%rbx), %rax
cvtsi2ss %rax, %xmm1
divss 0x2080(%rip), %xmm1     # 0x13e60
mulss 0x207c(%rip), %xmm0     # 0x13e64
addss %xmm1, %xmm0
leaq 0x30(%rbx), %rsi
movss %xmm0, 0x64(%rbx)
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x1265c
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/Chrono.cpp
// Function: Chrono::tic()
void Chrono::tic(void)
{
	if (!enabled){
		return;
	}

	if (ticIdle){
		ticIdle = false;
		doTic();
	} else{
		++errors;
		cerr << "Chrono::tic - " << name << ": Calling Chrono::tic with no matching Chrono::tag!" << endl;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
cmpb $0x1, 0x28(%rdi)
jne 0x11fcf
movq %rdi, %rbx
cmpb $0x1, 0x29(%rdi)
jne 0x11fd4
movb $0x0, 0x29(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmpq *0x10(%rax)
popq %rbx
popq %r14
popq %rbp
retq
incl 0x2c(%rbx)
movq 0x7012(%rip), %r14      # 0x18ff0
leaq 0x1ef0(%rip), %rsi      # 0x13ed5
movl $0xe, %edx
movq %r14, %rdi
callq 0x43f0
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
movq %r14, %rdi
callq 0x43f0
movq %rax, %rbx
leaq 0x1ed8(%rip), %rsi      # 0x13ee4
movl $0x33, %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
popq %rbx
popq %r14
popq %rbp
jmp 0x4260
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/Chrono.cpp
// Function: Chrono::tac()
void Chrono::tac(void)
{
	if (!enabled){
		return;
	}

	if (!ticIdle){
		ticIdle = true;
		doTac();
	} else{
		++errors;
		cerr << "Chrono::tac - " << name << ": Calling Chrono::tac with no matching Chrono::tic!" << endl;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
cmpb $0x1, 0x28(%rdi)
jne 0x120ca
movq %rdi, %rbx
cmpb $0x0, 0x29(%rdi)
je 0x120cf
incl 0x2c(%rbx)
movq 0x6f8c(%rip), %r14      # 0x18ff0
leaq 0x1ead(%rip), %rsi      # 0x13f18
movl $0xe, %edx
movq %r14, %rdi
callq 0x43f0
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
movq %r14, %rdi
callq 0x43f0
movq %rax, %rbx
leaq 0x1e95(%rip), %rsi      # 0x13f27
movl $0x33, %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
popq %rbx
popq %r14
popq %rbp
jmp 0x4260
popq %rbx
popq %r14
popq %rbp
retq
movb $0x1, 0x29(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmpq *0x18(%rax)
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/Chrono.cpp
// Function: Chrono::printAvgTime(Chrono::ChronoStats const&, std::ostream&) const
std::ostream& Chrono::printAvgTime(const Chrono::ChronoStats& stats, std::ostream& os) const
{
	os.precision(2);
	os << fixed;
	os << name << ": " << stats.name << " -> " << "averageTime: " << stats.averageTime_ms << " [ms]" << endl;

	return os;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq (%rdx), %rax
movq -0x18(%rax), %rcx
movq $0x2, 0x8(%rdx,%rcx)
movq -0x18(%rax), %rax
movl $0xfffffefb, %ecx       # imm = 0xFFFFFEFB
andl 0x18(%rdx,%rax), %ecx
orl $0x4, %ecx
movl %ecx, 0x18(%rdx,%rax)
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rdx
movq %rbx, %rdi
callq 0x43f0
movq %rax, %r15
leaq 0xfb3(%rip), %rsi       # 0x13443
movl $0x2, %edx
movq %rax, %rdi
callq 0x43f0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r15, %rdi
callq 0x43f0
movq %rax, %r15
leaq 0x1b01(%rip), %rsi      # 0x13fb7
movl $0x4, %edx
movq %rax, %rdi
callq 0x43f0
leaq 0x1aaf(%rip), %rsi      # 0x13f79
movl $0xd, %edx
movq %r15, %rdi
callq 0x43f0
cvtss2sd 0x2c(%r14), %xmm0
movq %r15, %rdi
callq 0x4560
movq %rax, %r14
leaq 0x1a83(%rip), %rsi      # 0x13f72
movl $0x5, %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
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/Chrono.cpp
// Function: Chrono::printAvgTime(Chrono::ChronoStats const&, std::ostream&, float) const
std::ostream& Chrono::printAvgTime(const Chrono::ChronoStats& stats, std::ostream& os, const float ref) const
{
	os.precision(2);
	os << fixed;
	os << name << ": " << stats.name << " -> " << "averageTime: " << stats.averageTime_ms << " [ms] (";
	os << (stats.averageTime_ms/ref*100.0f) << "%)" << endl;

	return os;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movss %xmm0, -0x1c(%rbp)
movq %rdx, %rbx
movq %rsi, %r14
movq (%rdx), %rax
movq -0x18(%rax), %rcx
movq $0x2, 0x8(%rdx,%rcx)
movq -0x18(%rax), %rax
movl $0xfffffefb, %ecx       # imm = 0xFFFFFEFB
andl 0x18(%rdx,%rax), %ecx
orl $0x4, %ecx
movl %ecx, 0x18(%rdx,%rax)
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rdx
movq %rbx, %rdi
callq 0x43f0
movq %rax, %r15
leaq 0xebe(%rip), %rsi       # 0x13443
movl $0x2, %edx
movq %rax, %rdi
callq 0x43f0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r15, %rdi
callq 0x43f0
movq %rax, %r15
leaq 0x1a0c(%rip), %rsi      # 0x13fb7
movl $0x4, %edx
movq %rax, %rdi
callq 0x43f0
leaq 0x19ba(%rip), %rsi      # 0x13f79
movl $0xd, %edx
movq %r15, %rdi
callq 0x43f0
xorps %xmm0, %xmm0
cvtss2sd 0x2c(%r14), %xmm0
movq %r15, %rdi
callq 0x4560
leaq 0x19d8(%rip), %rsi      # 0x13fbc
movl $0x7, %edx
movq %rax, %rdi
callq 0x43f0
movss 0x2c(%r14), %xmm0
divss -0x1c(%rbp), %xmm0
mulss 0x18b4(%rip), %xmm0     # 0x13eb8
cvtss2sd %xmm0, %xmm0
movq %rbx, %rdi
callq 0x4560
movq %rax, %r14
leaq 0x19aa(%rip), %rsi      # 0x13fc4
movl $0x2, %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
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/luisremis[P]SDFS/Chrono.cpp
// Function: Chrono::updateStats(Chrono::ChronoStats&)
void Chrono::updateStats(ChronoStats& stats)
{
	++stats.counter;
	stats.totalTime_ms += stats.lastTime_ms;
	stats.totalSquaredTime_ms2 += stats.lastTime_ms * stats.lastTime_ms;
	stats.averageTime_ms = stats.totalTime_ms / (float)stats.counter;
	stats.stdDevTime_ms = sqrtf(stats.totalSquaredTime_ms2 / (float)stats.counter - stats.averageTime_ms * stats.averageTime_ms);
	if (stats.counter > 1){
		stats.maxTime_ms = max(stats.lastTime_ms, stats.maxTime_ms);
		stats.minTime_ms = min(stats.lastTime_ms, stats.minTime_ms);
	} else{
		stats.maxTime_ms = stats.lastTime_ms;
		stats.minTime_ms = stats.lastTime_ms;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl 0x20(%rsi), %eax
incl %eax
movl %eax, 0x20(%rsi)
movss 0x34(%rsi), %xmm0
movss 0x24(%rsi), %xmm1
addss %xmm0, %xmm1
movss %xmm1, 0x24(%rsi)
mulss %xmm0, %xmm0
addss 0x28(%rsi), %xmm0
movss %xmm0, 0x28(%rsi)
cvtsi2ss %rax, %xmm2
divss %xmm2, %xmm1
movss %xmm1, 0x2c(%rsi)
divss %xmm2, %xmm0
mulss %xmm1, %xmm1
subss %xmm1, %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0x126b6
sqrtss %xmm0, %xmm0
jmp 0x126bb
callq 0x4670
movss %xmm0, 0x30(%rbx)
cmpl $0x2, 0x20(%rbx)
jb 0x126e9
movss 0x3c(%rbx), %xmm0
movss 0x34(%rbx), %xmm1
movss 0x38(%rbx), %xmm2
maxss %xmm1, %xmm0
movss %xmm0, 0x3c(%rbx)
minss %xmm1, %xmm2
movss %xmm2, 0x38(%rbx)
jmp 0x126f8
movss 0x34(%rbx), %xmm0
movss %xmm0, 0x3c(%rbx)
movss %xmm0, 0x38(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/aaronpuchert[P]throttle/src/main.cpp
// Function: main
int main(int argc, char **argv)
{
	const char *config_fn, *pipe_fn;

	// Read arguments from command line, or take the defaults
	config_fn = (argc > 1) ? argv[1] : "throttle.conf";
	pipe_fn = (argc > 2) ? argv[2] : "pipe";

	// Block SIGINT, SIGQUIT, SIGTERM - we're going to wait for them explicitly.
	sigset_t signals;
	sigemptyset(&signals);
	sigaddset(&signals, SIGINT);
	sigaddset(&signals, SIGQUIT);
	sigaddset(&signals, SIGTERM);
	sigprocmask(SIG_BLOCK, &signals, nullptr);

	constexpr struct timespec wait_time{wait, 0};

	try {
		// create Throttle object
		Throttle throttle = Throttle::createFromConfig(config_fn, pipe_fn);

		// Run the feedback loop
		do
			throttle();
		while (sigtimedwait(&signals, nullptr, &wait_time) == -1);
	}
	catch (const std::runtime_error& ex) {
		std::cerr << "Error: " <<  ex.what() << std::endl;
		return 1;
	}

	DEBUG_PRINT("[Main] Successful shutdown");

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x120, %rsp            # imm = 0x120
cmpl $0x2, %edi
jl 0x2513
movq 0x8(%rsi), %rbx
jmp 0x251a
leaq 0x2aea(%rip), %rbx      # 0x5004
cmpl $0x3, %edi
jl 0x2525
movq 0x10(%rsi), %r14
jmp 0x252c
leaq 0x2c39(%rip), %r14      # 0x5165
leaq 0xa0(%rsp), %r15
movq %r15, %rdi
callq 0x2220
movq %r15, %rdi
movl $0x2, %esi
callq 0x2280
movq %r15, %rdi
movl $0x3, %esi
callq 0x2280
movq %r15, %rdi
movl $0xf, %esi
callq 0x2280
xorl %edi, %edi
movq %r15, %rsi
xorl %edx, %edx
callq 0x20d0
movups 0x2aaa(%rip), %xmm0     # 0x5020
movaps %xmm0, (%rsp)
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x28bc
leaq 0x10(%rsp), %rbx
leaq 0xa0(%rsp), %r14
movq %rsp, %r15
movq %rbx, %rdi
callq 0x2c52
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x2110
cmpl $-0x1, %eax
je 0x259a
leaq 0x88(%rsp), %rbx
movq %rbx, %rdi
callq 0x3d3e
movq -0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x25da
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x21f0
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
callq 0x26e6
movq -0x28(%rbx), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x2602
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21f0
xorl %eax, %eax
addq $0x120, %rsp            # imm = 0x120
popq %rbx
popq %r14
popq %r15
retq
movq %rdx, %r14
movq %rax, %rbx
jmp 0x2629
movq %rdx, %r14
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2696
cmpl $0x1, %r14d
jne 0x2686
movq %rbx, %rdi
callq 0x20b0
movq %rax, %rbx
movq 0x59a7(%rip), %rdi      # 0x7fe8
leaq 0x29ca(%rip), %rsi      # 0x5012
movl $0x7, %edx
callq 0x2210
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq 0x5986(%rip), %rdi      # 0x7fe8
movq %rax, %rsi
callq 0x21d0
movq %rax, %rdi
callq 0x20e0
callq 0x22e0
movl $0x1, %eax
jmp 0x2604
movq %rax, %rbx
callq 0x22e0
movq %rbx, %rdi
callq 0x2330
movq %rax, %rdi
callq 0x26db
// File: /workspace/github_cpp_makefile_star2_O1/aaronpuchert[P]throttle/src/throttle.cpp
// Function: Throttle::FreqFilenames::FreqFilenames(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned int)
Throttle::FreqFilenames::FreqFilenames(
	const std::string &prefix, const std::string &suffix, unsigned numCores)
	: numCores(numCores), templates(log10(numCores) + 1), prefix_size(prefix.size())
{
	size_t suffix_size = suffix.size();
	for (unsigned i = 0; i != templates.size(); ++i) {
		templates[i].reserve(prefix_size + (i + 1) + suffix_size);
		templates[i] = prefix;
		templates[i].append(i + 1, '#');
		templates[i] += suffix;
		DEBUG_PRINT("[Throttle] Template for length " << i + 1 << ": " << templates[i]);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rsi, 0x8(%rsp)
movq %rdi, %r12
movl %ecx, (%rdi)
leaq 0x8(%rdi), %rbx
movl $0x1, %esi
cmpl $0xa, %ecx
jb 0x278c
movl $0x1, %eax
movl $0xcccccccd, %edx       # imm = 0xCCCCCCCD
movl %ecx, %esi
imulq %rdx, %rsi
shrq $0x23, %rsi
incl %eax
cmpl $0x63, %ecx
movl %esi, %ecx
ja 0x2777
movl %eax, %esi
leaq 0x7(%rsp), %rdx
movq %rbx, %rdi
callq 0x2e80
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x20(%r12)
movq 0x8(%r14), %rax
movq %rax, 0x10(%rsp)
movl $0x1, %r15d
leal -0x1(%r15), %r13d
movq 0x8(%r12), %rdi
movq 0x10(%r12), %rax
subq %rdi, %rax
sarq $0x5, %rax
cmpq %r13, %rax
je 0x282f
shlq $0x5, %r13
addq %r13, %rdi
movl %r15d, %ebp
movq 0x10(%rsp), %rax
leaq (%rax,%rbp), %rsi
addq 0x20(%r12), %rsi
callq 0x22a0
movq (%rbx), %rdi
addq %r13, %rdi
movq 0x8(%rsp), %rsi
callq 0x2120
movq (%rbx), %rdi
movq 0x8(%rdi,%r13), %rsi
addq %r13, %rdi
xorl %edx, %edx
movq %rbp, %rcx
movl $0x23, %r8d
callq 0x2360
addq (%rbx), %r13
movq (%r14), %rsi
movq 0x8(%r14), %rdx
incl %r15d
movq %r13, %rdi
callq 0x2070
jmp 0x27b6
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x26e6
movq %r14, %rdi
callq 0x2330
nop
// File: /workspace/github_cpp_makefile_star2_O1/aaronpuchert[P]throttle/src/throttle.cpp
// Function: Throttle::FreqFilenames::operator[](unsigned int) const
const char *Throttle::FreqFilenames::operator[](unsigned core) const
{
	unsigned bucket = log10(core);
	std::string &ret = templates[bucket];
	unsigned print = core;
	do {
		ret[prefix_size + bucket] = '0' + char(print % 10);
		print /= 10;
	} while (bucket--);
	DEBUG_PRINT("[Throttle] Filename for core " << core << ": " << ret);
	return ret.c_str();
}

// Assembly:
xorl %eax, %eax
cmpl $0xa, %esi
jb 0x2877
movl $0xcccccccd, %ecx       # imm = 0xCCCCCCCD
movl %esi, %edx
movl %edx, %r8d
imulq %rcx, %r8
shrq $0x23, %r8
incl %eax
cmpl $0x63, %edx
movl %r8d, %edx
ja 0x2860
movl %eax, %eax
movq %rax, %rcx
shlq $0x5, %rcx
addq 0x8(%rdi), %rcx
incq %rax
movl $0xcccccccd, %edx       # imm = 0xCCCCCCCD
movl %esi, %r8d
imulq %rdx, %r8
shrq $0x23, %r8
leal (%r8,%r8), %r9d
leal (%r9,%r9,4), %r9d
subl %r9d, %esi
movq (%rcx), %r9
addq 0x20(%rdi), %r9
orb $0x30, %sil
movb %sil, -0x1(%rax,%r9)
movl %r8d, %esi
decq %rax
jne 0x288a
movq (%rcx), %rax
retq
// File: /workspace/github_cpp_makefile_star2_O1/aaronpuchert[P]throttle/src/throttle.cpp
// Function: Throttle::operator()()
void Throttle::operator()()
{
	// Look if there is new input in the pipe
	queue.update();

	if (override_freq) {
		if (freq != override_freq) {
			freq = override_freq;
			writeFreq();
		}
	}
	else
		adjust();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
addq $0x78, %rdi
callq 0x3d52
movl 0x88(%rbx), %eax
testl %eax, %eax
je 0x2c70
cmpl %eax, 0x68(%rbx)
jne 0x2c79
popq %rbx
retq
movq %rbx, %rdi
popq %rbx
jmp 0x2d32
movl %eax, 0x68(%rbx)
movq %rbx, %rdi
popq %rbx
jmp 0x2c86
nop
// File: /workspace/github_cpp_makefile_star2_O1/aaronpuchert[P]throttle/src/throttle.cpp
// Function: Throttle::writeFreq() const
void Throttle::writeFreq() const
{
	DEBUG_PRINT("[Throttle] New frequency: " << (float)freq/1000 << " MHz");

	// loop over the files, write the frequency in each
       for (unsigned core = 0; core != freq_fn.size(); ++core) {
		std::ofstream freq_file(freq_fn[core]);
		freq_file << freq;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
cmpl $0x0, 0x20(%rdi)
je 0x2d0a
movq %rdi, %rbx
leaq 0x20(%rdi), %r14
movq 0x530d(%rip), %rax      # 0x7fb8
movq (%rax), %r15
movq 0x18(%rax), %r12
xorl %ebp, %ebp
leaq 0x8(%rsp), %r13
movq %r14, %rdi
movl %ebp, %esi
callq 0x2852
movq %r13, %rdi
movq %rax, %rsi
movl $0x10, %edx
callq 0x2200
movl 0x68(%rbx), %esi
movq %r13, %rdi
callq 0x2310
movq %r15, 0x8(%rsp)
movq -0x18(%r15), %rax
movq %r12, 0x8(%rsp,%rax)
leaq 0x10(%rsp), %rdi
callq 0x21a0
leaq 0x100(%rsp), %rdi
callq 0x2080
incl %ebp
cmpl (%r14), %ebp
jne 0x2cb9
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2270
movq %rbx, %rdi
callq 0x2330
nop
// File: /workspace/github_cpp_makefile_star2_O1/aaronpuchert[P]throttle/src/throttle.cpp
// Function: Throttle::adjust()
void Throttle::adjust()
{
	int temp = readTemp();
	std::vector<int>::const_iterator new_freq = freqs.end();

	DEBUG_PRINT("[Throttle] Temperature: " << (float)temp/1000 << "°C");

	// slowly reset stabilize counter
	if (stabilize > 0) --stabilize;
	if (stabilize < 0) ++stabilize;

	// If the temperature exceeds a threshold, find the next best frequency.
	if (temp > temp_max && stabilize >= 0) {
		new_freq = std::lower_bound(freqs.begin(), freqs.end(), freq);
		if (new_freq == freqs.begin())
			return;     // There is nothing we can do.
		else
			--new_freq;
		stabilize = -wait_after_adjust;
	}
	if (temp < temp_min && stabilize <= 0) {
		new_freq = std::upper_bound(freqs.begin(), freqs.end(), freq);
		stabilize = wait_after_adjust;
	}

	// Have we found one? Then adjust.
	if (new_freq != freqs.end()) {
		freq = *new_freq;
		writeFreq();
	}
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x2e28
movl 0x70(%rbx), %ecx
testl %ecx, %ecx
jle 0x2d47
decl %ecx
movl %ecx, 0x70(%rbx)
movl 0x70(%rbx), %ecx
testl %ecx, %ecx
jns 0x2d53
incl %ecx
movl %ecx, 0x70(%rbx)
movq 0x58(%rbx), %rcx
movq %rcx, %rdx
cmpl 0x48(%rbx), %eax
jle 0x2dc1
cmpl $0x0, 0x70(%rbx)
movq %rcx, %rdx
js 0x2dc1
movq 0x50(%rbx), %rsi
movq %rcx, %rdi
subq %rsi, %rdi
sarq $0x2, %rdi
movq %rsi, %rdx
testq %rdi, %rdi
jle 0x2db0
movl 0x68(%rbx), %r8d
movq %rsi, %rdx
movq %rdi, %r9
shrq %r9
movq %r9, %r10
notq %r10
addq %rdi, %r10
leaq (%rdx,%r9,4), %rdi
addq $0x4, %rdi
cmpl %r8d, -0x4(%rdi)
cmovlq %rdi, %rdx
cmovgeq %r9, %r10
movq %r10, %rdi
testq %r10, %r10
jg 0x2d85
cmpq %rsi, %rdx
je 0x2e25
addq $-0x4, %rdx
xorl %esi, %esi
subl 0x6c(%rbx), %esi
movl %esi, 0x70(%rbx)
cmpl 0x4c(%rbx), %eax
jge 0x2e12
cmpl $0x0, 0x70(%rbx)
jg 0x2e12
movq 0x50(%rbx), %rdx
movq %rcx, %rsi
subq %rdx, %rsi
sarq $0x2, %rsi
testq %rsi, %rsi
jle 0x2e0c
movl 0x68(%rbx), %eax
movq %rsi, %rdi
shrq %rdi
movq %rdi, %r8
notq %r8
addq %rsi, %r8
leaq (%rdx,%rdi,4), %rsi
addq $0x4, %rsi
cmpl -0x4(%rsi), %eax
cmovgeq %rsi, %rdx
cmovlq %rdi, %r8
movq %r8, %rsi
testq %r8, %r8
jg 0x2de2
movl 0x6c(%rbx), %eax
movl %eax, 0x70(%rbx)
cmpq %rcx, %rdx
je 0x2e25
movl (%rdx), %eax
movl %eax, 0x68(%rbx)
movq %rbx, %rdi
popq %rbx
jmp 0x2c86
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/aaronpuchert[P]throttle/src/throttle.hpp
// Function: Conf::Parser<std::vector<int, std::allocator<int>>>::parse(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
std::vector<T> Conf::Parser<std::vector<T>>::parse(const std::string &str)
{
	std::istringstream stream(str);

	std::vector<T> ret;
	T cur;
	while (stream >> cur)
		ret.push_back(cur);
	return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x190, %rsp            # imm = 0x190
movq %rdi, %rbx
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movl $0x8, %edx
callq 0x22f0
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
leaq 0xc(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x2130
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x30b2
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x30a5
movl 0xc(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x3072
movq %rbx, %rdi
movq %r15, %rdx
callq 0x311e
jmp 0x3072
movq 0x4f07(%rip), %rsi      # 0x7fc0
leaq 0x10(%rsp), %rdi
callq 0x2240
leaq 0x88(%rsp), %rdi
callq 0x2080
movq %rbx, %rax
addq $0x190, %rsp            # imm = 0x190
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x30f7
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x21f0
movq 0x4ec2(%rip), %rsi      # 0x7fc0
leaq 0x10(%rsp), %rdi
callq 0x2240
leaq 0x88(%rsp), %rdi
callq 0x2080
movq %r14, %rdi
callq 0x2330
nop