LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/sotrteacher[P]1MM1INTRO/20190925_1MM1_INTRO/EvalContinua.c
// Function: save_reactivos_asignados(unsigned int)
void save_reactivos_asignados(unsigned int reactivo_index)
{
  int i;
  char str[10];
  string strturno;
  printf("Guardando los indices de %u reactivos ya asignados.\n",cantidad_de_reactivos_usados);
  if(modificado){
    //ofstream out(File_Name1.c_str());
    ofstream out(File_Name1);
    if(out){
        out<<cantidad_de_reactivos_usados<<endl;
        out<<reactivos_usados[0];
        for(i=1;i<cantidad_de_reactivos_usados;i++){
          sprintf(str,",%d",reactivos_usados[i]);
          strturno=string(str);
          out<<strturno;
        }
      out.close();
    }
  } 
  modificado=false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x258, %rsp            # imm = 0x258
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x434b(%rip), %rax      # 0x6950
movl (%rax), %esi
leaq 0xa4e(%rip), %rdi       # 0x305c
xorl %eax, %eax
callq 0x2030
leaq 0x4344(%rip), %rbx      # 0x6960
cmpb $0x1, (%rbx)
jne 0x2721
leaq 0x433c(%rip), %rax      # 0x6968
movq (%rax), %rsi
leaq -0x280(%rbp), %rdi
pushq $0x10
popq %rdx
callq 0x2150
movq -0x280(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x260(%rbp,%rax)
jne 0x2715
leaq 0x42f2(%rip), %rax      # 0x6950
movl (%rax), %esi
leaq -0x280(%rbp), %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20b0
leaq 0x42dd(%rip), %rax      # 0x6958
movq (%rax), %rax
movl (%rax), %esi
leaq -0x280(%rbp), %rdi
callq 0x20d0
pushq $0x1
popq %r12
leaq -0x5a(%rbp), %r14
leaq -0x80(%rbp), %r15
leaq -0x50(%rbp), %r13
leaq -0x280(%rbp), %rbx
leaq 0x42a6(%rip), %rax      # 0x6950
movl (%rax), %eax
cmpq %rax, %r12
jae 0x2702
leaq 0x42a0(%rip), %rax      # 0x6958
movq (%rax), %rax
movl (%rax,%r12,4), %edx
movq %r14, %rdi
leaq 0x9c8(%rip), %rsi       # 0x3091
xorl %eax, %eax
callq 0x2040
movq %r15, %rdi
movq %r14, %rsi
leaq -0x29(%rbp), %rdx
callq 0x2768
movq %r13, %rdi
movq %r15, %rsi
callq 0x2180
movq %r15, %rdi
callq 0x20a0
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2110
incq %r12
jmp 0x26a3
leaq -0x280(%rbp), %rdi
callq 0x21a0
leaq 0x424b(%rip), %rbx      # 0x6960
leaq -0x280(%rbp), %rdi
callq 0x21c0
movb $0x0, (%rbx)
leaq -0x50(%rbp), %rdi
callq 0x20a0
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x2757
jmp 0x2748
jmp 0x2748
movq %rax, %rbx
leaq -0x280(%rbp), %rdi
callq 0x21c0
leaq -0x50(%rbp), %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x2220
// File: /workspace/github_cpp_makefile_star2_O2/sotrteacher[P]1MM1INTRO/20190925_1MM1_INTRO/test_EvalContinua.c
// Function: main
int main(int argc,char *argv[])
{
  unsigned int indice_de_reactivo,reactivo_index,ret;
  if(argc<2){
    printf("FORMA DE USO:%s <file_index_reactivos_intro>\n",
            argv[0]);
    exit(1);
  }
void run_ctor(char *);
  run_ctor(argv[1]);
unsigned int init_REACTIVO();
   if((ret=init_REACTIVO())==NUMDREAC){
unsigned int siguiente_turno();
     if((reactivo_index=siguiente_turno())>0){
#ifndef NDEBUG
       printf("reactivo_index=%u\n",reactivo_index);
#endif
       indice_de_reactivo=reactivo_index-1;
int show_reactivo(unsigned int);
       show_reactivo(indice_de_reactivo);
void save_reactivos_asignados(unsigned int);
       if(modificado){
         save_reactivos_asignados(reactivo_index);
       }
     }else{ 
       printf("Reactivos YA asignados ...\n");
       return 0;
     }
   }else{
#ifndef NDEBUG
     printf("ret=%u\n",ret);
#endif
     return -1;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
cmpl $0x1, %edi
jle 0x28aa
movq 0x8(%rsi), %rdi
callq 0x28c4
callq 0x2a74
cmpl $0x3, %eax
jne 0x2890
callq 0x2417
testl %eax, %eax
je 0x2895
movl %eax, %r14d
leal -0x1(%r14), %edi
callq 0x23bc
leaq 0x40e1(%rip), %rax      # 0x6960
xorl %ebx, %ebx
cmpb $0x1, (%rax)
jne 0x28a3
movl %r14d, %edi
callq 0x25da
jmp 0x28a3
pushq $-0x1
popq %rbx
jmp 0x28a3
leaq 0x885(%rip), %rdi       # 0x3121
callq 0x21e0
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
movq (%rsi), %rsi
leaq 0x83f(%rip), %rdi       # 0x30f3
xorl %eax, %eax
callq 0x2030
pushq $0x1
popq %rdi
callq 0x2170
nop
// File: /workspace/github_cpp_makefile_star2_O2/sotrteacher[P]1MM1INTRO/20190925_1MM1_INTRO/ctors.c
// Function: init_REACTIVO()
unsigned int init_REACTIVO()
{
  unsigned int i,j=0;
  FILE *fent;
  int car,res=0;
  char nombre_de_archivo[1024];
  
  for(i=0;i<NUMDREAC;i++){
    sprintf(nombre_de_archivo,"./reactivos/reactivo%d.txt",i+1);
#ifndef NDEBUG
    printf("Abriendo %s\n",nombre_de_archivo);
#endif
    /**Apertura del i-esimo archivo de entrada*/
    fent=fopen(nombre_de_archivo,"r");
    if(fent==NULL){
      fprintf(stderr,"Error abriendo %s\n",nombre_de_archivo);
      return i;
    }
    while((car=fgetc(fent))!=EOF){
      REACTIVO[i][j++]=car;
    }
    j=0;
    /**Cierre del i-esimo archivo*/ 
    fclose(fent);
#ifndef NDEBUG
    printf("%s\n",REACTIVO[i]);
#endif
  }/*end for()*/
  return i;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
leaq 0x26c1(%rip), %r12      # 0x5150
xorl %r13d, %r13d
cmpq $0x3, %r13
je 0x2afe
leaq 0x1(%r13), %r14
leaq -0x430(%rbp), %rbx
movq %rbx, %rdi
leaq 0x691(%rip), %rsi       # 0x313e
movl %r14d, %edx
xorl %eax, %eax
callq 0x2040
movq %rbx, %rdi
leaq 0x698(%rip), %rsi       # 0x3159
callq 0x2160
testq %rax, %rax
je 0x2b13
movq %rax, %rbx
xorl %r15d, %r15d
shlq $0xb, %r13
movq %rbx, %rdi
callq 0x2210
cmpl $-0x1, %eax
je 0x2af1
movl %r15d, %ecx
incl %r15d
leaq (%r12,%r13), %rdx
movb %al, (%rcx,%rdx)
jmp 0x2ad5
movq %rbx, %rdi
callq 0x2140
movq %r14, %r13
jmp 0x2a92
pushq $0x3
popq %rax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x24be(%rip), %rax      # 0x4fd8
movq (%rax), %rdi
leaq 0x637(%rip), %rsi       # 0x315b
leaq -0x430(%rbp), %rdx
xorl %eax, %eax
callq 0x21b0
movl %r13d, %eax
jmp 0x2b01
// File: /workspace/github_cpp_makefile_star2_O2/roberty65[P]bServer/serverd/src/main.cpp
// Function: loadProcessor(char const*)
Processor *loadProcessor(const char *lib)
{
	void *dh = dlopen(lib, RTLD_NOW);
	if (dh == NULL) {
		SYSLOG_ERROR("can not load plugin %s, error: %s", lib, dlerror());
		return NULL;
	}

	Processor *(*creator)();
	if ((creator = (Processor *(*)())dlsym(dh, "createProcessor")) == NULL) {
		SYSLOG_ERROR("plugin %s has no createProcessor defined: %s", lib, dlerror());
		dlclose(dh);
		return NULL;
	}
	
	Processor *processor = (*creator)();
	if (processor == NULL) {
		SYSLOG_ERROR("plugin %s createProcessor failed: %m", lib);
		dlclose(dh);
		return NULL;
	}

	return processor;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
pushq $0x2
popq %rsi
callq 0x34d0
testq %rax, %rax
je 0x3884
movq %rax, %r14
leaq 0x67e2(%rip), %rsi      # 0xa026
movq %rax, %rdi
callq 0x3310
testq %rax, %rax
je 0x38b8
callq *%rax
movq %rax, %r15
testq %rax, %rax
jne 0x38f2
leaq 0xccc2(%rip), %rax      # 0x10528
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x38e7
leaq 0x67ee(%rip), %rdx      # 0xa063
pushq $0x2
popq %rsi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x6d1a
jmp 0x38e7
leaq 0xcc9d(%rip), %rax      # 0x10528
movq (%rax), %r14
cmpl $0x2, (%r14)
jl 0x38ef
callq 0x3320
leaq 0x6764(%rip), %rdx      # 0xa004
xorl %r15d, %r15d
pushq $0x2
popq %rsi
movq %r14, %rdi
movq %rbx, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x6d1a
jmp 0x38f2
leaq 0xcc69(%rip), %rax      # 0x10528
movq (%rax), %r15
cmpl $0x2, (%r15)
jl 0x38e7
callq 0x3320
leaq 0x6762(%rip), %rdx      # 0xa036
pushq $0x2
popq %rsi
movq %r15, %rdi
movq %rbx, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x6d1a
movq %r14, %rdi
callq 0x32a0
xorl %r15d, %r15d
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/roberty65[P]bServer/frame/main/EventManager.cpp
// Function: beyondy::Async::EventManager::addListener(char const*, beyondy::Async::Queue<beyondy::Async::Message>*, beyondy::Async::Processor*, int)
int EventManager::addListener(const char *address, Queue<Message> *inQueue, Processor *processor, int maxActive)
{
	Listener *listener = new Listener(address, maxActive, this, inQueue, processor);
	if (listener == NULL) {
		SYSLOG_ERROR("open listener at %s failed", address);
		return -1;
	}
	
	if (listener->open() < 0 || this->addHandler(listener, EVENT_IN) < 0) {
		SYSLOG_ERROR("open or watch-IN failed for listener at %s", address);
		delete listener;
		return -1;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %ebp
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %r15
movl $0xb0, %edi
callq 0x3340
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
movl %ebp, %edx
movq %r15, %rcx
movq %r13, %r8
movq %r12, %r9
callq 0x6968
movq %rbx, %rdi
callq 0x6c98
testl %eax, %eax
js 0x4a2b
pushq $0x1
popq %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4a82
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
jns 0x4a5a
leaq 0xbaf6(%rip), %rax      # 0x10528
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x4a4e
leaq 0x5a08(%rip), %rdx      # 0xa449
pushq $0x2
popq %rsi
movq %r14, %rcx
xorl %eax, %eax
callq 0x6d1a
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movl $0xb0, %esi
movq %rbx, %rdi
callq 0x3350
movq %r14, %rdi
callq 0x3600
nop
// File: /workspace/github_cpp_makefile_star2_O2/roberty65[P]bServer/frame/main/EventManager.cpp
// Function: beyondy::Async::EventManager::addHandler(beyondy::Async::EventHandler*, int)
int EventManager::addHandler(EventHandler *handler, int events)
{
	struct epoll_event ee;
	int retval;
	
	ee.events = events;
	ee.data.ptr = (void *)handler;
	
	retval = epoll_ctl(epoll_fd, EPOLL_CTL_ADD, handler->fd, &ee);
	if (retval == 0) {
		handler->events = events;
		SYSLOG_DEBUG("addHandler fd=%d events=%d OK", handler->fd, events);
	}
	else {
		SYSLOG_DEBUG("addHandler fd=%d failed: %m", handler->fd);
	}

	return retval;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebp
movq %rsi, %r14
leaq 0x4(%rsp), %rcx
movl %edx, (%rcx)
movq %rsi, 0x4(%rcx)
movl (%rdi), %edi
movl 0x8(%rsi), %edx
pushq $0x1
popq %rsi
callq 0x34c0
movl %eax, %ebx
testl %eax, %eax
je 0x4ad3
leaq 0xba74(%rip), %rax      # 0x10528
movq (%rax), %rdi
cmpl $0x5, (%rdi)
jl 0x4afe
movl 0x8(%r14), %ecx
leaq 0x59e7(%rip), %rdx      # 0xa4ae
pushq $0x5
popq %rsi
xorl %eax, %eax
callq 0x6d1a
jmp 0x4afe
movl %ebp, 0xc(%r14)
leaq 0xba4a(%rip), %rax      # 0x10528
movq (%rax), %rdi
cmpl $0x5, (%rdi)
jl 0x4afe
movl 0x8(%r14), %ecx
leaq 0x599f(%rip), %rdx      # 0xa490
pushq $0x5
popq %rsi
movl %ebp, %r8d
xorl %eax, %eax
callq 0x6d1a
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/roberty65[P]bServer/frame/main/EventManager.cpp
// Function: beyondy::Async::EventManager::addConnector(char const*, beyondy::Async::Queue<beyondy::Async::Message>*, beyondy::Async::Processor*, int)
int EventManager::addConnector(const char *address, Queue<Message> *inQueue, Processor *processor, int openImmediately)
{
	int flow = nextFlow();
	Connector *connector = new Connector(flow, address, this, inQueue, processor);

	if (openImmediately && connector->open() < 0) {
		SYSLOG_ERROR("open Connector to %s failed", address);
		return -1;
	}

	mapFlow(flow, connector);
	_list_add_tail(&connector->connectorsEntry, &connectorsHead);

	return flow;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, 0xc(%rsp)
movq %rcx, %r13
movq %rdx, %r14
movq %rsi, %rbp
movq %rdi, %r15
movl 0x40(%rdi), %ebx
leal 0x1(%rbx), %eax
movl %eax, 0x40(%rdi)
movl $0x138, %edi            # imm = 0x138
callq 0x3340
movq %rax, %r12
movq %rax, %rdi
movl %ebx, %esi
movq %rbp, 0x10(%rsp)
movq %rbp, %rdx
movq %r15, %rcx
movq %r14, %r8
movq %r13, %r9
callq 0x6380
cmpl $0x0, 0xc(%rsp)
je 0x4b6d
movq %r12, %rdi
callq 0x6552
testl %eax, %eax
js 0x4bb3
movq %r15, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x4c00
movq %r12, %rax
addq $0x90, %rax
leaq 0x30(%r15), %rcx
movq 0x38(%r15), %rdx
movq %rax, 0x38(%r15)
movq %rcx, 0x90(%r12)
movq %rdx, 0x98(%r12)
movq %rax, (%rdx)
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb96e(%rip), %rax      # 0x10528
movq (%rax), %rdi
pushq $-0x1
popq %rbx
cmpl $0x2, (%rdi)
jl 0x4ba2
leaq 0x58a8(%rip), %rdx      # 0xa474
pushq $0x2
popq %rsi
movq 0x10(%rsp), %rcx
xorl %eax, %eax
callq 0x6d1a
jmp 0x4ba2
movq %rax, %rbx
movl $0x138, %esi            # imm = 0x138
movq %r12, %rdi
callq 0x3350
movq %rbx, %rdi
callq 0x3600
nop
// File: /workspace/github_cpp_makefile_star2_O2/roberty65[P]bServer/frame/main/EventManager.cpp
// Function: beyondy::Async::EventManager::mapFlow(int, beyondy::Async::Connection*)
int EventManager::mapFlow(int flow, Connection *connection)
{
	assert(flow2Connection(flow) == NULL);
	Connection *ret = __insert(flow, &connection->flowEntry);
	if (ret == NULL) rb_insert_color(&connection->flowEntry, &flowRoot);

	SYSLOG_DEBUG("mapFlow=%d => %d", flow, connection->fd);
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movl %esi, %ebx
movq %rdi, %r15
callq 0x4e4a
testq %rax, %rax
jne 0x4c73
leaq 0x38(%r14), %r12
movq %r15, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x4e76
testq %rax, %rax
jne 0x4c3f
addq $0x48, %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x75ac
leaq 0xb8e2(%rip), %rax      # 0x10528
movq (%rax), %rdi
cmpl $0x5, (%rdi)
jl 0x4c65
movl 0x8(%r14), %r8d
leaq 0x5a32(%rip), %rdx      # 0xa68b
pushq $0x5
popq %rsi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x6d1a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x593f(%rip), %rdi      # 0xa5b9
leaq 0x5956(%rip), %rsi      # 0xa5d7
leaq 0x5960(%rip), %rcx      # 0xa5e8
movl $0xdc, %edx
callq 0x3200
// File: /workspace/github_cpp_makefile_star2_O2/roberty65[P]bServer/frame/main/EventManager.cpp
// Function: beyondy::Async::EventManager::addConnection(beyondy::Async::Connection*, int)
int EventManager::addConnection(Connection *connection, int events)
{
	if (addHandler(connection, events) < 0) {
		SYSLOG_ERROR("can not add connection fd=%d flow=%d", connection->fd, connection->flow);
		return -1;
	}

	/* init it */
	gettimeofday(&connection->tsLastRead, NULL);
	_list_add_tail(&connection->lruEntry, &lruHead);

	SYSLOG_DEBUG("addConneciton fd=%d flow=%d OK", connection->fd, connection->flow);
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
callq 0x4a82
testl %eax, %eax
js 0x4cf2
leaq 0x28(%r14), %rdi
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x35a0
leaq 0x18(%r14), %rax
leaq 0x20(%r15), %rcx
movq 0x28(%r15), %rdx
movq %rax, 0x28(%r15)
movq %rcx, 0x18(%r14)
movq %rdx, 0x20(%r14)
movq %rax, (%rdx)
leaq 0xb853(%rip), %rax      # 0x10528
movq (%rax), %rdi
cmpl $0x5, (%rdi)
jl 0x4d1d
movl 0x8(%r14), %ecx
movl 0x10(%r14), %r8d
leaq 0x5803(%rip), %rdx      # 0xa4ef
xorl %ebx, %ebx
pushq $0x5
jmp 0x4d15
leaq 0xb82f(%rip), %rax      # 0x10528
movq (%rax), %rdi
pushq $-0x1
popq %rbx
cmpl $0x2, (%rdi)
jl 0x4d1d
movl 0x8(%r14), %ecx
movl 0x10(%r14), %r8d
leaq 0x57b7(%rip), %rdx      # 0xa4ca
pushq $0x2
popq %rsi
xorl %eax, %eax
callq 0x6d1a
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/roberty65[P]bServer/frame/main/EventManager.cpp
// Function: beyondy::Async::EventManager::modifyConnection(beyondy::Async::Connection*, int, int)
int EventManager::modifyConnection(Connection *connection, int add, int remove)
{
	struct epoll_event ee;
	int retval;

	ee.events = (connection->events | add) & ~remove;
	ee.data.ptr = (void *)(EventHandler *)connection;

	retval = epoll_ctl(epoll_fd, EPOLL_CTL_MOD, connection->fd, &ee);
	if (retval == 0) {
		connection->events = ee.events;
		SYSLOG_DEBUG("modifyConneciton fd=%d flow=%d events=%d OK", connection->fd, connection->flow, ee.events);
	}
	else {
		SYSLOG_DEBUG("modifyConneciton fd=%d flow=%d events=%d failed: %m", connection->fd, connection->flow, ee.events);
	}

	return retval;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
orl 0xc(%rsi), %edx
notl %ecx
andl %edx, %ecx
leaq 0xc(%rsp), %rax
movl %ecx, (%rax)
movq %rsi, 0x4(%rax)
movl (%rdi), %edi
movl 0x8(%rsi), %edx
pushq $0x3
popq %rsi
movq %rax, %rcx
callq 0x34c0
movl %eax, %ebx
testl %eax, %eax
je 0x4d7d
leaq 0xb7c9(%rip), %rax      # 0x10528
movq (%rax), %rdi
cmpl $0x5, (%rdi)
jl 0x4dae
movl 0x8(%r14), %ecx
movl 0x10(%r14), %r8d
movl 0xc(%rsp), %r9d
leaq 0x57bf(%rip), %rdx      # 0xa53a
jmp 0x4da4
movl 0xc(%rsp), %r9d
movl %r9d, 0xc(%r14)
leaq 0xb79b(%rip), %rax      # 0x10528
movq (%rax), %rdi
cmpl $0x5, (%rdi)
jl 0x4dae
movl 0x8(%r14), %ecx
movl 0x10(%r14), %r8d
leaq 0x576a(%rip), %rdx      # 0xa50e
pushq $0x5
popq %rsi
xorl %eax, %eax
callq 0x6d1a
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
andl $0x0, (%rcx)
movq %rsi, 0x4(%rcx)
movl (%rdi), %edi
movl 0x8(%rsi), %edx
pushq $0x2
popq %rsi
callq 0x34c0
movl %eax, %ebx
testl %eax, %eax
je 0x4e01
leaq 0xb740(%rip), %rax      # 0x10528
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x4e40
movl 0x8(%r14), %ecx
movl 0x10(%r14), %r8d
leaq 0x578f(%rip), %rdx      # 0xa58e
jmp 0x4e36
movq 0x18(%r14), %rax
movq 0x20(%r14), %rcx
movq %rcx, 0x8(%rax)
movq %rax, (%rcx)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%r14)
leaq 0xb709(%rip), %rax      # 0x10528
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x4e40
movl 0x8(%r14), %ecx
movl 0x10(%r14), %r8d
leaq 0x5738(%rip), %rdx      # 0xa56e
pushq $0x2
popq %rsi
xorl %eax, %eax
callq 0x6d1a
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/roberty65[P]bServer/frame/main/EventManager.cpp
// Function: beyondy::Async::EventManager::flow2Connection(int)
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:
addq $0x48, %rdi
pushq $0x10
popq %rcx
pushq $0x8
popq %rdx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x4e72
leaq -0x38(%rdi), %rax
movq %rcx, %r8
cmpl %esi, -0x28(%rdi)
jg 0x4e6d
movq %rdx, %r8
jge 0x4e74
addq %r8, %rdi
jmp 0x4e54
xorl %eax, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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:
addq $0x48, %rdi
xorl %eax, %eax
pushq $0x8
popq %rcx
pushq $0x10
popq %r8
movq (%rdi), %r9
testq %r9, %r9
je 0x4ea5
leaq -0x38(%r9), %rax
movq %rcx, %rdi
cmpl %esi, -0x28(%r9)
jl 0x4e9d
movq %r8, %rdi
jle 0x4eb4
addq %r9, %rdi
movq %r9, %rax
jmp 0x4e83
movq %rax, (%rdx)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdx)
movq %rdx, (%rdi)
xorl %eax, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/roberty65[P]bServer/frame/main/EventManager.cpp
// Function: beyondy::Async::EventManager::unmapFlow(beyondy::Async::Connection*)
int EventManager::unmapFlow(Connection *connection)
{
	assert(flow2Connection(connection->flow) != NULL);
	SYSLOG_DEBUG("upmapFlow=%d => %d", connection->flow, connection->fd);
		
	rb_erase(&connection->flowEntry, &flowRoot);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl 0x10(%rsi), %ebp
movl %ebp, %esi
callq 0x4e4a
testq %rax, %rax
je 0x4f0f
leaq 0xb652(%rip), %rax      # 0x10528
movq (%rax), %rdi
cmpl $0x5, (%rdi)
jl 0x4ef5
movl 0x8(%rbx), %r8d
leaq 0x57a0(%rip), %rdx      # 0xa689
pushq $0x5
popq %rsi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x6d1a
addq $0x38, %rbx
addq $0x48, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7744
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x570f(%rip), %rdi      # 0xa625
leaq 0x56ba(%rip), %rsi      # 0xa5d7
leaq 0x572b(%rip), %rcx      # 0xa64f
movl $0xe6, %edx
callq 0x3200
// File: /workspace/github_cpp_makefile_star2_O2/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
andq $0x0, 0x4(%rdi)
movq 0x10(%rdi), %rsi
movl (%rdi), %edi
movl 0xc(%rbx), %edx
pushq $0xa
popq %rcx
callq 0x3170
testl %eax, %eax
js 0x4f4f
movl %eax, 0x8(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x4f9f
movq (%r14), %rax
movq %r14, %rdi
movl %ebx, %esi
callq *0x18(%rax)
movl %eax, %r15d
testl %eax, %eax
jns 0x4f9f
leaq 0xb5a6(%rip), %rax      # 0x10528
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x4f9f
movl 0x8(%r14), %ecx
leaq 0x5707(%rip), %rdx      # 0xa69c
pushq $0x2
popq %rsi
xorl %eax, %eax
callq 0x6d1a
testb $0x1, %bpl
je 0x4fe0
testl %r15d, %r15d
js 0x4fe0
movq (%r14), %rax
movq %r14, %rdi
movl %ebx, %esi
callq *0x10(%rax)
movl %eax, %r15d
testl %eax, %eax
jns 0x4fe0
leaq 0xb565(%rip), %rax      # 0x10528
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x4fe0
movl 0x8(%r14), %ecx
leaq 0x56de(%rip), %rdx      # 0xa6b4
pushq $0x2
popq %rsi
xorl %eax, %eax
callq 0x6d1a
testb $0x8, %bpl
jne 0x4ff6
testl %r15d, %r15d
js 0x4ff6
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb52b(%rip), %rax      # 0x10528
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x501e
leaq 0x56c0(%rip), %rdx      # 0xa6cc
pushq $0x2
popq %rsi
movl %ebx, %ecx
movl %r15d, %r8d
movl %ebp, %r9d
xorl %eax, %eax
callq 0x6d1a
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_O2/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:
pushq %rbx
movq %rdi, %rbx
xorl %eax, %eax
movl %eax, 0x4(%rbx)
cmpl 0x8(%rbx), %eax
jge 0x5065
movq 0x10(%rbx), %rcx
cltq
imulq $0xc, %rax, %rax
movq 0x4(%rcx,%rax), %rdx
movl 0x8(%rdx), %esi
movl (%rcx,%rax), %ecx
callq 0x4f52
movl 0x4(%rbx), %eax
incl %eax
jmp 0x503c
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xb4ab(%rip), %r15      # 0x10528
xorl %ebp, %ebp
cmpl 0x54(%rbx), %ebp
jge 0x5127
movq 0x18(%rbx), %rdi
xorl %esi, %esi
callq 0x5328
testq %rax, %rax
je 0x5127
movq %rax, %r12
movq %rax, %rdi
addq $0x50, %rdi
xorl %esi, %esi
callq 0x35a0
movl 0x28(%r12), %r13d
movq %rbx, %rdi
movl %r13d, %esi
callq 0x4e4a
testq %rax, %rax
je 0x50f7
movq %rax, %r14
movq (%rax), %rax
movq %r14, %rdi
movq %r12, %rsi
callq *0x28(%rax)
testl %eax, %eax
je 0x5120
movq (%r15), %rdi
cmpl $0x2, (%rdi)
jl 0x5120
movl 0x8(%r14), %ecx
pushq $0x2
popq %rsi
leaq 0x563a(%rip), %rdx      # 0xa725
movl %r13d, %r8d
xorl %eax, %eax
callq 0x6d1a
jmp 0x5120
movq (%r15), %rdi
cmpl $0x2, (%rdi)
jl 0x5118
movl 0x24(%r12), %ecx
pushq $0x2
popq %rsi
leaq 0x55e2(%rip), %rdx      # 0xa6f0
movl %r13d, %r8d
xorl %eax, %eax
callq 0x6d1a
movq %r12, %rdi
callq 0x6fc6
incl %ebp
jmp 0x507f
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x35a0
leaq 0x20(%rbx), %r15
movq 0x20(%rbx), %rbp
movq (%r14), %r12
movq 0x8(%r14), %r13
cmpq %r15, %rbp
je 0x51d3
movq %r12, %rcx
subq 0x10(%rbp), %rcx
movq %r13, %rax
subq 0x18(%rbp), %rax
imulq $0x3e8, %rcx, %rcx      # imm = 0x3E8
cqto
movl $0x3e8, %esi            # imm = 0x3E8
idivq %rsi
addq %rcx, %rax
movslq 0x60(%rbx), %rcx
cmpq %rcx, %rax
jle 0x51d3
movq (%rbp), %r14
leaq 0xb388(%rip), %rax      # 0x10528
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x51c0
movl -0x10(%rbp), %ecx
movl -0x8(%rbp), %r8d
pushq $0x2
popq %rsi
leaq 0x5590(%rip), %rdx      # 0xa749
xorl %eax, %eax
callq 0x6d1a
leaq -0x18(%rbp), %rdi
movl -0x10(%rbp), %esi
movq -0x18(%rbp), %rax
callq *0x20(%rax)
movq %r14, %rbp
jmp 0x5165
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x35a0
leaq 0x30(%rbx), %rbp
movq 0x30(%rbx), %r15
movq (%r14), %rax
movq %rax, (%rsp)
movq 0x8(%r14), %r14
cmpq %rbp, %r15
je 0x52d5
movq %r15, %r12
movq (%r15), %r15
leaq -0x90(%r12), %r13
cmpl $0x0, 0x24(%r12)
jne 0x52c8
movq (%rsp), %rax
subq 0x10(%r12), %rax
imulq $0x3e8, %rax, %rcx      # imm = 0x3E8
movq %r14, %rax
subq 0x18(%r12), %rax
cqto
movl $0x3e8, %esi            # imm = 0x3E8
idivq %rsi
addq %rcx, %rax
movslq 0x20(%r12), %rcx
incq %rcx
movslq 0x6c(%rbx), %rdx
imulq %rcx, %rdx
cmpq %rdx, %rax
jle 0x52c8
leaq 0xb2af(%rip), %rax      # 0x10528
movq (%rax), %rdi
cmpl $0x2, (%rdi)
jl 0x5297
movl -0x80(%r12), %ecx
pushq $0x2
popq %rsi
leaq 0x54eb(%rip), %rdx      # 0xa77b
xorl %eax, %eax
callq 0x6d1a
movq %r13, %rdi
callq 0x6552
testl %eax, %eax
jns 0x52c8
leaq 0xb27e(%rip), %rax      # 0x10528
movq (%rax), %rdi
cmpl $0x3, (%rdi)
jl 0x52c8
movl -0x80(%r12), %ecx
pushq $0x3
popq %rsi
leaq 0x54e8(%rip), %rdx      # 0xa7a9
xorl %eax, %eax
callq 0x6d1a
movq %r13, %rdi
callq 0x620a
jmp 0x5215
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/roberty65[P]bServer/frame/main/EventManager.cpp
// Function: beyondy::Async::EventManager::start()
int EventManager::start()
{
	/* start it */
	isRunning = 1;

	while (isRunning) {
		BPROF_TRACE(BPT_LOOP)

		waitingEvents();

		handleEvents();

		// check outQueue
		dispatchOutMessage();

		// timeout check
		checkTimeout();

		// re-connect for connectors if they are broken
		reconnectWhenNecessary();
	}

	return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x1, 0x50(%rdi)
pushq $0x1
popq %rax
testl %eax, %eax
je 0x5323
movq %rbx, %rdi
callq 0x4f2e
movq %rbx, %rdi
callq 0x5036
movq %rbx, %rdi
callq 0x5068
movq %rbx, %rdi
callq 0x5136
movq %rbx, %rdi
callq 0x51e2
movl 0x50(%rbx), %eax
jmp 0x52f2
xorl %eax, %eax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3540
movq 0x70(%rbx), %rax
movq 0x90(%rbx), %rcx
cmpq %rax, %rcx
setne %dl
testq %r14, %r14
setle %sil
orb %dl, %sil
jne 0x536b
leaq 0x28(%rbx), %rdi
movq %rbx, %rsi
callq 0x3570
movq 0x70(%rbx), %rax
movq 0x90(%rbx), %rcx
cmpq %rax, %rcx
je 0x537e
leaq 0x60(%rbx), %rdi
movq (%rax), %r14
callq 0x5394
jmp 0x5381
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x3270
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xb0d3(%rip), %rax      # 0x10528
movq (%rax), %r14
cmpl $0x5, (%r14)
jl 0x5486
movq %rbx, %rdi
callq 0x54cc
movl %eax, %ebp
callq 0x32e0
leaq 0x535a(%rip), %rdx      # 0xa7ce
pushq $0x5
popq %rsi
movq %r14, %rdi
movl %ebp, %ecx
movq %rax, %r8
xorl %eax, %eax
callq 0x6d1a
pushq $0xa
popq %r14
cmpl $0x0, 0x10(%rbx)
je 0x54c0
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x5328
testq %rax, %rax
je 0x548a
movq %rax, %r15
movq %rax, %rdi
addq $0x50, %rdi
xorl %esi, %esi
callq 0x35a0
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
movq %r15, %rsi
callq *0x30(%rax)
jmp 0x548a
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
movl 0x14(%rdi), %r12d
movq 0x18(%rdi), %r13
xorl %r15d, %r15d
testl %r12d, %r12d
cmovlel %r15d, %r12d
pushq $-0x1
popq %rbx
cmpq %r15, %r12
je 0x5510
movq (%r13,%r15,8), %r14
callq 0x32e0
movq %r14, %rdi
movq %rax, %rsi
callq 0x35f0
testl %eax, %eax
jne 0x550d
incq %r15
jmp 0x54ea
movl %r15d, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
movq %rdi, %rbx
movl $0x1, 0x10(%rdi)
pushq $-0x1
popq %r15
xorl %edi, %edi
leaq -0x104(%rip), %r14      # 0x543a
movslq 0x14(%rbx), %r12
incq %r15
cmpq %r12, %r15
jge 0x556f
leaq 0x8(%rdi), %r13
addq 0x18(%rbx), %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x3630
movq %r13, %rdi
testl %eax, %eax
je 0x553e
movl %eax, %ebp
callq 0x3060
movl %ebp, (%rax)
xorl %eax, %eax
cmpq %r12, %r15
setl %al
negl %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x0, 0x10(%rdi)
xorl %r14d, %r14d
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jge 0x55b6
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rdi
xorl %esi, %esi
callq 0x32f0
incq %r14
jmp 0x5599
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x35a0
movq %r15, %rdi
movq %r14, %rsi
callq 0x561e
testl %eax, %eax
jns 0x5616
leaq 0xaf3a(%rip), %rax      # 0x10528
movq (%rax), %rdi
pushq $-0x1
popq %rbx
cmpl $0x2, (%rdi)
jl 0x5616
movl 0x24(%r14), %ecx
movl 0x28(%r14), %r8d
movq 0x10(%r14), %r9
leaq 0x51df(%rip), %rdx      # 0xa7eb
pushq $0x2
popq %rsi
xorl %eax, %eax
callq 0x6d1a
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %rdi, %rbx
movq %rsi, 0x8(%rsp)
callq 0x3540
leaq 0x60(%rbx), %r14
movq %r14, %rdi
callq 0x5676
cmpq 0x58(%rbx), %rax
jae 0x5656
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x56be
xorl %ebp, %ebp
jmp 0x5659
pushq $-0x1
popq %rbp
leaq 0x28(%rbx), %rdi
callq 0x3030
movq %rbx, %rdi
callq 0x3270
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0xa3c1(%rip), %rax      # 0xfc88
movq %rax, (%rdi)
movl %edx, 0x10(%rdi)
andq $0x0, 0x50(%rdi)
movq %r8, 0x58(%rdi)
andq $0x0, 0x60(%rdi)
pushq $0x50
popq %rdi
callq 0x3340
movq %rax, %r12
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
movaps %xmm0, 0x10(%rax)
movaps %xmm0, 0x20(%rax)
movaps %xmm0, 0x30(%rax)
movaps %xmm0, 0x40(%rax)
movq %rax, %rdi
callq 0x4650
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
pushq $0x50
popq %rsi
movq %r12, %rdi
callq 0x3350
movq %rbx, %rdi
callq 0x3600
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x5d60
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 0x3520
movq 0x50(%r14), %rcx
incl 0x2c(%rcx)
cmpq %rbx, %rax
jne 0x5ced
addq %rbx, 0x10(%rcx)
jmp 0x5cf9
testq %rax, %rax
jle 0x5d04
addq %rax, 0x10(%rcx)
movq %rax, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0xa81d(%rip), %rax      # 0x10528
movq (%rax), %rdi
movl (%rdi), %eax
je 0x5d35
pushq $-0x1
popq %rbx
cmpl $0x2, %eax
jl 0x5cf9
movl 0x8(%r14), %ecx
movl 0x10(%r14), %r8d
leaq 0x5128(%rip), %rdx      # 0xae51
pushq $0x2
popq %rsi
xorl %eax, %eax
callq 0x6d1a
jmp 0x5cf9
cmpl $0x2, %eax
jl 0x5d53
movl 0x8(%r14), %ecx
movl 0x10(%r14), %r8d
leaq 0x50d7(%rip), %rdx      # 0xae20
pushq $0x2
popq %rsi
xorl %eax, %eax
callq 0x6d1a
callq 0x3060
andl $0x0, (%rax)
pushq $-0x1
popq %rbx
jmp 0x5cf9
leaq 0x507e(%rip), %rdi      # 0xade5
leaq 0x4af9(%rip), %rsi      # 0xa867
leaq 0x5079(%rip), %rcx      # 0xadee
movl $0x111, %edx            # imm = 0x111
callq 0x3200
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x5fa5
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 0x5f63
addq %rbx, 0x8(%r15)
jmp 0x5f9c
testq %rax, %rax
jle 0x5f71
addq %rax, 0x8(%r15)
movq %rax, %rbx
jmp 0x5f9c
leaq 0xa5b0(%rip), %rax      # 0x10528
movq (%rax), %rdi
pushq $-0x1
popq %rbx
cmpl $0x2, (%rdi)
jl 0x5f9c
movl 0x8(%r14), %ecx
movl 0x10(%r14), %r8d
leaq 0x4f25(%rip), %rdx      # 0xaeb7
pushq $0x2
popq %rsi
xorl %eax, %eax
callq 0x6d1a
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x4e39(%rip), %rdi      # 0xade5
leaq 0x48b4(%rip), %rsi      # 0xa867
leaq 0x4ebf(%rip), %rcx      # 0xae79
movl $0x12c, %edx            # imm = 0x12C
callq 0x3200
// File: /workspace/github_cpp_makefile_star2_O2/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 0x5ffd
movq %rdi, %rbx
leaq 0xa554(%rip), %rax      # 0x10528
movq (%rax), %rdi
cmpl $0x5, (%rdi)
jl 0x5ff3
movl %esi, %ecx
movl 0x10(%rbx), %r8d
leaq 0x4c7f(%rip), %rdx      # 0xac68
pushq $0x5
popq %rsi
xorl %eax, %eax
callq 0x6d1a
movq (%rbx), %rax
movq %rbx, %rdi
popq %rbx
jmpq *0x30(%rax)
leaq 0x4854(%rip), %rdi      # 0xa858
leaq 0x485c(%rip), %rsi      # 0xa867
leaq 0x4c21(%rip), %rcx      # 0xac33
movl $0xaa, %edx
callq 0x3200
// File: /workspace/github_cpp_makefile_star2_O2/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 0x35a0
movq (%r14), %r13
movq 0x8(%r14), %r14
movl $0x3e8, %r15d           # imm = 0x3E8
pushq $0x1
popq %rbp
movq 0x68(%rbx), %rdi
movq 0x10(%rdi), %rax
cmpq %rax, 0x30(%rdi)
je 0x62c3
movq (%rax), %r12
movq %r13, %rax
subq 0x40(%r12), %rax
imulq $0x3e8, %rax, %rcx      # imm = 0x3E8
movq %r14, %rax
subq 0x48(%r12), %rax
cqto
idivq %r15
addq %rcx, %rax
movq 0x70(%rbx), %rcx
movslq 0x5c(%rcx), %rcx
cmpq %rcx, %rax
jl 0x62c3
leaq 0xa2aa(%rip), %rax      # 0x10528
movq (%rax), %rax
cmpl $0x2, (%rax)
jl 0x62aa
movl 0x8(%rbx), %ecx
movl 0x10(%rbx), %r8d
movq 0x10(%r12), %r9
movq %rax, %rdi
pushq $0x2
popq %rsi
leaq 0x4b0e(%rip), %rdx      # 0xadad
xorl %eax, %eax
callq 0x6d1a
movq 0x68(%rbx), %rdi
callq 0x5394
movq 0x78(%rbx), %rdi
movq (%rdi), %rax
movq %r12, %rsi
movl %ebp, %edx
callq *0x38(%rax)
jmp 0x623a
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x50(%rdi), %rdi
testq %rdi, %rdi
je 0x62ec
callq 0x6fc6
andq $0x0, 0x50(%rbx)
movq 0x60(%rbx), %rsi
testq %rsi, %rsi
je 0x6307
movq 0x78(%rbx), %rdi
movq (%rdi), %rax
pushq $0x5
popq %rdx
callq *0x38(%rax)
andq $0x0, 0x60(%rbx)
pushq $0x5
popq %rbp
movq 0x68(%rbx), %rdi
movq 0x10(%rdi), %rax
cmpq %rax, 0x30(%rdi)
je 0x6336
movq (%rax), %rax
movq %rax, 0x60(%rbx)
callq 0x5394
movq 0x60(%rbx), %rsi
movq 0x78(%rbx), %rdi
movq (%rdi), %rax
movl %ebp, %edx
callq *0x38(%rax)
jmp 0x630a
cmpl $0x0, 0x80(%rbx)
jne 0x635f
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 0x6c24
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movl %esi, %edx
movq %rdi, %rbx
pushq $-0x1
popq %rsi
pushq $0x0
pushq $0x1
callq 0x58ac
popq %rax
popq %rcx
leaq 0x9957(%rip), %rax      # 0xfcf8
movq %rax, (%rbx)
andl $0x0, 0xb4(%rbx)
leaq 0xb8(%rbx), %rdi
movl $0x80, %edx
movq %r14, %rsi
callq 0x3190
movb $0x0, 0x137(%rbx)
leaq 0xa0(%rbx), %rdi
xorl %esi, %esi
callq 0x35a0
andl $0x0, 0xb0(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop