LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/frame/main/MtWorker.cpp
// Function: beyondy::Async::MtWorker::workerId()
int MtWorker::workerId()
{
	int no = -1;

	for (int i = 0; i < tcnt; ++i) {
		if (pthread_equal(tids[i], pthread_self())) {
			no = i;
			break;
		}
	}

	return no;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq 0x14(%rdi), %r15
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %r15, %r15
jle 0x5808
movq 0x18(%rdi), %r13
xorl %r12d, %r12d
callq 0x32d0
movq %rax, %r14
movq (%r13,%r12,8), %rdi
movq %r14, %rsi
callq 0x35c0
testl %eax, %eax
jne 0x5805
incq %r12
cmpq %r12, %r15
jne 0x57ea
jmp 0x5808
movl %r12d, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/frame/main/MtWorker.cpp
// Function: beyondy::Async::MtWorker::start()
int MtWorker::start()
{
	isRunning = 1;
	for (int i = 0; i < tcnt; ++i) {
		int retval = pthread_create(&tids[i], NULL, __workerEntry, (void *)this);
		if (retval != 0) {
			errno = retval;
			return -1;
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0x1, 0x10(%rdi)
cmpl $0x0, 0x14(%rdi)
setg %r15b
jle 0x5890
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
leaq -0x102(%rip), %rdx      # 0x573c
xorl %esi, %esi
movq %rbx, %rcx
callq 0x3600
testl %eax, %eax
jne 0x5887
movl $0x8, %edi
xorl %r12d, %r12d
leaq -0x11f(%rip), %r14      # 0x573c
incq %r12
movslq 0x14(%rbx), %rax
cmpq %rax, %r12
setl %r15b
jge 0x5890
leaq 0x8(%rdi), %r13
addq 0x18(%rbx), %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x3600
movq %r13, %rdi
testl %eax, %eax
je 0x585b
movl %eax, %ebp
callq 0x3060
movl %ebp, (%rax)
movzbl %r15b, %eax
negl %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/frame/main/MtWorker.cpp
// Function: beyondy::Async::MtWorker::stop()
int MtWorker::stop()
{
	isRunning = 0;
	for (int i = 0; i < tcnt; ++i) {
		pthread_join(tids[i], NULL);
	}

	return 0;
}

// Assembly:
movl $0x0, 0x10(%rdi)
cmpl $0x0, 0x14(%rdi)
jle 0x58df
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rdi
xorl %esi, %esi
callq 0x32e0
incq %r14
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jl 0x58bd
addq $0x8, %rsp
popq %rbx
popq %r14
xorl %eax, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/frame/main/Processor.cpp
// Function: beyondy::Async::async_send_delegator(beyondy::Async::Message*, void*)
int async_send_delegator(Message *msg, void *data)
{
	// set it
	gettimeofday(&msg->ts_enqueue, NULL);

	Queue<Message> *outQ = (Queue<Message> *)data;
	if (outQ->push(msg) < 0) {
		SYSLOG_ERROR("push msg(fd=%d, flow=%d size=%ld) into system queue overflow", msg->fd, msg->flow, (long)msg->getWptr());
		return -1;
	}

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %r14
addq $0x40, %rdi
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x3570
movq %r15, %rdi
movq %r14, %rsi
callq 0x5946
testl %eax, %eax
jns 0x593e
leaq 0xabf6(%rip), %rax      # 0x10508
movq (%rax), %rdi
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x2, (%rdi)
jl 0x593e
movl 0x24(%r14), %ecx
movl 0x28(%r14), %r8d
movq 0x10(%r14), %r9
leaq 0x4eb9(%rip), %rdx      # 0xa7eb
movl $0x2, %esi
xorl %eax, %eax
callq 0x7310
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/frame/main/./Queue.h
// Function: beyondy::Async::Queue<beyondy::Async::Message>::push(beyondy::Async::Message*)
int Queue<T>::push(T *obj)
{
	int retval = 0;

	pthread_mutex_lock(&lock);
	if (queue.size() < maxSize) queue.push(obj);
	else retval = -1;

	pthread_cond_signal(&cond);
	pthread_mutex_unlock(&lock);

	return retval;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rsi, (%rsp)
callq 0x3510
movq 0xa8(%rbx), %rax
movq %rax, %rcx
subq 0x88(%rbx), %rcx
shrq $0x3, %rcx
cmpq $0x1, %rax
adcq $-0x1, %rcx
shlq $0x6, %rcx
movq 0x80(%rbx), %rdx
movq 0x90(%rbx), %rax
movq %rax, %rsi
subq 0x98(%rbx), %rsi
sarq $0x3, %rsi
subq 0x70(%rbx), %rdx
sarq $0x3, %rdx
addq %rsi, %rdx
addq %rcx, %rdx
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpq 0x58(%rbx), %rdx
jae 0x59da
movq 0xa0(%rbx), %rcx
addq $-0x8, %rcx
cmpq %rcx, %rax
je 0x59cc
movq (%rsp), %rcx
movq %rcx, (%rax)
addq $0x8, 0x90(%rbx)
jmp 0x59d8
leaq 0x60(%rbx), %rdi
movq %rsp, %rsi
callq 0x59f4
xorl %ebp, %ebp
leaq 0x28(%rbx), %rdi
callq 0x3030
movq %rbx, %rdi
callq 0x3260
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/frame/main/Connection.cpp
// Function: beyondy::Async::Connection::Connection(int, int, beyondy::Async::EventManager*, beyondy::Async::Queue<beyondy::Async::Message>*, beyondy::Async::Processor*, int, void*)
Connection::Connection(int _fd, int _flow, EventManager *_emgr, Queue<Message> *_inQueue, Processor *_proc, int _creatorType, void *_parent)
	: EventHandler(_fd), flow(_flow),
	  inMsg(NULL), inQueue(_inQueue),
	  outMsg(NULL), outQueue(new std::deque<Message*>()),
	  emgr(_emgr), proc(_proc),
	  creatorType(_creatorType)
{
	if (creatorType == CT_LISTENER)
		this->parentListener = static_cast<Listener *>(_parent);
	else
		this->parentData = _parent;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %rbx
movq %rcx, %r15
movq %rdi, %r14
movl %esi, 0x8(%rdi)
leaq 0xa02d(%rip), %rax      # 0xfc50
movq %rax, (%rdi)
movl %edx, 0x10(%rdi)
xorl %eax, %eax
movq %rax, 0x50(%rdi)
movq %r8, 0x58(%rdi)
movq %rax, 0x60(%rdi)
movl $0x50, %edi
callq 0x3330
movq %rax, %r12
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
movq %rax, %rdi
xorl %esi, %esi
callq 0x48b0
movq 0x38(%rsp), %rax
movl 0x30(%rsp), %ecx
movq %r12, 0x68(%r14)
movq %r15, 0x70(%r14)
movq %rbx, 0x78(%r14)
movl %ecx, 0x80(%r14)
movq %rax, 0x88(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
movl $0x50, %esi
movq %r12, %rdi
callq 0x3340
movq %rbx, %rdi
callq 0x35d0
nop
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/frame/main/Connection.cpp
// Function: beyondy::Async::Connection::readN(unsigned long)
ssize_t Connection::readN(size_t size)
{
	assert(size > 0);
	ssize_t rlen = ::read(fd, inMsg->wb(), size);
	++inMsg->ioCount;

	if ((size_t)rlen == size) {
		inMsg->incWptr(rlen);
		return rlen;
	}
	else if (rlen > 0) {
		inMsg->incWptr(rlen);
		return rlen;
	}
	else if (rlen == 0) {
		/* closed by peer. reset errno */
		SYSLOG_ERROR("connection fd=%d flow=%d has been closed by peer", fd, flow);
		return errno = 0, -1;
	}

	/* error with errno set */
	SYSLOG_ERROR("connection fd=%d flow=%d read error: %m", fd, flow);
	return -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rsi, %rsi
je 0x616e
movq %rsi, %r15
movq %rdi, %r14
movl 0x8(%rdi), %edi
movq 0x50(%r14), %rax
movq (%rax), %rsi
addq 0x10(%rax), %rsi
movq %r15, %rdx
callq 0x34f0
movq %rax, %rbx
movq 0x50(%r14), %rax
incl 0x2c(%rax)
cmpq %r15, %rbx
je 0x60f6
testq %rbx, %rbx
jle 0x6103
addq %rbx, 0x10(%rax)
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0xa3fe(%rip), %rax      # 0x10508
movq (%rax), %rdi
movl (%rdi), %eax
je 0x613a
movq $-0x1, %rbx
cmpl $0x2, %eax
jl 0x60fa
movl 0x8(%r14), %ecx
movl 0x10(%r14), %r8d
leaq 0x4d25(%rip), %rdx      # 0xae51
movl $0x2, %esi
xorl %eax, %eax
callq 0x7310
jmp 0x60fa
cmpl $0x2, %eax
jl 0x615a
movl 0x8(%r14), %ecx
movl 0x10(%r14), %r8d
leaq 0x4cd2(%rip), %rdx      # 0xae20
movl $0x2, %esi
xorl %eax, %eax
callq 0x7310
callq 0x3060
movl $0x0, (%rax)
movq $-0x1, %rbx
jmp 0x60fa
leaq 0x4c70(%rip), %rdi      # 0xade5
leaq 0x46eb(%rip), %rsi      # 0xa867
leaq 0x4c6b(%rip), %rcx      # 0xadee
movl $0x111, %edx            # imm = 0x111
callq 0x31f0
nop
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/frame/main/Connection.cpp
// Function: beyondy::Async::Connection::writeN(beyondy::Async::Message*, unsigned long)
ssize_t Connection::writeN(Message *msg, size_t size) 
{
	BPROF_TRACE(BPT_CONN_WRITEN)

	assert(size > 0);
	ssize_t wlen = ::write(fd, msg->rb(), size);
	++msg->ioCount;

	if ((size_t)wlen == size) {
		msg->incRptr(wlen);
		return wlen;
	}
	else if (wlen > 0) {
		msg->incRptr(wlen);
		return wlen;
	}
	else {
		SYSLOG_ERROR("connection fd=%d flow=%d write error: %m", fd, flow);
	}

	/* error */
	return -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdx, %rdx
je 0x63ea
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r14
movl 0x8(%rdi), %edi
movq (%rsi), %rsi
addq 0x8(%r15), %rsi
callq 0x30f0
movq %rax, %rbx
incl 0x2c(%r15)
cmpq %r12, %rax
je 0x63a4
testq %rbx, %rbx
jle 0x63b7
addq %rbx, 0x8(%r15)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0xa14a(%rip), %rax      # 0x10508
movq (%rax), %rdi
movq $-0x1, %rbx
cmpl $0x2, (%rdi)
jl 0x63a8
movl 0x8(%r14), %ecx
movl 0x10(%r14), %r8d
leaq 0x4adb(%rip), %rdx      # 0xaeb7
movl $0x2, %esi
xorl %eax, %eax
callq 0x7310
jmp 0x63a8
leaq 0x49f4(%rip), %rdi      # 0xade5
leaq 0x446f(%rip), %rsi      # 0xa867
leaq 0x4a7a(%rip), %rcx      # 0xae79
movl $0x12c, %edx            # imm = 0x12C
callq 0x31f0
nop
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/frame/main/Connection.cpp
// Function: beyondy::Async::Connection::onError(int)
int Connection::onError(int fd) {
	assert(this->fd == fd);
	SYSLOG_DEBUG("connection fd=%d flow=%d onError", fd, flow);

	int retval = destroy();
	return retval;
}

// Assembly:
pushq %rbx
cmpl %esi, 0x8(%rdi)
jne 0x6445
movq %rdi, %rbx
leaq 0xa0ee(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x5, (%rdi)
jl 0x643b
movl %esi, %ecx
movl 0x10(%rbx), %r8d
leaq 0x4839(%rip), %rdx      # 0xac68
movl $0x5, %esi
xorl %eax, %eax
callq 0x7310
movq (%rbx), %rax
movq %rbx, %rdi
popq %rbx
jmpq *0x30(%rax)
leaq 0x440c(%rip), %rdi      # 0xa858
leaq 0x4414(%rip), %rsi      # 0xa867
leaq 0x47d9(%rip), %rcx      # 0xac33
movl $0xaa, %edx
callq 0x31f0
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/frame/main/Connection.cpp
// Function: beyondy::Async::Connection::checkMessageExpiration()
void Connection::checkMessageExpiration()
{
	struct timeval tNow;
	gettimeofday(&tNow, NULL);

	// TODO: how to check sending message?
	while (!outQueue->empty()) {
		Message *msg = outQueue->front();
		if (TV2MS(msg->ts_enqueue, tNow) < emgr->getOutMessageExpire())
			break;

		SYSLOG_ERROR("connection fd=%d flow=%d msg(size=%ld) expired in queue", fd, flow, (long)msg->getWptr());

		outQueue->pop_front();
		proc->onSent(msg, SS_TIMEDOUT);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x3570
movq (%r14), %r13
movq 0x8(%r14), %rbp
movq 0x68(%rbx), %rcx
movq 0x10(%rcx), %rax
cmpq %rax, 0x30(%rcx)
je 0x67a4
movq (%rax), %r15
movq %r13, %rax
subq 0x40(%r15), %rax
imulq $0x3e8, %rax, %rcx      # imm = 0x3E8
movq %rbp, %rax
subq 0x48(%r15), %rax
movabsq $0x20c49ba5e353f7cf, %rdx # imm = 0x20C49BA5E353F7CF
imulq %rdx
movq %rdx, %r12
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x7, %r12
addq %rax, %r12
addq %rcx, %r12
movq 0x70(%rbx), %rax
movslq 0x5c(%rax), %r14
cmpq %r14, %r12
jl 0x67a4
leaq 0x9dae(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x6780
movl 0x8(%rbx), %ecx
movl 0x10(%rbx), %r8d
movq 0x10(%r15), %r9
movl $0x2, %esi
leaq 0x4634(%rip), %rdx      # 0xadad
xorl %eax, %eax
callq 0x7310
movq 0x68(%rbx), %rdi
callq 0x568e
movq 0x78(%rbx), %rdi
movq (%rdi), %rax
movq %r15, %rsi
movl $0x1, %edx
callq *0x38(%rax)
cmpq %r14, %r12
jge 0x66fb
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/frame/main/Connection.cpp
// Function: beyondy::Async::Connection::destroy()
int Connection::destroy() {
	/* notify un-sent message */
	if (inMsg != NULL) {
		Message::destroy(inMsg);
		inMsg = NULL;
	}

	if (outMsg != NULL) {
		proc->onSent(outMsg, SS_DESTROY);
		outMsg = NULL;
	}

	while (!outQueue->empty()) {
		outMsg = outQueue->front(); outQueue->pop_front();
		proc->onSent(outMsg, SS_DESTROY);
	}
	
	if (this->creatorType == CT_LISTENER) {
		Listener *listener = this->parentListener;
		proc->onDisconnected(flow);
		listener->destroyConnection(this);
	}

	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x50(%rdi), %rdi
testq %rdi, %rdi
je 0x67d1
callq 0x7600
movq $0x0, 0x50(%rbx)
movq 0x60(%rbx), %rsi
testq %rsi, %rsi
je 0x6812
movq 0x78(%rbx), %rdi
movq (%rdi), %rax
movl $0x5, %edx
callq *0x38(%rax)
movq $0x0, 0x60(%rbx)
jmp 0x6812
movq (%rax), %rax
movq %rax, 0x60(%rbx)
callq 0x568e
movq 0x60(%rbx), %rsi
movq 0x78(%rbx), %rdi
movq (%rdi), %rax
movl $0x5, %edx
callq *0x38(%rax)
movq 0x68(%rbx), %rdi
movq 0x10(%rdi), %rax
cmpq %rax, 0x30(%rdi)
jne 0x67f3
cmpl $0x0, 0x80(%rbx)
jne 0x6849
movq 0x78(%rbx), %rdi
movq 0x88(%rbx), %r14
leaq 0x10(%rbx), %rsi
movq (%rdi), %rax
callq *0x48(%rax)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7204
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/frame/main/Connector.cpp
// Function: beyondy::Async::Connector::Connector(int, char const*, beyondy::Async::EventManager*, beyondy::Async::Queue<beyondy::Async::Message>*, beyondy::Async::Processor*)
Connector::Connector(int _flow, const char *_address, EventManager *_emgr, Queue<Message> *_inQueue, Processor *_proc)
	: Connection(-1, _flow, _emgr, _inQueue, _proc, CT_CONNECTOR, NULL), status(CONN_CLOSE)
{
	strncpy(address, _address, sizeof(address));
	address[sizeof(address) - 1] = 0;

	gettimeofday(&tsLastClosed, NULL);
	cntRetryConnect = 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movl %esi, %edx
movq %rdi, %rbx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
pushq $0x0
pushq $0x1
callq 0x5c08
addq $0x10, %rsp
leaq 0x945a(%rip), %rax      # 0xfcf8
movq %rax, (%rbx)
xorl %r15d, %r15d
movl %r15d, 0xb4(%rbx)
leaq 0xb8(%rbx), %rdi
movl $0x80, %edx
movq %r14, %rsi
callq 0x3180
movb $0x0, 0x137(%rbx)
leaq 0xa0(%rbx), %rdi
xorl %esi, %esi
callq 0x3570
movl %r15d, 0xb0(%rbx)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/frame/main/Connector.cpp
// Function: beyondy::Async::Connector::onWritable(int)
int Connector::onWritable(int fd)
{
	SYSLOG_DEBUG("connector(%s) is onWritable", address);
	assert(this->fd == fd);

	if (status == CONN_ESTABLISHED) {
		return Connection::onWritable(fd);
	}
	else if (status == CONN_OPENNING) {
			int err = XbsGetError(this->fd);
			if (err != 0) {
				errno = err;
				SYSLOG_ERROR("connect to %s failed: %m", address);
				return -1;
			}

			cntRetryConnect = 0;	// reset it
			status = CONN_ESTABLISHED;
			if (emgr->modifyConnection(this, EVENT_IN, 0) < 0) {
				SYSLOG_ERROR("connector(%s) fd=%d flow=%d add EVENT_IN failed: %m", address, fd, flow);
				return -1;
			}

			SYSLOG_ERROR("connector(%s) establish done: fd=%d flow=%d", address, fd, flow);
			return Connection::onWritable(fd);
	}

	SYSLOG_ERROR("connector %s is writable but in CLOSE state", address);
	return 0; // why here?
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x9c13(%rip), %r15      # 0x10508
movq (%r15), %rdi
cmpl $0x5, (%rdi)
jl 0x6917
leaq 0xb8(%rbx), %rcx
leaq 0x4611(%rip), %rdx      # 0xaf1c
movl $0x5, %esi
xorl %eax, %eax
callq 0x7310
movl 0x8(%rbx), %edi
cmpl %ebp, %edi
jne 0x6a41
movl 0xb4(%rbx), %eax
cmpl $0x1, %eax
je 0x6946
cmpl $0x2, %eax
jne 0x6978
movq %rbx, %rdi
movl %ebp, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x618e
callq 0x77e4
testl %eax, %eax
je 0x69b1
movl %eax, %r14d
callq 0x3060
movl %r14d, (%rax)
movq (%r15), %rdi
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpl $0x2, (%rdi)
jl 0x69a3
addq $0xb8, %rbx
leaq 0x4607(%rip), %rdx      # 0xaf7d
jmp 0x6994
movq (%r15), %rdi
xorl %r14d, %r14d
cmpl $0x2, (%rdi)
jl 0x69a3
addq $0xb8, %rbx
leaq 0x4665(%rip), %rdx      # 0xaff6
xorl %r14d, %r14d
movl $0x2, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x7310
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movabsq $0x200000000, %rax      # imm = 0x200000000
movq %rax, 0xb0(%rbx)
movq 0x70(%rbx), %rdi
movq %rbx, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x4f78
movq (%r15), %rdi
movl (%rdi), %ecx
testl %eax, %eax
js 0x6a0d
cmpl $0x2, %ecx
jl 0x6932
leaq 0xb8(%rbx), %rcx
movl 0x10(%rbx), %r9d
leaq 0x45d1(%rip), %rdx      # 0xafca
movl $0x2, %esi
movl %ebp, %r8d
xorl %eax, %eax
callq 0x7310
jmp 0x6932
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpl $0x2, %ecx
jl 0x69a3
movl 0x10(%rbx), %r9d
addq $0xb8, %rbx
leaq 0x456c(%rip), %rdx      # 0xaf96
movl $0x2, %esi
movq %rbx, %rcx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x7310
jmp 0x69a3
leaq 0x3e10(%rip), %rdi      # 0xa858
leaq 0x44e9(%rip), %rsi      # 0xaf38
leaq 0x44f0(%rip), %rcx      # 0xaf46
movl $0x21, %edx
callq 0x31f0
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/frame/main/Connector.cpp
// Function: beyondy::Async::Connector::open()
int Connector::open()
{
	fd = XbsClient(address, O_NONBLOCK, 0);
	if (++cntRetryConnect >= 5) cntRetryConnect = 0;

	if (fd >= 0) {
		if (errno == EINPROGRESS) {
			events = EVENT_OUT;
			status = CONN_OPENNING;
		}
		else {
			cntRetryConnect = 0;
			events = EVENT_IN;
			status = CONN_ESTABLISHED;
		}
	} 
	else {
		return -1;
	}

	SYSLOG_DEBUG("connector(%s) open OK, fd=%d flow=%d, status=%d", address, fd, flow, (int)status);
	int retval = emgr->addConnection(this, events);
	if (retval < 0) {
		// TODO: 
		::close(fd); fd = -1;
		status = CONN_CLOSE;

		SYSLOG_ERROR("connector(%s) addConnection got error: %m", address);
		return retval;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0xb8(%rdi), %rbx
xorl %r15d, %r15d
movq %rbx, %rdi
movl $0x800, %esi            # imm = 0x800
xorl %edx, %edx
callq 0x7c4f
movl %eax, %ebp
movl %eax, 0x8(%r14)
movl 0xb0(%r14), %eax
leal 0x1(%rax), %ecx
cmpl $0x4, %eax
cmovgel %r15d, %ecx
movl %ecx, 0xb0(%r14)
testl %ebp, %ebp
js 0x6abb
callq 0x3060
cmpl $0x73, (%rax)
jne 0x6ac5
movl $0x1, %eax
movl $0x4, %ecx
jmp 0x6ada
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x6b6f
movl $0x0, 0xb0(%r14)
movl $0x2, %eax
movl $0x1, %ecx
movl %ecx, 0xc(%r14)
movl %eax, 0xb4(%r14)
leaq 0x9a1c(%rip), %r15      # 0x10508
movq (%r15), %rdi
cmpl $0x5, (%rdi)
jl 0x6b1b
movl 0x10(%r14), %r9d
movl 0xb4(%r14), %eax
movl %eax, (%rsp)
leaq 0x4519(%rip), %rdx      # 0xb022
movl $0x5, %esi
movq %rbx, %rcx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x7310
movq 0x70(%r14), %rdi
movl 0xc(%r14), %edx
movq %r14, %rsi
callq 0x4ede
movl %eax, %ebp
xorl %eax, %eax
testl %ebp, %ebp
jns 0x6b6f
movl 0x8(%r14), %edi
callq 0x3630
movl $0xffffffff, 0x8(%r14)  # imm = 0xFFFFFFFF
movl $0x0, 0xb4(%r14)
movq (%r15), %rdi
cmpl $0x2, (%rdi)
jl 0x6b6d
leaq 0x44f4(%rip), %rdx      # 0xb052
movl $0x2, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x7310
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/frame/main/Connector.cpp
// Function: beyondy::Async::Connector::destroy()
int Connector::destroy()
{
	SYSLOG_ERROR("connector(%s) is cleared, outQ-size=%ld", address, (long)((outMsg == NULL ? 0 : 1) + outQueue->size()));

	if (inMsg != NULL) {
		Message::destroy(inMsg);
		inMsg = NULL;
	}

	if (outMsg != NULL) {
		outMsg->setRptr(0);	// reset it and re-send next time
		outQueue->push_front(outMsg);
		outMsg = NULL;
	}

	// keep other message in the queue
	// Need check timeout in the main-loop

	// DO NOT UNMAP FLOW
	emgr->deleteConnection(this);

	::close(fd); fd = -1;
	status = CONN_CLOSE;

	// re-connect sometime later
	gettimeofday(&tsLastClosed, NULL);

	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x9980(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x6bf0
movq 0x68(%rbx), %rax
movq 0x48(%rax), %rcx
movq %rcx, %rdx
subq 0x28(%rax), %rdx
shrq $0x3, %rdx
cmpq $0x1, %rcx
adcq $-0x1, %rdx
leaq 0xb8(%rbx), %rcx
shlq $0x6, %rdx
movq 0x20(%rax), %rsi
movq 0x30(%rax), %r8
subq 0x38(%rax), %r8
subq 0x10(%rax), %rsi
sarq $0x3, %r8
sarq $0x3, %rsi
cmpq $0x1, 0x60(%rbx)
sbbq $-0x1, %r8
addq %rsi, %r8
addq %rdx, %r8
leaq 0x4498(%rip), %rdx      # 0xb07c
movl $0x2, %esi
xorl %eax, %eax
callq 0x7310
movq 0x50(%rbx), %rdi
testq %rdi, %rdi
je 0x6c06
callq 0x7600
movq $0x0, 0x50(%rbx)
movq 0x60(%rbx), %rax
testq %rax, %rax
je 0x6c43
leaq 0x60(%rbx), %r14
movq $0x0, 0x8(%rax)
movq 0x68(%rbx), %rdi
movq 0x10(%rdi), %rcx
cmpq 0x18(%rdi), %rcx
je 0x6c34
movq %rax, -0x8(%rcx)
addq $-0x8, 0x10(%rdi)
jmp 0x6c3c
movq %r14, %rsi
callq 0x6e6a
movq $0x0, (%r14)
movq 0x70(%rbx), %rdi
movq %rbx, %rsi
callq 0x500e
movl 0x8(%rbx), %edi
callq 0x3630
movl $0xffffffff, 0x8(%rbx)  # imm = 0xFFFFFFFF
movl $0x0, 0xb4(%rbx)
addq $0xa0, %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3570
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/frame/main/Connector.cpp
// Function: beyondy::Async::Connector::sendMessage(beyondy::Async::Message*)
int Connector::sendMessage(Message *msg)
{
	if (status == CONN_CLOSE) {
		if (open() < 0) {
			SYSLOG_WARN("when sendMessage, open connector to %s failed", address);
			return -1;
		}

		SYSLOG_DEBUG("connector(%s) open OK when sendMessage", address);
	}

	if (status == CONN_OPENNING) {
		if (outQueue->size() >= (size_t)emgr->getConnectionOutQueueSize()) {
			SYSLOG_ERROR("connector fd=%d flow=%d sendMessge over-flow, out-queue-size=%ld", fd, flow, (long)outQueue->size());
			proc->onSent(msg, SS_QUEUE_FULL);
		}
		else {
			SYSLOG_DEBUG("connector(%s) is openning when sendMessage", address);
			outQueue->push_back(msg);
		}

		return 0;
	}

	assert(status == CONN_ESTABLISHED);
	SYSLOG_DEBUG("connector(%s) is established when sendMessage", address);

	return Connection::sendMessage(msg);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rsi, (%rsp)
cmpl $0x0, 0xb4(%rdi)
je 0x6d91
movl 0xb4(%rbx), %eax
cmpl $0x2, %eax
je 0x6d56
cmpl $0x1, %eax
jne 0x6e41
movq 0x68(%rbx), %rax
movq 0x70(%rbx), %rcx
movq 0x48(%rax), %rdx
movq %rdx, %rsi
subq 0x28(%rax), %rsi
shrq $0x3, %rsi
cmpq $0x1, %rdx
adcq $-0x1, %rsi
shlq $0x6, %rsi
movq 0x30(%rax), %rdx
subq 0x38(%rax), %rdx
movq 0x20(%rax), %r9
sarq $0x3, %rdx
subq 0x10(%rax), %r9
sarq $0x3, %r9
addq %rdx, %r9
addq %rsi, %r9
movslq 0x64(%rcx), %rcx
leaq 0x9809(%rip), %rax      # 0x10508
movq (%rax), %rdi
movl (%rdi), %eax
cmpq %rcx, %r9
jae 0x6dd1
cmpl $0x5, %eax
jl 0x6d2c
leaq 0xb8(%rbx), %rcx
leaq 0x441a(%rip), %rdx      # 0xb13a
movl $0x5, %esi
xorl %eax, %eax
callq 0x7310
movq 0x68(%rbx), %rdi
movq 0x30(%rdi), %rax
movq 0x40(%rdi), %rcx
addq $-0x8, %rcx
cmpq %rcx, %rax
je 0x6e2e
movq (%rsp), %rcx
movq %rcx, (%rax)
addq $0x8, 0x30(%rdi)
jmp 0x6e36
leaq 0x97ab(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x5, (%rdi)
jl 0x6d7f
leaq 0xb8(%rbx), %rcx
leaq 0x444b(%rip), %rdx      # 0xb1be
movl $0x5, %esi
xorl %eax, %eax
callq 0x7310
movq (%rsp), %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x6464
movq %rbx, %rdi
callq 0x6a60
leaq 0x9768(%rip), %rcx      # 0x10508
movq (%rcx), %rdi
movl (%rdi), %ecx
testl %eax, %eax
js 0x6e05
cmpl $0x5, %ecx
jl 0x6c9b
leaq 0xb8(%rbx), %rcx
leaq 0x4312(%rip), %rdx      # 0xb0d2
movl $0x5, %esi
xorl %eax, %eax
callq 0x7310
jmp 0x6c9b
cmpl $0x2, %eax
jl 0x6df0
movl 0x8(%rbx), %ecx
movl 0x10(%rbx), %r8d
leaq 0x4315(%rip), %rdx      # 0xb0f9
movl $0x2, %esi
xorl %eax, %eax
callq 0x7310
movq 0x78(%rbx), %rdi
movq (%rsp), %rsi
movq (%rdi), %rax
movl $0x3, %edx
callq *0x38(%rax)
jmp 0x6e36
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x3, %ecx
jl 0x6e38
addq $0xb8, %rbx
leaq 0x4287(%rip), %rdx      # 0xb0a4
movl $0x3, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x7310
jmp 0x6e38
movq %rsp, %rsi
callq 0x59f4
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x431d(%rip), %rdi      # 0xb165
leaq 0x40e9(%rip), %rsi      # 0xaf38
leaq 0x432a(%rip), %rcx      # 0xb180
movl $0x95, %edx
callq 0x31f0
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/frame/main/Listener.cpp
// Function: beyondy::Async::Listener::onReadable(int)
int Listener::onReadable(int fd) {
	assert(this->fd == fd);

	int cfd = ::accept(fd, NULL, NULL);
	if (cfd < 0) {
		SYSLOG_WARN("listener(%s) accept failed: %m", address);
		return 0; // ignore
	}

	char peerName[128];
	if (beyondy::XbsGetPeername(cfd, peerName, sizeof(peerName)) < 0) {
		::close(cfd);
		SYSLOG_ERROR("listener(%s) new accepted fd=%d can not get peer name: %m", address, cfd);
		return 0; /* ignore (this is usually caused by peer closed immediately */
	}

	beyondy::XbsSetFlags(cfd, O_NONBLOCK, 0);
	if (connActive >= connMax) {
		::close(fd);
		SYSLOG_ERROR("listener(%s) reject connection from %s for overflow limit %d", address, peerName, connActive);
		return 0; // ignore
	}

	SYSLOG_DEBUG("listener(%s) accepted a connection: fd=%d peer=%s", address, cfd, peerName);
	Connection *connection = createConnection(cfd);
	if (connection == NULL) {
		::close(fd);
		SYSLOG_ERROR("listener(%s) failed to create connection from %s", address, peerName);
		return 0; // ignore
	}

	++connActive;
	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x80, %rsp
cmpl %esi, 0x8(%rdi)
jne 0x7106
movl %esi, %r14d
movq %rdi, %rbx
movl %esi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x30e0
testl %eax, %eax
js 0x705b
movl %eax, %ebp
movq %rsp, %rsi
movl $0x80, %edx
movl %eax, %edi
callq 0x7869
movl %ebp, %edi
testl %eax, %eax
js 0x708a
movl $0x800, %esi            # imm = 0x800
xorl %edx, %edx
callq 0x797d
movl 0x90(%rbx), %eax
cmpl 0x94(%rbx), %eax
jge 0x70bd
leaq 0x94e7(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x5, (%rdi)
jl 0x7046
leaq 0x10(%rbx), %rcx
leaq 0x42ac(%rip), %rdx      # 0xb2e0
movq %rsp, %r9
movl $0x5, %esi
movl %ebp, %r8d
xorl %eax, %eax
callq 0x7310
movq %rbx, %rdi
movl %ebp, %esi
callq 0x7126
incl 0x90(%rbx)
jmp 0x70f8
leaq 0x94a6(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x3, (%rdi)
jl 0x70f8
addq $0x10, %rbx
leaq 0x41d1(%rip), %rdx      # 0xb24a
movl $0x3, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x7310
jmp 0x70f8
callq 0x3630
leaq 0x9472(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x70f8
addq $0x10, %rbx
leaq 0x41c0(%rip), %rdx      # 0xb269
movl $0x2, %esi
movq %rbx, %rcx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x7310
jmp 0x70f8
movl %r14d, %edi
callq 0x3630
leaq 0x943c(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x70f8
movl 0x90(%rbx), %r9d
addq $0x10, %rbx
leaq 0x41bd(%rip), %rdx      # 0xb2a3
movq %rsp, %r8
movl $0x2, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x7310
xorl %eax, %eax
addq $0x80, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x374b(%rip), %rdi      # 0xa858
leaq 0x40f3(%rip), %rsi      # 0xb207
leaq 0x40f9(%rip), %rcx      # 0xb214
movl $0x1f, %edx
callq 0x31f0
nop
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/frame/main/Listener.cpp
// Function: beyondy::Async::Listener::createConnection(int)
Connection *Listener::createConnection(int cfd) 
{
	int flow = emgr->nextFlow();
	
	Connection *connection = new Connection(cfd, flow, emgr, inQueue, proc, CT_LISTENER, static_cast<void *>(this));
	if (connection != NULL) {
		emgr->mapFlow(flow, connection);
		emgr->addConnection(connection, EVENT_IN);
	}
	else {
		SYSLOG_ERROR("listener(%s) new Connection failed: %m", address);
	}
	
	return connection;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r15d
movq %rdi, %r14
movq 0x98(%rdi), %rdi
callq 0x4dee
movl %eax, %ebp
movl $0x90, %edi
callq 0x3330
movq %rax, %rbx
movq 0x98(%r14), %rcx
movq 0xa0(%r14), %r8
movq 0xa8(%r14), %r9
movq %rax, %rdi
movl %r15d, %esi
movl %ebp, %edx
pushq %r14
pushq $0x0
callq 0x5c08
addq $0x10, %rsp
movq 0x98(%r14), %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4df8
movq 0x98(%r14), %rdi
movq %rbx, %rsi
movl $0x1, %edx
callq 0x4ede
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movl $0x90, %esi
movq %rbx, %rdi
callq 0x3340
movq %r14, %rdi
callq 0x35d0
nop
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/frame/main/Listener.cpp
// Function: beyondy::Async::Listener::destroyConnection(beyondy::Async::Connection*)
void Listener::destroyConnection(Connection *connection) 
{
	SYSLOG_INFO("listener(%s) close its connection: fd=%d, flow=%d", address, connection->fd, connection->flow);

	emgr->unmapFlow(connection);
	emgr->deleteConnection(connection);
	::close(connection->fd);

	--connActive;
	delete connection;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x92f3(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x4, (%rdi)
jl 0x723c
leaq 0x10(%r14), %rcx
movl 0x8(%rbx), %r8d
movl 0x10(%rbx), %r9d
leaq 0x414b(%rip), %rdx      # 0xb37b
movl $0x4, %esi
xorl %eax, %eax
callq 0x7310
movq 0x98(%r14), %rdi
movq %rbx, %rsi
callq 0x5116
movq 0x98(%r14), %rdi
movq %rbx, %rsi
callq 0x500e
movl 0x8(%rbx), %edi
callq 0x3630
decl 0x90(%r14)
testq %rbx, %rbx
je 0x727e
movq (%rbx), %rax
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmpq *0x8(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/frame/main/Listener.cpp
// Function: beyondy::Async::Listener::open()
int Listener::open()
{
	fd = XbsServer(address, 1024, O_NONBLOCK);
	if (fd < 0) {
		SYSLOG_ERROR("listener(%s) open failed: %m", address);
		return -1;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
leaq 0x10(%rdi), %rbx
movq %rbx, %rdi
movl $0x400, %esi            # imm = 0x400
movl $0x800, %edx            # imm = 0x800
movl $0x3, %ecx
callq 0x7b52
movl %eax, 0x8(%r14)
xorl %ebp, %ebp
testl %eax, %eax
jns 0x72dc
leaq 0x924f(%rip), %rax      # 0x10508
movq (%rax), %rdi
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x2, (%rdi)
jl 0x72dc
leaq 0x40e0(%rip), %rdx      # 0xb3ad
movl $0x2, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x7310
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/common/src/xbs_socket.cpp
// Function: beyondy::XbsConnect(int, sockaddr const*, unsigned int, long)
int XbsConnect(int fd, const struct sockaddr *target, socklen_t alen, long timedout)
{
	int retval = connect(fd, target, alen);
	if (retval == -1) {
		if (timedout < 1)
			return 0;	// with errno

		if (errno == EINPROGRESS) {
			if (XbsWaitWritable(fd, timedout) < 0) {
				return -1;
			}

			if ((retval = XbsGetError(fd)) != 0) {
				errno = retval;
				return -1;
			}

			errno = 0;	// clear errno
			return 0;
		}
		else {
			return -1;
		}
	}
	
	errno = 0;	// clear errno
	return 0;	// good?!
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %r15
movl %edi, %ebp
callq 0x32b0
cmpl $-0x1, %eax
je 0x7779
callq 0x3060
movl $0x0, (%rax)
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %r14d, %r14d
testq %r15, %r15
jle 0x776b
callq 0x3060
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpl $0x73, (%rax)
jne 0x776b
movq %rax, %rbx
movl %ebp, %edi
movq %r15, %rsi
callq 0x96cc
testl %eax, %eax
js 0x776b
leaq 0x4(%rsp), %r8
movl $0x4, (%r8)
movq %rsp, %rcx
movl %ebp, %edi
movl $0x1, %esi
movl $0x4, %edx
callq 0x3250
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x77ce
movl (%rsp), %ecx
testl %ecx, %ecx
je 0x77dc
movl %ecx, (%rbx)
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x776b
movl $0x0, (%rbx)
jmp 0x7768
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/common/src/xbs_socket.cpp
// Function: beyondy::XbsGetPeername(int, char*, unsigned long)
int XbsGetPeername(int fd, char *nbuf, size_t size)
{
	struct sockaddr_storage addr_buf;
	int type = 0;
	socklen_t addr_len = sizeof(addr_buf);
	socklen_t tlen = sizeof(type);

	if (getpeername(fd, (struct sockaddr *)&addr_buf, &addr_len) < 0) return -1;
	if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &type, &tlen) < 0) return -1;

	return sockaddr2str((struct sockaddr *)&addr_buf, type, nbuf, size);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x98, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %r15d
movl $0x0, 0xc(%rsp)
leaq 0x14(%rsp), %rdx
movl $0x80, (%rdx)
movl $0x4, 0x10(%rsp)
leaq 0x18(%rsp), %rsi
callq 0x3230
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x78e3
leaq 0xc(%rsp), %rcx
leaq 0x10(%rsp), %r8
movl %r15d, %edi
movl $0x1, %esi
movl $0x3, %edx
callq 0x3250
testl %eax, %eax
js 0x78e3
movl 0xc(%rsp), %esi
leaq 0x18(%rsp), %rdi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x954a
movl %eax, %ebp
movl %ebp, %eax
addq $0x98, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/common/src/xbs_socket.cpp
// Function: beyondy::XbsGetLocalname(int, char*, unsigned long)
int XbsGetLocalname(int fd, char *nbuf, size_t size)
{
	struct sockaddr_storage addr_buf;
	int type = 0;
	socklen_t addr_len = sizeof(addr_buf);
	socklen_t tlen = sizeof(type);

	if (getsockname(fd, (struct sockaddr *)&addr_buf, &addr_len) < 0) return -1;
	if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &type, &tlen) < 0) return -1;

	return sockaddr2str((struct sockaddr *)&addr_buf, type, nbuf, size);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x98, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %r15d
movl $0x0, 0xc(%rsp)
leaq 0x14(%rsp), %rdx
movl $0x80, (%rdx)
movl $0x4, 0x10(%rsp)
leaq 0x18(%rsp), %rsi
callq 0x32f0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x796d
leaq 0xc(%rsp), %rcx
leaq 0x10(%rsp), %r8
movl %r15d, %edi
movl $0x1, %esi
movl $0x3, %edx
callq 0x3250
testl %eax, %eax
js 0x796d
movl 0xc(%rsp), %esi
leaq 0x18(%rsp), %rdi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x954a
movl %eax, %ebp
movl %ebp, %eax
addq $0x98, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/common/src/xbs_socket.cpp
// Function: beyondy::XbsServer(char const*, int, int, int)
int XbsServer(const char *address, int backlog, int flags, int reuse)
{
	struct sockaddr_storage addr_buf;
	socklen_t addr_len = sizeof(addr_buf);
	int type;
	int fd;

	if (str2sockaddr(address, &type, (struct sockaddr *)&addr_buf, &addr_len, 1) < 0) goto error_out;
	if ((fd = XbsSocket(addr_buf.ss_family, type, 0)) < 0) goto error_out;
	if (flags && XbsSetFlags(fd, flags, 0) < 0) goto error_close;
	if (XbsSetReuse(fd, reuse) < 0) goto error_close;
	if (bind(fd, (struct sockaddr *)&addr_buf, addr_len) < 0) goto error_close;
	if (type == SOCK_STREAM && listen(fd, backlog) < 0) goto error_close;
	return fd;
error_close:
	close(fd);
error_out:
	return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x90, %rsp
movl %ecx, %r15d
movl %edx, %r12d
movl %esi, %ebp
leaq 0x8(%rsp), %rcx
movl $0x80, (%rcx)
leaq 0x4(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movl $0x1, %r8d
callq 0x9314
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x7c3d
movzwl 0x10(%rsp), %edi
movl 0x4(%rsp), %esi
xorl %edx, %edx
callq 0x30b0
testl %eax, %eax
js 0x7c3d
movl %eax, %r14d
testl %r12d, %r12d
je 0x7bde
movl %r14d, %edi
movl $0x3, %esi
xorl %eax, %eax
callq 0x31d0
orl %eax, %r12d
movl %r14d, %edi
movl $0x4, %esi
movl %r12d, %edx
xorl %eax, %eax
callq 0x31d0
testl %eax, %eax
js 0x7c35
andl $0x1, %r15d
leaq 0xc(%rsp), %rcx
movl %r15d, (%rcx)
movl %r14d, %edi
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x35e0
testl %eax, %eax
js 0x7c35
movl 0x8(%rsp), %edx
leaq 0x10(%rsp), %rsi
movl %r14d, %edi
callq 0x3080
testl %eax, %eax
js 0x7c35
cmpl $0x1, 0x4(%rsp)
jne 0x7c30
movl %r14d, %edi
movl %ebp, %esi
callq 0x33c0
testl %eax, %eax
js 0x7c35
movl %r14d, %ebx
jmp 0x7c3d
movl %r14d, %edi
callq 0x3630
movl %ebx, %eax
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/common/src/xbs_socket.cpp
// Function: beyondy::XbsClient(char const*, int, long)
int XbsClient(const char *address, int flags, long timedout)
{
	struct sockaddr_storage addr_buf;
	socklen_t addr_len = sizeof(addr_buf);
	int type;
	int fd;

	if (str2sockaddr(address, &type, (struct sockaddr *)&addr_buf, &addr_len, 1) < 1) goto error_out;
	if ((fd = XbsSocket(addr_buf.ss_family, type, 0)) < 0) goto error_out;
	if (flags && XbsSetFlags(fd, flags, 0) < 0) goto error_close;
	if (XbsConnect(fd, (struct sockaddr *)&addr_buf, addr_len, timedout) < 0) goto error_close;
	return fd;
error_close:
	close(fd);
error_out:
	return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x88, %rsp
movq %rdx, %r14
movl %esi, %ebp
leaq 0x4(%rsp), %rcx
movl $0x80, (%rcx)
movq %rsp, %rsi
leaq 0x8(%rsp), %rdx
movl $0x1, %r8d
callq 0x9314
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %eax, %eax
jle 0x7ced
movzwl 0x8(%rsp), %edi
movl (%rsp), %esi
xorl %edx, %edx
callq 0x30b0
testl %eax, %eax
js 0x7ced
movl %eax, %r15d
testl %ebp, %ebp
je 0x7cc8
movl %r15d, %edi
movl $0x3, %esi
xorl %eax, %eax
callq 0x31d0
orl %eax, %ebp
movl %r15d, %edi
movl $0x4, %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x31d0
testl %eax, %eax
js 0x7ce5
movl 0x4(%rsp), %edx
leaq 0x8(%rsp), %rsi
movl %r15d, %edi
movq %r14, %rcx
callq 0x7747
testl %eax, %eax
js 0x7ce5
movl %r15d, %ebx
jmp 0x7ced
movl %r15d, %edi
callq 0x3630
movl %ebx, %eax
addq $0x88, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/common/src/rbtree.c
// Function: rb_insert_color
void rb_insert_color(struct rb_node *node, struct rb_root *root)
{
	struct rb_node *parent, *gparent;

	while ((parent = rb_parent(node)) && rb_is_red(parent))
	{
		gparent = rb_parent(parent);

		if (parent == gparent->rb_left)
		{
			{
				register struct rb_node *uncle = gparent->rb_right;
				if (uncle && rb_is_red(uncle))
				{
					rb_set_black(uncle);
					rb_set_black(parent);
					rb_set_red(gparent);
					node = gparent;
					continue;
				}
			}

			if (parent->rb_right == node)
			{
				register struct rb_node *tmp;
				__rb_rotate_left(parent, root);
				tmp = parent;
				parent = node;
				node = tmp;
			}

			rb_set_black(parent);
			rb_set_red(gparent);
			__rb_rotate_right(gparent, root);
		} else {
			{
				register struct rb_node *uncle = gparent->rb_left;
				if (uncle && rb_is_red(uncle))
				{
					rb_set_black(uncle);
					rb_set_black(parent);
					rb_set_red(gparent);
					node = gparent;
					continue;
				}
			}

			if (parent->rb_left == node)
			{
				register struct rb_node *tmp;
				__rb_rotate_right(parent, root);
				tmp = parent;
				parent = node;
				node = tmp;
			}

			rb_set_black(parent);
			rb_set_red(gparent);
			__rb_rotate_left(gparent, root);
		}
	}

	rb_set_black(root->rb_node);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rdi
andq $-0x4, %rdi
je 0x7de1
movq (%rdi), %r15
testb $0x1, %r15b
jne 0x7de1
andq $-0x4, %r15
movq 0x10(%r15), %rcx
cmpq %rdi, %rcx
je 0x7d86
movb $0x1, %al
testq %rcx, %rcx
je 0x7d57
movq (%rcx), %rdx
testb $0x1, %dl
jne 0x7d57
orq $0x1, %rdx
movq %rdx, (%rcx)
orb $0x1, (%rdi)
andb $-0x2, (%r15)
xorl %eax, %eax
movq %r15, %r14
testb %al, %al
je 0x7dd9
cmpq %r14, 0x10(%rdi)
jne 0x7d72
movq %rdi, %r12
movq %rbx, %rsi
callq 0x7e4e
movq %r14, %rdi
movq %r12, %r14
orb $0x1, (%rdi)
andb $-0x2, (%r15)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x7df4
jmp 0x7dd9
movq 0x8(%r15), %rcx
movb $0x1, %al
testq %rcx, %rcx
je 0x7dac
movq (%rcx), %rdx
testb $0x1, %dl
jne 0x7dac
orq $0x1, %rdx
movq %rdx, (%rcx)
orb $0x1, (%rdi)
andb $-0x2, (%r15)
xorl %eax, %eax
movq %r15, %r14
testb %al, %al
je 0x7dd9
cmpq %r14, 0x8(%rdi)
jne 0x7dc7
movq %rdi, %r12
movq %rbx, %rsi
callq 0x7df4
movq %r14, %rdi
movq %r12, %r14
orb $0x1, (%rdi)
andb $-0x2, (%r15)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x7e4e
movq (%r14), %rdi
jmp 0x7d11
movq (%rbx), %rax
orq $0x1, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/common/src/rbtree.c
// Function: _rb_rotate_left
static void __rb_rotate_left(struct rb_node *node, struct rb_root *root)
{
	struct rb_node *right = node->rb_right;
	struct rb_node *parent = rb_parent(node);

	if ((node->rb_right = right->rb_left))
		rb_set_parent(right->rb_left, node);
	right->rb_left = node;

	rb_set_parent(right, parent);

	if (parent)
	{
		if (node == parent->rb_left)
			parent->rb_left = right;
		else
			parent->rb_right = right;
	}
	else
		root->rb_node = right;
	rb_set_parent(node, right);
}

// Assembly:
movq (%rdi), %rcx
movq 0x8(%rdi), %rax
andq $-0x4, %rcx
movq 0x10(%rax), %rdx
movq %rdx, 0x8(%rdi)
testq %rdx, %rdx
je 0x7e19
movq (%rdx), %r8
andl $0x3, %r8d
orq %rdi, %r8
movq %r8, (%rdx)
movq %rdi, 0x10(%rax)
movq (%rax), %rdx
andl $0x3, %edx
orq %rcx, %rdx
movq %rdx, (%rax)
testq %rcx, %rcx
je 0x7e3e
leaq 0x10(%rcx), %rdx
leaq 0x8(%rcx), %rsi
cmpq %rdi, 0x10(%rcx)
cmoveq %rdx, %rsi
movq %rax, (%rsi)
movq (%rdi), %rcx
andl $0x3, %ecx
orq %rax, %rcx
movq %rcx, (%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/common/src/rbtree.c
// Function: _rb_rotate_right
static void __rb_rotate_right(struct rb_node *node, struct rb_root *root)
{
	struct rb_node *left = node->rb_left;
	struct rb_node *parent = rb_parent(node);

	if ((node->rb_left = left->rb_right))
		rb_set_parent(left->rb_right, node);
	left->rb_right = node;

	rb_set_parent(left, parent);

	if (parent)
	{
		if (node == parent->rb_right)
			parent->rb_right = left;
		else
			parent->rb_left = left;
	}
	else
		root->rb_node = left;
	rb_set_parent(node, left);
}

// Assembly:
movq (%rdi), %rcx
movq 0x10(%rdi), %rax
andq $-0x4, %rcx
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rdi)
testq %rdx, %rdx
je 0x7e73
movq (%rdx), %r8
andl $0x3, %r8d
orq %rdi, %r8
movq %r8, (%rdx)
movq %rdi, 0x8(%rax)
movq (%rax), %rdx
andl $0x3, %edx
orq %rcx, %rdx
movq %rdx, (%rax)
testq %rcx, %rcx
je 0x7e98
leaq 0x8(%rcx), %rdx
leaq 0x10(%rcx), %rsi
cmpq %rdi, 0x8(%rcx)
cmoveq %rdx, %rsi
movq %rax, (%rsi)
movq (%rdi), %rcx
andl $0x3, %ecx
orq %rax, %rcx
movq %rcx, (%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/common/src/rbtree.c
// Function: rb_replace_node
void rb_replace_node(struct rb_node *victim, struct rb_node *newn,
		     struct rb_root *root)
{
	struct rb_node *parent = rb_parent(victim);

	/* Set the surrounding nodes to point to the replacement */
	if (parent) {
		if (victim == parent->rb_left)
			parent->rb_left = newn;
		else
			parent->rb_right = newn;
	} else {
		root->rb_node = newn;
	}
	if (victim->rb_left)
		rb_set_parent(victim->rb_left, newn);
	if (victim->rb_right)
		rb_set_parent(victim->rb_right, newn);

	/* Copy the pointers/colour from the victim to the replacement */
	*newn = *victim;
}

// Assembly:
movq (%rdi), %rax
andq $-0x4, %rax
je 0x81b3
leaq 0x10(%rax), %rcx
leaq 0x8(%rax), %rdx
cmpq %rdi, 0x10(%rax)
cmoveq %rcx, %rdx
movq %rsi, (%rdx)
movq 0x10(%rdi), %rax
testq %rax, %rax
je 0x81cb
movq (%rax), %rcx
andl $0x3, %ecx
orq %rsi, %rcx
movq %rcx, (%rax)
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x81e0
movq (%rax), %rcx
andl $0x3, %ecx
orq %rsi, %rcx
movq %rcx, (%rax)
movq 0x10(%rdi), %rax
movq %rax, 0x10(%rsi)
movups (%rdi), %xmm0
movups %xmm0, (%rsi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/common/src/ConfigProperty.cpp
// Function: ConfigProperty::getInt(char const*, int) const
int ConfigProperty::getInt(const char *name, int def) const
{
	const char *val = getString(name, NULL);
	if (val == NULL || strlen(val) == 0) return def;

	char *eptr;
	int v = strtol(val, &eptr, 0);
	if (eptr == val) {
		// invalid number
		if (!strcasecmp(val, "true")  || !strcasecmp(val, "yes") || !strcasecmp(val, "t")  || !strcasecmp(val, "y"))
			return 1;
		if (!strcasecmp(val, "false") || !strcasecmp(val, "no") || !strcasecmp(val, "f") || !strcasecmp(val, "n"))
			return 0;
		return def;
	}

	if (*eptr == 'k' || *eptr == 'K') v *= 1024;
	else if (*eptr == 'm' || *eptr == 'M') v *= 1024 * 1024;
	else if (*eptr == 'g' || *eptr == 'G') v *= 1024 * 1024 * 1024;
	/* ignore others */

	return v;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
xorl %edx, %edx
callq 0x862a
testq %rax, %rax
je 0x885e
movq %rax, %r15
cmpb $0x0, (%rax)
je 0x885e
movq %rsp, %r12
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x34d0
movq %rax, %r14
movq (%r12), %rax
cmpq %r15, %rax
je 0x87a2
movzbl (%rax), %eax
addl $-0x47, %eax
cmpl $0x26, %eax
ja 0x885b
movabsq $0x100000001, %rcx      # imm = 0x100000001
btq %rax, %rcx
jb 0x8857
movabsq $0x1000000010, %rcx     # imm = 0x1000000010
btq %rax, %rcx
jb 0x8851
movabsq $0x4000000040, %rcx     # imm = 0x4000000040
btq %rax, %rcx
jae 0x885b
shll $0x14, %r14d
jmp 0x885b
leaq 0x2c9b(%rip), %rsi      # 0xb444
movq %r15, %rdi
callq 0x3380
movl $0x1, %r14d
testl %eax, %eax
je 0x885b
leaq 0x2c83(%rip), %rsi      # 0xb449
movq %r15, %rdi
callq 0x3380
testl %eax, %eax
je 0x885b
leaq 0x1f46(%rip), %rsi      # 0xa723
movq %r15, %rdi
callq 0x3380
testl %eax, %eax
je 0x885b
leaq 0x1bb6(%rip), %rsi      # 0xa3a6
movq %r15, %rdi
callq 0x3380
testl %eax, %eax
je 0x885b
leaq 0x2c4a(%rip), %rsi      # 0xb44d
movq %r15, %rdi
callq 0x3380
xorl %r14d, %r14d
testl %eax, %eax
je 0x885b
leaq 0x2c3a(%rip), %rsi      # 0xb453
movq %r15, %rdi
callq 0x3380
testl %eax, %eax
je 0x885b
leaq 0x18fd(%rip), %rsi      # 0xa129
movq %r15, %rdi
callq 0x3380
testl %eax, %eax
je 0x885b
leaq 0x1a8c(%rip), %rsi      # 0xa2cb
movq %r15, %rdi
callq 0x3380
testl %eax, %eax
cmovel %eax, %ebx
movl %ebx, %r14d
jmp 0x885b
shll $0xa, %r14d
jmp 0x885b
shll $0x1e, %r14d
movl %r14d, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/roberty65[P]bServer/common/src/xbs_naddr.cpp
// Function: beyondy::sockaddr2str(sockaddr const*, int, char*, unsigned long)
int sockaddr2str(const struct sockaddr *naddr, int type, char *address, size_t addrlen)
{
	if (naddr->sa_family == PF_UNIX || naddr->sa_family == PF_LOCAL) {
		return __unix_naddr2str((struct sockaddr_un *)naddr, type, address, addrlen);
	}
	else if (naddr->sa_family == PF_INET) {
		return __inet_naddr2str((struct sockaddr_in *)naddr, type, address, addrlen);
	}
	else if (naddr->sa_family == PF_INET6) {
		return __inet6_naddr2str((struct sockaddr_in6 *)naddr, type, address, addrlen);
	}

	errno = EAFNOSUPPORT;
	return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r15
movzwl (%rdi), %edi
cmpl $0xa, %edi
je 0x95cf
cmpl $0x2, %edi
je 0x95c9
cmpl $0x1, %edi
jne 0x9633
cmpl $0x1, %ebp
leaq 0x1edd(%rip), %rax      # 0xb45e
leaq 0x1edd(%rip), %rcx      # 0xb465
cmoveq %rax, %rcx
addq $0x2, %r15
leaq 0x1ed5(%rip), %rdx      # 0xb46c
xorl %ebp, %ebp
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %r8
xorl %eax, %eax
callq 0x3560
testl %eax, %eax
js 0x964c
cmpl %ebx, %eax
setge %al
testq %rbx, %rbx
setne %cl
testb %al, %cl
jne 0x9651
jmp 0x9657
leaq 0x4(%r15), %rsi
jmp 0x95d3
leaq 0x8(%r15), %rsi
movq %rsp, %r12
movq %r12, %rdx
movl $0x10, %ecx
callq 0x3370
cmpl $0x1, %ebp
leaq 0x1e71(%rip), %rax      # 0xb45e
leaq 0x1e71(%rip), %rcx      # 0xb465
cmoveq %rax, %rcx
movzwl 0x2(%r15), %eax
rolw $0x8, %ax
movzwl %ax, %r9d
leaq 0x1e66(%rip), %rdx      # 0xb472
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %r8
xorl %eax, %eax
callq 0x3560
testl %eax, %eax
js 0x9645
testq %rbx, %rbx
je 0x962f
cmpl %ebx, %eax
jl 0x962f
movb $0x0, -0x1(%r14,%rbx)
xorl %ebp, %ebp
jmp 0x9657
callq 0x3060
movl $0x61, (%rax)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x9657
testq %rbx, %rbx
jne 0x9629
jmp 0x962f
testq %rbx, %rbx
je 0x9657
movb $0x0, -0x1(%r14,%rbx)
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop