LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/connection.cpp
// Function: Connection::PeerReadCallback(bufferevent*, void*)
void Connection::PeerReadCallback(struct bufferevent* bev, void* arg){
    Connection* item = (Connection*)arg;
    if(item->recv_raw_mode_){
        item->OnPeerRead();
    }else{
        struct evbuffer* input = bufferevent_get_input(bev);
        if(item->buffer_len_ < 0){
            evbuffer_remove(input, (void*)&item->buffer_len_, 4);   
            item->buffer_len_ = ntohl(item->buffer_len_);
        }
        if(item->buffer_len_ > 0 && item->buffer_len_ <= evbuffer_get_length(input)){
            evbuffer_remove(input, (void*)item->buffer_, item->buffer_len_); 
            item->buffer_[item->buffer_len_] = '\0';
            //process the data received
            item->OnPeerRead();
            //cleared the buffer
            item->buffer_len_ = -1;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
cmpb $0x1, 0x10090(%rsi)
jne 0x25d7
movq (%rbx), %rax
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmpq *0x10(%rax)
callq 0x21a0
movq %rax, %r14
leaq 0x1008c(%rbx), %r15
cmpl $0x0, 0x1008c(%rbx)
jns 0x2607
movl $0x4, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x22e0
movl (%r15), %eax
bswapl %eax
movl %eax, (%r15)
movslq (%r15), %r15
testq %r15, %r15
jle 0x2654
movq %r14, %rdi
callq 0x22b0
cmpq %r15, %rax
jb 0x2654
leaq 0x8d(%rbx), %rsi
movslq 0x1008c(%rbx), %rdx
movq %r14, %rdi
callq 0x22e0
movslq 0x1008c(%rbx), %rax
movb $0x0, 0x8d(%rbx,%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movl $0xffffffff, 0x1008c(%rbx) # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/connection.cpp
// Function: Connection::Connection(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned short, unsigned short, unsigned short)
Connection:: Connection(
    std::string peer_ip
    ,uint16_t peer_port
    ,uint16_t local_port
    ,uint16_t index 
    ):
    peer_ip_(peer_ip)
    ,peer_port_(peer_port)
    ,local_port_(local_port)
    ,index_(index)
    ,fd_(-1)
    ,connected_(false)
    ,buffer_len_(-1)
    ,recv_raw_mode_(false)
    ,send_raw_mode_(false)
    ,delconn_cb_(NULL)
{
  printf("local port : %u\n", local_port_);
  printf("peer port : %u\n", peer_port_);
  peer_event_ = NULL;
  conn_2_server_pair_[0] = conn_2_server_pair_[1] = NULL;
  server_2_conn_pair_[0] = server_2_conn_pair_[1] = NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %r15d
movl %ecx, %r14d
movl %edx, %r13d
movq %rdi, %rbx
leaq 0x45c7(%rip), %rax      # 0x6c68
movq %rax, (%rdi)
leaq 0x8(%rdi), %r12
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
movups %xmm0, 0x18(%rdi)
movl $0xffffffff, 0x58(%rdi) # imm = 0xFFFFFFFF
addq $0x60, %rdi
leaq 0x70(%rbx), %rax
movq %rax, 0x60(%rbx)
movq (%rsi), %rax
movq 0x8(%rsi), %rdx
addq %rax, %rdx
movq %rax, %rsi
callq 0x2a52
movw %r13w, 0x80(%rbx)
movw %r14w, 0x82(%rbx)
movw %r15w, 0x84(%rbx)
movb $0x0, 0x8c(%rbx)
movl $0xffffffff, 0x1008c(%rbx) # imm = 0xFFFFFFFF
movw $0x0, 0x10090(%rbx)
movzwl %r14w, %esi
leaq 0x18ef(%rip), %rdi      # 0x4004
xorl %eax, %eax
callq 0x2040
movzwl 0x80(%rbx), %esi
leaq 0x18eb(%rip), %rdi      # 0x4015
xorl %eax, %eax
callq 0x2040
movq $0x0, 0x28(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rbx)
movups %xmm0, 0x48(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x276c
movq %r12, %rdi
movq %r12, %rsi
movl $0x3, %edx
callq *%rax
movq %r14, %rdi
callq 0x23b0
movq %rax, %rdi
callq 0x2a44
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/connection.cpp
// Function: Connection::~Connection()
Connection:: ~Connection(){
  printf("connection %u destroyed\n", index_);
  bufferevent_free(peer_event_);
  if(conn_2_server_pair_[0]){
    bufferevent_free(conn_2_server_pair_[0]);
    bufferevent_free(conn_2_server_pair_[1]);
  }
  if(server_2_conn_pair_[0]){
    bufferevent_free(server_2_conn_pair_[0]);
    bufferevent_free(server_2_conn_pair_[1]);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x44dc(%rip), %rax      # 0x6c68
movq %rax, (%rdi)
movzwl 0x84(%rdi), %esi
leaq 0x1888(%rip), %rdi      # 0x4025
xorl %eax, %eax
callq 0x2040
movq 0x28(%rbx), %rdi
callq 0x20b0
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x27c4
callq 0x20b0
movq 0x40(%rbx), %rdi
callq 0x20b0
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0x27db
callq 0x20b0
movq 0x50(%rbx), %rdi
callq 0x20b0
movq 0x60(%rbx), %rdi
leaq 0x70(%rbx), %rax
cmpq %rax, %rdi
je 0x27ed
callq 0x2250
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x2807
addq $0x8, %rbx
movq %rbx, %rdi
movq %rbx, %rsi
movl $0x3, %edx
callq *%rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
jmp 0x2810
movq %rax, %rdi
callq 0x2a44
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/connection.cpp
// Function: Connection::Start()
bool Connection::Start(){
    if (SetKeepLive(fd_, 20, 5, 3) < 0)
       return false;
    if (SetRecvSendBufSize(fd_, 0xfffff) < 0)
       return false;
    if(SetReuseAddr(fd_) < 0)
       return false;
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x58(%rdi), %edi
movl $0x14, %esi
movl $0x5, %edx
movl $0x3, %ecx
callq 0x3ea3
testl %eax, %eax
js 0x2878
movl 0x58(%rbx), %edi
movl $0xfffff, %esi          # imm = 0xFFFFF
callq 0x3e36
testl %eax, %eax
js 0x2878
movl 0x58(%rbx), %edi
callq 0x3ded
testl %eax, %eax
setns %al
jmp 0x287a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/connection.cpp
// Function: Connection::Initialize(event_base*, int, bool)
void Connection::Initialize(struct event_base* base, evutil_socket_t fd, bool write_callback_on){
    fd_ = fd;
    base_ = base;
    peer_event_ = bufferevent_socket_new(base, fd_, BEV_OPT_CLOSE_ON_FREE);
    if(!peer_event_){
        printf("create bufferevent failed in %s:%s!\n", __FILE__, __func__);
        fd_ = -1;
        return;
    }
    bufferevent_setcb(peer_event_, PeerReadCallback, write_callback_on? PeerWriteCallback: NULL, PeerEventCallback, this);
    bufferevent_enable(peer_event_, EV_WRITE|EV_READ);
    //for TCP packet, we have 4 bytes-len head
    bufferevent_setwatermark(peer_event_, EV_READ, 4, 0xfffff);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %ecx, %r14d
movq %rdi, %rbx
movl %edx, 0x58(%rdi)
movq %rsi, 0x30(%rdi)
movq %rsi, %rdi
movl %edx, %esi
movl $0x1, %edx
callq 0x2380
movq %rax, 0x28(%rbx)
testq %rax, %rax
je 0x2901
leaq -0x255(%rip), %rcx      # 0x2660
xorl %edx, %edx
testb %r14b, %r14b
cmovneq %rcx, %rdx
leaq -0x317(%rip), %rsi      # 0x25ae
leaq -0x25e(%rip), %rcx      # 0x266e
movq %rax, %rdi
movq %rbx, %r8
callq 0x2290
movq 0x28(%rbx), %rdi
movl $0x6, %esi
callq 0x23e0
movq 0x28(%rbx), %rdi
movl $0x4, %edx
movl $0xfffff, %ecx          # imm = 0xFFFFF
movl $0x2, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x2090
leaq 0x1736(%rip), %rdi      # 0x403e
leaq 0x1754(%rip), %rsi      # 0x4063
leaq 0x175c(%rip), %rdx      # 0x4072
xorl %eax, %eax
callq 0x2040
movl $0xffffffff, 0x58(%rbx) # imm = 0xFFFFFFFF
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/connection.cpp
// Function: Connection::OnPeerEvent(short)
void Connection::OnPeerEvent(short events){
   if (events & BEV_EVENT_CONNECTED){
        connected_ = true;
        printf("connected!\n");
   }else if (events & BEV_EVENT_EOF){
        evutil_closesocket(fd_);
        fd_ = -1;
        bufferevent_setfd(peer_event_, -1);
        connected_ = false;
        printf("connection closed!\n");
        if(delconn_cb_)
          delconn_cb_(this->index_);
   }else if (events & BEV_EVENT_ERROR){
        printf("got an error on connection in %s\n", strerror(errno));
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
testb %sil, %sil
js 0x29cc
movzwl %si, %eax
testb $0x10, %al
jne 0x29e5
testb $0x20, %al
je 0x2a31
callq 0x2030
movl (%rax), %edi
callq 0x20e0
leaq 0x16c1(%rip), %rdi      # 0x407d
movq %rax, %rsi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2040
movb $0x1, 0x8c(%rbx)
leaq 0x1702(%rip), %rdi      # 0x40dc
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2340
movl 0x58(%rbx), %edi
callq 0x2180
movl $0xffffffff, 0x58(%rbx) # imm = 0xFFFFFFFF
movq 0x28(%rbx), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x23a0
movb $0x0, 0x8c(%rbx)
leaq 0x16b9(%rip), %rdi      # 0x40c9
callq 0x2340
cmpq $0x0, 0x18(%rbx)
je 0x2a31
leaq 0x8(%rbx), %rdi
movzwl 0x84(%rbx), %eax
leaq -0xa(%rbp), %rsi
movw %ax, (%rsi)
callq *0x20(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/tcp_client.cpp
// Function: TcpClient::KeepAliveCallback(int, short, void*)
void TcpClient::KeepAliveCallback(evutil_socket_t fd, short event, void* arg){
    printf("in %s:%s\n", __FILE__, __func__);
    TcpClient* client = (TcpClient*)arg;
    //reconnect
    if(!client->connected_){
        client->DoConnect();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdx, %rbx
leaq 0x162b(%rip), %rdi      # 0x413b
leaq 0x15ed(%rip), %rsi      # 0x4104
leaq 0x15f5(%rip), %rdx      # 0x4113
xorl %eax, %eax
callq 0x2040
cmpb $0x0, 0x8c(%rbx)
je 0x2b35
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2b44
nop
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/tcp_client.cpp
// Function: TcpClient::DoConnect()
bool TcpClient::DoConnect(){
    if(fd_ < 0){
        fd_ = socket(AF_INET, SOCK_STREAM, 0);
        if(fd_ < 0){
            printf("create socket failed in %s:%s\n", __FILE__, __func__);
            return false;
        }
        bufferevent_setfd(peer_event_, fd_);
    }

    struct sockaddr_in peer_addr;
    peer_addr.sin_family = AF_INET;
    peer_addr.sin_addr.s_addr = inet_addr(peer_ip_.c_str());
    peer_addr.sin_port = htons(peer_port_);
    int ret = bufferevent_socket_connect(peer_event_, (const sockaddr*)&peer_addr, sizeof(peer_addr));
    if (ret < 0){
        printf("bufferevent socket connect failed in %s:%s!\n", __FILE__, __func__);
        return false;
    }
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
cmpl $0x0, 0x58(%rdi)
jns 0x2b7b
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x2080
movl %eax, 0x58(%rbx)
testl %eax, %eax
js 0x2bd1
movq 0x28(%rbx), %rdi
movl %eax, %esi
callq 0x23a0
leaq -0x20(%rbp), %r14
movw $0x2, (%r14)
movq 0x60(%rbx), %rdi
callq 0x22a0
movl %eax, 0x4(%r14)
movzwl 0x80(%rbx), %eax
rolw $0x8, %ax
movw %ax, 0x2(%r14)
movq 0x28(%rbx), %rdi
movq %r14, %rsi
movl $0x10, %edx
callq 0x22d0
testl %eax, %eax
setns %bl
jns 0x2bef
leaq 0x1658(%rip), %rdi      # 0x4219
leaq 0x153c(%rip), %rsi      # 0x4104
leaq 0x1640(%rip), %rdx      # 0x420f
jmp 0x2be8
leaq 0x1618(%rip), %rdi      # 0x41f0
leaq 0x1525(%rip), %rsi      # 0x4104
leaq 0x1629(%rip), %rdx      # 0x420f
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2040
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/tcp_client.cpp
// Function: TcpClient::Start()
bool TcpClient::Start(){
    
    if(!DoConnect())
        return false;    

    if(SetKeepLive(fd_, 20, 5, 3) < 0){
        printf("set keep alive failed in %s:%s\n", __FILE__, __func__);
        return false;
    }
    if(SetRecvSendBufSize(fd_, 0xfffff) < 0){
        printf("set recv sned bufsize failed in %s:%s\n", __FILE__, __func__);
        return false;
    }

    //create a timer to keep connection alive
    keepalive_event_ = event_new(base_, -1, EV_PERSIST, TcpClient::KeepAliveCallback, this);
    if(!keepalive_event_){
        printf("create event failed in %s:%s!\n", __FILE__, __func__);
        return false;
    }
     
    struct timeval tv = {10, 0};
    evtimer_add(keepalive_event_, &tv);
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
callq 0x2b44
testb %al, %al
je 0x2d3e
movl 0x58(%rbx), %edi
movl $0x14, %esi
movl $0x5, %edx
movl $0x3, %ecx
callq 0x3ea3
testl %eax, %eax
js 0x2d42
movl 0x58(%rbx), %edi
movl $0xfffff, %esi          # imm = 0xFFFFF
callq 0x3e36
testl %eax, %eax
js 0x2d4b
movq 0x30(%rbx), %rdi
leaq -0x206(%rip), %rcx      # 0x2b00
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0x10, %edx
movq %rbx, %r8
callq 0x2210
movq %rax, 0x10098(%rbx)
testq %rax, %rax
je 0x2d54
movups 0x151d(%rip), %xmm0     # 0x4248
leaq -0x20(%rbp), %rsi
movaps %xmm0, (%rsi)
movq %rax, %rdi
callq 0x2120
movb $0x1, %bl
jmp 0x2d72
xorl %ebx, %ebx
jmp 0x2d72
leaq 0x13dc(%rip), %rdi      # 0x4125
jmp 0x2d5b
leaq 0x13f9(%rip), %rdi      # 0x414b
jmp 0x2d5b
leaq 0x1417(%rip), %rdi      # 0x4172
leaq 0x13a2(%rip), %rsi      # 0x4104
leaq 0x13dc(%rip), %rdx      # 0x4145
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2040
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/tcp_client.cpp
// Function: TcpClient::OnPeerRead()
void TcpClient::OnPeerRead(){
    //this is for test
    printf("received data from peer, length = %d, data = %s\n", buffer_len_, buffer_);
    usleep(1000000);
    
    char *msg = "hello server!\n";
    Write(msg, strlen(msg));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x1008c(%rdi), %esi
leaq 0x8d(%rdi), %rdx
leaq 0x13f8(%rip), %rdi      # 0x4191
xorl %eax, %eax
callq 0x2040
movl $0xf4240, %edi          # imm = 0xF4240
callq 0x2310
leaq 0x1411(%rip), %rsi      # 0x41c2
movq %rbx, %rdi
movl $0xe, %edx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x292a
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/tcp_client.cpp
// Function: TcpClient::OnPeerEvent(short)
void TcpClient::OnPeerEvent(short events){
   if (events == BEV_EVENT_CONNECTED){
        printf("connected!\n");
        connected_ = true;

        //this is for test
        usleep(1000000);
        char *msg = "hello server!\n";
        Write(msg, strlen(msg));

   }else if (events & BEV_EVENT_EOF){
        evutil_closesocket(fd_);
        fd_ = -1;
        bufferevent_setfd(peer_event_, -1);
        connected_ = false;
        printf("connection closed!\n");
   }else if (events & BEV_EVENT_ERROR){
        printf("got an error on TcpClient: %s\n", strerror(errno));
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x80, %esi
jne 0x2e0c
leaq 0x1300(%rip), %rdi      # 0x40dc
callq 0x2340
movb $0x1, 0x8c(%rbx)
movl $0xf4240, %edi          # imm = 0xF4240
callq 0x2310
leaq 0x13c9(%rip), %rsi      # 0x41c2
movq %rbx, %rdi
movl $0xe, %edx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x292a
movzwl %si, %eax
testb $0x10, %al
jne 0x2e1e
testb $0x20, %al
jne 0x2e54
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl 0x58(%rbx), %edi
callq 0x2180
movl $0xffffffff, 0x58(%rbx) # imm = 0xFFFFFFFF
movq 0x28(%rbx), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x23a0
movb $0x0, 0x8c(%rbx)
leaq 0x1280(%rip), %rdi      # 0x40c9
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2340
callq 0x2030
movl (%rax), %edi
callq 0x20e0
leaq 0x136a(%rip), %rdi      # 0x41d1
movq %rax, %rsi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2040
nop
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/tcp_server.cpp
// Function: TcpServer::Bind(char const*, unsigned short, event_base*)
void TcpServer::Bind(const char* ip, uint16_t port, struct event_base* base){
    base_ = base;
    listen_addr_.sin_family = AF_INET;
    listen_addr_.sin_addr.s_addr = inet_addr(ip);
    listen_addr_.sin_port = htons(port);
    listener_ = evconnlistener_new_bind(
                base_, 
                ListenCallback,
                this, 
                LEV_OPT_REUSEABLE|LEV_OPT_CLOSE_ON_FREE,
                -1,
                (const sockaddr*)&listen_addr_, 
                sizeof(listen_addr_));
    if (!listener_){
        printf("evconnlistener create failed in %s:%s!\n", __FILE__, __func__);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rdi, %r14
movq %rcx, 0x8(%rdi)
leaq 0x18(%rdi), %r15
movw $0x2, 0x18(%rdi)
movq %rsi, %rdi
callq 0x22a0
movl %eax, 0x1c(%r14)
rolw $0x8, %bx
movw %bx, 0x1a(%r14)
movq 0x8(%r14), %rdi
movl $0x10, (%rsp)
leaq -0x13a(%rip), %rsi      # 0x2e78
movq %r14, %rdx
movl $0xa, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movq %r15, %r9
callq 0x2230
movq %rax, 0x10(%r14)
testq %rax, %rax
je 0x2fdc
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1280(%rip), %rdi      # 0x4263
leaq 0x12a1(%rip), %rsi      # 0x428b
leaq 0x12a9(%rip), %rdx      # 0x429a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2040
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/tcp_server.cpp
// Function: TcpServer::OnListen(evconnlistener*, int, sockaddr*, int)
void TcpServer::OnListen(struct evconnlistener* listener, evutil_socket_t sock, struct sockaddr* addr, int socklen){
    string client_ip = string(inet_ntoa(((struct sockaddr_in*)addr)->sin_addr));
    uint16_t client_port = ntohs(((struct sockaddr_in*)addr)->sin_port);
    printf("receive connection from %s:%d\n", client_ip.c_str(), client_port);
    Connection* conn = new Connection(client_ip, client_port, 0, next_client_index_);
    connections_[next_client_index_++] = conn;
    conn->Initialize(base_, sock);
    conn->Start();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, %r14
movl %edx, %ebx
movq %rdi, %r15
movl 0x4(%rcx), %edi
callq 0x2130
leaq -0x70(%rbp), %r12
leaq -0x2a(%rbp), %rdx
movq %r12, %rdi
movq %rax, %rsi
callq 0x2100
movzwl 0x2(%r14), %eax
rolw $0x8, %ax
movq (%r12), %rsi
movzwl %ax, %r12d
leaq 0x1251(%rip), %rdi      # 0x429f
movl %r12d, %edx
xorl %eax, %eax
callq 0x2040
movl $0x10098, %edi          # imm = 0x10098
callq 0x2280
movq %rax, %r14
leaq -0x40(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
addq %rsi, %rdx
leaq -0x50(%rbp), %rdi
callq 0x2a52
movzwl 0x68(%r15), %r8d
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
movl %r12d, %edx
xorl %ecx, %ecx
callq 0x2680
movq -0x50(%rbp), %rdi
cmpq %r13, %rdi
je 0x30a5
callq 0x2250
leaq 0x30(%r15), %rdi
movl 0x68(%r15), %eax
movl %eax, %ecx
incl %ecx
movw %cx, 0x68(%r15)
leaq -0x2a(%rbp), %rsi
movw %ax, (%rsi)
callq 0x31c0
movq %r14, (%rax)
movq 0x8(%r15), %rsi
movq %r14, %rdi
movl %ebx, %edx
xorl %ecx, %ecx
callq 0x2882
movq (%r14), %rax
movq %r14, %rdi
callq *0x38(%rax)
leaq -0x60(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x30f0
callq 0x2250
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3121
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r13, %rdi
je 0x3117
callq 0x2250
jmp 0x3117
movq %rax, %rbx
movq %r14, %rdi
callq 0x2250
jmp 0x3124
movq %rax, %rbx
leaq -0x60(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3136
callq 0x2250
movq %rbx, %rdi
callq 0x23b0
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/udp_socket.cpp
// Function: UdpSocket::ReadCallback(int, short, void*)
void UdpSocket::ReadCallback(evutil_socket_t fd, short events, void* arg){
    UdpSocket* udp_socket = (UdpSocket*)arg;
    udp_socket->read_len_ = recv(udp_socket->fd_, udp_socket->read_buffer_, 0xffff, 0);
    udp_socket->read_buffer_[udp_socket->read_len_] = '\0';
    assert(udp_socket->read_cb_);
    udp_socket->read_cb_(udp_socket->read_buffer_, udp_socket->read_len_);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movl 0x1003c(%rdx), %edi
leaq 0x38(%rdx), %r14
movl $0xffff, %edx           # imm = 0xFFFF
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x20c0
movl %eax, 0x10038(%rbx)
cltq
movb $0x0, 0x38(%rbx,%rax)
cmpq $0x0, 0x18(%rbx)
je 0x3516
leaq 0x8(%rbx), %rdi
movl 0x10038(%rbx), %eax
leaq -0x20(%rbp), %rsi
movq %r14, (%rsi)
leaq -0x14(%rbp), %rdx
movl %eax, (%rdx)
callq *0x20(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0xdac(%rip), %rdi       # 0x42c9
leaq 0xdba(%rip), %rsi       # 0x42de
leaq 0xdc2(%rip), %rcx       # 0x42ed
movl $0xa, %edx
callq 0x2190
nop
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/udp_socket.cpp
// Function: UdpSocket::Bind(char const*, unsigned short, event_base*)
bool UdpSocket::Bind(const char* local_ip, uint16_t local_port, struct event_base* base){
    base_ = base;
    assert(base_);    
    if(!Bind(local_ip, local_port))
      return false;
    event_ = event_new(base_, fd_, EV_PERSIST|EV_READ, UdpSocket::ReadCallback, this); 
    if(!event_){
        printf("event new failed in %s!\n", __func__);
        return false;
    }
    event_add(event_, NULL);
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rcx, 0x28(%rdi)
testq %rcx, %rcx
je 0x35ad
movq %rdi, %rbx
movzwl %dx, %edx
callq 0x35cc
testb %al, %al
je 0x3589
movq 0x28(%rbx), %rdi
movl 0x1003c(%rbx), %esi
leaq -0xad(%rip), %rcx       # 0x34b8
movl $0x12, %edx
movq %rbx, %r8
callq 0x2210
movq %rax, 0x30(%rbx)
testq %rax, %rax
je 0x358d
movq %rax, %rdi
xorl %esi, %esi
callq 0x2120
movb $0x1, %bl
jmp 0x35a4
xorl %ebx, %ebx
jmp 0x35a4
leaq 0xdd9(%rip), %rdi       # 0x436d
leaq 0xcff(%rip), %rsi       # 0x429a
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2040
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0xd71(%rip), %rdi       # 0x4325
leaq 0xd23(%rip), %rsi       # 0x42de
leaq 0xd69(%rip), %rcx       # 0x432b
movl $0x10, %edx
callq 0x2190
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/udp_socket.cpp
// Function: UdpSocket::Bind(char const*, unsigned short)
bool UdpSocket::Bind(const char* local_ip, uint16_t local_port){
    struct sockaddr_in local_addr;
    local_addr.sin_family = AF_INET;
    local_addr.sin_port = htons(local_port);
    local_addr.sin_addr.s_addr = inet_addr(local_ip);
    uint32_t option = 1;
    if (setsockopt(fd_, SOL_SOCKET, SO_REUSEADDR, (char*)&option, sizeof(option)) < 0){
       perror("set socket reuse addr\n");
       return false;
    }
    if (bind(fd_, (sockaddr*)&local_addr, sizeof(local_addr)) != 0){
       perror("bind socket\n");
       return false;
    }
    SetRecvSendBufSize(fd_, 0xfffff);
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movw $0x2, -0x1c(%rbp)
rolw $0x8, %dx
movw %dx, -0x1a(%rbp)
movq %rsi, %rdi
callq 0x22a0
movl %eax, -0x18(%rbp)
leaq -0xc(%rbp), %rcx
movl $0x1, (%rcx)
movl 0x1003c(%rbx), %edi
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x23c0
testl %eax, %eax
js 0x364b
movl 0x1003c(%rbx), %edi
leaq -0x1c(%rbp), %rsi
movl $0x10, %edx
callq 0x2060
testl %eax, %eax
jne 0x3654
movl 0x1003c(%rbx), %edi
movl $0xfffff, %esi          # imm = 0xFFFFF
callq 0x3e36
movb $0x1, %al
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
leaq 0xd57(%rip), %rdi       # 0x43a9
jmp 0x365b
leaq 0xd65(%rip), %rdi       # 0x43c0
callq 0x2200
xorl %eax, %eax
jmp 0x3644
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/udp_socket.cpp
// Function: UdpSocket::UdpSocket()
UdpSocket::UdpSocket(){
#ifndef LINUX //in windows system
    static bool was_inited = false;
  	if (wsa_inited_){
		return;
	}

	WSADATA wsaData;
	int iErrorCode;
	if (WSAStartup(MAKEWORD(2, 1), &wsaData)) //µ÷ÓÃWindows Sockets DLL
	{
		printf("Winsock init failed in %s\n", __func__);
		WSACleanup();
		return;
	}
	wsa_inited_ = true;
#endif

#ifdef ASYNC_UDP
    event_ = NULL;
    base_ = NULL;
    read_cb_=NULL;
#endif

    //create a udp socket
    fd_ = socket(AF_INET, SOCK_DGRAM, 0);
    if(fd_ < 0){
        printf("udp create failed in %s\n", __func__);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x3704(%rip), %rax      # 0x6d78
movq %rax, (%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rdi)
movups %xmm0, 0x8(%rdi)
movups %xmm0, 0x28(%rdi)
movq 0x18(%rdi), %rax
testq %rax, %rax
je 0x36a7
leaq 0x8(%rbx), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0x18(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movl $0x2, %edi
movl $0x2, %esi
xorl %edx, %edx
callq 0x2080
movl %eax, 0x1003c(%rbx)
testl %eax, %eax
js 0x36c9
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0xcb6(%rip), %rdi       # 0x4386
leaq 0xcc8(%rip), %rsi       # 0x439f
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2040
movq %rax, %rdi
callq 0x2a44
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/udp_socket.cpp
// Function: UdpSocket::~UdpSocket()
UdpSocket::~UdpSocket(){
#ifdef LINUX
    close(fd_);
#else
    closesocket(fd_);
#endif

#ifdef ASYNC_UDP
    if(event_)
        event_free(event_);
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x367c(%rip), %rax      # 0x6d78
movq %rax, (%rdi)
movl 0x1003c(%rdi), %edi
callq 0x23f0
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x3718
callq 0x2370
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x3732
addq $0x8, %rbx
movq %rbx, %rdi
movq %rbx, %rsi
movl $0x3, %edx
callq *%rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
jmp 0x373b
movq %rax, %rdi
callq 0x2a44
nop
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/udp_socket.cpp
// Function: UdpSocket::Send(char*, int)
int UdpSocket::Send(char* buf, int len){
	int result = sendto(fd_, buf, len, 0, (sockaddr*)&remote_addr_, sizeof(remote_addr_));
	if (result < 0){
		perror("udp send\n");
	}
    return result;	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl 0x1003c(%rdi), %eax
movslq %edx, %rdx
leaq 0x10040(%rdi), %r8
movl %eax, %edi
xorl %ecx, %ecx
movl $0x10, %r9d
callq 0x2050
movq %rax, %rbx
testl %ebx, %ebx
js 0x379b
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0xc2b(%rip), %rdi       # 0x43cd
callq 0x2200
jmp 0x3792
nop
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/udp_socket.cpp
// Function: UdpSocket::SendTo(char*, int, char const*, unsigned short)
int UdpSocket::SendTo(char* buf, int len, const char* dst_ip, uint16_t dst_port){
	struct sockaddr_in sock_addr;
	sock_addr.sin_family = AF_INET;
	sock_addr.sin_port = htons(dst_port);
	sock_addr.sin_addr.s_addr = inet_addr(dst_ip);
	int result = sendto(fd_, buf, len, 0, (sockaddr*)&sock_addr, sizeof(sockaddr));
	if (result < 0){
		perror("udp send\n");
	}
	return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
leaq -0x30(%rbp), %r12
movw $0x2, (%r12)
rolw $0x8, %r8w
movw %r8w, 0x2(%r12)
movq %rcx, %rdi
callq 0x22a0
movl %eax, 0x4(%r12)
movl 0x1003c(%r15), %edi
movslq %ebx, %rdx
movq %r14, %rsi
xorl %ecx, %ecx
movq %r12, %r8
movl $0x10, %r9d
callq 0x2050
movq %rax, %rbx
testl %ebx, %ebx
js 0x3817
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xbaf(%rip), %rdi       # 0x43cd
callq 0x2200
jmp 0x3808
nop
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/udp_socket.cpp
// Function: UdpSocket::SendTo(char*, int, sockaddr_in const&)
int UdpSocket::SendTo(char* buf, int len, const struct sockaddr_in& sock_addr){
	int result = sendto(fd_, buf, len, 0, (sockaddr*)&sock_addr, sizeof(sockaddr));
	if (result < 0){
		perror("udp send\n");
	}
	return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rcx, %r8
movl 0x1003c(%rdi), %edi
movslq %edx, %rdx
xorl %ecx, %ecx
movl $0x10, %r9d
callq 0x2050
movq %rax, %rbx
testl %ebx, %ebx
js 0x3855
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0xb71(%rip), %rdi       # 0x43cd
callq 0x2200
jmp 0x384c
nop
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/udp_socket.cpp
// Function: UdpSocket::Recv(char*, int)
int UdpSocket::Recv(char* buf, int buf_len){
	struct sockaddr_in sock_addr;
#ifdef LINUX
	socklen_t addr_len = sizeof(sock_addr);
#else
	int addr_len = sizeof(sock_addr);
#endif
	int recv_bytes = recvfrom(fd_, buf, buf_len, 0, (sockaddr*)&sock_addr, &addr_len);
	if (recv_bytes < 0){
		perror("udp recv\n");
	}
    return recv_bytes;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
leaq -0xc(%rbp), %r9
movl $0x10, (%r9)
movl 0x1003c(%rdi), %edi
movslq %edx, %rdx
leaq -0x1c(%rbp), %r8
xorl %ecx, %ecx
callq 0x21d0
movq %rax, %rbx
testl %ebx, %ebx
js 0x389c
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
leaq 0xb34(%rip), %rdi       # 0x43d7
callq 0x2200
jmp 0x3893
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/udp_socket.cpp
// Function: UdpSocket::RecvFrom(char*, int, unsigned int*, unsigned short*)
int UdpSocket::RecvFrom(char* buf, int buf_len, uint32_t* from_ip, uint16_t* from_port){
	struct sockaddr_in sock_addr;
#ifdef LINUX
	socklen_t addr_len = sizeof(sock_addr);
#else
	int addr_len = sizeof(sock_addr);
#endif
	int recv_bytes = recvfrom(fd_, buf, buf_len, 0, (sockaddr*)&sock_addr, &addr_len);
	if (recv_bytes < 0){
		perror("udp recv\n");
	}
	if (from_ip){
		*from_ip = ntohl(sock_addr.sin_addr.s_addr);
	}
	if (from_port){
		*from_port = ntohs(sock_addr.sin_port);
	}

	return recv_bytes;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movq %rcx, %r14
leaq -0x1c(%rbp), %r9
movl $0x10, (%r9)
movl 0x1003c(%rdi), %edi
movslq %edx, %rdx
leaq -0x2c(%rbp), %r8
xorl %ecx, %ecx
callq 0x21d0
movq %rax, %r15
testl %r15d, %r15d
js 0x390f
testq %r14, %r14
je 0x38f1
movl -0x28(%rbp), %eax
bswapl %eax
movl %eax, (%r14)
testq %rbx, %rbx
je 0x3901
movzwl -0x2a(%rbp), %eax
rolw $0x8, %ax
movw %ax, (%rbx)
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0xac1(%rip), %rdi       # 0x43d7
callq 0x2200
jmp 0x38e4
nop
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/udp_socket.cpp
// Function: UdpSocket::WaitMsg(int, int*)
int UdpSocket::WaitMsg(int time_out, int *elapsed_time){
	const int MSG_IDLE = 0, MSG_ARRIVAL = 1;
	fd_set read_fds;
	FD_ZERO(&read_fds);
	FD_SET(fd_, &read_fds);
	struct timeval time_val;
	time_val.tv_sec = time_out / 1000;
	time_val.tv_usec = time_out % 1000 * 1000;
	int ret = select(fd_ + 1, &read_fds, NULL, NULL, &time_val);
	int result = MSG_IDLE;
	if (ret == -1){
		perror("udp select error\n");
		return result;
	}else if(ret == 0){
		//time out
		*elapsed_time = time_out;
	}else{
		if (FD_ISSET(fd_, &read_fds)){
			*elapsed_time = time_out - (time_val.tv_sec * 1000 + time_val.tv_usec / 1000);
			result = MSG_ARRIVAL;
		}
	}
	return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x90, %rsp
movq %rdx, %rbx
movq %rdi, %r15
xorps %xmm0, %xmm0
leaq -0xb0(%rbp), %rax
movaps %xmm0, 0x70(%rax)
movaps %xmm0, 0x60(%rax)
movaps %xmm0, 0x50(%rax)
movaps %xmm0, 0x40(%rax)
movaps %xmm0, 0x30(%rax)
movaps %xmm0, 0x20(%rax)
movaps %xmm0, 0x10(%rax)
movaps %xmm0, (%rax)
movl 0x1003c(%rdi), %edi
leal 0x3f(%rdi), %edx
testl %edi, %edi
cmovnsl %edi, %edx
movl %edx, %r8d
andl $-0x40, %r8d
movl %edi, %ecx
subl %r8d, %ecx
movl $0x1, %r8d
shlq %cl, %r8
sarl $0x6, %edx
movslq %edx, %rcx
orq %r8, -0xb0(%rbp,%rcx,8)
movl %esi, %r14d
movslq %esi, %rcx
imulq $0x10624dd3, %rcx, %rdx # imm = 0x10624DD3
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x26, %rdx
addl %esi, %edx
movslq %edx, %rdx
leaq -0x30(%rbp), %r8
movq %rdx, (%r8)
imull $0x3e8, %edx, %edx      # imm = 0x3E8
subl %edx, %ecx
imull $0x3e8, %ecx, %ecx      # imm = 0x3E8
movslq %ecx, %rcx
movq %rcx, 0x8(%r8)
incl %edi
xorl %r12d, %r12d
movq %rax, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x2260
testl %eax, %eax
je 0x3a37
cmpl $-0x1, %eax
je 0x3a3c
movl 0x1003c(%r15), %eax
leal 0x3f(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
sarl $0x6, %ecx
movslq %ecx, %rcx
movq -0xb0(%rbp,%rcx,8), %rcx
btq %rax, %rcx
jae 0x3a48
imull $0xfffffc18, -0x30(%rbp), %ecx # imm = 0xFFFFFC18
movabsq $-0x20c49ba5e353f7cf, %rax # imm = 0xDF3B645A1CAC0831
imulq -0x28(%rbp)
movq %rdx, %rax
shrq $0x3f, %rax
shrq $0x7, %rdx
addl %eax, %edx
addl %ecx, %edx
addl %r14d, %edx
movl %edx, (%rbx)
movl $0x1, %r12d
jmp 0x3a4b
movl %r14d, (%rbx)
jmp 0x3a4b
leaq 0x99e(%rip), %rdi       # 0x43e1
callq 0x2200
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/utils.cpp
// Function: InitSocketAddr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, unsigned short, sockaddr_in*)
void InitSocketAddr(std::string& ip, uint16_t port, sockaddr_in* addr){
	memset((char*)addr, 0, sizeof(sockaddr_in));
	addr->sin_family = AF_INET;
	addr->sin_port = htons(port);
#ifndef LINUX
	addr->sin_addr.S_un.S_addr = inet_addr(ip.c_str());
#else
	addr->sin_addr.s_addr = inet_addr(ip.c_str());
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdx, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdx)
movw $0x2, (%rdx)
rolw $0x8, %si
movw %si, 0x2(%rdx)
movq (%rdi), %rdi
callq 0x22a0
movl %eax, 0x4(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/utils.cpp
// Function: SetNonBlock(int)
int SetNonBlock(int fd){
	int flags;
	flags = fcntl(fd, F_GETFL);
	if (flags < 0) return flags;
	flags |= O_NONBLOCK;
	if (fcntl(fd, F_SETFL, flags) < 0){
    perror("fcntl set nonblock error : ");
    return -1;
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %edi, %r14d
xorl %ebx, %ebx
movl $0x3, %esi
xorl %eax, %eax
callq 0x2170
testl %eax, %eax
js 0x3de4
orl $0x800, %eax            # imm = 0x800
movl %r14d, %edi
movl $0x4, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x2170
testl %eax, %eax
jns 0x3de6
leaq 0x629(%rip), %rdi       # 0x4401
callq 0x2200
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x3de6
movl %eax, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/utils.cpp
// Function: SetReuseAddr(int)
int SetReuseAddr(int fd){
	int on = 1;
	if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < -1){
    perror("setsocketopt so_reuseaddr error : ");
    return -1;
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq -0x4(%rbp), %rcx
movl $0x1, (%rcx)
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x23c0
movl %eax, %ecx
xorl %eax, %eax
cmpl $-0x2, %ecx
jle 0x3e23
addq $0x10, %rsp
popq %rbp
retq
leaq 0x5f3(%rip), %rdi       # 0x441d
callq 0x2200
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x3e1d
// File: /workspace/github_cpp_makefile_star2_O1/gtarcoder[P]libevent_utils/utils.cpp
// Function: SetKeepLive(int, int, int, int)
int SetKeepLive(int fd, int idle, int interval, int count){
  if ( setsockopt(fd, SOL_TCP, TCP_KEEPIDLE, (void *)&idle, sizeof(idle)) < 0 ){
    perror("setsocketopt tcp_keepidle error : ");
    return -1;
  }
  if ( setsockopt(fd, SOL_TCP,  TCP_KEEPINTVL, (void *)&interval, sizeof(idle)) < 0 ){
    perror("setsocketopt tcp_keepintvl error : ");
    return -1;
  }
  if ( setsockopt(fd, SOL_TCP,  TCP_KEEPCNT, (void *)&count, sizeof(count)) < 0 ){
    perror("setsocketopt tcp_keepcnt error : ");
    return -1;
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
movl %edi, %ebx
leaq -0x14(%rbp), %rax
movl %esi, (%rax)
movl %edx, -0x10(%rbp)
movl %ecx, -0xc(%rbp)
movl $0x6, %esi
movl $0x4, %edx
movq %rax, %rcx
movl $0x4, %r8d
callq 0x23c0
testl %eax, %eax
js 0x3f1f
leaq -0x10(%rbp), %rcx
movl %ebx, %edi
movl $0x6, %esi
movl $0x5, %edx
movl $0x4, %r8d
callq 0x23c0
testl %eax, %eax
js 0x3f28
leaq -0xc(%rbp), %rcx
movl %ebx, %edi
movl $0x6, %esi
movl $0x6, %edx
movl $0x4, %r8d
callq 0x23c0
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
js 0x3f31
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
leaq 0x55a(%rip), %rdi       # 0x4480
jmp 0x3f38
leaq 0x574(%rip), %rdi       # 0x44a3
jmp 0x3f38
leaq 0x58f(%rip), %rdi       # 0x44c7
callq 0x2200
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x3f18
// File: /workspace/github_cpp_makefile_star2_O1/alex-courtis[P]xlayoutdisplay/src/Edid.cpp
// Function: Edid::dpiForMode(std::shared_ptr<Mode const> const&) const
long Edid::dpiForMode(const std::shared_ptr<const Mode> &mode) const {
    if (maxCmVert() == 0 || maxCmHoriz() == 0) {
        return 0;
    }
    double dpiHoriz = mode->width * INCHES_PER_CM / maxCmHoriz();
    double dpiVert = mode->height * INCHES_PER_CM / maxCmVert();

    // nearest 12 dpi
    return lround((dpiHoriz + dpiVert) / 24) * 12;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rax
callq *0x18(%rax)
testl %eax, %eax
je 0x6e54
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
testl %eax, %eax
je 0x6e54
movq (%r14), %rax
movl 0x8(%rax), %eax
cvtsi2sd %rax, %xmm0
mulsd 0x13237(%rip), %xmm0    # 0x1a008
movsd %xmm0, 0x8(%rsp)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
movq (%r14), %rax
movl 0xc(%rax), %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x131f8(%rip), %xmm0    # 0x1a008
movsd %xmm0, 0x10(%rsp)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x18(%rax)
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd 0x10(%rsp), %xmm1
divsd %xmm0, %xmm1
addsd 0x8(%rsp), %xmm1
divsd 0x131cf(%rip), %xmm1    # 0x1a010
movapd %xmm1, %xmm0
callq 0x6060
shlq $0x2, %rax
leaq (%rax,%rax,2), %rax
jmp 0x6e56
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/alex-courtis[P]xlayoutdisplay/src/Monitors.cpp
// Function: calculateLaptopLidClosed(char const*)
bool calculateLaptopLidClosed(const char *laptopLidRootPath) {
    static char lidFileName[PATH_MAX];
    static char line[512];

    // find the lid state directory
    DIR *dir = opendir(laptopLidRootPath);
    if (dir) {
        struct dirent *dirent;
        while ((dirent = readdir(dir)) != nullptr) {
            if (dirent->d_type == DT_DIR && strcmp(dirent->d_name, ".") != 0 && strcmp(dirent->d_name, "..") != 0) {

                // read the lid state file
                snprintf(lidFileName, PATH_MAX, "%s/%s/%s", laptopLidRootPath, dirent->d_name, "state");
                FILE *lidFile = fopen(lidFileName, "r");
                if (lidFile != nullptr) {
                    if (fgets(line, 512, lidFile))
                        if (strcasestr(line, "closed"))
                            return true;
                    fclose(lidFile);
                }

                // drivers/acpi/button.c acpi_button_add_fs seems to indicate there will be only one file
                break;
            }
        }
        closedir(dir);
    }
    return false;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %r14
callq 0x65c0
testq %rax, %rax
je 0x7284
movq %rax, %rbx
movq %rax, %rdi
callq 0x65d0
testq %rax, %rax
je 0x727c
movq %rax, %r15
leaq 0x1336b(%rip), %r12     # 0x1a5a7
leaq 0x13363(%rip), %r13     # 0x1a5a6
cmpb $0x4, 0x12(%r15)
jne 0x726c
addq $0x13, %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x6560
testl %eax, %eax
je 0x726c
movq %r15, %rdi
movq %r13, %rsi
callq 0x6560
testl %eax, %eax
jne 0x7290
movq %rbx, %rdi
callq 0x65d0
movq %rax, %r15
testq %rax, %rax
jne 0x7243
movq %rbx, %rdi
callq 0x6650
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x1e729(%rip), %r12     # 0x259c0
leaq 0x12f6b(%rip), %rdx     # 0x1a209
leaq 0x12f6d(%rip), %r9      # 0x1a212
movl $0x1000, %esi           # imm = 0x1000
movq %r12, %rdi
movq %r14, %rcx
movq %r15, %r8
xorl %eax, %eax
callq 0x6640
leaq 0x13a8e(%rip), %rsi     # 0x1ad4f
movq %r12, %rdi
callq 0x6490
testq %rax, %rax
je 0x727c
movq %rax, %r14
leaq 0x1f6e8(%rip), %rdi     # 0x269c0
movl $0x200, %esi            # imm = 0x200
movq %rax, %rdx
callq 0x6620
testq %rax, %rax
je 0x730b
leaq 0x1f6cf(%rip), %rdi     # 0x269c0
leaq 0x12f20(%rip), %rsi     # 0x1a218
callq 0x67d0
movq %rax, %rcx
movb $0x1, %al
testq %rcx, %rcx
jne 0x7286
movq %r14, %rdi
callq 0x6370
jmp 0x727c
// File: /workspace/github_cpp_makefile_star2_O1/alex-courtis[P]xlayoutdisplay/src/calculations.cpp
// Function: orderOutputs(std::__cxx11::list<std::shared_ptr<Output>, std::allocator<std::shared_ptr<Output>>> const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&)
const std::list<std::shared_ptr<Output>> orderOutputs(const list<shared_ptr<Output>> &outputs, const vector<string> &order) {
    list<shared_ptr<Output>> orderedOutputs(outputs);

    // stack all the preferred, available outputs
    stack<shared_ptr<Output>> preferredOutputs;
    for (const auto &name : order) {
        for (const auto &output : outputs) {
            if (strcasecmp(name.c_str(), output->name.c_str()) == 0) {
                preferredOutputs.push(output);
            }
        }
    }

    // move preferred to the front
    while (!preferredOutputs.empty()) {
        orderedOutputs.remove(preferredOutputs.top());
        orderedOutputs.push_front(preferredOutputs.top());
        preferredOutputs.pop();
    }

    return orderedOutputs;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
callq 0x88bc
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
xorl %esi, %esi
callq 0x8bc6
movq (%r15), %r12
movq 0x8(%r15), %r13
cmpq %r13, %r12
je 0x7c32
movq %rsp, %r15
movq (%r14), %rbp
cmpq %r14, %rbp
je 0x7c29
movq (%r12), %rdi
movq 0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x6400
testl %eax, %eax
jne 0x7c23
leaq 0x10(%rbp), %rsi
movq %r15, %rdi
callq 0x8d3e
movq (%rbp), %rbp
jmp 0x7bfe
addq $0x20, %r12
cmpq %r13, %r12
jne 0x7bfb
movq 0x30(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x7cb0
movl $0x200, %r12d           # imm = 0x200
movq %rsp, %r14
cmpq 0x38(%rsp), %rsi
jne 0x7c5a
movq 0x48(%rsp), %rax
movq -0x8(%rax), %rsi
addq %r12, %rsi
addq $-0x10, %rsi
movq %rbx, %rdi
callq 0x88f8
movq 0x30(%rsp), %rsi
cmpq 0x38(%rsp), %rsi
jne 0x7c7e
movq 0x48(%rsp), %rax
movq -0x8(%rax), %rsi
addq %r12, %rsi
addq $-0x10, %rsi
movq (%rbx), %r15
movq %rbx, %rdi
callq 0x8b8c
movq %rax, %rdi
movq %r15, %rsi
callq 0x6080
incq 0x10(%rbx)
movq %r14, %rdi
callq 0x8fbc
movq 0x30(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
jne 0x7c47
movq %rsp, %rdi
callq 0x8972
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x7cdc
jmp 0x7cd1
movq %rax, %r14
movq %rsp, %rdi
callq 0x8972
movq %rbx, %rdi
callq 0x8ace
movq %r14, %rdi
callq 0x6700
// File: /workspace/github_cpp_makefile_star2_O1/alex-courtis[P]xlayoutdisplay/src/calculations.cpp
// Function: ltrOutputs(std::__cxx11::list<std::shared_ptr<Output>, std::allocator<std::shared_ptr<Output>>> const&)
void ltrOutputs(const list<shared_ptr<Output>> &outputs) {
    int xpos = 0;
    int ypos = 0;
    for (const auto &output : outputs) {

        if (output->desiredActive) {

            // set the desired mode to optimal
            output->desiredMode = output->optimalMode;

            // position the screen
            output->desiredPos = make_shared<Pos>(xpos, ypos);

            // next position
            xpos += output->desiredMode->width;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq (%rdi), %r14
cmpq %rdi, %r14
je 0x7ee3
movq %rdi, %rbx
xorl %ebp, %ebp
movabsq $0x100000001, %r15      # imm = 0x100000001
leaq 0x1cacd(%rip), %r12     # 0x24930
movq 0x10(%r14), %rsi
cmpb $0x1, 0x90(%rsi)
jne 0x7edb
movq 0x60(%rsi), %rax
movq %rax, 0x98(%rsi)
leaq 0xa0(%rsi), %rdi
addq $0x68, %rsi
callq 0x8b0a
movl $0x18, %edi
callq 0x6390
movq %r15, 0x8(%rax)
movq %r12, (%rax)
leaq 0x10(%rax), %rcx
movl %ebp, 0x10(%rax)
movl $0x0, 0x14(%rax)
movq 0x10(%r14), %rdx
movq %rcx, 0xa8(%rdx)
movq 0xb0(%rdx), %rdi
movq %rax, 0xb0(%rdx)
testq %rdi, %rdi
je 0x7ecd
callq 0x79fe
movq 0x10(%r14), %rax
movq 0x98(%rax), %rax
addl 0x8(%rax), %ebp
movq (%r14), %r14
cmpq %rbx, %r14
jne 0x7e63
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/alex-courtis[P]xlayoutdisplay/src/calculations.cpp
// Function: calculateOptimalMode(std::__cxx11::list<std::shared_ptr<Mode const>, std::allocator<std::shared_ptr<Mode const>>> const&, std::shared_ptr<Mode const> const&)
const shared_ptr<const Mode> calculateOptimalMode(const list<shared_ptr<const Mode>> &modes, const shared_ptr<const Mode> &preferredMode) {
    shared_ptr<const Mode> optimalMode;

    // default optimal mode is empty
    if (!modes.empty()) {

        // use highest resolution/refresh for optimal
        const list<shared_ptr<const Mode>> reverseOrderedModes = reverseSort(modes);
        optimalMode = reverseOrderedModes.front();

        // override with highest refresh of preferred resolution, if available
        if (preferredMode)
            for (const auto &mode : reverseOrderedModes)
                if (mode->width == preferredMode->width && mode->height == preferredMode->height) {
                    optimalMode = mode;
                    break;
                }
    }

    return optimalMode;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
cmpq %rsi, (%rsi)
je 0x8887
movq %rdx, %r14
movq %rsp, %rdi
callq 0x793a
leaq 0xaf4(%rip), %rsi       # 0x9308
movq %rsp, %rdi
callq 0x9096
movq %rsp, %r15
movq %r15, %rdi
callq 0x6430
movq (%r15), %rsi
movq 0x10(%rsi), %rax
movq %rax, (%rbx)
leaq 0x8(%rbx), %r12
addq $0x18, %rsi
movq %r12, %rdi
callq 0x8b0a
movq (%r14), %rax
testq %rax, %rax
je 0x887f
movq (%rsp), %rsi
cmpq %r15, %rsi
je 0x887f
movl 0x8(%rax), %ecx
movq 0x10(%rsi), %rdx
cmpl %ecx, 0x8(%rdx)
jne 0x8866
movl 0xc(%rdx), %edi
cmpl 0xc(%rax), %edi
je 0x8870
movq (%rsi), %rsi
cmpq %r15, %rsi
jne 0x8855
jmp 0x887f
movq %rdx, (%rbx)
addq $0x18, %rsi
movq %r12, %rdi
callq 0x8b0a
movq %rsp, %rdi
callq 0x7a6e
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
movq %rsp, %rdi
callq 0x7a6e
jmp 0x88a6
movq %rax, %r14
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x88b4
callq 0x79fe
movq %r14, %rdi
callq 0x6700
// File: /workspace/github_cpp_makefile_star2_O1/alex-courtis[P]xlayoutdisplay/src/xrandrrutil.cpp
// Function: refreshFromModeInfo(_XRRModeInfo const&)
unsigned int refreshFromModeInfo(const XRRModeInfo &modeInfo) {
    double rate;
    double vTotal = modeInfo.vTotal;

    if (modeInfo.modeFlags & RR_DoubleScan)
        /* doublescan doubles the number of lines */
        vTotal *= 2;

    if (modeInfo.modeFlags & RR_Interlace)
        /* interlace splits the frame into two fields */
        /* the field rate is what is typically reported by monitors */
        vTotal /= 2;

    if (modeInfo.hTotal && vTotal)
        rate = ((double) modeInfo.dotClock / ((double) modeInfo.hTotal * vTotal));
    else
        rate = 0;

    // round up
    return static_cast<unsigned int>(round(rate));
}

// Assembly:
movl 0x30(%rdi), %eax
cvtsi2sd %rax, %xmm1
movq 0x48(%rdi), %rcx
testb $0x20, %cl
je 0x9b31
addsd %xmm1, %xmm1
movl 0x20(%rdi), %eax
testb $0x10, %cl
je 0x9b41
mulsd 0x10af7(%rip), %xmm1    # 0x1a638
xorpd %xmm0, %xmm0
testl %eax, %eax
je 0x9b87
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm1
jne 0x9b55
jnp 0x9b87
movsd 0x10(%rdi), %xmm2
unpcklps 0x10adf(%rip), %xmm2    # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x10ae7(%rip), %xmm2    # 0x1a650
movapd %xmm2, %xmm0
unpckhpd %xmm2, %xmm0            # xmm0 = xmm0[1],xmm2[1]
addsd %xmm2, %xmm0
movl %eax, %eax
xorps %xmm2, %xmm2
cvtsi2sd %rax, %xmm2
mulsd %xmm2, %xmm1
divsd %xmm1, %xmm0
pushq %rax
callq 0x6180
cvttsd2si %xmm0, %rax
popq %rcx
retq