LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/Neuromancer2701[P]OpenTool/lib/Timer/Timer.cpp
// Function: Timer::Timer(int, int, bool)
Timer::Timer(int _seconds, int _milliseconds, bool singleshot)
{
	timerSpecs.it_value.tv_sec = seconds = _seconds;
	milliseconds =_milliseconds;
	timerSpecs.it_value.tv_nsec = MILLISECONDS_TO_NANOSECONDS * milliseconds;

	if(singleshot)
	{
		timerSpecs.it_interval.tv_sec = 0;
		timerSpecs.it_interval.tv_nsec = 0;
	}
	else
	{
		timerSpecs.it_interval.tv_sec = timerSpecs.it_value.tv_sec;
		timerSpecs.it_interval.tv_nsec = timerSpecs.it_value.tv_nsec;
	}

	sigemptyset(&SignalAction.sa_mask);
	SignalAction.sa_flags = SA_SIGINFO;
	SignalAction.sa_sigaction = Timer::signal_handler;
	memset(&signalEvent, 0, sizeof(signalEvent));
	signalEvent.sigev_notify = SIGEV_SIGNAL;
	signalEvent.sigev_value.sival_ptr = (void*) this;
	signalEvent.sigev_signo = SIGALRM;


	if (timer_create(CLOCK_REALTIME, &signalEvent, &timerID)!= 0)
	{
		perror("Could not creat the timer");
	}

	if (sigaction(SIGALRM, &SignalAction, NULL))
	{
		perror("Could not install new signal handler");
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x5e77(%rip), %rax      # 0xefe0
addq $0x10, %rax
movq %rax, (%rdi)
movl %esi, 0x8(%rdi)
movslq %esi, %rax
movq %rax, 0x180(%rdi)
movl %edx, 0xc(%rdi)
imull $0xf4240, %edx, %edx    # imm = 0xF4240
movslq %edx, %rdx
movq %rdx, 0x188(%rdi)
testl %ecx, %ecx
je 0x91a3
leaq 0x170(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
jmp 0x91b1
movq %rax, 0x170(%rbx)
movq %rdx, 0x178(%rbx)
leaq 0xd8(%rbx), %r14
leaq 0xe0(%rbx), %rdi
callq 0x64a0
movl $0x4, 0x160(%rbx)
movq 0x5da3(%rip), %rax      # 0xef78
movq %rax, 0xd8(%rbx)
leaq 0x98(%rbx), %rsi
xorps %xmm0, %xmm0
movups %xmm0, 0x98(%rbx)
movups %xmm0, 0xa8(%rbx)
movups %xmm0, 0xb8(%rbx)
movups %xmm0, 0xc8(%rbx)
movq %rbx, 0x98(%rbx)
movl $0xe, 0xa0(%rbx)
addq $0x10, %rbx
xorl %edi, %edi
movq %rbx, %rdx
callq 0x60b0
testl %eax, %eax
jne 0x923d
movl $0xe, %edi
movq %r14, %rsi
xorl %edx, %edx
callq 0x64b0
testl %eax, %eax
jne 0x924b
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x1eea(%rip), %rdi      # 0xb12e
callq 0x6370
jmp 0x9225
leaq 0x1ef6(%rip), %rdi      # 0xb148
popq %rbx
popq %r14
popq %rbp
jmp 0x6370
nop
// File: /workspace/github_cpp_makefile_star2_O1/Neuromancer2701[P]OpenTool/lib/Timer/Timer.cpp
// Function: Timer::init(int, int, bool)
void Timer::init(int seconds, int milliseconds, bool singleshot)
{
	timerSpecs.it_value.tv_sec = seconds;
	timerSpecs.it_value.tv_nsec = MILLISECONDS_TO_NANOSECONDS * milliseconds;

	if(singleshot)
	{
		timerSpecs.it_interval.tv_sec = 0;
		timerSpecs.it_interval.tv_nsec = 0;
	}
	else
	{
		timerSpecs.it_interval.tv_sec = timerSpecs.it_value.tv_sec;
		timerSpecs.it_interval.tv_nsec = timerSpecs.it_value.tv_nsec;
	}

	sigemptyset(&SignalAction.sa_mask);
	SignalAction.sa_flags = SA_SIGINFO;
	SignalAction.sa_sigaction = Timer::signal_handler;
	memset(&signalEvent, 0, sizeof(signalEvent));
	signalEvent.sigev_notify = SIGEV_SIGNAL;
	signalEvent.sigev_value.sival_ptr = (void*) this;
	signalEvent.sigev_signo = SIGALRM;


	if (timer_create(CLOCK_REALTIME, &signalEvent, &timerID)!= 0)
	{
		perror("Could not creat the timer");
	}

	if (sigaction(SIGALRM, &SignalAction, NULL))
	{
		perror("Could not install new signal handler");
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
movslq %esi, %rax
movq %rax, 0x180(%rdi)
imull $0xf4240, %edx, %edx    # imm = 0xF4240
movslq %edx, %rdx
movq %rdx, 0x188(%rdi)
testl %ecx, %ecx
je 0x92d9
leaq 0x170(%r14), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
jmp 0x92e7
movq %rax, 0x170(%r14)
movq %rdx, 0x178(%r14)
leaq 0xd8(%r14), %rbx
leaq 0xe0(%r14), %rdi
callq 0x64a0
movl $0x4, 0x160(%r14)
movq 0x5c6c(%rip), %rax      # 0xef78
movq %rax, 0xd8(%r14)
leaq 0x98(%r14), %rsi
xorps %xmm0, %xmm0
movups %xmm0, 0x98(%r14)
movups %xmm0, 0xa8(%r14)
movups %xmm0, 0xb8(%r14)
movups %xmm0, 0xc8(%r14)
movq %r14, 0x98(%r14)
movl $0xe, 0xa0(%r14)
addq $0x10, %r14
xorl %edi, %edi
movq %r14, %rdx
callq 0x60b0
testl %eax, %eax
jne 0x9379
movl $0xe, %edi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x64b0
testl %eax, %eax
jne 0x9387
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x1dae(%rip), %rdi      # 0xb12e
callq 0x6370
jmp 0x9361
leaq 0x1dba(%rip), %rdi      # 0xb148
popq %rbx
popq %r14
popq %rbp
jmp 0x6370
nop
// File: /workspace/github_cpp_makefile_star2_O1/Neuromancer2701[P]OpenTool/lib/sockets/Client.cpp
// Function: Client::Client(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned short)
Client::Client(string _ip_address,unsigned short _port) {

	ip_address = _ip_address;
	port = _port;
	client_fd = -1;
	status = Connection_Status::UNKNOWN;
	retries = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %r14d
movq %rdi, %rbx
movq 0x5bbc(%rip), %rax      # 0xefc8
addq $0x10, %rax
movq %rax, (%rdi)
leaq 0x18(%rdi), %r15
leaq 0x28(%rdi), %r12
movq %r12, 0x18(%rdi)
movq $0x0, 0x20(%rdi)
movb $0x0, 0x28(%rdi)
movq %r15, %rdi
callq 0x6240
movw %r14w, 0x38(%rbx)
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rax, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x9463
callq 0x63e0
movq %rbx, %rdi
callq 0x6680
nop
// File: /workspace/github_cpp_makefile_star2_O1/Neuromancer2701[P]OpenTool/lib/sockets/Client.cpp
// Function: Client::Client()
Client::Client() {

	ip_address = "";
	port = 0;
	client_fd = -1;
	status = Connection_Status::UNKNOWN;
	retries = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x5b48(%rip), %rax      # 0xefc8
addq $0x10, %rax
movq %rax, (%rdi)
leaq 0x18(%rdi), %r14
leaq 0x28(%rdi), %r15
movq %r15, 0x18(%rdi)
movq $0x0, 0x20(%rdi)
movb $0x0, 0x28(%rdi)
leaq 0x1e5f(%rip), %rcx      # 0xb305
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x65a0
movw $0x0, 0x38(%rbx)
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rax, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq (%r14), %rdi
cmpq %r15, %rdi
je 0x94e8
callq 0x63e0
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O1/Neuromancer2701[P]OpenTool/lib/sockets/Client.cpp
// Function: Client::Accept(int)
Error Client::Accept(int _server_fd){
	struct sockaddr in_addr;
	socklen_t in_len;
	int local_client_fd;
	char port_buffer[32];
	char ip_buffer[32];
	Error error_state = Error::NONE;

	DEBUG("Accepting, Server FD: %d\n ",_server_fd);
	in_len = sizeof( in_addr);
	local_client_fd = accept (_server_fd, &in_addr, &in_len);
	if (local_client_fd == -1)
	{
		if ((errno == EAGAIN) || (errno == EWOULDBLOCK))  /* We have processed all incoming connections. */
		{
			status = Connection_Status::UNKNOWN;
			error_state = Error::ACCEPT_DONE;
			client_fd = -1;
		}
		else
		{
			perror ("accept");
			status = Connection_Status::DISCONNECTED;
			error_state = Error::ACCEPT;
			client_fd = -1;
		}
	}
	else
	{
		client_fd = local_client_fd;
		status = Connection_Status::CONNECTED;
		retries = 0;

		DEBUG("Accepted connections, client FD: %d\n ",client_fd);

        int nameinfo = getnameinfo (&in_addr, in_len, ip_buffer, sizeof(ip_buffer), port_buffer, sizeof(port_buffer), NI_NUMERICHOST | NI_NUMERICSERV);
		if (nameinfo == 0)
		{
			ip_address = string(ip_buffer);
			port = atoi(port_buffer);
			DEBUG("Client Ip:%s:%d \n ",ip_address.c_str(), port);
		}

		if(setBlockingMode(Blocking_Mode::NonBlock) != Error::NONE)
		{
			perror("Nonblock failed.");
			status = Connection_Status::DISCONNECTED;
		}
	}

	return error_state;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x90, %rsp
movl %esi, %r14d
movq %rdi, %rbx
leaq 0x1c5c(%rip), %rdi      # 0xb18b
xorl %eax, %eax
callq 0x6060
leaq -0x24(%rbp), %rdx
movl $0x10, (%rdx)
leaq -0x34(%rbp), %rsi
movl %r14d, %edi
callq 0x6130
cmpl $-0x1, %eax
je 0x9637
movl %eax, 0xc(%rbx)
movl $0x1, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
leaq 0x1c43(%rip), %rdi      # 0xb1ad
movl %eax, %esi
xorl %eax, %eax
callq 0x6060
movl -0x24(%rbp), %esi
movl $0x3, (%rsp)
leaq -0x34(%rbp), %rdi
leaq -0x60(%rbp), %rdx
leaq -0x80(%rbp), %r8
movl $0x20, %ecx
movl $0x20, %r9d
callq 0x62a0
testl %eax, %eax
jne 0x960a
leaq -0x90(%rbp), %r12
movq %r12, -0x10(%r12)
leaq -0x60(%rbp), %r14
movq %r14, %rdi
callq 0x61e0
leaq (%rax,%rbp), %rdx
addq $-0x60, %rdx
leaq -0xa0(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x61b0
leaq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0x6470
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x95e8
callq 0x63e0
leaq -0x80(%rbp), %rdi
callq 0x65c0
movw %ax, 0x38(%rbx)
movq 0x18(%rbx), %rsi
movzwl %ax, %edx
leaq 0x1bd0(%rip), %rdi      # 0xb1d3
xorl %eax, %eax
callq 0x6060
movq %rbx, %rdi
movl $0x1, %esi
callq 0x66e0
movl $0x2, %r14d
cmpl $0x2, %eax
je 0x9655
leaq 0x1d34(%rip), %rdi      # 0xb35d
callq 0x6370
movl $0xffffffff, 0x8(%rbx)  # imm = 0xFFFFFFFF
jmp 0x9655
callq 0x6050
cmpl $0xb, (%rax)
jne 0x9668
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rax, 0x8(%rbx)
movl $0x10, %r14d
movl %r14d, %eax
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1b37(%rip), %rdi      # 0xb1a6
callq 0x6370
movq $-0x1, 0x8(%rbx)
movl $0x9, %r14d
jmp 0x9655
// File: /workspace/github_cpp_makefile_star2_O1/Neuromancer2701[P]OpenTool/lib/sockets/Client.cpp
// Function: Client::setBlockingMode(Blocking_Mode)
Error Client::setBlockingMode(Blocking_Mode mode)
{
	Error status = Error::UNKNOWN;
	int old_flags = fcntl(client_fd,F_GETFL, 0);

	if(old_flags < 0 )
	{
		perror("failed to read old flags.");
		status = Error::FCNTL_GET;
	}
	else
	{
		if(mode == Blocking_Mode::NonBlock)
		{
			old_flags |= O_NONBLOCK;
		}
		else
		{
			old_flags &= ~O_NONBLOCK;
		}

		old_flags = fcntl(client_fd,F_SETFL, old_flags);
		if(old_flags < 0 )
		{
			perror("failed to set non-block flags.");
			status = Error::FCNTL_SET;
		}
		else
		{
			status = Error::NONE;
		}
	}

	return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
movl 0xc(%rdi), %edi
movl $0x3, %r15d
movl $0x3, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x6260
testl %eax, %eax
js 0x96ea
movl %eax, %ecx
orl $0x800, %ecx            # imm = 0x800
andl $0x7ffff7ff, %eax       # imm = 0x7FFFF7FF
cmpl $0x1, %r14d
cmovel %ecx, %eax
movl 0xc(%rbx), %edi
movl $0x4, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x6260
movl %eax, %ecx
movl $0x2, %eax
testl %ecx, %ecx
js 0x96f9
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x4, %r15d
leaq 0x1b96(%rip), %rdi      # 0xb28d
jmp 0x9700
leaq 0x1ba7(%rip), %rdi      # 0xb2a7
callq 0x6370
movl %r15d, %eax
jmp 0x96df
// File: /workspace/github_cpp_makefile_star2_O1/Neuromancer2701[P]OpenTool/lib/sockets/Client.cpp
// Function: Client::Disconnect()
Connection_Status Client::Disconnect()
{
	status = Connection_Status::UNKNOWN;

	    if (client_fd >= 0)
	    {
	        close(client_fd);
	        client_fd = -1;
	        status = Connection_Status::DISCONNECTED;
	    }

	return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x0, 0x8(%rdi)
movl 0xc(%rdi), %edi
testl %edi, %edi
js 0x996a
callq 0x6720
movq $-0x1, 0x8(%rbx)
movl 0x8(%rbx), %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/Neuromancer2701[P]OpenTool/lib/sockets/Client.cpp
// Function: Client::EventRead(std::vector<char, std::allocator<char>>&)
Error Client::EventRead(vector<char>& buffer)
{
	Error error_state = Error::UNKNOWN;
	int event_fd, epoll_status;
	struct epoll_event event;
	struct epoll_event events[MAX_EVENTS];

	event_fd = epoll_create1(0);
	if (event_fd == -1)
	{
		perror ("epoll_create");
		error_state = Error::EPOLL_CREATE;
	}
	else
	{
		event.data.fd = client_fd;
		event.events = EPOLLIN | EPOLLET | EPOLLRDHUP;

		epoll_status = epoll_ctl (event_fd, EPOLL_CTL_ADD, client_fd, &event);
		if (epoll_status == -1)
		{
			perror ("epoll_create");
			error_state = Error::EPOLL_CTL;
		}
		else
		{
		    int epoll_events = epoll_wait (event_fd, events, MAX_EVENTS, 1000);
		    for (int i = 0; i < epoll_events; i++)
			{
				if((events[i].events & EPOLLERR) || (events[i].events & EPOLLHUP) || (!(events[i].events & EPOLLIN ))) /*Epoll error occured*/
				{
				  perror("epoll wait error\n");
				  error_state = Error::EPOLL_WAIT;
				  close (events[i].data.fd);
				}
				else if(events[i].events & EPOLLRDHUP)
				{
					perror("epoll event Client has hung up.\n");
					error_state = Error::EPOLL_CLOSE;
				}
				else if(client_fd == events[i].data.fd)
				{
					error_state = Read(buffer);
				}
			}
		}
	}

	return error_state;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorl %edi, %edi
callq 0x6500
cmpl $-0x1, %eax
je 0x9a4c
movl %eax, %r12d
movl 0xc(%r14), %edx
leaq -0x34(%rbp), %rcx
movl %edx, 0x4(%rcx)
movl $0x80002001, (%rcx)     # imm = 0x80002001
movl %eax, %edi
movl $0x1, %esi
callq 0x6520
cmpl $-0x1, %eax
je 0x9a54
leaq -0x100(%rbp), %r15
movl %r12d, %edi
movq %r15, %rsi
movl $0x10, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
callq 0x6200
testl %eax, %eax
jle 0x9a47
movl %eax, %r13d
xorl %r12d, %r12d
movl (%r15), %eax
movl %eax, %ecx
andl $0x19, %ecx
cmpl $0x1, %ecx
jne 0x9a23
btl $0xd, %eax
jb 0x9a33
movl 0xc(%r14), %eax
cmpl 0x4(%r15), %eax
jne 0x9a18
movq %r14, %rdi
movq %rbx, %rsi
callq 0x6220
movl %eax, %r12d
addq $0xc, %r15
decq %r13
jne 0x99ed
jmp 0x9a66
movq %r15, %rdi
callq 0x6740
movl $0xd, %r12d
jmp 0x9a18
leaq 0x18ab(%rip), %rdi      # 0xb2e5
callq 0x6370
movl $0xf, %r12d
jmp 0x9a18
xorl %r12d, %r12d
jmp 0x9a66
movl $0xb, %r12d
jmp 0x9a5a
movl $0xc, %r12d
leaq 0x1865(%rip), %rdi      # 0xb2c6
callq 0x6370
movl %r12d, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/Neuromancer2701[P]OpenTool/lib/sockets/Client.cpp
// Function: Client::Read(std::vector<char, std::allocator<char>>&)
Error Client::Read(vector<char>& buffer)
{
	Error status = Error::UNKNOWN;
	int read_bytes = 0;
	char read_buffer[MAX_PACKET_LENGTH];

	read_bytes = read(client_fd, read_buffer, MAX_PACKET_LENGTH);
	if(read_bytes > 0)
	{
		buffer.resize(read_bytes);
		std::copy ( read_buffer, read_buffer + read_bytes, buffer.begin() );
		status = Error::NONE;
	}
	else
	{
		perror("failed to Read.");
		status = Error::READ;
	}

	return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x2718, %rsp           # imm = 0x2718
movq %rsi, %rbx
movl 0xc(%rdi), %edi
leaq -0x2730(%rbp), %rsi
movl $0x2710, %edx           # imm = 0x2710
callq 0x6560
movq %rax, %r14
testl %r14d, %r14d
jle 0x9aef
movq %r14, %rsi
andq $0x7fffffff, %rsi       # imm = 0x7FFFFFFF
movq %rbx, %rdi
callq 0x6650
movl $0x2, %r15d
andq $0x7fffffff, %r14       # imm = 0x7FFFFFFF
je 0x9ade
movq (%rbx), %rdi
leaq -0x2730(%rbp), %rsi
movq %r14, %rdx
callq 0x6350
movl %r15d, %eax
addq $0x2718, %rsp           # imm = 0x2718
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1810(%rip), %rdi      # 0xb306
callq 0x6370
movl $0x5, %r15d
jmp 0x9ade
nop
// File: /workspace/github_cpp_makefile_star2_O1/Neuromancer2701[P]OpenTool/lib/sockets/Client.cpp
// Function: Client::Write(std::vector<char, std::allocator<char>>)
Error Client::Write(vector<char>  buffer)
{
	Error status = Error::UNKNOWN;
	int written_bytes = 0;
	char write_buffer[MAX_PACKET_LENGTH];
	int size = 0;

	for(unsigned int i = 0; i < buffer.size(); i ++)
	{
		write_buffer[i] = buffer[i];
	}

	written_bytes = write(client_fd, write_buffer, size);

	if(written_bytes > 0)
	{
		status = Error::NONE;
	}
	else
	{
		perror("failed to Write.");
		status = Error::WRITE;
	}

	return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2710, %rsp           # imm = 0x2710
movq (%rsi), %rax
movq 0x8(%rsi), %rcx
subq %rax, %rcx
je 0x9b33
xorl %edx, %edx
movb (%rax,%rdx), %sil
movb %sil, -0x2710(%rbp,%rdx)
incq %rdx
movl %edx, %esi
cmpq %rsi, %rcx
ja 0x9b1d
movl 0xc(%rdi), %edi
leaq -0x2710(%rbp), %rsi
xorl %edx, %edx
callq 0x6170
movq %rax, %rcx
movl $0x2, %eax
testl %ecx, %ecx
jle 0x9b59
addq $0x2710, %rsp           # imm = 0x2710
popq %rbp
retq
leaq 0x17b6(%rip), %rdi      # 0xb316
callq 0x6370
movl $0x6, %eax
jmp 0x9b50
// File: /workspace/github_cpp_makefile_star2_O1/Neuromancer2701[P]OpenTool/lib/sockets/Server.cpp
// Function: Server::setBlockingMode(Blocking_Mode)
Error Server::setBlockingMode(Blocking_Mode mode)
{
	error_state = Error::UNKNOWN;
	int old_flags = fcntl(server_fd,F_GETFL, 0);

	if(old_flags < 0 )
	{
		perror("failed to read old flags.");
		error_state = Error::FCNTL_GET;
	}
	else
	{
		if(mode == Blocking_Mode::NonBlock)
		{
			old_flags |= O_NONBLOCK;
		}
		else
		{
			old_flags &= ~O_NONBLOCK;
		}

		old_flags = fcntl(server_fd,F_SETFL, old_flags);
		if(old_flags < 0 )
		{
			perror("failed to set non-block flags.");
			error_state = Error::FCNTL_SET;
		}
		else
		{
			error_state = Error::NONE;
		}
	}

	return error_state;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
movl $0x0, 0x1b4(%rdi)
movl 0x1a8(%rdi), %edi
movl $0x3, %r15d
movl $0x3, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x6260
testl %eax, %eax
js 0xa136
movl %eax, %ecx
orl $0x800, %ecx            # imm = 0x800
andl $0x7ffff7ff, %eax       # imm = 0x7FFFF7FF
cmpl $0x1, %r14d
cmovel %ecx, %eax
movl 0x1a8(%rbx), %edi
movl $0x4, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x6260
movl %eax, %ecx
movl $0x2, %eax
testl %ecx, %ecx
js 0xa145
movl %eax, 0x1b4(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x4, %r15d
leaq 0x114a(%rip), %rdi      # 0xb28d
jmp 0xa14c
leaq 0x115b(%rip), %rdi      # 0xb2a7
callq 0x6370
movl %r15d, %eax
jmp 0xa125
// File: /workspace/github_cpp_makefile_star2_O1/Neuromancer2701[P]OpenTool/lib/sockets/Server.cpp
// Function: Server::~Server()
Server::~Server() {

	if(server_fd > 0)
		close(server_fd);

	for(int i = 0;i < MAX_CONNECTIONS; i++)
	{
		client_list[i].Disconnect();
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x4e39(%rip), %rax      # 0xefa0
addq $0x10, %rax
movq %rax, (%rdi)
movl 0x1a8(%rdi), %edi
testl %edi, %edi
jle 0xa17d
callq 0x6720
movl $0x10, %r14d
leaq (%rbx,%r14), %rdi
callq 0x66d0
addq $0x40, %r14
cmpq $0x190, %r14            # imm = 0x190
jne 0xa183
leaq 0x288(%rbx), %rdi
callq 0x66b0
movq 0x190(%rbx), %rdi
testq %rdi, %rdi
je 0xa1b6
callq 0x63e0
movl $0x150, %r14d           # imm = 0x150
leaq (%rbx,%r14), %rdi
callq 0x60e0
addq $-0x40, %r14
cmpq $-0x30, %r14
jne 0xa1bc
popq %rbx
popq %r14
popq %rbp
retq
jmp 0xa1d6
movq %rax, %rdi
callq 0x7b16
// File: /workspace/github_cpp_makefile_star2_O1/Neuromancer2701[P]OpenTool/lib/sockets/Server.cpp
// Function: Server::AddClientToEvent(Client)
Error Server::AddClientToEvent(Client client)
{
	error_state = Error::UNKNOWN;
	int epoll_status;
	struct epoll_event event;

	event.data.fd = client.get_fd();
	event.events = EPOLLIN | EPOLLET | EPOLLRDHUP;

	epoll_status = epoll_ctl(event_fd, EPOLL_CTL_ADD, event.data.fd, &event);

	if (epoll_status == -1)
	{
		perror ("epoll_create");
		error_state = Error::EPOLL_CTL;
	}
	else
	{
		error_state = Error::NONE;
	}

	return error_state;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl $0x0, 0x1b4(%rdi)
movl 0xc(%rsi), %edx
leaq -0x14(%rbp), %rcx
movl %edx, 0x4(%rcx)
movl $0x80002001, (%rcx)     # imm = 0x80002001
movl 0x1b8(%rdi), %edi
movl $0x1, %esi
callq 0x6520
movl %eax, %ecx
movl $0x2, %eax
cmpl $-0x1, %ecx
je 0xa487
movl %eax, 0x1b4(%rbx)
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
leaq 0xe38(%rip), %rdi       # 0xb2c6
callq 0x6370
movl $0xc, %eax
jmp 0xa47a
// File: /workspace/github_cpp_makefile_star2_O1/Neuromancer2701[P]OpenTool/lib/sockets/Server.cpp
// Function: Server::isClient(int, Client&)
bool Server::isClient(int fd, Client& client)
{
	bool found = false;
	for(auto local:client_list)
	{
		if(local.get_fd() == fd)
		{
			client = local;
			found = true;
		}
	}

	return found;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %esi, -0x30(%rbp)
movq %rdi, %r15
leaq -0x78(%rbp), %r13
leaq 0x8(%rdx), %r12
movq %rdx, -0x38(%rbp)
leaq 0x18(%rdx), %rax
movq %rax, -0x40(%rbp)
movl $0x48, %ebx
movl $0x0, -0x2c(%rbp)
movq 0x4af0(%rip), %r14      # 0xefc8
addq $0x10, %r14
movq %r14, -0x80(%rbp)
movb -0x28(%r15,%rbx), %al
movb %al, 0x8(%r13)
movq -0x30(%r15,%rbx), %rax
movq %rax, (%r13)
leaq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x20(%r15,%rbx), %rsi
movq -0x18(%r15,%rbx), %rdx
addq %rsi, %rdx
leaq -0x68(%rbp), %rdi
callq 0x61c0
movzwl (%r15,%rbx), %eax
movw %ax, -0x48(%rbp)
movl -0x30(%rbp), %eax
cmpl %eax, -0x74(%rbp)
jne 0xa550
movb 0x8(%r13), %al
movb %al, 0x8(%r12)
movq (%r13), %rax
movq %rax, (%r12)
movq -0x40(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x6240
movzwl -0x48(%rbp), %eax
movq -0x38(%rbp), %rcx
movw %ax, 0x38(%rcx)
movb $0x1, %al
movl %eax, -0x2c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x60e0
addq $0x40, %rbx
cmpq $0x1c8, %rbx            # imm = 0x1C8
jne 0xa4dc
movl -0x2c(%rbp), %eax
andb $0x1, %al
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x60e0
movq %rbx, %rdi
callq 0x6680
// File: /workspace/github_cpp_makefile_star2_O1/iZhangHui[P]CppPrimer/CH13_CopyControl/examples/HasPtrValueLike.cc
// Function: HasPtr::operator=(HasPtr const&)
HasPtr& HasPtr::operator=(const HasPtr& rhs)
{
	auto newp = new string(*rhs.ps);  // copy the underlying string
	delete ps;       // free the old memory
	ps = newp;       // copy data from rhs into this object
	i = rhs.i;
	return *this;    // return this object
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl $0x20, %edi
callq 0x1050
movq %rax, %r15
movq (%r14), %rax
leaq 0x10(%r15), %rcx
movq %rcx, (%r15)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x1412
movq (%rbx), %r12
testq %r12, %r12
je 0x11f4
movq (%r12), %rdi
leaq 0x10(%r12), %rax
cmpq %rax, %rdi
je 0x11e7
movq (%rax), %rsi
incq %rsi
callq 0x1060
movl $0x20, %esi
movq %r12, %rdi
callq 0x1060
movq %r15, (%rbx)
movl 0x8(%r14), %eax
movl %eax, 0x8(%rbx)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x20, %esi
movq %r15, %rdi
callq 0x1060
movq %rbx, %rdi
callq 0x1070
// File: /workspace/github_cpp_makefile_star2_O1/renzibei[P]TSProxy/proxyclient.cpp
// Function: sendMessage(int, unsigned char const*, unsigned long, ClientContext*, int)
ssize_t sendMessage(int sockFd, const uint8_t *src, size_t nbyte, ClientContext *ctx, int msgType = 4) {
    static InnerMsg innerMsg;
    memset(&innerMsg, 0, sizeof(innerMsg));
    ctx->cSeq++;
    innerMsg.cSeq = ctx->cSeq;
    innerMsg.sSeq = ctx->sSeq;
    innerMsg.msgType = msgType;
    if (nbyte > sizeof(innerMsg.data)) {
        LogHelper::log(Error, "Failed to send data, nbyte too large, nbyte: %lu", nbyte);
        return -1;
    }
    innerMsg.dataLength = nbyte;
    memcpy(innerMsg.data, src, nbyte);
    ssize_t sendCode = sendTSPacket(sockFd, &innerMsg, constants::serverNonBlocking);
    if (sendCode < 0) {
        LogHelper::log(Error, "Fail to send data");
        return sendCode;
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %r8d, %r15d
movq %rcx, %r12
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
leaq 0x187c9(%rip), %rdi     # 0x1b240
movl $0x10000, %edx          # imm = 0x10000
xorl %esi, %esi
callq 0x2130
movq (%r12), %rax
incq %rax
movq %rax, (%r12)
movq %rax, 0x187ab(%rip)     # 0x1b240
movq 0x8(%r12), %rax
movq %rax, 0x187a7(%rip)     # 0x1b248
movw %r15w, 0x187a7(%rip)    # 0x1b250
cmpq $0xffed, %rbx           # imm = 0xFFED
jb 0x2ace
leaq 0x4698(%rip), %rsi      # 0x7151
xorl %edi, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x27f8
movq $-0x1, %rbx
jmp 0x2b19
movw %bx, 0x1877d(%rip)      # 0x1b252
leaq 0x18764(%rip), %r15     # 0x1b240
leaq 0x18771(%rip), %rdi     # 0x1b254
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2190
movl %ebp, %edi
movq %r15, %rsi
movl $0x1, %edx
callq 0x4f10
testq %rax, %rax
js 0x2b06
xorl %ebx, %ebx
jmp 0x2b19
movq %rax, %rbx
leaq 0x4672(%rip), %rsi      # 0x7182
xorl %edi, %edi
xorl %eax, %eax
callq 0x27f8
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/renzibei[P]TSProxy/proxyclient.cpp
// Function: sendRequestMsg(int, int, unsigned char const*, unsigned long, ClientContext*)
ssize_t sendRequestMsg(int serverFd, int localFd, const uint8_t *src, size_t nbyte, ClientContext *ctx) {
    static uint8_t msgBuffer[constants::AES_MAX_DATA_LENGTH];
    memset(msgBuffer, 0, sizeof(msgBuffer));
    hton_copy4bytes(msgBuffer, &localFd);
    if (sizeof(msgBuffer) < nbyte + 4) {
        LogHelper::log(Warn, "Failed to send request msg, nbyte greater than buffersize + 4");
        return -1;
    }
    memcpy(msgBuffer + 4, src, nbyte);
    ssize_t sendCode = sendMessage(serverFd, msgBuffer, nbyte + 4, ctx, 8);
    if (sendCode < 0) {
        LogHelper::log(Error, "Failed to send request msg");
        return sendCode;
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r15
movl %esi, %r12d
movl %edi, %ebp
leaq 0x286fe(%rip), %rdi     # 0x2b240
movl $0xffcc, %edx           # imm = 0xFFCC
xorl %esi, %esi
callq 0x2130
bswapl %r12d
movl %r12d, 0x286e8(%rip)    # 0x2b240
leaq 0x4(%r14), %r12
cmpq $0xffcd, %r12           # imm = 0xFFCD
jb 0x2b81
leaq 0x4628(%rip), %rsi      # 0x7194
movl $0x1, %edi
xorl %eax, %eax
callq 0x27f8
movq $-0x1, %rbx
jmp 0x2bc9
leaq 0x286bc(%rip), %rdi     # 0x2b244
movq %r15, %rsi
movq %r14, %rdx
callq 0x2190
leaq 0x286a6(%rip), %rsi     # 0x2b240
movl %ebp, %edi
movq %r12, %rdx
movq %rbx, %rcx
movl $0x8, %r8d
callq 0x2a5a
testq %rax, %rax
js 0x2bb6
xorl %ebx, %ebx
jmp 0x2bc9
movq %rax, %rbx
leaq 0x4612(%rip), %rsi      # 0x71d2
xorl %edi, %edi
xorl %eax, %eax
callq 0x27f8
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/renzibei[P]TSProxy/proxyclient.cpp
// Function: recvMessage(int, unsigned char*, unsigned long, ClientContext*, unsigned char*)
ssize_t recvMessage(int sockFd, uint8_t *dst, size_t bufferSize, ClientContext *ctx, uint8_t *msgTypePtr = NULL) {
    static InnerMsg innerMsg;
    memset(&innerMsg, 0, sizeof(innerMsg));

    ssize_t recvCode = recvTSPacket(sockFd, &innerMsg, constants::serverNonBlocking);
    if (recvCode < 0) {
        LogHelper::log(Error, "Fail to recv data");
        return recvCode;
    }
    if (innerMsg.sSeq != ctx->sSeq + 1) {
        LogHelper::log(Error, "Fail to recv data, seq error, sSeq: %llu, expected: %llu", innerMsg.sSeq, ctx->sSeq + 1);
        return -2;
    }
    if (innerMsg.msgType != 5 && innerMsg.msgType != 7 && innerMsg.msgType != 9) {
        LogHelper::log(Error, "Fail to recv data, msgType error, recv type :%d", innerMsg.msgType);
        return -3;
    }
    if (msgTypePtr != NULL)
        *msgTypePtr = innerMsg.msgType;
    if (innerMsg.dataLength > bufferSize) {
        LogHelper::log(Error, "Fail to recv data, bufferSize not enought, bufferSize :%lu, expected: %lu", bufferSize, innerMsg.dataLength);
        return -4;
    }
    memcpy(dst, innerMsg.data, innerMsg.dataLength);
    ctx->sSeq = innerMsg.sSeq;
    return innerMsg.dataLength;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r12
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %ebp
leaq 0x3861b(%rip), %r13     # 0x3b210
movl $0x10000, %edx          # imm = 0x10000
movq %r13, %rdi
xorl %esi, %esi
callq 0x2130
movl %ebp, %edi
movq %r13, %rsi
movl $0x1, %edx
callq 0x5096
testq %rax, %rax
js 0x2c7a
movq 0x385f9(%rip), %rdx     # 0x3b218
movq 0x8(%rbx), %rcx
incq %rcx
cmpq %rcx, %rdx
jne 0x2c8f
movzwl 0x385ee(%rip), %edx     # 0x3b220
cmpl $0x9, %edx
ja 0x2ccf
movl $0x2a0, %eax            # imm = 0x2A0
btl %edx, %eax
jae 0x2ccf
testq %r12, %r12
je 0x2c52
movb %dl, (%r12)
movzwl 0x385c9(%rip), %ecx     # 0x3b222
cmpq %r14, %rcx
jbe 0x2ca8
leaq 0x4603(%rip), %rsi      # 0x7268
xorl %edi, %edi
movq %r14, %rdx
xorl %eax, %eax
callq 0x27f8
movq $-0x4, %r13
jmp 0x2ce6
movq %rax, %r13
leaq 0x4569(%rip), %rsi      # 0x71ed
xorl %edi, %edi
xorl %eax, %eax
callq 0x27f8
jmp 0x2ce6
leaq 0x4569(%rip), %rsi      # 0x71ff
xorl %edi, %edi
xorl %eax, %eax
callq 0x27f8
movq $-0x2, %r13
jmp 0x2ce6
leaq 0x38575(%rip), %rsi     # 0x3b224
movq %r15, %rdi
movq %rcx, %rdx
callq 0x2190
movq 0x38557(%rip), %rax     # 0x3b218
movq %rax, 0x8(%rbx)
movzwl 0x38555(%rip), %r13d    # 0x3b222
jmp 0x2ce6
leaq 0x4562(%rip), %rsi      # 0x7238
xorl %edi, %edi
xorl %eax, %eax
callq 0x27f8
movq $-0x3, %r13
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/renzibei[P]TSProxy/proxyclient.cpp
// Function: recvReplyMsg(int, unsigned char*, unsigned long, ClientContext*, int*)
int recvReplyMsg(int serverFd, uint8_t *dst, size_t bufferSize, ClientContext *ctx, int *localFdPtr) {
    static uint8_t msgBuffer[constants::MAX_MSG_DATA_LENGTH];
    memset(msgBuffer, 0, sizeof(msgBuffer));
    uint8_t msgType = 0;
    ssize_t recvCode = recvMessage(serverFd, msgBuffer, sizeof(msgBuffer), ctx, &msgType);
    if (msgType != 9) {
        LogHelper::log(Error, "Failed in reply msg, error msg type, get :%d, expected: %d", msgType, 9);
        return -3;
    }
    if (recvCode < 0) {
        LogHelper::log(Error, "Failed to recv reply msg");
        return recvCode;
    }
    if (recvCode > bufferSize + 4) {
        LogHelper::log(Error, "buffer size less than recv msg len + 4, buffersize: %d, msgLen: %d", bufferSize, recvCode);
        return -1;
    }
    if (recvCode < 4) {
        LogHelper::log(Error, "recv msg len less than 4, recv len: %d", recvCode);
        return -2;
    }
    int localFd = 0;
    ntoh_copy4bytes(&localFd, msgBuffer);
    memcpy(dst, msgBuffer + 4, recvCode - 4);
    assert(localFdPtr != NULL);
    *localFdPtr = localFd;
    return recvCode - 4;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, 0x10(%rsp)
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r15
movl %edi, %ebp
leaq 0x484f3(%rip), %r13     # 0x4b210
movl $0xffec, %edx           # imm = 0xFFEC
movq %r13, %rdi
xorl %esi, %esi
callq 0x2130
leaq 0xf(%rsp), %r14
movb $0x0, (%r14)
movl $0xffec, %edx           # imm = 0xFFEC
movl %ebp, %edi
movq %r13, %rsi
movq %rbx, %rcx
movq %r14, %r8
callq 0x2bd5
movzbl (%r14), %edx
cmpl $0x9, %edx
jne 0x2d82
movq %rax, %rbx
testq %rax, %rax
js 0x2d9e
leaq 0x4(%r12), %rax
cmpq %rax, %rbx
jbe 0x2db0
leaq 0x459a(%rip), %rsi      # 0x7306
xorl %edi, %edi
movq %r12, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x27f8
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x2dfa
leaq 0x4529(%rip), %rsi      # 0x72b2
xorl %edi, %edi
movl $0x9, %ecx
xorl %eax, %eax
callq 0x27f8
movl $0xfffffffd, %ebx       # imm = 0xFFFFFFFD
jmp 0x2dfa
leaq 0x4548(%rip), %rsi      # 0x72ed
xorl %edi, %edi
xorl %eax, %eax
callq 0x27f8
jmp 0x2dfa
cmpq $0x3, %rbx
jg 0x2dd0
leaq 0x458c(%rip), %rsi      # 0x7349
xorl %edi, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x27f8
movl $0xfffffffe, %ebx       # imm = 0xFFFFFFFE
jmp 0x2dfa
movl 0x4843a(%rip), %ebp     # 0x4b210
addq $-0x4, %rbx
leaq 0x48433(%rip), %rsi     # 0x4b214
movq %r15, %rdi
movq %rbx, %rdx
callq 0x2190
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x2e0b
bswapl %ebp
movl %ebp, (%rax)
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x455e(%rip), %rdi      # 0x7370
leaq 0x456a(%rip), %rsi      # 0x7383
leaq 0x4573(%rip), %rcx      # 0x7393
movl $0xac, %edx
callq 0x2150
// File: /workspace/github_cpp_makefile_star2_O1/renzibei[P]TSProxy/proxyclient.cpp
// Function: loopSend(int, ClientContext*)
void loopSend(int sockFd, ClientContext *ctx) {
    static char sendBuf[] = "Hello Server!";
    while (true) {
        ssize_t sendCode = sendMessage(sockFd, (const uint8_t *)sendBuf, sizeof(sendBuf), ctx);
        if (sendCode < 0) {
            LogHelper::log(Error, "Fail to send msg to Server, break");
            break;
        }
        LogHelper::log(Debug, "Send hello to server");
        std::this_thread::sleep_for(std::chrono::milliseconds(10));
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x8394(%rip), %r14      # 0xb1d8
leaq 0x45ab(%rip), %r15      # 0x73f6
leaq 0x8(%rsp), %r12
movl $0xe, %edx
movl %ebp, %edi
movq %r14, %rsi
movq %rbx, %rcx
movl $0x4, %r8d
callq 0x2a5a
movq %rax, %r13
testq %rax, %rax
js 0x2ead
movl $0x3, %edi
movq %r15, %rsi
xorl %eax, %eax
callq 0x27f8
movq $0x0, 0x8(%rsp)
movq $0x989680, 0x10(%rsp)   # imm = 0x989680
movq %r12, %rdi
movq %r12, %rsi
callq 0x20b0
cmpl $-0x1, %eax
jne 0x2ebd
callq 0x2040
cmpl $0x4, (%rax)
je 0x2e91
jmp 0x2ebd
xorl %edi, %edi
leaq 0x451e(%rip), %rsi      # 0x73d4
xorl %eax, %eax
callq 0x27f8
testq %r13, %r13
jns 0x2e50
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/renzibei[P]TSProxy/proxyclient.cpp
// Function: loopRead(int, ClientContext*)
void loopRead(int sockFd, ClientContext *ctx) {
    static char buf[65536];
    while (true) {
        memset(buf, 0, sizeof(buf));
        ssize_t recvCode = recvMessage(sockFd, (uint8_t *)buf, sizeof(buf), ctx, NULL);
        if (recvCode < 0) {
            LogHelper::log(Error, "Fail to recv msg from server, break");
            break;
        }
        LogHelper::log(Debug, "recv msg from server: %s", buf);
        // std::this_thread::sleep_for(std::chrono::milliseconds(500));
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x58318(%rip), %r14     # 0x5b200
leaq 0x4540(%rip), %r15      # 0x742f
leaq 0x4515(%rip), %r12      # 0x740b
movl $0x10000, %edx          # imm = 0x10000
movq %r14, %rdi
xorl %esi, %esi
callq 0x2130
movl $0x10000, %edx          # imm = 0x10000
movl %ebp, %edi
movq %r14, %rsi
movq %rbx, %rcx
xorl %r8d, %r8d
callq 0x2bd5
movq %rax, %r13
testq %rax, %rax
js 0x2f36
movl $0x3, %edi
movq %r15, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x27f8
jmp 0x2f42
xorl %edi, %edi
movq %r12, %rsi
xorl %eax, %eax
callq 0x27f8
testq %r13, %r13
jns 0x2ef6
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/renzibei[P]TSProxy/proxyclient.cpp
// Function: launch_client()
int launch_client() {

    // ignore signal
    signal(SIGPIPE, SIG_IGN);
    const char tempBuf[] = "Hello, test!";
    while (true) {
        ClientContext context;
        if (SocketPlugin::getInstance()->connectSocket(serverAddrStr.c_str(),  serverListenPort, constants::clientNonBlocking) < 0 ) {
            LogHelper::log(Error, "Client Fail to connect to server");
            std::this_thread::sleep_for(std::chrono::milliseconds(200));
            break;
        }
        ssize_t shakeCode = clientHandleShake(&context);
        if (shakeCode < 0) {
            return shakeCode;
        }
        
        LogHelper::log(Debug, "Hand shake success");
        int sockFd = SocketPlugin::getInstance()->getSockFd();
        // std::thread readThread(loopRead, sockFd, &context), writeThread(loopSend, sockFd, &context);
        // readThread.join();
        // writeThread.join();
        std::thread listenThread(startListen, sockFd, &context);
        listenThread.join();

        SocketPlugin::getInstance()->closeSocket();
        // break;
        std::this_thread::sleep_for(std::chrono::milliseconds(20));
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl $0x1, %esi
movl $0xd, %edi
callq 0x2240
leaq 0x10(%rsp), %r14
leaq 0x20(%rsp), %r15
leaq -0x75a(%rip), %r13      # 0x37df
leaq 0x8(%rsp), %rbx
leaq 0x4(%rsp), %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
callq 0x408e
movq 0x72a9(%rip), %rsi      # 0xb200
movq %rax, %rdi
movl $0x1bb, %edx            # imm = 0x1BB
movl $0x1, %ecx
callq 0x45ec
testl %eax, %eax
js 0x400d
movq %r15, %rdi
callq 0x28dc
testq %rax, %rax
js 0x4050
movl $0x3, %edi
leaq 0x3b7b(%rip), %rsi      # 0x7b09
xorl %eax, %eax
callq 0x27f8
callq 0x408e
movq %rax, %rdi
callq 0x4672
movl %eax, 0x4(%rsp)
movq %r15, 0x10(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x4102
movq %rbx, %rdi
callq 0x2340
callq 0x408e
movq %rax, %rdi
callq 0x462c
movq $0x0, 0x10(%rsp)
movq $0x1312d00, 0x18(%rsp)  # imm = 0x1312D00
movq %r14, %rdi
movq %r14, %rsi
callq 0x20b0
cmpl $-0x1, %eax
jne 0x3ffd
callq 0x2040
cmpl $0x4, (%rax)
je 0x3fe3
cmpq $0x0, 0x8(%rsp)
jne 0x4089
xorl %ecx, %ecx
jmp 0x4057
xorl %edi, %edi
leaq 0x3ad2(%rip), %rsi      # 0x7ae8
xorl %eax, %eax
callq 0x27f8
movq $0x0, 0x10(%rsp)
movq $0xbebc200, 0x18(%rsp)  # imm = 0xBEBC200
movq %r14, %rdi
movq %r14, %rsi
callq 0x20b0
cmpl $-0x1, %eax
jne 0x4049
callq 0x2040
cmpl $0x4, (%rax)
je 0x402f
movl $0x3, %ecx
jmp 0x4057
movl $0x1, %ecx
movl %eax, %ebp
testl %ecx, %ecx
je 0x3f43
cmpl $0x3, %ecx
jne 0x4066
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4079
cmpq $0x0, 0x8(%rsp)
jne 0x4089
movq %rax, %rdi
callq 0x2350
callq 0x20a0
// File: /workspace/github_cpp_makefile_star2_O1/renzibei[P]TSProxy/./Singleton.h
// Function: Singleton<SocketPlugin>::getInstance()
static T* getInstance() {
        if(_instance == nullptr) {
            std::lock_guard<std::mutex> lockGuard(singleMutex);
            if(_instance == nullptr)
                _instance = new T();
        }
        return _instance;
    }

// Assembly:
pushq %rbx
cmpq $0x0, 0x87411(%rip)     # 0x8b4a8
jne 0x40da
leaq 0x87410(%rip), %rdi     # 0x8b4b0
callq 0x22f0
testl %eax, %eax
jne 0x40e3
cmpq $0x0, 0x873f7(%rip)     # 0x8b4a8
jne 0x40ce
movl $0x10, %edi
callq 0x2210
leaq 0x6c5c(%rip), %rcx      # 0xad20
movq %rcx, (%rax)
movq %rax, 0x873da(%rip)     # 0x8b4a8
leaq 0x873db(%rip), %rdi     # 0x8b4b0
callq 0x2170
movq 0x873c7(%rip), %rax     # 0x8b4a8
popq %rbx
retq
movl %eax, %edi
callq 0x2160
movq %rax, %rbx
leaq 0x873bc(%rip), %rdi     # 0x8b4b0
callq 0x2170
movq %rbx, %rdi
callq 0x2350
nop
// File: /workspace/github_cpp_makefile_star2_O1/renzibei[P]TSProxy/SocketPlugin.cpp
// Function: SocketPlugin::closeSocket()
int SocketPlugin::closeSocket() {

    int ret = close(this->m_sockfd);
    if(ret == -1) {
        LogHelper::log(Error, "close socket failed", strerror(errno));
    }
    LogHelper::log(Info, "close socket");
    return ret;
}

// Assembly:
pushq %rbx
movl 0x8(%rdi), %edi
callq 0x2380
movl %eax, %ebx
cmpl $-0x1, %eax
jne 0x465b
callq 0x2040
movl (%rax), %edi
callq 0x20e0
leaq 0x3565(%rip), %rsi      # 0x7bb4
xorl %edi, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x27f8
leaq 0x3566(%rip), %rsi      # 0x7bc8
movl $0x2, %edi
xorl %eax, %eax
callq 0x27f8
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/gasparfm[P]anapache/anapacheapp.cpp
// Function: AnapacheApp::fixLogFormat(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
std::string AnapacheApp::fixLogFormat(std :: string lf)
{
  if ( (lf.front()=='"') && (lf.back()=='"') )
    lf = lf.substr(1, lf.length()-2);

  lf = GCommon::replace(lf, "\\\"", "\"");
  return lf;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %rbx
movq %rdi, %r14
movq (%rdx), %rax
cmpb $0x22, (%rax)
jne 0x48ea
movq 0x8(%rbx), %rcx
cmpb $0x22, -0x1(%rax,%rcx)
jne 0x48ea
addq $-0x2, %rcx
leaq 0x68(%rsp), %r15
movl $0x1, %edx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x33a0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3460
movq (%r15), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x48ea
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3390
leaq 0x58(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x48(%rsp), %rdi
callq 0x7998
leaq 0x38(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x58b9(%rip), %rsi      # 0xa1d1
leaq 0x58b4(%rip), %rdx      # 0xa1d3
leaq 0x28(%rsp), %rdi
callq 0x4074
leaq 0x18(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x5899(%rip), %rsi      # 0xa1d2
leaq 0x5893(%rip), %rdx      # 0xa1d3
leaq 0x8(%rsp), %rdi
callq 0x4074
leaq 0x68(%rsp), %rdi
leaq 0x48(%rsp), %rsi
leaq 0x28(%rsp), %rdx
leaq 0x8(%rsp), %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x9200
leaq 0x68(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3460
movq (%r15), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x4993
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x49aa
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x49c1
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3390
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x49d8
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3390
leaq 0x10(%r14), %rcx
movq %rcx, (%r14)
movq (%rbx), %rdx
leaq 0x10(%rbx), %rax
cmpq %rax, %rdx
je 0x49f7
movq %rdx, (%r14)
movq (%rax), %rcx
movq %rcx, 0x10(%r14)
jmp 0x49fd
movups (%rax), %xmm0
movups %xmm0, (%rcx)
movq 0x8(%rbx), %rcx
movq %rcx, 0x8(%r14)
movq %rax, (%rbx)
movq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq %r14, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x4a48
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3390
jmp 0x4a48
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x4a64
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3390
jmp 0x4a64
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x4a7b
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3390
movq %rbx, %rdi
callq 0x3590
nop
// File: /workspace/github_cpp_makefile_star2_O1/gasparfm[P]anapache/anapacheapp.cpp
// Function: AnapacheApp::ipCount_Input(long, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<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>>>>>&, AnapacheApp::AnalizerOptions)
void AnapacheApp::ipCount_Input(time_t moment, ParsedInput & parsed, AnalizerOptions opts)
{
  auto ipAddress = parsed.find("h");
  if (ipAddress == parsed.end())
    {
      std::cerr << "No IP found on request"<<std::endl;
      return;
    }

  auto fip = ipCount_data.queryCount.find(ipAddress->second);
  if (fip == ipCount_data.queryCount.end())
    ipCount_data.queryCount.insert({ipAddress->second, 1});
  else
    fip->second++;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r14
movq %rdi, %rbx
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x522e(%rip), %rsi      # 0xa35a
leaq 0x5228(%rip), %rdx      # 0xa35b
movq %rsp, %rdi
callq 0x4074
movq %rsp, %rsi
movq %r14, %rdi
callq 0x7bf4
movq %rax, %r15
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x515f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3390
addq $0x8, %r14
cmpq %r14, %r15
je 0x518a
leaq 0x78(%rbx), %r14
leaq 0x40(%r15), %rsi
movq %r14, %rdi
callq 0x7c3a
subq $-0x80, %rbx
cmpq %rbx, %rax
je 0x51ce
incq 0x40(%rax)
jmp 0x5210
movq 0x8e57(%rip), %rbx      # 0xdfe8
leaq 0x5168(%rip), %rsi      # 0xa300
movl $0x16, %edx
movq %rbx, %rdi
callq 0x33f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3340
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3240
jmp 0x5210
movq %rsp, %rbx
movq %r12, (%rbx)
movq 0x40(%r15), %rsi
movq 0x48(%r15), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x7998
movq $0x1, 0x20(%rbx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7cc4
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x5210
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3390
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x521e
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x523c
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3390
jmp 0x523c
movq %rax, %rbx
movq %rbx, %rdi
callq 0x3590
// File: /workspace/github_cpp_makefile_star2_O1/gasparfm[P]anapache/anapacheapp.cpp
// Function: AnapacheApp::parseTime(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
time_t AnapacheApp::parseTime(std::string strTime)
{
  /* We must improve it a little bit */
  std::string format;
  struct tm tm;
  time_t now = time(NULL);
  localtime_r(&now, &tm);

  if (strTime == "now")
    return now;
  else if (strTime == "yesterday")
    return now-86400;

  if (strTime.find('/') == std::string::npos)
    format = "%H:%M:%S";
  else
    format ="%d/%m/%Y %H:%M:%S";

  char *conv = strptime(strTime.c_str(), format.c_str(), &tm);

  time_t newtime = mktime(&tm);
  if ( (conv == NULL) && (newtime == now) )
    return 0;

  return newtime;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x60, %rsp
movq %rsi, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq $0x0, -0x8(%r15)
movb $0x0, (%r15)
xorl %edi, %edi
callq 0x3330
movq %rsp, %rdi
movq %rax, (%rdi)
leaq 0x28(%rsp), %rsi
callq 0x31f0
leaq 0x4548(%rip), %rsi      # 0xa25b
movq %rbx, %rdi
callq 0x3100
testl %eax, %eax
je 0x5dab
leaq 0x4535(%rip), %rsi      # 0xa25f
movq %rbx, %rdi
callq 0x3100
testl %eax, %eax
je 0x5db1
movq %rbx, %rdi
movl $0x2f, %esi
xorl %edx, %edx
callq 0x3470
xorl %esi, %esi
cmpq $-0x1, %rax
setne %sil
leaq 0x8(%rsp), %rdi
movq 0x8(%rdi), %rdx
leaq 0x4513(%rip), %rax      # 0xa272
leaq 0x4503(%rip), %rcx      # 0xa269
cmoveq %rax, %rcx
leaq (%rsi,%rsi,8), %r8
addq $0x8, %r8
xorl %esi, %esi
callq 0x34f0
movq (%rbx), %rdi
movq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rbx
movq %rbx, %rdx
callq 0x3080
movq %rax, %r14
movq %rbx, %rdi
callq 0x3220
movq (%rsp), %rcx
xorq %rax, %rcx
xorl %ebx, %ebx
orq %r14, %rcx
cmovneq %rax, %rbx
jmp 0x5dbc
movq (%rsp), %rbx
jmp 0x5dbc
movq $-0x15180, %rbx         # imm = 0xFFFEAE80
addq (%rsp), %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x5dd3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3390
movq %rbx, %rax
addq $0x60, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x5dfa
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3390
movq %rbx, %rdi
callq 0x3590