LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/superblocks[P]superblocks/next.cpp
// Function: main
int main( int argc, char **argv ) 
{

	Superblocks s;
	s.init();	

	if( !argv[1] ) 
	{
		cout << "usage: " << argv[0];
		switch( s.seed_type[1] ) { 
			default: cout << " <input>"; break;
			case 1: cout << " <block height>"; break;
			case 2: cout << " <block hash>"; break;
		}
		cout << " [debug]" << endl;
		return 0; 
	}

	s.debug = 0;
	if( argv[2] ) { s.debug = 1; }

	int reward = s.getnextblockreward( argv[1] );

	cout << reward << endl;

	return 0;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0xe8, %rsp
movq %rsi, %rbx
leaq -0xc0(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq -0xa0(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq -0xe8(%rbp), %rdi
callq 0x2258
movq 0x8(%rbx), %rsi
testq %rsi, %rsi
je 0x19b5
xorl %eax, %eax
cmpq $0x0, 0x10(%rbx)
setne %al
leaq -0xe8(%rbp), %rdi
movl %eax, (%rdi)
callq 0x12ec
movq 0x4634(%rip), %rdi      # 0x5fd8
movl %eax, %esi
callq 0x1110
movq %rax, %rdi
callq 0x1050
jmp 0x1a23
movq 0x461c(%rip), %rdi      # 0x5fd8
leaq 0x19b4(%rip), %rsi      # 0x3377
callq 0x10e0
movq (%rbx), %rsi
movq %rax, %rdi
callq 0x10e0
movl -0x88(%rbp), %eax
cmpl $0x2, %eax
leaq 0x19b5(%rip), %rcx      # 0x3398
leaq 0x1995(%rip), %rdx      # 0x337f
cmoveq %rcx, %rdx
cmpl $0x1, %eax
leaq 0x1990(%rip), %rsi      # 0x3388
cmovneq %rdx, %rsi
movq 0x45d5(%rip), %rdi      # 0x5fd8
callq 0x10e0
movq 0x45c9(%rip), %rdi      # 0x5fd8
leaq 0x1990(%rip), %rsi      # 0x33a6
callq 0x10e0
movq %rax, %rdi
callq 0x1050
leaq -0xe8(%rbp), %rdi
callq 0x1ae8
xorl %eax, %eax
addq $0xe8, %rsp
popq %rbx
popq %rbp
retq
jmp 0x1a3d
movq %rax, %rbx
leaq -0xe8(%rbp), %rdi
callq 0x1ae8
movq %rbx, %rdi
callq 0x1120
// File: /workspace/github_cpp_makefile_star2_O2/superblocks[P]superblocks/./superblocks.hpp
// Function: Superblocks::getlucktype[abi:cxx11](int)
string getlucktype( int type ) 
	{
		switch( type ) {
			case 1: return "LUCK_WITH_LESS_THAN_X";
			case 2: return "LUCK_WITH_MORE_THAN_X";
			case 3: return "LUCK_WITH_MORE_THAN_X_AND_LESS_THAN_Y";
			default: return "error";
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x3, %edx
je 0x1a86
cmpl $0x2, %edx
je 0x1a79
cmpl $0x1, %edx
jne 0x1a93
leaq 0x193c(%rip), %rsi      # 0x33af
leaq -0xc(%rbp), %rdx
jmp 0x1a9e
leaq 0x1945(%rip), %rsi      # 0x33c5
leaq -0xb(%rbp), %rdx
jmp 0x1a9e
leaq 0x194e(%rip), %rsi      # 0x33db
leaq -0xa(%rbp), %rdx
jmp 0x1a9e
leaq 0x1967(%rip), %rsi      # 0x3401
leaq -0x9(%rbp), %rdx
movq %rbx, %rdi
callq 0x1b0c
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/superblocks[P]superblocks/utils.cpp
// Function: Superblocks::generateMTRandom(unsigned int, int, int)
int /*static*/ Superblocks::generateMTRandom(unsigned int s, int range_low, int range_high) 
{
	if( debug ) { 
		cout << "generateMTRandom: seed: " << s << endl;
		cout << "generateMTRandom: range_low: " << range_low << endl;
		cout << "generateMTRandom: range_high: " << range_high << endl;
	}
	random::mt19937 gen(s);
	random::uniform_int_distribution<> dist(range_low, range_high);
	int result = dist(gen);
	if( debug ) { cout << "generateMTRandom: result: " << result << endl; }	
	return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x9d8, %rsp            # imm = 0x9D8
movl %ecx, %r14d
movl %edx, %r15d
movq %rdi, %rbx
movl %esi, -0x2c(%rbp)
cmpl $0x0, (%rdi)
je 0x1f2f
movl %esi, %r13d
movq 0x410f(%rip), %r12      # 0x5fd8
leaq 0x168f(%rip), %rsi      # 0x355f
movq %r12, %rdi
callq 0x10e0
movl %r13d, %esi
movq %rax, %rdi
callq 0x1080
movq %rax, %rdi
callq 0x1050
leaq 0x1686(%rip), %rsi      # 0x3578
movq %r12, %rdi
callq 0x10e0
movq %rax, %rdi
movl %r15d, %esi
callq 0x1110
movq %rax, %rdi
callq 0x1050
leaq 0x1682(%rip), %rsi      # 0x3596
movq %r12, %rdi
callq 0x10e0
movq %rax, %rdi
movl %r14d, %esi
callq 0x1110
movq %rax, %rdi
callq 0x1050
leaq -0xa00(%rbp), %r12
leaq -0x2c(%rbp), %rsi
movq %r12, %rdi
callq 0x1fe6
leaq -0x34(%rbp), %r13
movq %r13, %rdi
movl %r15d, %esi
movl %r14d, %edx
callq 0x1fa2
movq %r13, %rdi
movq %r12, %rsi
callq 0x1fd0
movl %eax, %r14d
cmpl $0x0, (%rbx)
je 0x1f8d
movq 0x406a(%rip), %rdi      # 0x5fd8
leaq 0x1640(%rip), %rsi      # 0x35b5
callq 0x10e0
movq %rax, %rdi
movl %r14d, %esi
callq 0x1110
movq %rax, %rdi
callq 0x1050
movl %r14d, %eax
addq $0x9d8, %rsp            # imm = 0x9D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/test/test_selector_impl.h
// Function: main
int main(){
	int const fd1 = net::socket_create(net::SOCKET_TCP{},  "localhost.not.used.yet", 2000);
	int const fd2 = net::socket_create(net::SOCKET_TCP{},  "localhost.not.used.yet", 2002);
	int const fd3 = net::socket_create(net::SOCKET_UNIX{}, "/tmp/echo");

	net::AsyncLoop<MySelector, MyWorker> loop( MySelector{ 4 }, myWorkerFactory(), { fd1, fd2, fd3 } );

	while(loop.process());
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x1100, %rsp           # imm = 0x1100
leaq 0x2c05(%rip), %r14      # 0x502c
pushq $0x7
popq %rbp
movq %r14, %rdi
movl $0x7d0, %esi            # imm = 0x7D0
xorl %edx, %edx
movl %ebp, %ecx
callq 0x455e
movl %eax, %ebx
movq %r14, %rdi
movl $0x7d2, %esi            # imm = 0x7D2
xorl %edx, %edx
movl %ebp, %ecx
callq 0x455e
movl %eax, %ebp
leaq 0x2bec(%rip), %rdi      # 0x5043
pushq $0x1
popq %rdx
xorl %esi, %esi
callq 0x4628
movl %eax, %r14d
leaq 0x8(%rsp), %rdi
pushq $0x4
popq %rsi
callq 0x3c4c
leaq 0x20(%rsp), %rdi
callq 0x23fc
leaq 0x44(%rsp), %rax
movl %ebx, (%rax)
movl %ebp, 0x4(%rax)
movl %r14d, 0x8(%rax)
leaq 0x50(%rsp), %rcx
movq %rax, (%rcx)
movq $0x3, 0x8(%rcx)
leaq 0x60(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0x20(%rsp), %rdx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x2524
leaq 0x20(%rsp), %rdi
callq 0x2778
leaq 0x8(%rsp), %rdi
callq 0x3cac
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
callq 0x263c
testb %al, %al
jne 0x24cc
leaq 0x60(%rsp), %rdi
callq 0x270a
xorl %eax, %eax
addq $0x1100, %rsp           # imm = 0x1100
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x2778
jmp 0x2502
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3cac
jmp 0x251b
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x270a
movq %rbx, %rdi
callq 0x22a0
nop
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/asyncloop_impl.h
// Function: net::AsyncLoop<net::selector::PollSelector, net::worker::KeyValueWorker<net::protocol::RedisProtocol, KeyValueMockAdapter>>::process()
bool AsyncLoop<SELECTOR, WORKER>::process(){
	using WaitStatus = selector::WaitStatus;
	using FDStatus   = selector::FDStatus;

	keepProcessing_ = true;

	log_("poll()-ing...");
	const WaitStatus status = selector_.wait(WAIT_TIMEOUT_MS);

	if (status == WaitStatus::ERROR){
		log_("poll() error");

		return false;
	}

	if (status == WaitStatus::NONE){
		// idle loop, check for expired conn
		expireFD_();
		return true;
	}

	for(uint32_t i = 0; i < selector_.getFDStatusCount(); ++i){
		const auto &t = selector_.getFDStatus(i);

		switch(t.status){
		case FDStatus::READ:
			handleRead_( t.fd );
			break;

		case FDStatus::WRITE:
			handleWrite_( t.fd );
			break;

		case FDStatus::ERROR:
			handleDisconnect_( t.fd, DisconnectStatus::ERROR );
			break;

		case FDStatus::STOP:
			goto break2;

		case FDStatus::NONE:
		default:
			break;

		}
	}

	break2: // label for goto... ;)

	return keepProcessing_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb $0x1, 0x8c(%rdi)
leaq 0x2a3a(%rip), %rsi      # 0x508e
pushq $-0x1
popq %rdx
callq 0x2ac2
movq %rbx, %rdi
movl $0x1388, %esi           # imm = 0x1388
callq 0x3cfc
cmpl $0x1, %eax
je 0x2689
cmpl $0x2, %eax
jne 0x2695
leaq 0x2a22(%rip), %rsi      # 0x509c
pushq $-0x1
popq %rdx
movq %rbx, %rdi
callq 0x2ac2
xorl %eax, %eax
jmp 0x26fe
movq %rbx, %rdi
callq 0x2aea
movb $0x1, %al
jmp 0x26fe
xorl %ebp, %ebp
leaq 0x2966(%rip), %r15      # 0x5004
pushq $0x1
popq %r14
movq %rbx, %rdi
callq 0x3cf0
cmpl %eax, %ebp
jae 0x26f8
movq %rbx, %rdi
movl %ebp, %esi
callq 0x3d24
movq %rax, %rcx
shrq $0x20, %rcx
decl %ecx
cmpl $0x3, %ecx
ja 0x26f4
movslq (%r15,%rcx,4), %rcx
addq %r15, %rcx
jmpq *%rcx
movq %rbx, %rdi
movl %eax, %esi
callq 0x2b2a
jmp 0x26f4
movq %rbx, %rdi
movl %eax, %esi
movl %r14d, %edx
callq 0x2cb2
jmp 0x26f4
movq %rbx, %rdi
movl %eax, %esi
callq 0x2c06
incl %ebp
jmp 0x26a2
movb 0x8c(%rbx), %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/asyncloop.h
// Function: net::AsyncLoop<net::selector::PollSelector, net::worker::KeyValueWorker<net::protocol::RedisProtocol, KeyValueMockAdapter>>::log_(char const*, int) const
void log_(const char *s, int const fd = -1) const{
		if (fd < 0)
			printf("%-40s | clients: %5u |\n",         s, connectedClients_);
		else
			printf("%-40s | clients: %5u | fd: %5d\n", s, connectedClients_, fd);
	}

// Assembly:
movl %edx, %ecx
movl 0x88(%rdi), %edx
testl %ecx, %ecx
js 0x2adc
leaq 0x25ec(%rip), %rdi      # 0x50c1
xorl %eax, %eax
jmp 0x2040
leaq 0x25c6(%rip), %rdi      # 0x50a9
xorl %eax, %eax
jmp 0x2040
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/asyncloop_impl.h
// Function: net::AsyncLoop<net::selector::PollSelector, net::worker::KeyValueWorker<net::protocol::RedisProtocol, KeyValueMockAdapter>>::expireFD_()
void AsyncLoop<SELECTOR, WORKER>::expireFD_(){
	for(const auto &p : clients_){
		int const fd = p.first;
		auto &c = p.second;

		if (c.expired(conf_connectionTimeout_)){
			handleDisconnect_(fd, DisconnectStatus::TIMEOUT);
			// iterator is invalid now...
			return;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x60(%rdi), %r14
movq (%r14), %r14
testq %r14, %r14
je 0x2b25
movl 0x8(%r14), %ebp
leaq 0x38(%r14), %rdi
movl 0x90(%rbx), %esi
callq 0x2cf2
testb %al, %al
je 0x2af5
pushq $0x2
popq %rdx
movq %rbx, %rdi
movl %ebp, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x2cb2
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/asyncloop_impl.h
// Function: net::AsyncLoop<net::selector::PollSelector, net::worker::KeyValueWorker<net::protocol::RedisProtocol, KeyValueMockAdapter>>::handleRead_(int)
void AsyncLoop<SELECTOR, WORKER>::handleRead_(int const fd){
	if ( isServerFD_(fd) ){
		while (handleConnect_(fd));
		return;
	}

	// -------------------------------------

	auto it = clients_.find(fd);

	if (it == clients_.end())
		return handleDisconnect_(fd, DisconnectStatus::PROBLEM_MAP_NOT_FOUND);

	auto &buffer = it->second;

	// -------------------------------------

	ssize_t const size = ::read(fd, inputBuffer_, BUFFER_CAPACITY);

	if (size <= 0)
		return handleSocketOps_(fd, size);

	if (buffer.size() + (size_t) size > conf_maxPacketSize_)
		return handleDisconnect_(fd, DisconnectStatus::ERROR);

	buffer.push(size, inputBuffer_);

	buffer.restartTimer();

	handleWorker_(fd, buffer);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movl %esi, 0xc(%rsp)
callq 0x2d04
testb %al, %al
je 0x2b5b
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2d2e
testb %al, %al
jne 0x2b48
jmp 0x2bf9
leaq 0x50(%rbx), %rdi
leaq 0xc(%rsp), %rsi
callq 0x3314
testq %rax, %rax
je 0x2baa
movq %rax, %r14
movl 0xc(%rsp), %edi
leaq 0xa0(%rbx), %r15
movl $0x1000, %edx           # imm = 0x1000
movq %r15, %rsi
callq 0x2230
testq %rax, %rax
jle 0x2bbb
movq 0x20(%r14), %rcx
addq %rax, %rcx
subq 0x10(%r14), %rcx
cmpq 0x98(%rbx), %rcx
jbe 0x2bcc
movl 0xc(%rsp), %esi
pushq $0x1
jmp 0x2bb0
movl 0xc(%rsp), %esi
pushq $0x5
popq %rdx
movq %rbx, %rdi
callq 0x2cb2
jmp 0x2bf9
movl 0xc(%rsp), %esi
movq %rbx, %rdi
movq %rax, %rdx
callq 0x2d7e
jmp 0x2bf9
movq %r14, %r12
addq $0x10, %r12
movq %r12, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x3332
callq 0x43a0
movl %eax, 0x38(%r14)
movl 0xc(%rsp), %esi
movq %rbx, %rdi
movq %r12, %rdx
callq 0x2db8
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/asyncloop_impl.h
// Function: net::AsyncLoop<net::selector::PollSelector, net::worker::KeyValueWorker<net::protocol::RedisProtocol, KeyValueMockAdapter>>::handleWrite_(int)
void AsyncLoop<SELECTOR, WORKER>::handleWrite_(int const fd){
	if ( isServerFD_(fd) ){
		// WTF?!?
		return;
	}

	// -------------------------------------

	auto it = clients_.find(fd);

	if (it == clients_.end())
		return handleDisconnect_(fd, DisconnectStatus::PROBLEM_MAP_NOT_FOUND);

	ClientBuffer &buffer = it->second;

	// -------------------------------------

	auto available = buffer.size();

	if (available <= 0){
		// this must never happen, disconnect.
		return handleDisconnect_(fd, DisconnectStatus::PROBLEM_BUFFER_WRITE);
	}

	ssize_t const size = ::write(fd, buffer.data(), available);

	// -------------------------------------

	if (size <= 0)
		return handleSocketOps_(fd, size);

	buffer.pop(size);

	buffer.restartTimer();

	if (buffer.size() == 0){
		// process with read
		selector_.updateFD(fd, selector::FDEvent::READ);

		return;
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %esi, 0x4(%rsp)
callq 0x2d04
testb %al, %al
jne 0x2c54
leaq 0x50(%rbx), %rdi
leaq 0x4(%rsp), %rsi
callq 0x3314
testq %rax, %rax
je 0x2c45
movq %rax, %r14
movq 0x10(%rax), %rsi
movq 0x20(%rax), %rdx
subq %rsi, %rdx
jne 0x2c5c
movl 0x4(%rsp), %esi
pushq $0x7
jmp 0x2c4b
movl 0x4(%rsp), %esi
pushq $0x5
popq %rdx
movq %rbx, %rdi
callq 0x2cb2
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl 0x4(%rsp), %edi
addq 0x18(%r14), %rsi
callq 0x20b0
testq %rax, %rax
jle 0x2ca0
movq %r14, %rdi
addq $0x10, %rdi
movq %rax, %rsi
callq 0x3ae8
callq 0x43a0
movl %eax, 0x38(%r14)
movq 0x20(%r14), %rax
cmpq 0x10(%r14), %rax
jne 0x2c54
movl 0x4(%rsp), %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x3dd2
jmp 0x2c54
movl 0x4(%rsp), %esi
movq %rbx, %rdi
movq %rax, %rdx
callq 0x2d7e
jmp 0x2c54
nop
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/asyncloop_impl.h
// Function: net::AsyncLoop<net::selector::PollSelector, net::worker::KeyValueWorker<net::protocol::RedisProtocol, KeyValueMockAdapter>>::handleDisconnect_(int, net::AsyncLoop<net::selector::PollSelector, net::worker::KeyValueWorker<net::protocol::RedisProtocol, KeyValueMockAdapter>>::DisconnectStatus)
void AsyncLoop<SELECTOR, WORKER>::handleDisconnect_(int const fd, const DisconnectStatus error){
	removeFD_(fd);

	socket_close(fd);

	switch(error){
	case DisconnectStatus::NORMAL			: return log_("Normal  Disconnect",				fd);
	case DisconnectStatus::ERROR			: return log_("Error   Disconnect",				fd);
	case DisconnectStatus::TIMEOUT			: return log_("Timeout Disconnect",				fd);

	case DisconnectStatus::WORKER_NORMAL		: return log_("Worker  Disconnect - Normal",			fd);
	case DisconnectStatus::WORKER_ERROR		: return log_("Worker  Disconnect - Error",			fd);

	case DisconnectStatus::PROBLEM_MAP_NOT_FOUND	: return log_("Problem Disconnect - FD not found",		fd);
	case DisconnectStatus::PROBLEM_BUFFER_READ	: return log_("Problem Disconnect - Read buffer full",		fd);
	case DisconnectStatus::PROBLEM_BUFFER_WRITE	: return log_("Problem Disconnect - Write buffer problem",	fd);
	};
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movl %esi, %ebx
movq %rdi, %r14
callq 0x3b1a
movl %ebx, %edi
callq 0x448e
cmpl $0x7, %ebp
ja 0x2cec
movl %ebp, %eax
leaq 0x2581(%rip), %rcx      # 0x5258
movslq (%rcx,%rax,4), %rsi
addq %rcx, %rsi
movq %r14, %rdi
movl %ebx, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0x2ac2
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/asyncloop_impl.h
// Function: net::AsyncLoop<net::selector::PollSelector, net::worker::KeyValueWorker<net::protocol::RedisProtocol, KeyValueMockAdapter>>::handleConnect_(int)
bool AsyncLoop<SELECTOR, WORKER>::handleConnect_(int const fd){
	// fd is same as serverFD_
	int const newFD = socket_accept(fd);

	// serverFD_ is non blocking, so we do not need to check EAGAIN
	if (newFD < 0)
		return false;

	if ( insertFD_(newFD) ){
		// socket_makeNonBlocking(newFD);

		log_("Connect", newFD);
	}else{
		socket_close(newFD);

		log_("Drop connect", newFD);
	}

	return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl %esi, %edi
callq 0x44be
movl %eax, %ebx
testl %eax, %eax
js 0x2d71
movq %r14, %rdi
movl %ebx, %esi
callq 0x2eac
testb %al, %al
je 0x2d59
leaq 0x238a(%rip), %rsi      # 0x50e1
jmp 0x2d67
movl %ebx, %edi
callq 0x448e
leaq 0x2382(%rip), %rsi      # 0x50e9
movq %r14, %rdi
movl %ebx, %edx
callq 0x2ac2
testl %ebx, %ebx
setns %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/asyncloop_impl.h
// Function: net::AsyncLoop<net::selector::PollSelector, net::worker::KeyValueWorker<net::protocol::RedisProtocol, KeyValueMockAdapter>>::handleSocketOps_(int, long)
void AsyncLoop<SELECTOR, WORKER>::handleSocketOps_(int const fd, ssize_t const size){
	if (size < 0){
		if ( socket_check_eagain() ){
			// try again
			return;
		}else{
			// error, disconnect.
			return handleDisconnect_(fd, DisconnectStatus::ERROR);
		}
	}

	if (size == 0){
		// normal, disconnect.
		return handleDisconnect_(fd, DisconnectStatus::NORMAL);
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
testq %rdx, %rdx
js 0x2d92
jne 0x2d9b
xorl %edx, %edx
jmp 0x2da6
callq 0x4430
testb %al, %al
je 0x2da3
addq $0x8, %rsp
popq %rbx
popq %r14
retq
pushq $0x1
popq %rdx
movq %r14, %rdi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2cb2
nop
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/asyncloop_impl.h
// Function: net::AsyncLoop<net::selector::PollSelector, net::worker::KeyValueWorker<net::protocol::RedisProtocol, KeyValueMockAdapter>>::handleWorker_(int, net::ClientBuffer&)
bool AsyncLoop<SELECTOR, WORKER>::handleWorker_(int const fd, ClientBuffer &buffer){
//	static const char *redis_ok  = "$2\r\nOK\r\n";
//	static const char *redis_err = "-ERR Error\r\n";

	const WorkerStatus status = worker_( buffer );

	switch( status ){
	case WorkerStatus::PASS:
		return false;

	case WorkerStatus::READ:
		selector_.updateFD(fd, selector::FDEvent::READ);

		return true;

	case WorkerStatus::WRITE:
		selector_.updateFD(fd, selector::FDEvent::WRITE);

		return true;

	case WorkerStatus::DISCONNECT:
		handleDisconnect_(fd, DisconnectStatus::WORKER_NORMAL);

		return true;

	case WorkerStatus::SHUTDOWN:
	//	handleDisconnect_(fd, DisconnectStatus::WORKER_NORMAL);
		keepProcessing_ = false;

		return true;

	default:
	case WorkerStatus::DISCONNECT_ERROR:
		handleDisconnect_(fd, DisconnectStatus::WORKER_ERROR);

		return true;
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
addq $0x18, %rdi
movq %rdx, %rsi
callq 0x3374
cmpl $0x5, %eax
ja 0x2de8
movl %eax, %eax
leaq 0x2239(%rip), %rcx      # 0x5014
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %eax, %eax
jmp 0x2e1d
pushq $0x4
jmp 0x2e06
pushq $0x1
popq %rdx
movq %r14, %rdi
movl %ebx, %esi
jmp 0x2dfd
movq %r14, %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0x3dd2
jmp 0x2e1b
pushq $0x3
popq %rdx
movq %r14, %rdi
movl %ebx, %esi
callq 0x2cb2
jmp 0x2e1b
movb $0x0, 0x8c(%r14)
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/asyncloop_impl.h
// Function: net::AsyncLoop<net::selector::PollSelector, net::worker::KeyValueWorker<net::protocol::RedisProtocol, KeyValueMockAdapter>>::insertFD_(int)
bool AsyncLoop<SELECTOR, WORKER>::insertFD_(int const fd){
	// one for server fd
	if (connectedClients_ + 1 >= selector_.maxFD() )
		return false;

	bool const result = selector_.insertFD(fd);

	if (result == false)
		return false;

	//clients_.insert(std::make_pair(fd, ClientBuffer{}));
	clients_[fd];

	++connectedClients_;

	return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %r14d
movq %rdi, %rbx
movl %esi, 0xc(%rsp)
movl 0x88(%rdi), %ebp
incl %ebp
callq 0x3cf0
cmpl %eax, %ebp
jae 0x2efb
xorl %ebp, %ebp
movq %rbx, %rdi
movl %r14d, %esi
xorl %edx, %edx
callq 0x3d5c
testb %al, %al
je 0x2efd
leaq 0x50(%rbx), %rdi
leaq 0xc(%rsp), %rsi
callq 0x2f08
incl 0x88(%rbx)
movb $0x1, %bpl
jmp 0x2efd
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/test/test_keyvalue_worker_impl.h
// Function: KeyValueMockAdapter::getall(StringRef const&) const
std::vector<StringRef> getall(const StringRef &key) const{
		return {
			"key1", "value1",
			"key2", "value2",
			"key3", "value3",
			"key4", "value4"
		};
	}

// Assembly:
pushq %rbx
subq $0x90, %rsp
movq %rdi, %rbx
leaq 0x552e(%rip), %rsi      # 0x8c58
pushq $0x10
popq %rcx
leaq 0x10(%rsp), %rax
movq %rax, %rdi
rep  movsq (%rsi), %es:(%rdi)
pushq $0x8
popq %rdx
leaq 0xf(%rsp), %rcx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x39fa
movq %rbx, %rax
addq $0x90, %rsp
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/protocol/redisprotocol_impl.h
// Function: void net::protocol::RedisProtocol::response_string<net::ClientBuffer>(net::ClientBuffer&, StringRef const&)
void RedisProtocol::response_string(CONNECTION &buffer, const StringRef &msg){
	buffer.push(DOLLAR);
	buffer.push(std::to_string(msg.size()));
	buffer.push(ENDLN);

	buffer.push(msg);
	buffer.push(ENDLN);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rsi, %r14
movq %rdi, %rbx
addq $0x8, %rdi
pushq $0x24
popq %rsi
callq 0x2180
movq (%r14), %rsi
movq %rsp, %r15
movq %r15, %rdi
callq 0x3841
movq (%r15), %rax
movq 0x8(%r15), %rcx
leaq 0x20(%rsp), %rsi
movq %rcx, (%rsi)
movq %rax, 0x8(%rsi)
movq %rbx, %rdi
callq 0x382a
movq %rsp, %rdi
callq 0x2100
leaq 0x1939(%rip), %r15      # 0x5124
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3884
movq %rbx, %rdi
movq %r14, %rsi
callq 0x382a
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3884
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x22a0
nop
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/iobuffer.h
// Function: net::IOBuffer::push(char const*)
bool push(const char *p){
		size_t size;

		// C++17 if :)
		if (p && ( size = strlen(p) ) )
			return push_(size, p);

		return false;
	}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x38b5
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x20f0
testq %rax, %rax
je 0x38b5
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x334a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/protocol/redisprotocol_impl.h
// Function: void net::protocol::RedisProtocol::response_strings<net::ClientBuffer, std::vector<StringRef, std::allocator<StringRef>>>(net::ClientBuffer&, std::vector<StringRef, std::allocator<StringRef>> const&)
void RedisProtocol::response_strings(CONNECTION &buffer, const CONTAINER &list){
	buffer.push(STAR);
	buffer.push(std::to_string(list.size()));
	buffer.push(ENDLN);

	for(const auto &msg : list)
		response_string(buffer, msg);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rsi, %r14
movq %rdi, %rbx
addq $0x8, %rdi
pushq $0x2a
popq %rsi
callq 0x2180
movq 0x8(%r14), %rsi
subq (%r14), %rsi
sarq $0x4, %rsi
movq %rsp, %r15
movq %r15, %rdi
callq 0x3841
movq (%r15), %rax
movq 0x8(%r15), %rcx
leaq 0x20(%rsp), %rsi
movq %rcx, (%rsi)
movq %rax, 0x8(%rsi)
movq %rbx, %rdi
callq 0x382a
movq %rsp, %rdi
callq 0x2100
leaq 0x176d(%rip), %rsi      # 0x5124
movq %rbx, %rdi
callq 0x3884
movq (%r14), %r15
movq 0x8(%r14), %r14
cmpq %r14, %r15
je 0x39dc
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3798
addq $0x10, %r15
jmp 0x39c6
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x22a0
nop
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/iobuffer.h
// Function: net::IOBuffer::pop(unsigned long)
bool pop(size_t const len){
		if (len == 0)
			return false;

		auto const available = size();

		if (available < len)
			return false;

		if (available == len){
			clear();
			return true;
		}

		head_ = head_ + len;

		return true;
	}

// Assembly:
testq %rsi, %rsi
je 0x3afc
movq (%rdi), %rax
movq 0x10(%rdi), %rcx
subq %rax, %rcx
cmpq %rsi, %rcx
jae 0x3aff
xorl %eax, %eax
retq
jne 0x3b11
andq $0x0, 0x10(%rdi)
movq 0x8(%rdi), %rax
movb $0x0, (%rax)
xorl %eax, %eax
jmp 0x3b14
addq %rsi, %rax
movq %rax, (%rdi)
movb $0x1, %al
retq
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/selector/pollselector.cc
// Function: net::selector::PollSelector::wait(int)
WaitStatus PollSelector::wait(int const timeout){
	// size cast is for FreeBSD and OSX warning
	int const activity = poll(statusData_.data(), (nfds_t) statusData_.size(), timeout);

	if (activity < 0)
		return WaitStatus::ERROR;

	if (activity == 0)
		return WaitStatus::NONE;

	return WaitStatus::OK;
}

// Assembly:
pushq %rax
movl %esi, %edx
movq (%rdi), %rax
movq 0x8(%rdi), %rsi
subq %rax, %rsi
sarq $0x3, %rsi
movq %rax, %rdi
callq 0x2250
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
pushq $0x2
popq %rax
cmovnsl %ecx, %eax
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/selector/pollselector.cc
// Function: net::selector::PollSelector::getFDStatus(unsigned int) const
FDResult PollSelector::getFDStatus(uint32_t const no) const{
	const auto &p = statusData_[no];
	int  const fd = p.fd;
	auto const ev = p.revents;

	if (ev & POLLERR)
		return { fd, FDStatus::ERROR };

	if (ev & POLLIN)
		return { fd, FDStatus::READ };

	if (ev & POLLOUT)
		return { fd, FDStatus::WRITE };

	return { fd, FDStatus::NONE };
}

// Assembly:
movl %esi, %eax
movq (%rdi), %rdx
movl (%rdx,%rax,8), %ecx
movzwl 0x6(%rdx,%rax,8), %eax
testb $0x8, %al
jne 0x3d42
testb $0x1, %al
jne 0x3d4e
andl $0x4, %eax
shlq $0x1f, %rax
jmp 0x3d58
movabsq $0x300000000, %rax      # imm = 0x300000000
jmp 0x3d58
movabsq $0x100000000, %rax      # imm = 0x100000000
orq %rcx, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/selector/pollselector.cc
// Function: net::selector::PollSelector::insertFD(int, net::selector::FDEvent)
bool PollSelector::insertFD(int const fd, const FDEvent event){
	uint32_t pos = 0;
	bool     pok = false;

	for(uint32_t i = 0; i < statusData_.size(); ++i){
		if (statusData_[i].fd == fd){
			pos = i;
			pok = true;
			break;
		}

		if (pok == false && statusData_[i].fd < 0){
			pos = i;
			pok = true;
		}
	}

	if (! pok)
		return false;

	statusData_[pos].fd = fd;
	statusData_[pos].events = pollConvert(event);

	return true;
}

// Assembly:
pushq %rbx
movq (%rdi), %rax
movq 0x8(%rdi), %rdi
subq %rax, %rdi
sarq $0x3, %rdi
xorl %r8d, %r8d
movl $0x1, %r9d
xorl %r10d, %r10d
xorl %ecx, %ecx
movl %ecx, %ecx
cmpq %rcx, %rdi
jbe 0x3daa
movl (%rax,%rcx,8), %r11d
cmpl %esi, %r11d
je 0x3db3
testb $0x1, %r10b
sete %bl
testl %r11d, %r11d
sets %r11b
testb %r11b, %bl
cmovnel %ecx, %r8d
movzbl %r10b, %r10d
cmovnel %r9d, %r10d
incl %ecx
jmp 0x3d79
testb $0x1, %r10b
je 0x3dcd
movl %r8d, %ecx
movl %esi, (%rax,%rcx,8)
xorl %esi, %esi
cmpl $0x1, %edx
sete %sil
leal (%rsi,%rsi,2), %edx
incl %edx
movw %dx, 0x4(%rax,%rcx,8)
movb $0x1, %al
jmp 0x3dcf
xorl %eax, %eax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/protocol/redisprotocol.cc
// Function: net::protocol::RedisProtocol::readInt_(StringRef const&, unsigned long&)
int RedisProtocol::readInt_(const StringRef &src, size_t &pos){
	char buff[INT_BUFFER_SIZE + 1];

	size_t bpos = 0;

	while(pos < src.size() && bpos < INT_BUFFER_SIZE){
		char const c = src[pos];
		if (c != '-' && c != '+' && (c < '0' || c > '9') )
			break;

		buff[bpos] = c;

		++pos;
		++bpos;
	}

	buff[bpos] = '\0';

	return atoi(buff);
}

// Assembly:
subq $0x18, %rsp
movq 0x8(%rdi), %rax
movq (%rsi), %rdx
xorl %ecx, %ecx
cmpq (%rdi), %rdx
jae 0x410f
cmpq $0x7, %rcx
ja 0x410f
movzbl (%rax,%rdx), %r8d
cmpl $0x2b, %r8d
je 0x40ff
cmpl $0x2d, %r8d
je 0x40ff
leal -0x3a(%r8), %r9d
cmpb $-0xa, %r9b
jb 0x410f
movb %r8b, 0xf(%rsp,%rcx)
incq %rdx
movq %rdx, (%rsi)
incq %rcx
jmp 0x40d9
movb $0x0, 0xf(%rsp,%rcx)
leaq 0xf(%rsp), %rdi
callq 0x2270
addq $0x18, %rsp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/protocol/redisprotocol.cc
// Function: net::protocol::RedisProtocol::readLn_(StringRef const&, unsigned long&)
auto RedisProtocol::readLn_(const StringRef &src, size_t &pos) -> Status{
	if (pos + 1 > src.size())
		return Status::BUFFER_NOT_READ;

	if (src[pos] == '\r' && src[pos + 1] == '\n'){
		pos += 2;
		return Status::OK;
	}

	return err_(Error::NO_CRLF);
}

// Assembly:
movq (%rsi), %rcx
leaq 0x1(%rcx), %rdx
cmpq (%rdi), %rdx
jbe 0x4134
pushq $0x1
popq %rax
retq
movq 0x8(%rdi), %rdi
pushq $0x2
popq %rax
cmpb $0xd, (%rdi,%rcx)
jne 0x4133
cmpb $0xa, (%rdi,%rdx)
jne 0x4133
addq $0x2, %rcx
movq %rcx, (%rsi)
xorl %eax, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/protocol/redisprotocol.cc
// Function: net::protocol::RedisProtocol::readParam_(StringRef const&, unsigned long&)
auto RedisProtocol::readParam_(const StringRef &src, size_t &pos) -> CheckedStringref{
	if (pos + 1 > src.size())
		return Status::BUFFER_NOT_READ;

	if (src[pos] != DOLLAR)
		return err_(Error::NO_DOLLAR);

	++pos;

	if (pos + 1 > src.size())
		return Status::BUFFER_NOT_READ;

	const size_t size = (size_t) readInt_(src, pos);
	if (size <= 0 || size > MAX_PARAM_SIZE)
		return err_(Error::PARAM_SIZE);

	{
		Status stat = readLn_(src, pos);
		if ( stat != Status::OK )
			return stat;
	}

	const auto pos_save = pos;

	// store param must be here, but is optimized at the end.

	pos += size;

	// check if all data is there.
	if (pos > src.size())
		return Status::BUFFER_NOT_READ;

	{
		Status stat = readLn_(src, pos);
		if ( stat != Status::OK )
			return stat;
	}

	return StringRef( & src[pos_save], size);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq (%rdx), %rax
leaq 0x1(%rax), %rcx
cmpq (%rsi), %rcx
jbe 0x416e
pushq $0x1
jmp 0x41a7
movq %rdx, %r15
movq %rsi, %r14
movq 0x8(%rsi), %rdx
cmpb $0x24, (%rdx,%rax)
jne 0x41a5
movq %rcx, (%r15)
addq $0x2, %rax
cmpq (%r14), %rax
ja 0x416a
movq %r14, %rdi
movq %r15, %rsi
callq 0x40cc
movl %eax, %r12d
movl $0xffffbfff, %eax       # imm = 0xFFFFBFFF
leal (%r12,%rax), %ecx
cmpl %eax, %ecx
ja 0x41bd
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x4240
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %r14, %rdi
movq %r15, %rsi
callq 0x4124
testl %eax, %eax
je 0x41d3
movq %rbx, %rdi
movl %eax, %esi
jmp 0x41ab
movslq %r12d, %r12
movq (%r15), %r13
leaq (%r12,%r13), %rax
movq %rax, (%r15)
cmpq (%r14), %rax
ja 0x416a
movq %r14, %rdi
movq %r15, %rsi
callq 0x4124
testl %eax, %eax
jne 0x41cc
movq 0x8(%r14), %rax
addq %rax, %r13
testq %rax, %rax
leaq 0xf21(%rip), %rax       # 0x5126
cmovneq %r13, %rax
andl $0x0, (%rbx)
movq %r12, 0x8(%rbx)
movq %rax, 0x10(%rbx)
jmp 0x41b0
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/sockets.cc
// Function: net::socket_read(int, void*, unsigned long, int)
ssize_t socket_read(int const fd, void *buf, size_t const count, int const timeout) noexcept{
	bool const ready = socket_poll_(fd, POLLIN, timeout);

	if (!ready){
		// simulate EAGAIN
		errno = EAGAIN;
		return -1;
	}

	return socket_read(fd, buf, count);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
pushq $0x1
popq %rsi
movl %ecx, %edx
callq 0x46d4
testb %al, %al
je 0x44fd
movl %ebp, %edi
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %rbp
jmp 0x449e
callq 0x2030
movl $0xb, (%rax)
pushq $-0x1
popq %rax
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rdi
callq 0x276c
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/sockets.cc
// Function: net::socket_write(int, void const*, unsigned long, int)
ssize_t socket_write(int const fd, const void *buf, size_t const count, int const timeout) noexcept{
	bool const ready = socket_poll_(fd, POLLOUT, timeout);

	if (!ready){
		// simulate EAGAIN
		errno = EAGAIN;
		return -1;
	}

	return socket_write(fd, buf, count);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
pushq $0x4
popq %rsi
movl %ecx, %edx
callq 0x46d4
testb %al, %al
je 0x4543
movl %ebp, %edi
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %rbp
jmp 0x44ae
callq 0x2030
movl $0xb, (%rax)
pushq $-0x1
popq %rax
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rdi
callq 0x276c
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/sockets.cc
// Function: net::socket_create(net::SOCKET_TCP, char const*, unsigned short, unsigned short, unsigned char)
int socket_create(const SOCKET_TCP,  const char *ip, uint16_t const port, uint16_t const backlog, options_type const options) noexcept{
	int fd = socket(AF_INET , SOCK_STREAM , 0);

	if(fd < 0)
		return SOCKET_ERROR_CREATE;

	if (options & SOCKET_REUSEADDR)
	if (! socket_makeReuseAddr_(fd))
		socket_error_(fd, SOCKET_ERROR_OPTIONS);

	if (options & SOCKET_NONBLOCK)
	if (! socket_makeNonBlocking(fd) )
		socket_error_(fd, SOCKET_ERROR_NONBLOCK);

	if (options & SOCKET_TCPNODELAY)
	if (! socket_makeTCPNoDelay(fd) )
		socket_error_(fd, SOCKET_ERROR_NODELAY);

	if (options & SOCKET_KEEPALIVE)
	if (! socket_makeKeepAlive(fd) )
		socket_error_(fd, SOCKET_ERROR_KEEPALIVE);

	struct sockaddr_in address;

	address.sin_family = AF_INET;
	address.sin_addr.s_addr = INADDR_ANY;
	address.sin_port = htons(port);

	return socket_server_(fd, address, backlog);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r15d
movl %edx, %ebx
movl %esi, %ebp
pushq $0x2
popq %rdi
pushq $0x1
popq %rsi
xorl %edx, %edx
callq 0x2080
testl %eax, %eax
js 0x4612
movl %eax, %r14d
testb $0x2, %r15b
je 0x45a1
movl %r14d, %edi
callq 0x4467
testb %al, %al
jne 0x45a1
movl %r14d, %edi
callq 0x22c0
testb $0x1, %r15b
je 0x45bb
movl %r14d, %edi
callq 0x4448
testb %al, %al
jne 0x45bb
movl %r14d, %edi
callq 0x22c0
testb $0x4, %r15b
je 0x45d5
movl %r14d, %edi
callq 0x4474
testb %al, %al
jne 0x45d5
movl %r14d, %edi
callq 0x22c0
testb $0x8, %r15b
je 0x45ef
movl %r14d, %edi
callq 0x4481
testb %al, %al
jne 0x45ef
movl %r14d, %edi
callq 0x22c0
leaq 0x8(%rsp), %rsi
movw $0x2, (%rsi)
andl $0x0, 0x4(%rsi)
rolw $0x8, %bp
movw %bp, 0x2(%rsi)
movzwl %bx, %edx
movl %r14d, %edi
callq 0x4708
jmp 0x4615
pushq $-0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rdi
callq 0x276c
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/sockets.cc
// Function: net::socket_create(net::SOCKET_UNIX, char const*, unsigned short, unsigned char)
int socket_create(const SOCKET_UNIX, const char *path, uint16_t const backlog, options_type const options) noexcept{
	if (sizeof sockaddr_un::sun_path < strlen(path))
		return SOCKET_NAME_SIZE;


	int fd = socket(AF_UNIX , SOCK_STREAM , 0);

	if(fd < 0)
		return SOCKET_ERROR_CREATE;

	if (options & SOCKET_NONBLOCK)
	if (! socket_makeNonBlocking(fd) )
		socket_error_(fd, SOCKET_ERROR_NONBLOCK);

	struct sockaddr_un address;
	address.sun_family = AF_UNIX;
	strcpy(address.sun_path, path);

	unlink(address.sun_path);

	return socket_server_(fd, address, backlog);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x78, %rsp
movl %edx, %r15d
movl %esi, %ebx
movq %rdi, %r14
callq 0x20f0
cmpq $0x6c, %rax
jbe 0x4649
pushq $-0x8
jmp 0x46a5
pushq $0x1
popq %rdi
movl %edi, %esi
xorl %edx, %edx
callq 0x2080
testl %eax, %eax
js 0x46a3
movl %eax, %ebp
testb $0x1, %r15b
je 0x4673
movl %ebp, %edi
callq 0x4448
testb %al, %al
jne 0x4673
movl %ebp, %edi
callq 0x22c0
leaq 0xc(%rsp), %r15
movw $0x1, -0x2(%r15)
movq %r15, %rdi
movq %r14, %rsi
callq 0x21a0
movq %r15, %rdi
callq 0x2110
movzwl %bx, %edx
leaq 0xa(%rsp), %rsi
movl %ebp, %edi
callq 0x474d
jmp 0x46a6
pushq $-0x1
popq %rax
addq $0x78, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rdi
callq 0x276c
// File: /workspace/github_cpp_makefile_star2_O2/nmmmnu[P]HM3/net/sockets.cc
// Function: net::socket_poll_(int, short, int)
inline bool socket_poll_(int const fd, pollfd_event_type event, int const timeout){
	pollfd p;
	p.fd		= fd;
	p.events	= event;

	// size cast is for FreeBSD and OSX warning
	int const result = poll(&p, (nfds_t) 1, timeout);

	// we are still checking the result, because it could be -1
	return result == 1 && p.revents & event;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rsp, %r14
movl %edi, (%r14)
movw %bx, 0x4(%r14)
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x2250
cmpl $0x1, %eax
sete %cl
andw 0x6(%r14), %bx
setne %al
andb %cl, %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/cpottamus[P]btree_lab/freebuffer.cc
// Function: main
int main(int argc, char *argv[])
{
  if (argc<5) { 
    usage();
    exit(-1);
  }
  SIZE_T cachesize=atoi(argv[2]);
  SIZE_T blocknum=atoi(argv[3]);
  SIZE_T numblocks=atoi(argv[4]);

  DiskSystem disk(argv[1]);
  BufferCache cache(&disk,cachesize);

  cache.Attach();

  for (unsigned i=blocknum;i<(blocknum+numblocks);i++) { 
    ERROR_T rc=cache.NotifyDeallocateBlock(i);
    if (rc!=ERROR_NOERROR) { 
      cerr << "Error " << rc <<" occured when notifying cache of allocation of block "<< i << endl;
      return -1;
    }
  }

  cache.Detach();

  cerr << "Deallocation done\n";

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
cmpl $0x4, %edi
jle 0x26b8
movq %rsi, %r15
movq 0x10(%rsi), %rdi
callq 0x2300
movl %eax, %r14d
movq 0x18(%r15), %rdi
callq 0x2300
movl %eax, %ebp
movq 0x20(%r15), %rdi
callq 0x2300
movl %eax, %ebx
movq 0x8(%r15), %rsi
leaq 0x28(%rsp), %rdi
leaq 0x27(%rsp), %rdx
callq 0x2704
andl $0x0, 0x10(%rsp)
andl $0x0, 0x8(%rsp)
andl $0x0, (%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x28(%rsp), %rsi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x27d8
leaq 0x28(%rsp), %rdi
callq 0x20b0
leaq 0x28(%rsp), %rdi
leaq 0x88(%rsp), %rsi
movl %r14d, %edx
callq 0x3d9c
leaq 0x28(%rsp), %rdi
callq 0x3e7e
addl %ebp, %ebx
movl %ebp, %r14d
leaq 0x28(%rsp), %r15
cmpl %ebx, %r14d
jae 0x262e
movq %r15, %rdi
movl %r14d, %esi
callq 0x3eb4
movl %eax, %ebp
testl %eax, %eax
jne 0x264f
incq %r14
jmp 0x2613
leaq 0x28(%rsp), %rdi
callq 0x3dfc
xorl %ebx, %ebx
movq 0x59af(%rip), %rdi      # 0x7ff0
leaq 0x2a32(%rip), %rsi      # 0x507a
callq 0x21a0
jmp 0x2691
movq 0x599a(%rip), %rdi      # 0x7ff0
leaq 0x29e0(%rip), %rsi      # 0x503d
callq 0x21a0
movq %rax, %rdi
movl %ebp, %esi
callq 0x2360
leaq 0x29d1(%rip), %rsi      # 0x5044
movq %rax, %rdi
callq 0x21a0
movq %rax, %rdi
movq %r14, %rsi
callq 0x2110
movq %rax, %rdi
callq 0x20c0
pushq $-0x1
popq %rbx
leaq 0x28(%rsp), %rdi
callq 0x3dc8
leaq 0x88(%rsp), %rdi
callq 0x2be6
movl %ebx, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x254c
pushq $-0x1
popq %rdi
callq 0x2260
movq %rax, %rbx
jmp 0x26ef
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x20b0
jmp 0x26fc
movq %rax, %rbx
jmp 0x26fc
jmp 0x26e2
jmp 0x26e2
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3dc8
leaq 0x88(%rsp), %rdi
callq 0x2be6
movq %rbx, %rdi
callq 0x2370
// File: /workspace/github_cpp_makefile_star2_O2/jcipar[P]stack-distance/src/rank-tree.cpp
// Function: RankTreeNode::RankTreeNode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned long)
RankTreeNode::RankTreeNode(string name, uint64_t weight) {
	_name = name;
	_subtreeWeight = 0;
	_weight = weight;
	_priority = rand();
	_left = nullptr;
	_right = nullptr;
	_parent = nullptr;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
callq 0x20e0
andq $0x0, 0x20(%rbx)
movq %r14, 0x28(%rbx)
callq 0x2050
movl %eax, 0x30(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rbx)
andq $0x0, 0x48(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x20c0
movq %r14, %rdi
callq 0x2210
nop
// File: /workspace/github_cpp_makefile_star2_O2/jcipar[P]stack-distance/src/rank-tree.cpp
// Function: RankTreeNode::~RankTreeNode()
RankTreeNode::~RankTreeNode() {
	if (_left != nullptr) {
		delete _left;
	}
	if (_right != nullptr) {
		delete _right;
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x38(%rdi), %r14
testq %r14, %r14
je 0x23e4
movq %r14, %rdi
callq 0x23c4
movq %r14, %rdi
callq 0x2150
movq 0x40(%rbx), %r14
testq %r14, %r14
je 0x23fd
movq %r14, %rdi
callq 0x23c4
movq %r14, %rdi
callq 0x2150
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x20c0
// File: /workspace/github_cpp_makefile_star2_O2/jcipar[P]stack-distance/src/rank-tree.cpp
// Function: RankTreeNode::print(int)
void RankTreeNode::print(int level) {
	for (int i=0; i< level; i++) {
		cout << "  ";
	}
	cout << _name 
	<< " " << _subtreeWeight
	<< " " << _priority 
	<< " " << Rank()
	<< endl;
	if (_left) {
		_left->print(level+1);
	} else { 
		for (int i=0; i< level+1; i++) {
			cout << "  ";
		}
		cout << "<empty subtree>\n";
	}

	if (_right) {
		_right->print(level+1);
	} else { 
		for (int i=0; i< level+1; i++) {
			cout << "  ";
		}
		cout << "<empty subtree>\n";
	}

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movq 0x4ba7(%rip), %r14      # 0x6fd0
leaq 0x1bd5(%rip), %r15      # 0x4005
leaq 0x1bcd(%rip), %r13      # 0x4004
movl %ebp, %r12d
testl %ebp, %ebp
movl $0x0, %ebp
cmovgl %r12d, %ebp
movq %r14, %rdi
subl $0x1, %ebp
jb 0x2457
movq %r13, %rsi
callq 0x2170
jmp 0x2445
movq %rbx, %rsi
callq 0x2140
movq %rax, %rdi
movq %r15, %rsi
callq 0x2170
movq 0x20(%rbx), %rsi
movq %rax, %rdi
callq 0x2160
movq %rax, %rdi
movq %r15, %rsi
callq 0x2170
movl 0x30(%rbx), %esi
movq %rax, %rdi
callq 0x2200
movq %rax, %rdi
movq %r15, %rsi
callq 0x2170
movq %rax, %rbp
movq %rbx, %rdi
callq 0x2546
movq %rbp, %rdi
movq %rax, %rsi
callq 0x2160
movq %rax, %rdi
callq 0x20d0
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x24cc
leal 0x1(%r12), %ebp
movl %ebp, %esi
callq 0x2412
jmp 0x24f3
xorl %ebp, %ebp
movq %r14, %rdi
cmpl %r12d, %ebp
jg 0x24e2
movq %r13, %rsi
callq 0x2170
incl %ebp
jmp 0x24ce
leaq 0x1b1e(%rip), %rsi      # 0x4007
callq 0x2170
leal 0x1(%r12), %ebp
movq 0x40(%rbx), %rbx
testq %rbx, %rbx
jne 0x2437
xorl %ebp, %ebp
movq 0x4ac7(%rip), %rbx      # 0x6fd0
leaq 0x1af4(%rip), %r14      # 0x4004
cmpl %r12d, %ebp
jg 0x2524
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2170
incl %ebp
jmp 0x2510
movq 0x4aa5(%rip), %rdi      # 0x6fd0
leaq 0x1ad5(%rip), %rsi      # 0x4007
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2170
nop
// File: /workspace/github_cpp_makefile_star2_O2/jcipar[P]stack-distance/src/rank-tree.cpp
// Function: RankTreeNode::Rank()
int64_t RankTreeNode::Rank() {
	if (root()) {
		return leftWeight();
	} else if (leftChild()) {
		return _parent->leftChildRank(leftWeight());
	} else {
		assert(rightChild());
		return _parent->rightChildRank(leftWeight());
	}
}

// Assembly:
movq %rdi, %rax
movq 0x48(%rdi), %rdi
testq %rdi, %rdi
je 0x2570
cmpq %rax, 0x38(%rdi)
je 0x257e
cmpq %rax, 0x40(%rdi)
jne 0x25a1
movq 0x38(%rax), %rax
testq %rax, %rax
je 0x2590
movq 0x20(%rax), %rsi
jmp 0x29e2
movq 0x38(%rax), %rax
testq %rax, %rax
je 0x2597
movq 0x20(%rax), %rax
retq
movq 0x38(%rax), %rax
testq %rax, %rax
je 0x259a
movq 0x20(%rax), %rsi
jmp 0x299e
xorl %esi, %esi
jmp 0x29e2
xorl %eax, %eax
retq
xorl %esi, %esi
jmp 0x299e
pushq %rax
leaq 0x1bed(%rip), %rdi      # 0x4196
leaq 0x1a9d(%rip), %rsi      # 0x404d
leaq 0x1cb7(%rip), %rcx      # 0x426e
movl $0xf5, %edx
callq 0x2110
nop
// File: /workspace/github_cpp_makefile_star2_O2/jcipar[P]stack-distance/src/rank-tree.cpp
// Function: RankTreeNode::checkWeights()
int64_t RankTreeNode::checkWeights() {
	int64_t leftWeight = 0;
	int64_t rightWeight = 0;
	if (_left != nullptr) {
		leftWeight = _left->checkWeights();
	}
	if (_right != nullptr) {
		rightWeight = _right->checkWeights();
	}
	assert(_subtreeWeight == _weight + leftWeight + rightWeight);
	return _subtreeWeight;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x38(%rdi), %rdi
testq %rdi, %rdi
je 0x25dc
callq 0x25c2
movq %rax, %r14
jmp 0x25df
xorl %r14d, %r14d
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x25ef
callq 0x25c2
jmp 0x25f1
xorl %eax, %eax
addq %r14, %rax
movq 0x20(%rbx), %rcx
addq 0x28(%rbx), %rax
cmpq %rax, %rcx
jne 0x260c
movq %rcx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x1a05(%rip), %rdi      # 0x4018
leaq 0x1a33(%rip), %rsi      # 0x404d
leaq 0x1a3e(%rip), %rcx      # 0x405f
pushq $0x48
popq %rdx
callq 0x2110
nop
// File: /workspace/github_cpp_makefile_star2_O2/jcipar[P]stack-distance/src/rank-tree.cpp
// Function: RankTreeNode::checkPriorities(int)
void RankTreeNode::checkPriorities(int parentPriority) {
	assert(_priority <= parentPriority);
	if (_left != nullptr) {
		_left->checkPriorities(_priority);
	}
	if (_right != nullptr) {
		_right->checkPriorities(_priority);
	}
}

// Assembly:
pushq %rbx
movl %esi, %eax
movq %rdi, %rbx
movl 0x30(%rbx), %esi
cmpl %eax, %esi
jg 0x2658
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x2645
callq 0x262a
movq 0x40(%rbx), %rcx
testq %rcx, %rcx
je 0x2656
movl 0x30(%rbx), %eax
movq %rcx, %rbx
jmp 0x2630
popq %rbx
retq
leaq 0x1a25(%rip), %rdi      # 0x4084
leaq 0x19e7(%rip), %rsi      # 0x404d
leaq 0x1a33(%rip), %rcx      # 0x40a0
pushq $0x4e
popq %rdx
callq 0x2110
nop
// File: /workspace/github_cpp_makefile_star2_O2/jcipar[P]stack-distance/src/rank-tree.cpp
// Function: RankTreeNode::checkParentPointers(RankTreeNode*)
void RankTreeNode::checkParentPointers(RankTreeNode* parent) {
	assert(_parent == parent);
	if (_left != nullptr) {
		_left->checkParentPointers(this);
	}
	if (_right != nullptr) {
		_right->checkParentPointers(this);
	}
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
cmpq %rbx, 0x48(%rdi)
jne 0x269f
movq %rdi, %rbx
movq 0x38(%rdi), %rdi
testq %rdi, %rdi
je 0x2694
movq %rbx, %rsi
callq 0x2676
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
jne 0x267a
popq %rbx
retq
leaq 0x1a22(%rip), %rdi      # 0x40c8
leaq 0x19a0(%rip), %rsi      # 0x404d
leaq 0x1a26(%rip), %rcx      # 0x40da
pushq $0x59
popq %rdx
callq 0x2110
// File: /workspace/github_cpp_makefile_star2_O2/jcipar[P]stack-distance/src/rank-tree.cpp
// Function: RankTreeNode::checkUniqueness(std::set<RankTreeNode*, std::less<RankTreeNode*>, std::allocator<RankTreeNode*>>&)
void RankTreeNode::checkUniqueness(std::set<RankTreeNode*>& ptrs) {
	assert(ptrs.count(this) == 0);
	ptrs.insert(this);
	if (_left != nullptr) {
		_left->checkUniqueness(ptrs);
	}
	if (_right != nullptr) {
		_right->checkUniqueness(ptrs);
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq %rsp, %rsi
movq %rdi, (%rsi)
movq %rbx, %rdi
callq 0x2cc0
testq %rax, %rax
jne 0x2711
movq %rsp, %rsi
movq %r14, (%rsi)
movq %rbx, %rdi
callq 0x2d84
movq 0x38(%r14), %rdi
testq %rdi, %rdi
je 0x26f8
movq %rbx, %rsi
callq 0x26bc
movq 0x40(%r14), %rdi
testq %rdi, %rdi
je 0x2709
movq %rbx, %rsi
callq 0x26bc
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x19f9(%rip), %rdi      # 0x4111
leaq 0x192e(%rip), %rsi      # 0x404d
leaq 0x1a01(%rip), %rcx      # 0x4127
pushq $0x64
popq %rdx
callq 0x2110