LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/roberty65[P]bServer/frame/main/EventManager.cpp
// Function: beyondy::Async::EventManager::deleteConnection(beyondy::Async::Connection*)
int EventManager::deleteConnection(Connection *connection)
{
	struct epoll_event ee;
	int retval;

	ee.events = 0;
	ee.data.ptr = (void *)(EventHandler *)connection;

	if (!(retval = epoll_ctl(epoll_fd, EPOLL_CTL_DEL, connection->fd, &ee))) {
		_list_del(&connection->lruEntry);

		SYSLOG_ERROR("delete connection fd=%d flow=%d", connection->fd, connection->flow);
	}
	else {
		SYSLOG_ERROR("delete connection fd=%d flow=%d failed: %m", connection->fd, connection->flow);
	}
	
	return retval;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
leaq 0xc(%rsp), %rcx
movl $0x0, (%rcx)
movq %rsi, 0x4(%rcx)
movl (%rdi), %edi
movl 0x8(%rsi), %edx
movl $0x2, %esi
callq 0x3490
movl %eax, %ebx
testl %eax, %eax
je 0x501c
leaq 0xb505(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x505d
movl 0x8(%r14), %ecx
movl 0x10(%r14), %r8d
leaq 0x5574(%rip), %rdx      # 0xa58e
jmp 0x5051
movq 0x18(%r14), %rax
movq 0x20(%r14), %rcx
movq %rcx, 0x8(%rax)
movq %rax, (%rcx)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%r14)
leaq 0xb4ce(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x505d
movl 0x8(%r14), %ecx
movl 0x10(%r14), %r8d
leaq 0x551d(%rip), %rdx      # 0xa56e
movl $0x2, %esi
xorl %eax, %eax
callq 0x71fc
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/roberty65[P]bServer/frame/main/EventManager.cpp
// Function: beyondy::Async::EventManager::__insert(int, rb_node*)
Connection *EventManager::__insert(int flow, struct rb_node *node)
{
	struct rb_node **p = &flowRoot.rb_node;
	struct rb_node *parent = NULL;
	struct Connection *connection;

	while (*p != NULL) {
		parent = *p;
		connection = rb_entry(parent, Connection, flowEntry);
		if (flow > connection->flow)
			p = &(*p)->rb_right;
		else if (flow < connection->flow)
			p = &(*p)->rb_left;
		else
			return connection;
	}

	rb_link_node(node, parent, p);
	return NULL;
}

// Assembly:
movq 0x48(%rdi), %rax
testq %rax, %rax
je 0x50bf
movq %rax, %rcx
addq $-0x38, %rax
movl $0x8, %edi
cmpl %esi, -0x28(%rcx)
jl 0x50b1
movl $0x10, %edi
jle 0x50d4
movq (%rcx,%rdi), %rax
testq %rax, %rax
jne 0x5099
addq %rcx, %rdi
jmp 0x50c5
addq $0x48, %rdi
xorl %ecx, %ecx
movq %rcx, (%rdx)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdx)
movq %rdx, (%rdi)
xorl %eax, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/roberty65[P]bServer/frame/main/EventManager.cpp
// Function: beyondy::Async::EventManager::unmapFlow(beyondy::Async::Connection*)
Connection *EventManager::flow2Connection(int flow)
{
	struct rb_node *n = flowRoot.rb_node;
	Connection *connection;

	while (n != NULL) {
		connection = rb_entry(n, Connection, flowEntry);
		if (flow < connection->flow)
			n = n->rb_left;
		else if (flow > connection->flow)
			n = n->rb_right;
		else
			return connection;
	}

	return NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x48(%rdi), %rax
testq %rax, %rax
je 0x510a
movq %rsi, %r14
movq %rdi, %rbx
movl 0x10(%rsi), %ecx
addq $0x48, %rbx
movl $0x10, %edx
cmpl %ecx, -0x28(%rax)
jg 0x5101
movl $0x8, %edx
jge 0x5129
movq (%rax,%rdx), %rax
testq %rax, %rax
jne 0x50f0
leaq 0x5514(%rip), %rdi      # 0xa625
leaq 0x54bf(%rip), %rsi      # 0xa5d7
leaq 0x5530(%rip), %rcx      # 0xa64f
movl $0xe6, %edx
callq 0x31f0
leaq 0xb3d8(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x5, (%rdi)
jl 0x514f
movl 0x8(%r14), %r8d
leaq 0x5546(%rip), %rdx      # 0xa689
movl $0x5, %esi
xorl %eax, %eax
callq 0x71fc
addq $0x38, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7d88
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/roberty65[P]bServer/frame/main/EventManager.cpp
// Function: beyondy::Async::EventManager::waitingEvents()
int EventManager::waitingEvents()
{
	BPROF_TRACE(BPT_EM_WAITING)
	// TODO: wtime = min(gap-to-next-timer, 10ms)
	long wtime = 10; /* 1s */

	event_next = event_total = 0;
	int cnt = epoll_wait(epoll_fd, epoll_events, epoll_size, wtime);
	if (cnt >= 0) event_total = cnt;

	return cnt;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq $0x0, 0x4(%rdi)
movq 0x10(%rdi), %rsi
movl (%rdi), %edi
movl 0xc(%rbx), %edx
movl $0xa, %ecx
callq 0x3160
testl %eax, %eax
js 0x518e
movl %eax, 0x8(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/roberty65[P]bServer/frame/main/EventManager.cpp
// Function: beyondy::Async::EventManager::handleEvent(int, beyondy::Async::EventHandler*, int)
void EventManager::handleEvent(int fd, EventHandler *handler, int event)
{
	BPROF_TRACE(BPT_EM_HEVENT)
	int retval = 0;

	if ((event & EVENT_OUT) && (retval = handler->onWritable(fd)) < 0) {
		SYSLOG_ERROR("fd=%d onWritable failed", handler->fd);
	}

	if (retval >= 0 && (event & EVENT_IN) && (retval = handler->onReadable(fd)) < 0) {
		SYSLOG_ERROR("fd=%d onReadable failed", handler->fd);
	}

	if (retval < 0 || (event & EVENT_ERR)) {
		SYSLOG_ERROR("fd=%d got retval=%d or ERR event=%d", fd, retval, event);
		retval = handler->onError(fd);
		// Note!!!
		// handler is not available now
	}

	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, %r14
movl %esi, %ebx
xorl %r15d, %r15d
testb $0x4, %bpl
je 0x51b9
movq (%r14), %rax
movq %r14, %rdi
movl %ebx, %esi
callq *0x18(%rax)
movl %eax, %r15d
testl %eax, %eax
js 0x51e2
testb $0x1, %bpl
je 0x51d1
movq (%r14), %rax
movq %r14, %rdi
movl %ebx, %esi
callq *0x10(%rax)
movl %eax, %r15d
testl %eax, %eax
js 0x51fe
testb $0x8, %bpl
jne 0x5224
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb31f(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x5224
movl 0x8(%r14), %ecx
leaq 0x54a0(%rip), %rdx      # 0xa69c
jmp 0x5218
leaq 0xb303(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x5224
movl 0x8(%r14), %ecx
leaq 0x549c(%rip), %rdx      # 0xa6b4
movl $0x2, %esi
xorl %eax, %eax
callq 0x71fc
leaq 0xb2dd(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x524e
leaq 0x5492(%rip), %rdx      # 0xa6cc
movl $0x2, %esi
movl %ebx, %ecx
movl %r15d, %r8d
movl %ebp, %r9d
xorl %eax, %eax
callq 0x71fc
movq (%r14), %rax
movq 0x20(%rax), %rax
movq %r14, %rdi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmpq *%rax
// File: /workspace/github_cpp_makefile_star2_O3/roberty65[P]bServer/frame/main/EventManager.cpp
// Function: beyondy::Async::EventManager::handleEvents()
void EventManager::handleEvents()
{
	BPROF_TRACE(BPT_EM_HEVENTS)

	for (event_next = 0; event_next < event_total; ++event_next) {
		struct epoll_event *ee = &epoll_events[event_next];
		EventHandler *handler = static_cast<EventHandler *>(ee->data.ptr);
		handleEvent(handler->fd, handler, ee->events);
	}

	return;
}

// Assembly:
movl $0x0, 0x4(%rdi)
cmpl $0x0, 0x8(%rdi)
jle 0x52a1
pushq %rbx
movq %rdi, %rbx
xorl %eax, %eax
movq 0x10(%rbx), %rcx
cltq
leaq (%rax,%rax,2), %rax
movq 0x4(%rcx,%rax,4), %rdx
movl 0x8(%rdx), %esi
movl (%rcx,%rax,4), %ecx
callq 0x5190
movl 0x4(%rbx), %eax
incl %eax
movl %eax, 0x4(%rbx)
cmpl 0x8(%rbx), %eax
jl 0x5279
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/roberty65[P]bServer/frame/main/EventManager.cpp
// Function: beyondy::Async::EventManager::dispatchOutMessage()
void EventManager::dispatchOutMessage()
{
	BPROF_TRACE(BPT_EM_DISPATCH)

	for (int i = 0; i < perCheckOutQueue; ++i) {
		Message *msg = outQueue->pop();
		if (msg == NULL)
			break;

		gettimeofday(&msg->ts_dequeue, NULL);
		int flow = msg->flow;

		Connection *connection = flow2Connection(flow);
		if (connection == NULL) {
			SYSLOG_ERROR("can not find connection for fd=%d flow=%d discard it", msg->fd, msg->flow);
			// TODO: how to call proc-onSent(msg, SS_SOCKET_NON_EXIST)
			Message::destroy(msg);
			continue;
		}
		
		int retval = connection->sendMessage(msg);
		if (retval != 0) {
			// msg has been freed
			SYSLOG_ERROR("sendMessage to fd=%d flow=%d failed", connection->fd, flow);
			continue;
		}
	}
}

// Assembly:
cmpl $0x0, 0x54(%rdi)
jle 0x538f
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xb247(%rip), %r15      # 0x10508
xorl %r14d, %r14d
movq 0x18(%rbx), %rdi
xorl %esi, %esi
callq 0x55a8
testq %rax, %rax
je 0x5381
movq %rax, %r12
movq %rax, %rdi
addq $0x50, %rdi
xorl %esi, %esi
callq 0x3570
movl 0x28(%r12), %ebp
movq 0x48(%rbx), %rax
testq %rax, %rax
je 0x5312
leaq -0x38(%rax), %r13
movl $0x10, %ecx
cmpl %ebp, -0x28(%rax)
jg 0x530c
movl $0x8, %ecx
jge 0x534c
movq (%rax,%rcx), %rax
jmp 0x52f2
movq (%r15), %rdi
cmpl $0x2, (%rdi)
jl 0x5335
movl 0x24(%r12), %ecx
movl $0x2, %esi
leaq 0x53c5(%rip), %rdx      # 0xa6f0
movl %ebp, %r8d
xorl %eax, %eax
callq 0x71fc
movq %r12, %rdi
callq 0x74ec
incl %r14d
cmpl 0x54(%rbx), %r14d
jl 0x52c4
jmp 0x5381
movq (%r13), %rax
movq %r13, %rdi
movq %r12, %rsi
callq *0x28(%rax)
testl %eax, %eax
je 0x533d
movq (%r15), %rdi
cmpl $0x2, (%rdi)
jl 0x533d
movl 0x8(%r13), %ecx
movl $0x2, %esi
leaq 0x53b0(%rip), %rdx      # 0xa725
movl %ebp, %r8d
xorl %eax, %eax
callq 0x71fc
jmp 0x533d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/roberty65[P]bServer/frame/main/EventManager.cpp
// Function: beyondy::Async::EventManager::checkTimeout()
void EventManager::checkTimeout()
{
	BPROF_TRACE(BPT_EM_CHKTIMEOUT)
	struct timeval tNow;
	struct list_head *pl, *pn;

	gettimeofday(&tNow, NULL);
	list_for_each_safe(pl, pn, &lruHead) {
		Connection *connection = list_entry(pl, Connection, lruEntry);
		if (TV2MS(connection->tsLastRead, tNow) > connectionMaxIdle) {
			SYSLOG_ERROR("connection fd=%d flow=%d timed out. close it now.", connection->fd, connection->flow);
			connection->onError(connection->fd);
			continue;
		}

		// the rest should be more active
		// so no need check this time.
		break;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x3570
leaq 0x20(%rbx), %r15
movq 0x20(%rbx), %r14
cmpq %r15, %r14
je 0x5448
movq 0x8(%rsp), %r12
movq 0x10(%rsp), %r13
movq %r12, %rcx
subq 0x10(%r14), %rcx
movq %r13, %rax
subq 0x18(%r14), %rax
imulq $0x3e8, %rcx, %rcx      # imm = 0x3E8
movabsq $0x20c49ba5e353f7cf, %rdx # imm = 0x20C49BA5E353F7CF
imulq %rdx
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x7, %rdx
addq %rax, %rdx
addq %rcx, %rdx
movslq 0x60(%rbx), %rax
cmpq %rax, %rdx
jle 0x5448
movq (%r14), %rbp
leaq 0xb0fa(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x5431
movl -0x10(%r14), %ecx
movl -0x8(%r14), %r8d
movl $0x2, %esi
leaq 0x531f(%rip), %rdx      # 0xa749
xorl %eax, %eax
callq 0x71fc
leaq -0x18(%r14), %rdi
movl -0x10(%r14), %esi
movq -0x18(%r14), %rax
callq *0x20(%rax)
movq %rbp, %r14
cmpq %r15, %rbp
jne 0x53c8
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/roberty65[P]bServer/frame/main/EventManager.cpp
// Function: beyondy::Async::EventManager::reconnectWhenNecessary()
void EventManager::reconnectWhenNecessary()
{
	struct timeval tNow;
	struct list_head *pl, *pn;

	gettimeofday(&tNow, NULL);
	list_for_each_safe(pl, pn, &connectorsHead) {
		Connector *connector = list_entry(pl, Connector, connectorsEntry);
		if (connector->getStatus() == Connector::CONN_CLOSE
				&& TV2MS(connector->tsLastClosed, tNow) > (connector->cntRetryConnect + 1) * reconnectDelay) {
			SYSLOG_ERROR("connector flow=%d is closed, re-connecting it", connector->flow);
			if (connector->open() < 0) {
				SYSLOG_WARN("re-connecting for low=%ld failed: %m", connector->flow);
				// retry next time but update tsLastClosed to avoid connect too often
			}

		}

		connector->checkMessageExpiration();
	}

	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x3570
leaq 0x30(%rbx), %r13
movq 0x30(%rbx), %r14
cmpq %r13, %r14
je 0x555a
movq 0x8(%rsp), %rax
movq %rax, (%rsp)
movq 0x10(%rsp), %r15
movq %r14, %rbp
movq (%r14), %r14
leaq -0x90(%rbp), %r12
cmpl $0x0, 0x24(%rbp)
jne 0x5549
movq (%rsp), %rcx
subq 0x10(%rbp), %rcx
movq %r15, %rax
subq 0x18(%rbp), %rax
movabsq $0x20c49ba5e353f7cf, %rdx # imm = 0x20C49BA5E353F7CF
imulq %rdx
imulq $0x3e8, %rcx, %rax      # imm = 0x3E8
movq %rdx, %rcx
shrq $0x3f, %rcx
sarq $0x7, %rdx
addq %rcx, %rdx
addq %rax, %rdx
movslq 0x20(%rbp), %rax
incq %rax
movslq 0x6c(%rbx), %rcx
imulq %rax, %rcx
cmpq %rcx, %rdx
jle 0x5549
leaq 0xb00e(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x5518
movl -0x80(%rbp), %ecx
movl $0x2, %esi
leaq 0x526a(%rip), %rdx      # 0xa77b
xorl %eax, %eax
callq 0x71fc
movq %r12, %rdi
callq 0x6958
testl %eax, %eax
jns 0x5549
leaq 0xafdd(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x3, (%rdi)
jl 0x5549
movl -0x80(%rbp), %ecx
movl $0x3, %esi
leaq 0x5267(%rip), %rdx      # 0xa7a9
xorl %eax, %eax
callq 0x71fc
movq %r12, %rdi
callq 0x65dc
cmpq %r13, %r14
jne 0x5494
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/roberty65[P]bServer/frame/main/./Queue.h
// Function: beyondy::Async::Queue<beyondy::Async::Message>::pop(long)
T* Queue<T>::pop(long ms) 
{
	pthread_mutex_lock(&lock);
	if (queue.empty() && ms > 0) {
		// TODO:		
		pthread_cond_wait(&cond, &lock);
	}

	T *obj = NULL;
	if (!queue.empty()) {
		obj = queue.front();
		queue.pop();
	}
	
	pthread_mutex_unlock(&lock);
	return obj;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq 0x3510
movq 0x70(%rbx), %rax
movq 0x90(%rbx), %rcx
cmpq %rax, %rcx
setne %dl
testq %r14, %r14
setle %sil
orb %dl, %sil
jne 0x55eb
leaq 0x28(%rbx), %rdi
movq %rbx, %rsi
callq 0x3540
movq 0x70(%rbx), %rax
movq 0x90(%rbx), %rcx
cmpq %rax, %rcx
je 0x55fe
leaq 0x60(%rbx), %rdi
movq (%rax), %r14
callq 0x5614
jmp 0x5601
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x3260
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/roberty65[P]bServer/frame/main/MtWorker.cpp
// Function: beyondy::Async::MtWorker::workerEntry()
void MtWorker::workerEntry()
{
	int no = workerId();
	SYSLOG_DEBUG("thread-%d (TID=%lu) start...", no, (unsigned long)pthread_self());

	while (isRunning) {
		Message *msg = inQueue->pop(10);
		if (msg == NULL) {
			// TODO: idle
			continue;
		}

		gettimeofday(&msg->ts_dequeue, NULL);
		proc->onMessage(msg);
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0xae3a(%rip), %rax      # 0x10508
movq (%rax), %r14
cmpl $0x5, (%r14)
jl 0x5733
movq %rbx, %rdi
callq 0x573e
movl %eax, %ebp
callq 0x32d0
leaq 0x50e1(%rip), %rdx      # 0xa7ce
movq %r14, %rdi
movl $0x5, %esi
movl %ebp, %ecx
movq %rax, %r8
xorl %eax, %eax
callq 0x71fc
jmp 0x5733
movq (%rbx), %rdi
movl $0xa, %esi
callq 0x55a8
testq %rax, %rax
je 0x5733
movq %rax, %r14
movq %rax, %rdi
addq $0x50, %rdi
xorl %esi, %esi
callq 0x3570
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x30(%rax)
cmpl $0x0, 0x10(%rbx)
jne 0x5703
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x5782
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 0x577f
incq %r12
cmpq %r12, %r15
jne 0x5764
jmp 0x5782
movl %r12d, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/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:
movl $0x1, 0x10(%rdi)
cmpl $0x0, 0x14(%rdi)
jle 0x57df
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
xorl %r15d, %r15d
leaq -0xfa(%rip), %r14       # 0x56b6
xorl %r12d, %r12d
movq 0x18(%rbx), %rdi
addq %r15, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x3600
testl %eax, %eax
jne 0x57e2
incq %r12
movslq 0x14(%rbx), %rax
addq $0x8, %r15
cmpq %rax, %r12
jl 0x57b3
xorl %eax, %eax
jmp 0x57f0
xorl %eax, %eax
retq
movl %eax, %ebp
callq 0x3060
movl %ebp, (%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x5833
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 0x5811
addq $0x8, %rsp
popq %rbx
popq %r14
xorl %eax, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x589a
testl %eax, %eax
jns 0x5892
leaq 0xaca2(%rip), %rax      # 0x10508
movq (%rax), %rdi
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x2, (%rdi)
jl 0x5892
movl 0x24(%r14), %ecx
movl 0x28(%r14), %r8d
movq 0x10(%r14), %r9
leaq 0x4f65(%rip), %rdx      # 0xa7eb
movl $0x2, %esi
xorl %eax, %eax
callq 0x71fc
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, 0x8(%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 0x5935
movq 0xa0(%rbx), %rcx
addq $-0x8, %rcx
cmpq %rcx, %rax
je 0x5925
movq %r14, (%rax)
addq $0x8, 0x90(%rbx)
jmp 0x5933
leaq 0x60(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x5952
xorl %ebp, %ebp
leaq 0x28(%rbx), %rdi
callq 0x3030
movq %rbx, %rdi
callq 0x3260
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0xa105(%rip), %rax      # 0xfc88
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 0x488e
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_O3/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 %r14
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x6083
movq %rsi, %rbx
movq %rdi, %r14
movl 0x8(%rdi), %edi
movq 0x50(%r14), %rax
movq (%rax), %rsi
addq 0x10(%rax), %rsi
movq %rbx, %rdx
callq 0x34f0
movq 0x50(%r14), %rcx
incl 0x2c(%rcx)
cmpq %rbx, %rax
jne 0x6001
addq %rbx, 0x10(%rcx)
jmp 0x600d
testq %rax, %rax
jle 0x6018
addq %rax, 0x10(%rcx)
movq %rax, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0xa4e9(%rip), %rax      # 0x10508
movq (%rax), %rdi
movl (%rdi), %eax
je 0x604f
movq $-0x1, %rbx
cmpl $0x2, %eax
jl 0x600d
movl 0x8(%r14), %ecx
movl 0x10(%r14), %r8d
leaq 0x4e10(%rip), %rdx      # 0xae51
movl $0x2, %esi
xorl %eax, %eax
callq 0x71fc
jmp 0x600d
cmpl $0x2, %eax
jl 0x606f
movl 0x8(%r14), %ecx
movl 0x10(%r14), %r8d
leaq 0x4dbd(%rip), %rdx      # 0xae20
movl $0x2, %esi
xorl %eax, %eax
callq 0x71fc
callq 0x3060
movl $0x0, (%rax)
movq $-0x1, %rbx
jmp 0x600d
leaq 0x4d5b(%rip), %rdi      # 0xade5
leaq 0x47d6(%rip), %rsi      # 0xa867
leaq 0x4d56(%rip), %rcx      # 0xadee
movl $0x111, %edx            # imm = 0x111
callq 0x31f0
// File: /workspace/github_cpp_makefile_star2_O3/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 %rbx
testq %rdx, %rdx
je 0x62fd
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movl 0x8(%rdi), %edi
movq (%rsi), %rsi
addq 0x8(%r15), %rsi
callq 0x30f0
incl 0x2c(%r15)
cmpq %rbx, %rax
jne 0x62b5
addq %rbx, 0x8(%r15)
jmp 0x62f4
testq %rax, %rax
jle 0x62c3
addq %rax, 0x8(%r15)
movq %rax, %rbx
jmp 0x62f4
leaq 0xa23e(%rip), %rax      # 0x10508
movq (%rax), %rdi
movq $-0x1, %rbx
cmpl $0x2, (%rdi)
jl 0x62f4
movl 0x8(%r14), %ecx
movl 0x10(%r14), %r8d
leaq 0x4bcf(%rip), %rdx      # 0xaeb7
movl $0x2, %esi
xorl %eax, %eax
callq 0x71fc
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x4ae1(%rip), %rdi      # 0xade5
leaq 0x455c(%rip), %rsi      # 0xa867
leaq 0x4b67(%rip), %rcx      # 0xae79
movl $0x12c, %edx            # imm = 0x12C
callq 0x31f0
// File: /workspace/github_cpp_makefile_star2_O3/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 0x6357
movq %rdi, %rbx
leaq 0xa1dc(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x5, (%rdi)
jl 0x634d
movl %esi, %ecx
movl 0x10(%rbx), %r8d
leaq 0x4927(%rip), %rdx      # 0xac68
movl $0x5, %esi
xorl %eax, %eax
callq 0x71fc
movq (%rbx), %rax
movq %rbx, %rdi
popq %rbx
jmpq *0x30(%rax)
leaq 0x44fa(%rip), %rdi      # 0xa858
leaq 0x4502(%rip), %rsi      # 0xa867
leaq 0x48c7(%rip), %rcx      # 0xac33
movl $0xaa, %edx
callq 0x31f0
// File: /workspace/github_cpp_makefile_star2_O3/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), %rdi
xorl %esi, %esi
callq 0x3570
movq 0x68(%rbx), %rdi
movq 0x10(%rdi), %rax
cmpq %rax, 0x30(%rdi)
je 0x66b5
movq 0x8(%rsp), %r12
movq 0x10(%rsp), %r13
movabsq $0x20c49ba5e353f7cf, %rbp # imm = 0x20C49BA5E353F7CF
leaq 0x9ee2(%rip), %r14      # 0x10508
movq (%rax), %r15
movq %r12, %rax
subq 0x40(%r15), %rax
imulq $0x3e8, %rax, %rcx      # imm = 0x3E8
movq %r13, %rax
subq 0x48(%r15), %rax
imulq %rbp
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x7, %rdx
addq %rax, %rdx
addq %rcx, %rdx
movq 0x70(%rbx), %rax
movslq 0x5c(%rax), %rax
cmpq %rax, %rdx
jl 0x66b5
movq (%r14), %rax
cmpl $0x2, (%rax)
jl 0x668c
movl 0x8(%rbx), %ecx
movl 0x10(%rbx), %r8d
movq 0x10(%r15), %r9
movq %rax, %rdi
movl $0x2, %esi
leaq 0x472c(%rip), %rdx      # 0xadad
xorl %eax, %eax
callq 0x71fc
movq 0x68(%rbx), %rdi
callq 0x5614
movq 0x78(%rbx), %rdi
movq (%rdi), %rax
movq %r15, %rsi
movl $0x1, %edx
callq *0x38(%rax)
movq 0x68(%rbx), %rdi
movq 0x10(%rdi), %rax
cmpq %rax, 0x30(%rdi)
jne 0x6626
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x66e1
callq 0x74ec
movq $0x0, 0x50(%rbx)
movq 0x60(%rbx), %rsi
testq %rsi, %rsi
je 0x6722
movq 0x78(%rbx), %rdi
movq (%rdi), %rax
movl $0x5, %edx
callq *0x38(%rax)
movq $0x0, 0x60(%rbx)
jmp 0x6722
movq (%rax), %rax
movq %rax, 0x60(%rbx)
callq 0x5614
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 0x6703
cmpl $0x0, 0x80(%rbx)
jne 0x6759
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 0x70fc
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x9d1b(%rip), %r15      # 0x10508
movq (%r15), %rdi
cmpl $0x5, (%rdi)
jl 0x680f
leaq 0xb8(%rbx), %rcx
leaq 0x4719(%rip), %rdx      # 0xaf1c
movl $0x5, %esi
xorl %eax, %eax
callq 0x71fc
cmpl %ebp, 0x8(%rbx)
jne 0x6939
movl 0xb4(%rbx), %eax
cmpl $0x1, %eax
je 0x683c
cmpl $0x2, %eax
jne 0x6870
movq %rbx, %rdi
movl %ebp, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x60a2
movl %ebp, %edi
callq 0x76d4
testl %eax, %eax
je 0x68a9
movl %eax, %r14d
callq 0x3060
movl %r14d, (%rax)
movq (%r15), %rdi
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpl $0x2, (%rdi)
jl 0x689b
addq $0xb8, %rbx
leaq 0x470f(%rip), %rdx      # 0xaf7d
jmp 0x688c
movq (%r15), %rdi
xorl %r14d, %r14d
cmpl $0x2, (%rdi)
jl 0x689b
addq $0xb8, %rbx
leaq 0x476d(%rip), %rdx      # 0xaff6
xorl %r14d, %r14d
movl $0x2, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x71fc
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 0x4f38
movq (%r15), %rdi
movl (%rdi), %ecx
testl %eax, %eax
js 0x6905
cmpl $0x2, %ecx
jl 0x6828
leaq 0xb8(%rbx), %rcx
movl 0x10(%rbx), %r9d
leaq 0x46d9(%rip), %rdx      # 0xafca
movl $0x2, %esi
movl %ebp, %r8d
xorl %eax, %eax
callq 0x71fc
jmp 0x6828
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpl $0x2, %ecx
jl 0x689b
movl 0x10(%rbx), %r9d
addq $0xb8, %rbx
leaq 0x4674(%rip), %rdx      # 0xaf96
movl $0x2, %esi
movq %rbx, %rcx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x71fc
jmp 0x689b
leaq 0x3f18(%rip), %rdi      # 0xa858
leaq 0x45f1(%rip), %rsi      # 0xaf38
leaq 0x45f8(%rip), %rcx      # 0xaf46
movl $0x21, %edx
callq 0x31f0
// File: /workspace/github_cpp_makefile_star2_O3/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 0x7b3f
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 0x69b3
callq 0x3060
cmpl $0x73, (%rax)
jne 0x69bd
movl $0x1, %eax
movl $0x4, %edx
jmp 0x69d2
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x6a60
movl $0x0, 0xb0(%r14)
movl $0x2, %eax
movl $0x1, %edx
movl %edx, 0xc(%r14)
movl %eax, 0xb4(%r14)
leaq 0x9b24(%rip), %r15      # 0x10508
movq (%r15), %rdi
cmpl $0x5, (%rdi)
jl 0x6a10
movl 0x10(%r14), %r9d
movl %eax, (%rsp)
leaq 0x4628(%rip), %rdx      # 0xb022
movl $0x5, %esi
movq %rbx, %rcx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x71fc
movl 0xc(%r14), %edx
movq 0x70(%r14), %rdi
movq %r14, %rsi
callq 0x4e9e
movl %eax, %ebp
xorl %eax, %eax
testl %ebp, %ebp
jns 0x6a60
movl 0x8(%r14), %edi
callq 0x3630
movl $0xffffffff, 0x8(%r14)  # imm = 0xFFFFFFFF
movl $0x0, 0xb4(%r14)
movq (%r15), %rdi
cmpl $0x2, (%rdi)
jl 0x6a5e
leaq 0x4603(%rip), %rdx      # 0xb052
movl $0x2, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x71fc
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x9a8e(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x6ae2
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 0x45a6(%rip), %rdx      # 0xb07c
movl $0x2, %esi
xorl %eax, %eax
callq 0x71fc
movq 0x50(%rbx), %rdi
testq %rdi, %rdi
je 0x6af8
callq 0x74ec
movq $0x0, 0x50(%rbx)
movq 0x60(%rbx), %rax
testq %rax, %rax
je 0x6b35
leaq 0x60(%rbx), %r14
movq $0x0, 0x8(%rax)
movq 0x68(%rbx), %rdi
movq 0x10(%rdi), %rcx
cmpq 0x18(%rdi), %rcx
je 0x6b26
movq %rax, -0x8(%rcx)
addq $-0x8, 0x10(%rdi)
jmp 0x6b2e
movq %r14, %rsi
callq 0x6d60
movq $0x0, (%r14)
movq 0x70(%rbx), %rdi
movq %rbx, %rsi
callq 0x4fce
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_O3/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 0x6ffe
movl %esi, %r14d
movq %rdi, %rbx
movl %esi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x30e0
testl %eax, %eax
js 0x6f53
movl %eax, %ebp
movq %rsp, %rsi
movl $0x80, %edx
movl %eax, %edi
callq 0x7759
movl %ebp, %edi
testl %eax, %eax
js 0x6f82
movl $0x800, %esi            # imm = 0x800
xorl %edx, %edx
callq 0x786d
movl 0x90(%rbx), %eax
cmpl 0x94(%rbx), %eax
jge 0x6fb5
leaq 0x95ef(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x5, (%rdi)
jl 0x6f3e
leaq 0x10(%rbx), %rcx
leaq 0x43b4(%rip), %rdx      # 0xb2e0
movq %rsp, %r9
movl $0x5, %esi
movl %ebp, %r8d
xorl %eax, %eax
callq 0x71fc
movq %rbx, %rdi
movl %ebp, %esi
callq 0x701e
incl 0x90(%rbx)
jmp 0x6ff0
leaq 0x95ae(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x3, (%rdi)
jl 0x6ff0
addq $0x10, %rbx
leaq 0x42d9(%rip), %rdx      # 0xb24a
movl $0x3, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x71fc
jmp 0x6ff0
callq 0x3630
leaq 0x957a(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x6ff0
addq $0x10, %rbx
leaq 0x42c8(%rip), %rdx      # 0xb269
movl $0x2, %esi
movq %rbx, %rcx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x71fc
jmp 0x6ff0
movl %r14d, %edi
callq 0x3630
leaq 0x9544(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x6ff0
movl 0x90(%rbx), %r9d
addq $0x10, %rbx
leaq 0x42c5(%rip), %rdx      # 0xb2a3
movq %rsp, %r8
movl $0x2, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x71fc
xorl %eax, %eax
addq $0x80, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x3853(%rip), %rdi      # 0xa858
leaq 0x41fb(%rip), %rsi      # 0xb207
leaq 0x4201(%rip), %rcx      # 0xb214
movl $0x1f, %edx
callq 0x31f0
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x4dce
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 0x5b68
addq $0x10, %rsp
movq 0x98(%r14), %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x4dd8
movq 0x98(%r14), %rdi
movq %rbx, %rsi
movl $0x1, %edx
callq 0x4e9e
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_O3/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 0x93fb(%rip), %rax      # 0x10508
movq (%rax), %rdi
cmpl $0x4, (%rdi)
jl 0x7134
leaq 0x10(%r14), %rcx
movl 0x8(%rbx), %r8d
movl 0x10(%rbx), %r9d
leaq 0x4253(%rip), %rdx      # 0xb37b
movl $0x4, %esi
xorl %eax, %eax
callq 0x71fc
movq 0x98(%r14), %rdi
movq %rbx, %rsi
callq 0x50d6
movq 0x98(%r14), %rdi
movq %rbx, %rsi
callq 0x4fce
movl 0x8(%rbx), %edi
callq 0x3630
decl 0x90(%r14)
movq (%rbx), %rax
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmpq *0x8(%rax)
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x7a42
movl %eax, 0x8(%r14)
xorl %ebp, %ebp
testl %eax, %eax
jns 0x71c8
leaq 0x9363(%rip), %rax      # 0x10508
movq (%rax), %rdi
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x2, (%rdi)
jl 0x71c8
leaq 0x41f4(%rip), %rdx      # 0xb3ad
movl $0x2, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x71fc
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x7669
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 0x765b
callq 0x3060
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpl $0x73, (%rax)
jne 0x765b
movq %rax, %rbx
movl %ebp, %edi
movq %r15, %rsi
callq 0x95d0
testl %eax, %eax
js 0x765b
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 0x76be
movl (%rsp), %ecx
testl %ecx, %ecx
je 0x76cc
movl %ecx, (%rbx)
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x765b
movl $0x0, (%rbx)
jmp 0x7658
// File: /workspace/github_cpp_makefile_star2_O3/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 0x77d3
leaq 0xc(%rsp), %rcx
leaq 0x10(%rsp), %r8
movl %r15d, %edi
movl $0x1, %esi
movl $0x3, %edx
callq 0x3250
testl %eax, %eax
js 0x77d3
movl 0xc(%rsp), %esi
leaq 0x18(%rsp), %rdi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x9443
movl %eax, %ebp
movl %ebp, %eax
addq $0x98, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x785d
leaq 0xc(%rsp), %rcx
leaq 0x10(%rsp), %r8
movl %r15d, %edi
movl $0x1, %esi
movl $0x3, %edx
callq 0x3250
testl %eax, %eax
js 0x785d
movl 0xc(%rsp), %esi
leaq 0x18(%rsp), %rdi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x9443
movl %eax, %ebp
movl %ebp, %eax
addq $0x98, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x9210
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x7b2d
movzwl 0x10(%rsp), %edi
movl 0x4(%rsp), %esi
xorl %edx, %edx
callq 0x30b0
testl %eax, %eax
js 0x7b2d
movl %eax, %r14d
testl %r12d, %r12d
je 0x7ace
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 0x7b25
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 0x7b25
movl 0x8(%rsp), %edx
leaq 0x10(%rsp), %rsi
movl %r14d, %edi
callq 0x3080
testl %eax, %eax
js 0x7b25
cmpl $0x1, 0x4(%rsp)
jne 0x7b20
movl %r14d, %edi
movl %ebp, %esi
callq 0x33c0
testl %eax, %eax
js 0x7b25
movl %r14d, %ebx
jmp 0x7b2d
movl %r14d, %edi
callq 0x3630
movl %ebx, %eax
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq