LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/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
movq %rdx, %rbx
movl 0x1003c(%rdx), %edi
leaq 0x38(%rdx), %r14
movl $0xffff, %edx           # imm = 0xFFFF
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x20d0
movl %eax, 0x10038(%rbx)
cltq
movb $0x0, 0x38(%rbx,%rax)
cmpq $0x0, 0x18(%rbx)
je 0x34c8
movl 0x10038(%rbx), %edx
addq $0x8, %rbx
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x398a
leaq 0xdd3(%rip), %rdi       # 0x42a2
leaq 0xde1(%rip), %rsi       # 0x42b7
leaq 0xde9(%rip), %rcx       # 0x42c6
pushq $0xa
popq %rdx
callq 0x21a0
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x355b
movq %rdi, %rbx
movzwl %dx, %edx
callq 0x3578
testb %al, %al
je 0x3537
movq 0x28(%rbx), %rdi
movl 0x1003c(%rbx), %esi
leaq -0x9d(%rip), %rcx       # 0x3478
pushq $0x12
popq %rdx
movq %rbx, %r8
callq 0x2200
movq %rax, 0x30(%rbx)
testq %rax, %rax
je 0x353b
movq %rax, %rdi
xorl %esi, %esi
callq 0x2130
movb $0x1, %bl
jmp 0x3552
xorl %ebx, %ebx
jmp 0x3552
leaq 0xe04(%rip), %rdi       # 0x4346
leaq 0xd29(%rip), %rsi       # 0x4272
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2040
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0xd9c(%rip), %rdi       # 0x42fe
leaq 0xd4e(%rip), %rsi       # 0x42b7
leaq 0xd94(%rip), %rcx       # 0x4304
pushq $0x10
popq %rdx
callq 0x21a0
// File: /workspace/github_cpp_makefile_star2_O2/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 0x2290
movl %eax, -0x18(%rbp)
leaq -0xc(%rbp), %rcx
movl $0x1, (%rcx)
movl 0x1003c(%rbx), %edi
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
pushq $0x4
popq %r8
callq 0x23d0
testl %eax, %eax
js 0x35ef
movl 0x1003c(%rbx), %edi
leaq -0x1c(%rbp), %rsi
pushq $0x10
popq %rdx
callq 0x2060
testl %eax, %eax
jne 0x35f8
movl 0x1003c(%rbx), %edi
movl $0xfffff, %esi          # imm = 0xFFFFF
callq 0x3c5f
movb $0x1, %al
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
leaq 0xd8c(%rip), %rdi       # 0x4382
jmp 0x35ff
leaq 0xd9a(%rip), %rdi       # 0x4399
callq 0x21f0
xorl %eax, %eax
jmp 0x35e8
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3768(%rip), %rax      # 0x6d80
movq %rax, (%rdi)
addq $0x8, %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
movups %xmm0, 0x18(%rbx)
movups %xmm0, 0x28(%rbx)
xorl %esi, %esi
callq 0x39b6
pushq $0x2
popq %rdi
movl %edi, %esi
xorl %edx, %edx
callq 0x2090
movl %eax, 0x1003c(%rbx)
testl %eax, %eax
js 0x3652
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0xd06(%rip), %rdi       # 0x435f
leaq 0xd18(%rip), %rsi       # 0x4378
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2040
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3702(%rip), %rax      # 0x6d80
movq %rax, (%rdi)
movl 0x1003c(%rdi), %edi
callq 0x23f0
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x369a
callq 0x2380
addq $0x8, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x29ce
movq %rax, %rdi
callq 0x29ed
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0x10
popq %r9
movl %eax, %edi
xorl %ecx, %ecx
callq 0x2050
movq %rax, %rbx
testl %ebx, %ebx
js 0x3709
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0xc96(%rip), %rdi       # 0x43a6
callq 0x21f0
jmp 0x3700
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x2290
movl %eax, 0x4(%r12)
movl 0x1003c(%r15), %edi
movslq %ebx, %rdx
pushq $0x10
popq %r9
movq %r14, %rsi
xorl %ecx, %ecx
movq %r12, %r8
callq 0x2050
movq %rax, %rbx
testl %ebx, %ebx
js 0x3783
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc1c(%rip), %rdi       # 0x43a6
callq 0x21f0
jmp 0x3774
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0x10
popq %r9
xorl %ecx, %ecx
callq 0x2050
movq %rax, %rbx
testl %ebx, %ebx
js 0x37bf
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0xbe0(%rip), %rdi       # 0x43a6
callq 0x21f0
jmp 0x37b6
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3806
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
leaq 0xba3(%rip), %rdi       # 0x43b0
callq 0x21f0
jmp 0x37fd
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3879
testq %r14, %r14
je 0x385b
movl -0x28(%rbp), %eax
bswapl %eax
movl %eax, (%r14)
testq %rbx, %rbx
je 0x386b
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 0xb30(%rip), %rdi       # 0x43b0
callq 0x21f0
jmp 0x384e
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, %rbx
movl %esi, %r14d
movq %rdi, %r15
xorl %eax, %eax
cmpq $0x10, %rax
je 0x38bb
andq $0x0, -0xb8(%rbp,%rax,8)
incq %rax
jmp 0x38a7
movl 0x1003c(%r15), %edi
pushq $0x40
popq %r13
movl %edi, %eax
cltd
idivl %r13d
movslq %eax, %rdx
shll $0x6, %eax
movl %edi, %ecx
subl %eax, %ecx
pushq $0x1
popq %rax
shlq %cl, %rax
orq %rax, -0xb8(%rbp,%rdx,8)
movl $0x3e8, %ecx            # imm = 0x3E8
movl %r14d, %eax
cltd
idivl %ecx
cltq
leaq -0x38(%rbp), %r8
movq %rax, (%r8)
imull $0x3e8, %edx, %eax      # imm = 0x3E8
cltq
movq %rax, 0x8(%r8)
incl %edi
xorl %r12d, %r12d
leaq -0xb8(%rbp), %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x2250
testl %eax, %eax
je 0x3961
cmpl $-0x1, %eax
je 0x3966
movl 0x1003c(%r15), %eax
cltd
idivl %r13d
cltq
movq -0xb8(%rbp,%rax,8), %rax
btq %rdx, %rax
jae 0x3972
imull $0xfffffc18, -0x38(%rbp), %ecx # imm = 0xFFFFFC18
movq -0x30(%rbp), %rax
movq $-0x3e8, %rsi           # imm = 0xFC18
cqto
idivq %rsi
addl %r14d, %ecx
addl %eax, %ecx
movl %ecx, (%rbx)
pushq $0x1
popq %r12
jmp 0x3975
movl %r14d, (%rbx)
jmp 0x3975
leaq 0xa4d(%rip), %rdi       # 0x43ba
callq 0x21f0
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
andl $0x0, 0xc(%rdx)
andq $0x0, 0x4(%rdx)
movw $0x2, (%rdx)
rolw $0x8, %si
movw %si, 0x2(%rdx)
movq (%rdi), %rdi
callq 0x2290
movl %eax, 0x4(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/gtarcoder[P]libevent_utils/utils.cpp
// Function: GetLocalTime[abi:cxx11]()
std::string GetLocalTime(){
	std::time_t now = time(NULL);
	struct tm* t = localtime(&now);
	std::ostringstream os;

	os << std::setw(4) << (t->tm_year + 1900);

	os << '-' << std::setw(2) << std::setfill('0') << t->tm_mon + 1 << '-' << std::setw(2) << std::setfill('0') << t->tm_mday
		<< "  " << std::setw(2) << std::setfill('0') << t->tm_hour
		<< ':' << std::setw(2) << std::setfill('0') << t->tm_min
		<< ':' << std::setw(2) << std::setfill('0') << t->tm_sec << "  ";

	return os.str();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rdi, %rbx
xorl %edi, %edi
callq 0x2230
leaq -0x20(%rbp), %rdi
movq %rax, (%rdi)
callq 0x21c0
movq %rax, %r14
leaq -0x198(%rbp), %r15
movq %r15, %rdi
callq 0x22f0
movq (%r15), %rax
movq -0x18(%rax), %rax
movq $0x4, -0x188(%rbp,%rax)
movl $0x76c, %esi            # imm = 0x76C
addl 0x14(%r14), %esi
movq %r15, %rdi
callq 0x23a0
leaq -0x198(%rbp), %rdi
pushq $0x2d
popq %rsi
callq 0x22c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x2, 0x10(%rax,%rcx)
pushq $0x30
popq %rsi
movq %rax, %rdi
callq 0x2350
movl 0x10(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x23a0
pushq $0x2d
popq %rsi
movq %rax, %rdi
callq 0x22c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x2, 0x10(%rax,%rcx)
pushq $0x30
popq %rsi
movq %rax, %rdi
callq 0x2350
movl 0xc(%r14), %esi
movq %rax, %rdi
callq 0x23a0
leaq 0x8e9(%rip), %rsi       # 0x43d7
movq %rax, %rdi
callq 0x2260
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x2, 0x10(%rax,%rcx)
pushq $0x30
popq %rsi
movq %rax, %rdi
callq 0x2350
movl 0x8(%r14), %esi
movq %rax, %rdi
callq 0x23a0
pushq $0x3a
popq %rsi
movq %rax, %rdi
callq 0x22c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x2, 0x10(%rax,%rcx)
pushq $0x30
popq %rsi
movq %rax, %rdi
callq 0x2350
movl 0x4(%r14), %esi
movq %rax, %rdi
callq 0x23a0
pushq $0x3a
popq %rsi
movq %rax, %rdi
callq 0x22c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x2, 0x10(%rax,%rcx)
pushq $0x30
popq %rsi
movq %rax, %rdi
callq 0x2350
movl (%r14), %esi
movq %rax, %rdi
callq 0x23a0
leaq 0x850(%rip), %rsi       # 0x43d7
movq %rax, %rdi
callq 0x2260
leaq -0x190(%rbp), %rsi
movq %rbx, %rdi
callq 0x2360
leaq -0x198(%rbp), %rdi
callq 0x2080
movq %rbx, %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x198(%rbp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x23c0
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0x3
popq %rsi
xorl %eax, %eax
callq 0x2180
testl %eax, %eax
js 0x3c15
orl $0x800, %eax            # imm = 0x800
pushq $0x4
popq %rsi
movl %r14d, %edi
movl %eax, %edx
xorl %eax, %eax
callq 0x2180
testl %eax, %eax
jns 0x3c17
leaq 0x7cf(%rip), %rdi       # 0x43da
callq 0x21f0
pushq $-0x1
popq %rbx
jmp 0x3c17
movl %eax, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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)
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
pushq $0x4
popq %r8
callq 0x23d0
movl %eax, %ecx
xorl %eax, %eax
cmpl $-0x2, %ecx
jle 0x3c4e
addq $0x10, %rsp
popq %rbp
retq
leaq 0x7a1(%rip), %rdi       # 0x43f6
callq 0x21f0
pushq $-0x1
popq %rax
jmp 0x3c48
// File: /workspace/github_cpp_makefile_star2_O2/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)
pushq $0x6
popq %rsi
pushq $0x4
popq %rdx
movq %rax, %rcx
movl %edx, %r8d
callq 0x23d0
testl %eax, %eax
js 0x3d26
pushq $0x6
popq %rsi
pushq $0x5
popq %rdx
leaq -0x10(%rbp), %rcx
pushq $0x4
popq %r8
movl %ebx, %edi
callq 0x23d0
testl %eax, %eax
js 0x3d2f
pushq $0x6
popq %rdx
leaq -0xc(%rbp), %rcx
pushq $0x4
popq %r8
movl %ebx, %edi
movl %edx, %esi
callq 0x23d0
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
js 0x3d38
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
leaq 0x72c(%rip), %rdi       # 0x4459
jmp 0x3d3f
leaq 0x746(%rip), %rdi       # 0x447c
jmp 0x3d3f
leaq 0x761(%rip), %rdi       # 0x44a0
callq 0x21f0
pushq $-0x1
popq %rax
jmp 0x3d1f
// File: /workspace/github_cpp_makefile_star2_O2/dechimal[P]TaggedUnion/test_product.cpp
// Function: main
int main() {
    {
        // basic
        auto v1 = product<int, int const>{1, 2};
        auto const v2 = v1;
        static_assert(std::is_same<decltype(v1.get(_0)), int &>{}, "failed to basic 1");
        static_assert(std::is_same<decltype(v1.get(_1)), int const &>{}, "failed to basic 2");
        static_assert(std::is_same<decltype(v2.get(_0)), int const &>{}, "failed to basic 3");
        static_assert(std::is_same<decltype(v2.get(_1)), int const &>{}, "failed to basic 4");
        assert(v1.get(_0) == 1);
        assert(v1.get(_1) == 2);
    }
    {
        // with recursion
        struct u {};
        using state = sum<u, int>;
        using stream = product<int, std::function<_()>>;
        auto f = fix([] (auto f, auto st) -> std::function<stream()> {
            return [f, st] {
                return st.when([&] (tag<0>, u) {
                    return stream{0, f(state(_1, 0))};
                }, [&] (tag<1>, int i) {
                    return stream{i + 1, f(state(_1, i + 1))};
                });
            };
        });
        auto s = f(state(_0))();
        assert(s.get(_0) == 0);
        s = s.get(_1)();
        assert(s.get(_0) == 1);
    }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
leaq 0x10(%rsp), %rsi
andl $0x0, (%rsi)
leaq 0x8(%rsp), %rdi
callq 0x1380
leaq 0x18(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x12dc
leaq 0x8(%rsp), %rdi
callq 0x12b6
leaq 0x40(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x1606
leaq 0x18(%rsp), %rdi
callq 0x161e
leaq 0x10(%rsp), %rdi
callq 0x12b6
cmpl $0x0, 0x60(%rsp)
jne 0x123e
leaq 0x18(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x1606
leaq 0x40(%rsp), %rbx
leaq 0x18(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x16a6
movq %r14, %rdi
callq 0x161e
cmpl $0x1, 0x20(%rbx)
jne 0x1257
leaq 0x40(%rsp), %rdi
callq 0x161e
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r14
retq
leaq 0xeae(%rip), %rdi       # 0x20f3
leaq 0xe8b(%rip), %rsi       # 0x20d7
leaq 0xe95(%rip), %rcx       # 0x20e8
pushq $0x30
jmp 0x126e
leaq 0xea4(%rip), %rdi       # 0x2102
leaq 0xe72(%rip), %rsi       # 0x20d7
leaq 0xe7c(%rip), %rcx       # 0x20e8
pushq $0x32
popq %rdx
callq 0x1060
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x161e
jmp 0x12ae
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x161e
jmp 0x12a4
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x12b6
jmp 0x12a4
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x12b6
movq %rbx, %rdi
callq 0x1090
// File: /workspace/github_cpp_makefile_star2_O2/alex-courtis[P]xlayoutdisplay/src/Edid.cpp
// Function: Edid::Edid(unsigned char const*, unsigned long, char const*)
Edid::Edid(const unsigned char *edid, const size_t length, const char *name) {
    if (length < EDID_MIN_LENGTH)
        throw invalid_argument(string(name) + " has Edid size " + to_string(length) + ", expected at least " +
                               to_string(EDID_MIN_LENGTH));

    this->edid = (unsigned char *) malloc(length);
    memcpy(this->edid, edid, length);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xf0, %rsp
movq %rdx, %r14
leaq 0x1ef7b(%rip), %rax     # 0x258e0
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
cmpq $0x7f, %rdx
jbe 0x69a3
movq %rsi, %rbx
movq %rdi, %r12
movq %r14, %rdi
callq 0x6550
movq %rax, 0x8(%r12)
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rdx
addq $0xf0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x6300
movq %rcx, %r15
pushq $0x10
popq %rdi
callq 0x61e0
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
leaq 0xf(%rsp), %rdx
movq %r15, %rsi
callq 0x6c8e
leaq 0x1164e(%rip), %rdx     # 0x18018
leaq 0x70(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x6c6e
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x6cc9
leaq 0x90(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x6c07
leaq 0x11624(%rip), %rdx     # 0x18028
leaq 0xb0(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x6c6e
leaq 0x10(%rsp), %rdi
movl $0x80, %esi
callq 0x6d0b
leaq 0xd0(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x6c07
movb $0x1, %bpl
leaq 0xd0(%rsp), %rsi
movq %rbx, %rdi
callq 0x66f0
xorl %ebp, %ebp
movq 0x1f562(%rip), %rsi     # 0x25fc0
movq 0x1f543(%rip), %rdx     # 0x25fa8
movq %rbx, %rdi
callq 0x66c0
movq %rax, %r14
leaq 0xd0(%rsp), %rdi
callq 0x61b0
jmp 0x6a85
movq %rax, %r14
movb $0x1, %bpl
leaq 0x10(%rsp), %rdi
callq 0x61b0
jmp 0x6a97
movq %rax, %r14
movb $0x1, %bpl
leaq 0xb0(%rsp), %rdi
callq 0x61b0
jmp 0x6aac
movq %rax, %r14
movb $0x1, %bpl
leaq 0x90(%rsp), %rdi
callq 0x61b0
jmp 0x6ac1
movq %rax, %r14
movb $0x1, %bpl
leaq 0x30(%rsp), %rdi
callq 0x61b0
jmp 0x6ad3
movq %rax, %r14
movb $0x1, %bpl
leaq 0x70(%rsp), %rdi
callq 0x61b0
jmp 0x6ae5
movq %rax, %r14
movb $0x1, %bpl
leaq 0x50(%rsp), %rdi
callq 0x61b0
testb %bpl, %bpl
jne 0x6af9
jmp 0x6b01
movq %rax, %r14
movq %rbx, %rdi
callq 0x62c0
movq %r14, %rdi
callq 0x6710
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x6bfd
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
testl %eax, %eax
je 0x6bfd
movq (%r14), %rax
movl 0x8(%rax), %eax
cvtsi2sd %rax, %xmm0
mulsd 0x11481(%rip), %xmm0    # 0x18008
movsd %xmm0, 0x8(%rsp)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
movq (%r14), %rax
movl 0xc(%rax), %eax
cvtsi2sd %rax, %xmm0
mulsd 0x11448(%rip), %xmm0    # 0x18008
movsd %xmm0, 0x10(%rsp)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x18(%rax)
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movsd 0x10(%rsp), %xmm1
divsd %xmm0, %xmm1
addsd 0x8(%rsp), %xmm1
divsd 0x11422(%rip), %xmm1    # 0x18010
movapd %xmm1, %xmm0
callq 0x6050
imulq $0xc, %rax, %rax
jmp 0x6bff
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
movq %rdi, %r14
callq 0x65c0
testq %rax, %rax
je 0x701f
movq %rax, %rbx
movq %rbx, %rdi
callq 0x65d0
testq %rax, %rax
je 0x7017
cmpb $0x4, 0x12(%rax)
jne 0x6f65
cmpb $0x2e, 0x13(%rax)
jne 0x6f94
cmpb $0x0, 0x14(%rax)
je 0x6f65
cmpb $0x2e, 0x14(%rax)
jne 0x6f94
cmpb $0x0, 0x15(%rax)
je 0x6f65
addq $0x13, %rax
leaq 0x1fa21(%rip), %r15     # 0x269c0
leaq 0x11263(%rip), %rdx     # 0x18209
leaq 0x11265(%rip), %r9      # 0x18212
movl $0x1000, %esi           # imm = 0x1000
movq %r15, %rdi
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x6640
leaq 0x11d86(%rip), %rsi     # 0x18d4f
movq %r15, %rdi
callq 0x6490
testq %rax, %rax
je 0x7017
movq %rax, %r14
leaq 0x209e0(%rip), %rdi     # 0x279c0
movl $0x200, %esi            # imm = 0x200
movq %rax, %rdx
callq 0x6610
testq %rax, %rax
je 0x700f
leaq 0x209c7(%rip), %rdi     # 0x279c0
leaq 0x11218(%rip), %rsi     # 0x18218
callq 0x67d0
movq %rax, %rcx
movb $0x1, %al
testq %rcx, %rcx
jne 0x7021
movq %r14, %rdi
callq 0x6380
movq %rbx, %rdi
callq 0x6650
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x8108
leaq 0x8(%rsp), %rdi
callq 0x8142
movq (%r15), %r12
movq 0x8(%r15), %r13
leaq 0x8(%rsp), %r15
movq %r14, %rbp
cmpq %r13, %r12
je 0x775b
movq (%rbp), %rbp
cmpq %r14, %rbp
je 0x7755
movq (%r12), %rdi
movq 0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x6410
testl %eax, %eax
jne 0x772a
leaq 0x10(%rbp), %rsi
movq %r15, %rdi
callq 0x8764
jmp 0x772a
addq $0x20, %r12
jmp 0x7722
movl $0x200, %r15d           # imm = 0x200
leaq 0x8(%rsp), %r14
movq 0x38(%rsp), %rsi
cmpq 0x18(%rsp), %rsi
je 0x77bf
cmpq 0x40(%rsp), %rsi
jne 0x7785
movq 0x50(%rsp), %rax
movq -0x8(%rax), %rsi
addq %r15, %rsi
addq $-0x10, %rsi
movq %rbx, %rdi
callq 0x815e
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
jne 0x77a9
movq 0x50(%rsp), %rax
movq -0x8(%rax), %rsi
addq %r15, %rsi
addq $-0x10, %rsi
movq %rbx, %rdi
callq 0x81bc
movq %r14, %rdi
callq 0x89dc
jmp 0x7766
leaq 0x8(%rsp), %rdi
callq 0x824a
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x77ef
jmp 0x77e2
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x824a
movq %rbx, %rdi
callq 0x83a8
movq %r14, %rdi
callq 0x6710
// File: /workspace/github_cpp_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r12
movq %rsp, %r14
andl $0x0, (%r14)
leaq 0x4(%rsp), %r15
andl $0x0, (%r15)
leaq 0x8(%rsp), %r13
movl $0xa8, %ebp
movq %rdi, %rbx
movq (%rbx), %rbx
cmpq %r12, %rbx
je 0x79c6
movq 0x10(%rbx), %rdi
cmpb $0x1, 0x90(%rdi)
jne 0x7967
leaq 0x60(%rdi), %rsi
addq $0x98, %rdi
callq 0x844e
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x81c7
movq 0x10(%rbx), %rdi
addq %rbp, %rdi
movq %r13, %rsi
callq 0x8bb8
leaq 0x10(%rsp), %rdi
callq 0x7518
movq 0x10(%rbx), %rax
movq 0x98(%rax), %rax
movl 0x8(%rax), %eax
addl %eax, (%rsp)
jmp 0x7967
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
subq $0x20, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
cmpq %rsi, (%rsi)
je 0x80e4
movq %rdx, %r15
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x81e8
movq 0x8(%rsp), %rsi
addq $0x10, %rsi
movq %rbx, %rdi
callq 0x844e
movq (%r15), %rax
testq %rax, %rax
je 0x80da
movq %r14, %rsi
movq (%rsi), %rsi
cmpq %r14, %rsi
je 0x80da
movq 0x10(%rsi), %rcx
movl 0x8(%rcx), %edx
cmpl 0x8(%rax), %edx
jne 0x80b2
movl 0xc(%rcx), %ecx
cmpl 0xc(%rax), %ecx
jne 0x80b2
addq $0x10, %rsi
movq %rbx, %rdi
callq 0x844e
leaq 0x8(%rsp), %rdi
callq 0x7594
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
addq $0x8, %rbx
movq %rbx, %rdi
callq 0x7518
movq %r14, %rdi
callq 0x6710
// File: /workspace/github_cpp_makefile_star2_O2/alex-courtis[P]xlayoutdisplay/src/util.h
// Function: std::__cxx11::list<std::shared_ptr<Mode const>, std::allocator<std::shared_ptr<Mode const>>> const reverseSort<Mode>(std::__cxx11::list<std::shared_ptr<Mode const>, std::allocator<std::shared_ptr<Mode const>>> const&)
inline const std::list<std::shared_ptr<const T>> reverseSort(const std::list<std::shared_ptr<const T>> &list) {
    std::list<std::shared_ptr<const T>> sorted = list;
    sorted.sort(sortSharedPtr<const T>);
    sorted.reverse();
    return sorted;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x740c
leaq 0xba1(%rip), %rsi       # 0x8d9c
movq %rbx, %rdi
callq 0x8be6
movq %rbx, %rdi
callq 0x6440
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x7594
movq %r14, %rdi
callq 0x6710
// File: /workspace/github_cpp_makefile_star2_O2/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 0x94c5
addsd %xmm1, %xmm1
movl 0x20(%rdi), %eax
testb $0x10, %cl
je 0x94d5
mulsd 0xf163(%rip), %xmm1     # 0x18638
xorpd %xmm0, %xmm0
testl %eax, %eax
je 0x9518
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm1
jne 0x94e9
jnp 0x9518
movsd 0x10(%rdi), %xmm2
unpcklps 0xf14b(%rip), %xmm2     # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0xf153(%rip), %xmm2     # 0x18650
movapd %xmm2, %xmm0
unpckhpd %xmm2, %xmm0            # xmm0 = xmm0[1],xmm2[1]
addsd %xmm2, %xmm0
movl %eax, %eax
cvtsi2sd %rax, %xmm2
mulsd %xmm2, %xmm1
divsd %xmm1, %xmm0
pushq %rax
callq 0x6180
cvttsd2si %xmm0, %rax
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O2/alex-courtis[P]xlayoutdisplay/src/xrandrrutil.cpp
// Function: modeFromXRR(unsigned long, _XRRScreenResources const*)
Mode *modeFromXRR(RRMode id, const XRRScreenResources *resources) {
    if (resources == nullptr)
        throw invalid_argument("cannot construct Mode: NULL XRRScreenResources");

    XRRModeInfo *modeInfo = nullptr;
    for (int i = 0; i < resources->nmode; i++) {
        if (id == resources->modes[i].id) {
            modeInfo = &(resources->modes[i]);
            break;
        }
    }

    if (modeInfo == nullptr)
        throw invalid_argument("cannot construct Mode: cannot retrieve RRMode '" + to_string(id) + "'");

    return new Mode(id, modeInfo->width, modeInfo->height, refreshFromModeInfo(*modeInfo));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x60, %rsp
testq %rsi, %rsi
je 0x9812
movq %rdi, %r14
movl 0x30(%rsi), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovgl %eax, %ecx
imulq $0x50, %rcx, %rax
pushq $-0x50
popq %rcx
leaq 0x50(%rcx), %r15
cmpq %r15, %rax
je 0x97aa
movq 0x38(%rsi), %r12
cmpq %r14, 0x50(%r12,%rcx)
movq %r15, %rcx
jne 0x9760
pushq $0x18
popq %rdi
callq 0x63a0
movq %rax, %rbx
leaq (%r12,%r15), %rdi
callq 0x94b0
movq %r14, (%rbx)
movq 0x8(%r12,%r15), %rcx
movq %rcx, 0x8(%rbx)
movl %eax, 0x10(%rbx)
movq %rbx, %rax
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x61e0
movq %rax, %rbx
movq %rsp, %rdi
movq %r14, %rsi
callq 0x6cc9
leaq 0xef13(%rip), %rsi      # 0x186da
leaq 0x20(%rsp), %rdi
movq %rsp, %rdx
callq 0x9dc3
leaq 0xef2d(%rip), %rdx      # 0x18708
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x6c6e
movb $0x1, %bpl
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0x66f0
xorl %ebp, %ebp
movq 0x1c7bd(%rip), %rsi     # 0x25fc0
movq 0x1c79e(%rip), %rdx     # 0x25fa8
movq %rbx, %rdi
callq 0x66c0
pushq $0x10
popq %rdi
callq 0x61e0
movq %rax, %rbx
leaq 0xee87(%rip), %rsi      # 0x186ab
movq %rax, %rdi
callq 0x6780
movq 0x1c78d(%rip), %rsi     # 0x25fc0
movq 0x1c76e(%rip), %rdx     # 0x25fa8
movq %rbx, %rdi
callq 0x66c0
jmp 0x987a
movq %rax, %r14
leaq 0x40(%rsp), %rdi
callq 0x61b0
jmp 0x9859
movq %rax, %r14
movb $0x1, %bpl
leaq 0x20(%rsp), %rdi
callq 0x61b0
jmp 0x986b
movq %rax, %r14
movb $0x1, %bpl
movq %rsp, %rdi
callq 0x61b0
testb %bpl, %bpl
jne 0x987d
jmp 0x9885
movq %rax, %r14
movq %rbx, %rdi
callq 0x62c0
movq %r14, %rdi
callq 0x6710
// File: /workspace/github_cpp_makefile_star2_O2/alex-courtis[P]xlayoutdisplay/src/xrdbutil.cpp
// Function: renderXrdbCmd[abi:cxx11](long const&)
const std::string renderXrdbCmd(const long &dpi) {
    stringstream ss;
    ss << "echo \"Xft.dpi: "
       << dpi
       << "\" | xrdb -merge";
    return ss.str();
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rsi, %r14
movq %rdi, %rbx
movq %rsp, %rdi
callq 0x62a0
leaq 0x10(%rsp), %rdi
leaq 0xe21d(%rip), %rsi      # 0x187f1
callq 0x6370
movq (%r14), %rsi
movq %rax, %rdi
callq 0x6360
leaq 0xe216(%rip), %rsi      # 0x18801
movq %rax, %rdi
callq 0x6370
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x6620
movq %rsp, %rdi
callq 0x62d0
movq %rbx, %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x62d0
movq %rbx, %rdi
callq 0x6710
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/alex-courtis[P]xlayoutdisplay/src/xutil.cpp
// Function: resetRootCursor()
void resetRootCursor() {
    Display* dpy = XOpenDisplay(nullptr);
    int screen = DefaultScreen(dpy);
    Window root = RootWindow(dpy, screen);
    Cursor cursor = XcursorLibraryLoadCursor(dpy, "left_ptr");
    XDefineCursor(dpy, root, cursor);
    XFreeCursor(dpy, cursor);
    XCloseDisplay(dpy);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
xorl %edi, %edi
callq 0x6560
movq %rax, %rbx
movslq 0xe0(%rax), %rax
movq 0xe8(%rbx), %rcx
shlq $0x7, %rax
movq 0x10(%rcx,%rax), %r14
leaq 0xe1b8(%rip), %rsi      # 0x18811
movq %rbx, %rdi
callq 0x6540
movq %rax, %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x66e0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6400
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x6790
nop
// File: /workspace/github_cpp_makefile_star2_O2/alex-courtis[P]xlayoutdisplay/main.cpp
// Function: parseLong(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&)
long parseLong(const string &name, const string &val) {
    try {
        return stoi(val);
    } catch (invalid_argument &e) {
        throw invalid_argument("invalid " + name + ": " + val);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x60, %rsp
movq %rsi, %r15
movq %rdi, %r12
pushq $0xa
popq %rdx
movq %rsi, %rdi
xorl %esi, %esi
callq 0xb5de
cltq
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
cmpl $0x1, %edx
jne 0xa7d8
movq %r14, %rdi
callq 0x6160
pushq $0x10
popq %rdi
callq 0x61e0
movq %rax, %rbx
leaq 0xe219(%rip), %rsi      # 0x18952
movq %rsp, %rdi
movq %r12, %rdx
callq 0x7445
leaq 0xe0b3(%rip), %rdx      # 0x187fe
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x6c6e
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
movq %r15, %rdx
callq 0xb5fa
movb $0x1, %bpl
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0x66f0
xorl %ebp, %ebp
movq 0x1b83d(%rip), %rsi     # 0x25fc0
movq 0x1b81e(%rip), %rdx     # 0x25fa8
movq %rbx, %rdi
callq 0x66c0
movq %rax, %r14
leaq 0x40(%rsp), %rdi
callq 0x61b0
jmp 0xa7a7
movq %rax, %r14
movb $0x1, %bpl
leaq 0x20(%rsp), %rdi
callq 0x61b0
jmp 0xa7b9
movq %rax, %r14
movb $0x1, %bpl
movq %rsp, %rdi
callq 0x61b0
testb %bpl, %bpl
jne 0xa7cb
jmp 0xa7d3
movq %rax, %r14
movq %rbx, %rdi
callq 0x62c0
callq 0x6690
movq %r14, %rdi
callq 0x6710
movq %rax, %rdi
callq 0x82ce
// File: /workspace/github_cpp_makefile_star2_O2/joraso[P]Glassius/main.cpp
// Function: main
int main(int argc, const char * argv[]) {

    // Check:
    if(argc != 6){
        std::cout << "Error: wrong number of command line inputs!" << std::endl;
        return 1;
    }

    // Current command line arguments:
    int mode = std::stoi(argv[1]);
    double T = std::stod(argv[2]);
    double relax = std::stod(argv[3]);
    int record = std::stoi(argv[4]);
    int JobID = std::stoi(argv[5]);

    // start the clock
    Stopwatch timer;
    timer.StampLaunch();
    
    // seed the random number generator
    chaos::seed(JobID);
    
    // running the protocol
    
    if (mode==0) {Protocol::KobAndersonTest(T, relax, record, &timer);};
    if (mode==1) {Protocol::SzamelTest(T, relax, record, &timer);};
    //Protocol::LennardJonesTest(5.0 ,1000, &timer);
    //Protocol::DiffusionTest(T, relax, &timer);
    //Protocol::KobAndersonReplication(T, relax, &timer);
    
    // timestamping the end
    timer.EndStamp();
    
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
cmpl $0x6, %edi
jne 0x257d
movq %rsi, %r14
movq 0x8(%rsi), %rsi
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x2090
leaq 0x8(%rsp), %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x25f6
movl %eax, %ebx
leaq 0x8(%rsp), %rdi
callq 0x20a0
movq 0x10(%r14), %rsi
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x2090
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x2612
movsd %xmm0, 0x30(%rsp)
leaq 0x8(%rsp), %rdi
callq 0x20a0
movq 0x18(%r14), %rsi
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x2090
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x2612
movsd %xmm0, 0x28(%rsp)
leaq 0x8(%rsp), %rdi
callq 0x20a0
movq 0x20(%r14), %rsi
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x2090
leaq 0x8(%rsp), %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x25f6
movl %eax, %ebp
leaq 0x8(%rsp), %rdi
callq 0x20a0
movq 0x28(%r14), %rsi
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x2090
leaq 0x8(%rsp), %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x25f6
movl %eax, %r14d
leaq 0x8(%rsp), %rdi
callq 0x20a0
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x28fc
movq %r15, %rdi
callq 0x2922
cvtsi2sd %r14d, %xmm0
callq 0x27a4
cmpl $0x1, %ebx
je 0x259d
testl %ebx, %ebx
jne 0x25b5
leaq 0x8(%rsp), %rsi
movsd 0x30(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movl %ebp, %edi
callq 0x457e
jmp 0x25b5
movq 0x6a4c(%rip), %rdi      # 0x8fd0
leaq 0x3a79(%rip), %rsi      # 0x6004
callq 0x2150
movq %rax, %rdi
callq 0x20c0
pushq $0x1
popq %rax
jmp 0x25c1
leaq 0x8(%rsp), %rsi
movsd 0x30(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movl %ebp, %edi
callq 0x4af8
leaq 0x8(%rsp), %rdi
callq 0x29ec
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x25dc
jmp 0x25eb
jmp 0x25dc
jmp 0x25eb
jmp 0x25dc
jmp 0x25eb
jmp 0x25dc
jmp 0x25eb
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x20a0
jmp 0x25ee
movq %rax, %rbx
movq %rbx, %rdi
callq 0x2200
// File: /workspace/github_cpp_makefile_star2_O2/joraso[P]Glassius/chaos.cpp
// Function: chaos::seed(double)
void chaos::seed(double s){
    /* Seeds the random number generator. */
    std::cout << "Seeding random number generation with: " << s << std::endl;
    //std::cout << "maximum random is: " << RAND_MAX << std::endl;
    std::srand(s);
    return;
}

// Assembly:
pushq %rax
movsd %xmm0, (%rsp)
movq 0x681f(%rip), %rdi      # 0x8fd0
leaq 0x38a8(%rip), %rsi      # 0x6060
callq 0x2150
movq %rax, %rdi
movsd (%rsp), %xmm0
callq 0x21c0
movq %rax, %rdi
callq 0x20c0
cvttsd2si (%rsp), %rdi
popq %rax
jmp 0x2140
// File: /workspace/github_cpp_makefile_star2_O2/joraso[P]Glassius/chaos.cpp
// Function: chaos::gaussian(double, double)
double chaos::gaussian(double mean, double std){
    /* Draws random numbers from a gaussian using the box-muller method */
    double r1 = chaos::random();
    double r2 = chaos::random();
    double z0 = sqrt(-2.0*log(r1))*cos(2.0*M_PI*r2);
    //double z1 = sqrt(-2.0*log(r1))*sin(2.0*M_PI*r2);
    return (z0 * std) + mean;
}

// Assembly:
subq $0x28, %rsp
movsd %xmm1, 0x18(%rsp)
movsd %xmm0, 0x20(%rsp)
callq 0x27de
movsd %xmm0, 0x8(%rsp)
callq 0x27de
movsd %xmm0, 0x10(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x2110
mulsd 0x381d(%rip), %xmm0     # 0x6048
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x283b
sqrtsd %xmm0, %xmm0
jmp 0x2840
callq 0x2100
movsd %xmm0, 0x8(%rsp)
movsd 0x10(%rsp), %xmm0
mulsd 0x37fc(%rip), %xmm0     # 0x6050
callq 0x2210
mulsd 0x8(%rsp), %xmm0
mulsd 0x18(%rsp), %xmm0
addsd 0x20(%rsp), %xmm0
addq $0x28, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O2/joraso[P]Glassius/chaos.cpp
// Function: chaos::test(int)
void chaos::test(int n){
    /* Draw random numbers and prints them to "chaostest.csv" */
    double r;
    
    // Opening the file
    std::ofstream chaosfile;
    chaosfile.open("Data/chaostest.csv");
    
    for(int i=0;i<n;i++){
        // change the function you want to test here:
        r = gaussian(0.0, 1);
        chaosfile << r << std::endl;
    }
    chaosfile.close();
    return;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movl %edi, %ebx
movq %rsp, %r14
movq %r14, %rdi
callq 0x21d0
leaq 0x37f9(%rip), %rsi      # 0x6088
pushq $0x10
popq %rdx
movq %r14, %rdi
callq 0x2050
xorl %ebp, %ebp
testl %ebx, %ebx
cmovgl %ebx, %ebp
movq %rsp, %rbx
subl $0x1, %ebp
jb 0x28cb
xorps %xmm0, %xmm0
movsd 0x37a4(%rip), %xmm1     # 0x6058
callq 0x27f2
movq %rbx, %rdi
callq 0x21c0
movq %rax, %rdi
callq 0x20c0
jmp 0x28a4
movq %rsp, %rdi
callq 0x2180
movq %rsp, %rdi
callq 0x21a0
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x28e9
movq %rax, %rbx
movq %rsp, %rdi
callq 0x21a0
movq %rbx, %rdi
callq 0x2200
// File: /workspace/github_cpp_makefile_star2_O2/joraso[P]Glassius/Stopwatch.cpp
// Function: Stopwatch::Stopwatch()
Stopwatch::Stopwatch(){
    tici = std::time(0);
    ticf = std::time(0);
    ticlast = std::time(0);
    return;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
xorl %edi, %edi
callq 0x2130
movq %rax, (%rbx)
xorl %edi, %edi
callq 0x2130
movq %rax, 0x8(%rbx)
xorl %edi, %edi
callq 0x2130
movq %rax, 0x10(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/joraso[P]Glassius/Stopwatch.cpp
// Function: Stopwatch::StampComplete()
void Stopwatch::StampComplete(){
    time_t lap = std::time(0);
    char* dt = std::ctime(&lap);
    std::cout << "Task completed: " << dt;
    double elapsed = std::difftime(lap, ticlast);
    std::cout << "Elapsed time: " << elapsed << " sec" << std::endl;
    ticlast = lap;
    return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorl %edi, %edi
callq 0x2130
leaq 0x10(%rsp), %r14
movq %rax, (%r14)
movq %r14, %rdi
callq 0x2080
movq %rax, %r15
movq 0x6657(%rip), %r12      # 0x8fd0
leaq 0x3731(%rip), %rsi      # 0x60b1
movq %r12, %rdi
callq 0x2150
movq %rax, %rdi
movq %r15, %rsi
callq 0x2150
movq (%r14), %rdi
movq 0x10(%rbx), %rsi
callq 0x20d0
movsd %xmm0, 0x8(%rsp)
leaq 0x3737(%rip), %rsi      # 0x60e3
movq %r12, %rdi
callq 0x2150
movq %rax, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x21c0
leaq 0x36f9(%rip), %rsi      # 0x60c2
movq %rax, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x20c0
movq (%r14), %rax
movq %rax, 0x10(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq