LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/hkshenSmart[P]ONVIF-discovery_cs/stdsoap2.c
// Function: soap_strerror
static const char*
soap_strerror(struct soap *soap)
{ register int err = soap->errnum;
  if (err)
  {
#ifndef WIN32
# ifdef HAVE_STRERROR_R
    strerror_r(err, soap->msgbuf, sizeof(soap->msgbuf));
# else
    return strerror(err);
# endif
#else
#ifndef UNDER_CE
    DWORD len;
    *soap->msgbuf = '\0';
    len = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)soap->msgbuf, (DWORD)sizeof(soap->msgbuf), NULL);
#else
    DWORD i, len;
    *soap->msgbuf = '\0';
    len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, 0, (LPTSTR)soap->msgbuf, (DWORD)(sizeof(soap->msgbuf)/sizeof(TCHAR)), NULL);
    for (i = 0; i <= len; i++)
    { if (((TCHAR*)soap->msgbuf)[i] < 0x80)
        soap->msgbuf[i] = (char)((TCHAR*)soap->msgbuf)[i];
      else
        soap->msgbuf[i] = '?';
    }
#endif
#endif
  }
  else
  { char *s = soap->msgbuf;
#ifndef WITH_LEAN
    int rt = soap->recv_timeout, st = soap->send_timeout;
    int ru = ' ', su = ' ';
#endif
    strcpy(s, "Operation interrupted or timed out");
#ifndef WITH_LEAN
    if (rt < 0)
    { rt = -rt;
      ru = 'u';
    }
    if (st < 0)
    { st = -st;
      su = 'u';
    }
    if (rt)
      sprintf(s + strlen(s), " (%d%cs receive delay)", rt, ru);
    if (st)
      sprintf(s + strlen(s), " (%d%cs send delay)", st, su);
#endif
  }
  return soap->msgbuf;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rax
movl 0x1f27c(%rdi), %edi
leaq 0x1c198(%rax), %rbx
testl %edi, %edi
je 0x23938
movl $0x400, %edx            # imm = 0x400
movq %rbx, %rsi
callq 0x30c0
jmp 0x239d4
movl 0x50(%rax), %ecx
movl 0x54(%rax), %r13d
movups 0x423e(%rip), %xmm0     # 0x27b84
movups %xmm0, 0x10(%rbx)
movups 0x4223(%rip), %xmm0     # 0x27b74
movups %xmm0, (%rbx)
movl %r13d, %ebp
negl %ebp
cmovsl %r13d, %ebp
movl $0x74756f, 0x1f(%rbx)   # imm = 0x74756F
testl %r13d, %r13d
movl $0x75, %eax
movl $0x20, %r15d
movl $0x20, %r14d
cmovsl %eax, %r14d
testl %ecx, %ecx
je 0x239b0
movl %ecx, %r12d
negl %r12d
cmovsl %ecx, %r12d
testl %ecx, %ecx
cmovsl %eax, %r15d
movq %rbx, %rdi
callq 0x3110
leaq (%rax,%rbx), %rdi
leaq 0x41f4(%rip), %rsi      # 0x27b97
movl %r12d, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x3300
testl %r13d, %r13d
je 0x239d4
movq %rbx, %rdi
callq 0x3110
leaq (%rax,%rbx), %rdi
leaq 0x41e6(%rip), %rsi      # 0x27bae
movl %ebp, %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x3300
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/hkshenSmart[P]ONVIF-discovery_cs/stdsoap2.c
// Function: soap_send_empty_response
SOAP_FMAC2
soap_send_empty_response(struct soap *soap, int httpstatuscode)
{ register soap_mode m = soap->omode;
  soap->count = 0;
  if ((m & SOAP_IO) == SOAP_IO_CHUNK)
    soap->omode = (m & ~SOAP_IO) | SOAP_IO_BUFFER;
  if (!soap_response(soap, httpstatuscode) && !soap_end_send(soap))
    soap->error = SOAP_STOP; /* stops the server's response */
  soap->omode = m;
  return soap_closesock(soap);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0xc(%rdi), %ebp
movq $0x0, 0xc170(%rdi)
movl %ebp, %eax
notl %eax
testb $0x3, %al
jne 0x23be0
movl %ebp, %eax
andl $-0x3, %eax
movl %eax, 0xc(%rbx)
movq %rbx, %rdi
callq 0x174ae
testl %eax, %eax
jne 0x23c02
movq %rbx, %rdi
callq 0x190b4
testl %eax, %eax
jne 0x23c02
movl $0x3e8, 0x1f274(%rbx)   # imm = 0x3E8
movl %ebp, 0xc(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x14730
// File: /workspace/github_c_makefile_star2_O3/hkshenSmart[P]ONVIF-discovery_cs/stdsoap2.c
// Function: soap_recv_empty_response
SOAP_FMAC2
soap_recv_empty_response(struct soap *soap)
{ if (!soap_begin_recv(soap))
    soap_end_recv(soap);
  else if (soap->error == SOAP_NO_DATA || soap->error == 202)
    soap->error = SOAP_OK;
  return soap_closesock(soap);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x219ea
testl %eax, %eax
je 0x23c3e
movl 0x1f274(%rbx), %eax
cmpl $0xca, %eax
je 0x23c32
cmpl $0xe, %eax
jne 0x23c46
movl $0x0, 0x1f274(%rbx)
jmp 0x23c46
movq %rbx, %rdi
callq 0x196e4
movq %rbx, %rdi
popq %rbx
jmp 0x14730
// File: /workspace/github_c_makefile_star2_O3/hkshenSmart[P]ONVIF-discovery_cs/stdsoap2.c
// Function: soap_set_error
static int
soap_set_error(struct soap *soap, const char *faultcode, const char *faultsubcodeQName, const char *faultstring, const char *faultdetailXML, int soaperror)
{ *soap_faultcode(soap) = faultcode;
  if (faultsubcodeQName)
    *soap_faultsubcode(soap) = faultsubcodeQName;
  *soap_faultstring(soap) = faultstring;
  if (faultdetailXML && *faultdetailXML)
  { register const char **s = soap_faultdetail(soap);
    if (s)
      *s = faultdetailXML;
  }
  return soap->error = soaperror;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %ebx
movq %r8, %r14
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %rbp
movq %rdi, %r15
callq 0x4094
movq %rbp, (%rax)
testq %r13, %r13
je 0x23c84
movq %r15, %rdi
callq 0x40b7
movq %r13, (%rax)
movq %r15, %rdi
callq 0x4112
movq %r12, (%rax)
testq %r14, %r14
je 0x23caa
cmpb $0x0, (%r14)
je 0x23caa
movq %r15, %rdi
callq 0x4135
testq %rax, %rax
je 0x23caa
movq %r14, (%rax)
movl %ebx, 0x1f274(%r15)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/hkshenSmart[P]ONVIF-discovery_cs/stdsoap2.c
// Function: http_send_header
static int
http_send_header(struct soap *soap, const char *s)
{ register const char *t;
  do
  { t = strchr(s, '\n'); /* disallow \n in HTTP headers */
    if (!t)
      t = s + strlen(s);
    if (soap_send_raw(soap, s, t - s))
      return soap->error;
    s = t + 1;
  } while (*t);
  return SOAP_OK;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %r14, %rdi
movl $0xa, %esi
callq 0x3130
movq %rax, %r15
testq %rax, %rax
jne 0x241d6
movq %r14, %rdi
callq 0x3110
movq %rax, %r15
addq %r14, %r15
movq %r15, %rdx
subq %r14, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x102b0
testl %eax, %eax
jne 0x241f9
leaq 0x1(%r15), %r14
cmpb $0x0, (%r15)
jne 0x241b3
xorl %eax, %eax
jmp 0x241ff
movl 0x1f274(%rbx), %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/eagle.c
// Function: create_pid_file
void create_pid_file(const char *pidfile)
{
	FILE *fp = fopen(pidfile, "w");

	if (fp) {
		fprintf(fp, "%d\n", (int)getpid());
		fclose(fp);
	}
}

// Assembly:
pushq %rbx
leaq 0x9679(%rip), %rsi      # 0xc06d
callq 0x23b0
testq %rax, %rax
je 0x2a22
movq %rax, %rbx
callq 0x2100
leaq 0x9662(%rip), %rsi      # 0xc06f
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2260
movq %rbx, %rdi
popq %rbx
jmp 0x2120
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/eagle.c
// Function: daemonize
void daemonize(void)
{
	int fd;

	if (fork() != 0) {
		exit(0);
	}

	setsid();

	if ((fd = open("/dev/null", O_RDWR, 0)) != -1)
	{
		dup2(fd, STDIN_FILENO);
		dup2(fd, STDOUT_FILENO);
		dup2(fd, STDERR_FILENO);
		if (fd > STDERR_FILENO) {
			close(fd);
		}
	}
}

// Assembly:
pushq %rbx
callq 0x2480
testl %eax, %eax
jne 0x2a7f
callq 0x21e0
leaq 0x9639(%rip), %rdi      # 0xc073
movl $0x2, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2390
cmpl $-0x1, %eax
je 0x2a7d
movl %eax, %ebx
movl %eax, %edi
xorl %esi, %esi
callq 0x2160
movl %ebx, %edi
movl $0x1, %esi
callq 0x2160
movl %ebx, %edi
movl $0x2, %esi
callq 0x2160
cmpl $0x3, %ebx
jl 0x2a7d
movl %ebx, %edi
popq %rbx
jmp 0x21d0
popq %rbx
retq
xorl %edi, %edi
callq 0x2440
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/eagle.c
// Function: unblock_open_files_limit
void unblock_open_files_limit(void)
{
	rlim_t maxfiles = server->max_clients + 32;
	rlim_t oldlimit;
	struct rlimit limit;

	if (maxfiles < 1024) {
		maxfiles = 1024;
	}

	if (getrlimit(RLIMIT_NOFILE, &limit) == -1) {
		warning("Error getrlimit", strerror(errno));
		server->max_clients = 1024 - 32;
	} else {
		oldlimit = limit.rlim_cur;

		if (oldlimit < maxfiles) {
			limit.rlim_cur = maxfiles;
			limit.rlim_max = maxfiles;

			if (setrlimit(RLIMIT_NOFILE, &limit) == -1) {
				server->max_clients = oldlimit - 32;
			}
		}
    }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq 0xf7fc(%rip), %rax      # 0x12290
movq 0x48(%rax), %rax
addq $0x20, %rax
cmpq $0x401, %rax            # imm = 0x401
movl $0x400, %r14d           # imm = 0x400
cmovaeq %rax, %r14
leaq 0x8(%rsp), %rsi
movl $0x7, %edi
callq 0x2460
cmpl $-0x1, %eax
je 0x2aeb
movq 0x8(%rsp), %rbx
cmpq %r14, %rbx
jae 0x2b18
leaq 0x8(%rsp), %rsi
movq %r14, (%rsi)
movq %r14, 0x8(%rsi)
movl $0x7, %edi
callq 0x2320
cmpl $-0x1, %eax
jne 0x2b18
addq $-0x20, %rbx
jmp 0x2b0d
callq 0x2050
movl (%rax), %edi
callq 0x2470
leaq 0x957f(%rip), %rdi      # 0xc07d
movq %rax, %rsi
xorl %eax, %eax
callq 0x4bc8
movl $0x3e0, %ebx            # imm = 0x3E0
movq 0xf77c(%rip), %rax      # 0x12290
movq %rbx, 0x48(%rax)
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/eagle.c
// Function: linux_overcommit_memory_value
int linux_overcommit_memory_value(void)
{
	FILE *fp;
	char buf[64];

	if ((fp = fopen("/proc/sys/vm/overcommit_memory", "r")) == NULL)
		return -1;

	if (fgets(buf, 64, fp) == NULL)
	{
		fclose(fp);
		return -1;
	}

	fclose(fp);

	return atoi(buf);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
leaq 0x955d(%rip), %rdi      # 0xc08d
leaq 0x9d6b(%rip), %rsi      # 0xc8a2
callq 0x23b0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x2b73
movq %rax, %r14
movq %rsp, %rdi
movl $0x40, %esi
movq %rax, %rdx
callq 0x2210
movq %rax, %r15
movq %r14, %rdi
callq 0x2120
testq %r15, %r15
je 0x2b73
movq %rsp, %rdi
callq 0x2410
movl %eax, %ebx
movl %ebx, %eax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/eagle.c
// Function: setup_signals
void setup_signals(void)
{
	struct sigaction sig;

	signal(SIGHUP, SIG_IGN);
	signal(SIGPIPE, SIG_IGN);

	sigemptyset(&sig.sa_mask);
	sig.sa_flags = SA_NODEFER | SA_ONSTACK | SA_RESETHAND;
	sig.sa_handler = sigterm_handler;

	sigaction(SIGTERM, &sig, NULL);
}

// Assembly:
pushq %rbx
subq $0xa0, %rsp
movl $0x1, %esi
movl $0x1, %edi
callq 0x2240
movl $0x1, %esi
movl $0xd, %edi
callq 0x2240
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x2270
movl $0xc8000000, 0x80(%rbx) # imm = 0xC8000000
leaq -0x66(%rip), %rax       # 0x2b9a
movq %rax, -0x8(%rbx)
leaq 0x8(%rsp), %rsi
movl $0xf, %edi
xorl %edx, %edx
callq 0x20a0
addq $0xa0, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/eagle.c
// Function: mstime
long long mstime(void)
{
	struct timeval tv;
	long long mst;

	gettimeofday(&tv, NULL);

	mst = tv.tv_sec * 1000;
	mst += tv.tv_usec / 1000;

	return mst;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rsp, %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x21a0
imulq $0x3e8, (%rbx), %rcx    # imm = 0x3E8
movabsq $0x20c49ba5e353f7cf, %rax # imm = 0x20C49BA5E353F7CF
imulq 0x8(%rbx)
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x7, %rdx
addq %rdx, %rax
addq %rcx, %rax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/eagle.c
// Function: check_memory
void check_memory(void)
{
	if (server->max_memory)
	{
		if (xmalloc_used_memory() > server->max_memory)
		{
			if ((server->now_time - server->last_memcheck) > EG_MEMORY_CHECK_TIMEOUT)
			{
				warning("Used memory: %u, limit: %u",
					xmalloc_used_memory(), server->max_memory);

				server->last_memcheck = server->now_time;
			}

			server->nomemory = 1;
		}
		else
		{
			server->nomemory = 0;
		}
	}
}

// Assembly:
movq 0xf3af(%rip), %rax      # 0x12290
cmpq $0x0, 0x50(%rax)
je 0x2f53
pushq %rbx
callq 0x4a10
movq 0xf39b(%rip), %rcx      # 0x12290
xorl %ebx, %ebx
cmpq 0x50(%rcx), %rax
jbe 0x2f4c
movq 0x188(%rcx), %rax
subq 0x1a8(%rcx), %rax
movl $0x1, %ebx
cmpq $0xb, %rax
jl 0x2f4c
callq 0x4a10
movq 0xf36e(%rip), %rcx      # 0x12290
movq 0x50(%rcx), %rdx
leaq 0x9203(%rip), %rdi      # 0xc130
movq %rax, %rsi
xorl %eax, %eax
callq 0x4bc8
movq 0xf352(%rip), %rcx      # 0x12290
movq 0x188(%rcx), %rax
movq %rax, 0x1a8(%rcx)
movl %ebx, 0x1b0(%rcx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/eagle.c
// Function: process_queues_messages
void process_queues_messages(void)
{
	ListNode *node;
	ListIterator iterator;
	Queue_t *queue_t;

	list_rewind(server->queues, &iterator);
	while ((node = list_next_node(&iterator)) != NULL)
	{
		queue_t = EG_LIST_NODE_VALUE(node);
		process_expired_messages_queue_t(queue_t, server->now_timems);
		process_unconfirmed_messages_queue_t(queue_t, server->now_timems);
	}
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq 0xf32e(%rip), %rax      # 0x12290
movq 0x170(%rax), %rdi
leaq 0x8(%rsp), %rbx
movq %rbx, %rsi
callq 0x8ed9
movq %rbx, %rdi
callq 0x8e98
testq %rax, %rax
je 0x2fc3
leaq 0x8(%rsp), %rbx
movq 0x10(%rax), %r14
movq 0xf2fd(%rip), %rax      # 0x12290
movl 0x190(%rax), %esi
movq %r14, %rdi
callq 0x9a70
movq 0xf2e8(%rip), %rax      # 0x12290
movl 0x190(%rax), %esi
movq %r14, %rdi
callq 0x9ae1
movq %rbx, %rdi
callq 0x8e98
testq %rax, %rax
jne 0x2f88
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/eagle.c
// Function: storage_timeout
void storage_timeout(void)
{
	pid_t pid;
	int stat;

	if (server->child_pid != -1)
	{
		if ((pid = wait3(&stat, WNOHANG, NULL)) != 0)
		{
			if (WEXITSTATUS(stat) != EG_STATUS_OK) {
				warning("Error background saving data in %s", server->storage);
			}

			server->child_pid = -1;
		}
	}

	if (server->storage_timeout && server->child_pid == -1)
	{
		if ((server->now_time - server->last_save) > server->storage_timeout)
		{
			wlog("Save all data to the storage...");
			if (storage_save_background(server->storage) != EG_STATUS_OK) {
				warning("Error saving data in %s", server->storage);
			}

			server->last_save = server->now_time;
		}
	}
}

// Assembly:
pushq %rax
movq 0xf2bd(%rip), %rax      # 0x12290
cmpl $-0x1, 0x34(%rax)
je 0x3028
leaq 0x4(%rsp), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x2130
testl %eax, %eax
je 0x3021
cmpb $0x0, 0x5(%rsp)
je 0x3011
movq 0xf294(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rsi
leaq 0x9141(%rip), %rdi      # 0xc14b
xorl %eax, %eax
callq 0x4bc8
movq 0xf278(%rip), %rax      # 0x12290
movl $0xffffffff, 0x34(%rax) # imm = 0xFFFFFFFF
jmp 0x3028
movq 0xf268(%rip), %rax      # 0x12290
movslq 0x5c(%rax), %rcx
testq %rcx, %rcx
je 0x30a0
cmpl $-0x1, 0x34(%rax)
jne 0x30a0
movq 0x188(%rax), %rdx
subq 0x1a0(%rax), %rdx
cmpq %rcx, %rdx
jle 0x30a0
leaq 0x911d(%rip), %rdi      # 0xc16e
xorl %eax, %eax
callq 0x4e5b
movq 0xf231(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rdi
callq 0xb1fa
testl %eax, %eax
je 0x308b
movq 0xf21a(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rsi
leaq 0x910a(%rip), %rdi      # 0xc18e
xorl %eax, %eax
callq 0x4bc8
movq 0xf1fe(%rip), %rax      # 0x12290
movq 0x188(%rax), %rcx
movq %rcx, 0x1a0(%rax)
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/eagle.c
// Function: server_updater
int server_updater(EventLoop *loop, long long id, void *data)
{
	EG_NOTUSED(loop);
	EG_NOTUSED(id);
	EG_NOTUSED(data);

	server->now_time = time(NULL);
	server->now_timems = mstime();
	server->msg_counter = 0;

	check_memory();
	client_timeout();
	process_queues_messages();
	storage_timeout();

	if (server->shutdown) {
		stop_event_loop(server->loop);
	}

	return 100;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
xorl %edi, %edi
callq 0x22a0
movq 0xf1db(%rip), %rcx      # 0x12290
movq %rax, 0x188(%rcx)
movq %rsp, %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x21a0
imulq $0x3e8, (%rbx), %rcx    # imm = 0x3E8
movabsq $0x20c49ba5e353f7cf, %rax # imm = 0x20C49BA5E353F7CF
imulq 0x8(%rbx)
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x7, %rdx
addq %rax, %rdx
addq %rcx, %rdx
movq 0xf19a(%rip), %rax      # 0x12290
movq %rdx, 0x190(%rax)
movl $0x0, 0x1b4(%rax)
callq 0x2eda
callq 0x8705
callq 0x2f54
callq 0x2fcb
movq 0xf16e(%rip), %rax      # 0x12290
cmpl $0x0, 0x1e0(%rax)
je 0x3133
movq (%rax), %rdi
callq 0x3c07
movl $0x64, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/eagle.c
// Function: init_storage
void init_storage()
{
	if (access(server->storage, F_OK) == -1)
	{
		if (storage_save(server->storage) != EG_STATUS_OK) {
			warning("Error init storage %s\n", server->storage);
		}
	}

	if (storage_load(server->storage) != EG_STATUS_OK) {
		warning("Error loading data from %s", server->storage);
	}
}

// Assembly:
pushq %rax
movq 0xf119(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rdi
xorl %esi, %esi
callq 0x23a0
cmpl $-0x1, %eax
jne 0x31bd
movq 0xf0ff(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rdi
callq 0xab82
testl %eax, %eax
je 0x31bd
movq 0xf0e8(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rsi
leaq 0x8ff0(%rip), %rdi      # 0xc1a6
xorl %eax, %eax
callq 0x4bc8
movq 0xf0cc(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rdi
callq 0xa5b0
testl %eax, %eax
je 0x31f1
movq 0xf0b5(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rsi
leaq 0x8fd4(%rip), %rdi      # 0xc1bd
xorl %eax, %eax
popq %rcx
jmp 0x4bc8
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/eagle.c
// Function: destroy_server
void destroy_server()
{
	if (server->child_pid != -1)
	{
		kill(server->child_pid, SIGKILL);
		remove_temp_file(server->child_pid);
	}

	if (server->fd > 0) {
		close(server->fd);
	}

	if (server->sfd > 0) {
		close(server->sfd);
	}

	if (server->pidfile) {
		unlink(server->pidfile);
	}

	if (server->unix_socket) {
		unlink(server->unix_socket);
	}

	disable_log();
}

// Assembly:
pushq %rax
movq 0xeed3(%rip), %rax      # 0x12290
movl 0x34(%rax), %edi
cmpl $-0x1, %edi
je 0x33e5
movl $0x9, %esi
callq 0x2290
movq 0xeeba(%rip), %rax      # 0x12290
movl 0x34(%rax), %edi
callq 0xb27f
movq 0xeeab(%rip), %rax      # 0x12290
movl 0x8(%rax), %edi
testl %edi, %edi
jle 0x33f8
callq 0x21d0
movq 0xee98(%rip), %rax      # 0x12290
movl 0xc(%rax), %edi
testl %edi, %edi
jle 0x340b
callq 0x21d0
movq 0xee85(%rip), %rax      # 0x12290
movq 0x1c8(%rax), %rdi
testq %rdi, %rdi
je 0x3423
callq 0x2060
movq 0xee6d(%rip), %rax      # 0x12290
movq 0x28(%rax), %rdi
testq %rdi, %rdi
je 0x3431
callq 0x2060
xorl %eax, %eax
popq %rcx
jmp 0x4c5b
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/eagle.c
// Function: init_config
void init_config(void)
{
	if (access(server->config, F_OK) != -1)
	{
		if (config_load(server->config) != EG_STATUS_OK)
		{
			fatal("Error load config file %s", server->config);
		}
	}
	else
	{
		warning("Config file %s don't exist", server->config);
	}
}

// Assembly:
pushq %rax
movq 0xee4f(%rip), %rax      # 0x12290
movq 0x1d8(%rax), %rdi
xorl %esi, %esi
callq 0x23a0
movq 0xee3a(%rip), %rcx      # 0x12290
movq 0x1d8(%rcx), %rsi
cmpl $-0x1, %eax
je 0x348b
movq %rsi, %rdi
callq 0xb7b8
testl %eax, %eax
je 0x349a
movq 0xee1b(%rip), %rax      # 0x12290
movq 0x1d8(%rax), %rsi
leaq 0x8db3(%rip), %rdi      # 0xc236
xorl %eax, %eax
popq %rcx
jmp 0x4dc6
leaq 0x8dbe(%rip), %rdi      # 0xc250
xorl %eax, %eax
popq %rcx
jmp 0x4bc8
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/eagle.c
// Function: destroy_server_config
void destroy_server_config(void)
{
	xfree(server->addr);
	xfree(server->name);
	xfree(server->password);
	xfree(server->storage);
	xfree(server->logfile);

	if (server->unix_socket)
		xfree(server->unix_socket);

	if (server->pidfile)
		xfree(server->pidfile);

	list_release(server->clients);
	list_release(server->users);
	list_release(server->queues);
	list_release(server->routes);
	list_release(server->channels);

	xfree(server);
}

// Assembly:
pushq %rax
movq 0xebba(%rip), %rax      # 0x12290
movq 0x18(%rax), %rdi
callq 0x4997
movq 0xebaa(%rip), %rax      # 0x12290
movq 0x38(%rax), %rdi
callq 0x4997
movq 0xeb9a(%rip), %rax      # 0x12290
movq 0x40(%rax), %rdi
callq 0x4997
movq 0xeb8a(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rdi
callq 0x4997
movq 0xeb77(%rip), %rax      # 0x12290
movq 0x1d0(%rax), %rdi
callq 0x4997
movq 0xeb64(%rip), %rax      # 0x12290
movq 0x28(%rax), %rdi
testq %rdi, %rdi
je 0x3741
callq 0x4997
movq 0xeb4f(%rip), %rax      # 0x12290
movq 0x1c8(%rax), %rdi
testq %rdi, %rdi
je 0x3759
callq 0x4997
movq 0xeb37(%rip), %rax      # 0x12290
movq 0x160(%rax), %rdi
callq 0x8c7e
movq 0xeb24(%rip), %rax      # 0x12290
movq 0x168(%rax), %rdi
callq 0x8c7e
movq 0xeb11(%rip), %rax      # 0x12290
movq 0x170(%rax), %rdi
callq 0x8c7e
movq 0xeafe(%rip), %rax      # 0x12290
movq 0x178(%rax), %rdi
callq 0x8c7e
movq 0xeaeb(%rip), %rax      # 0x12290
movq 0x180(%rax), %rdi
callq 0x8c7e
movq 0xead8(%rip), %rdi      # 0x12290
popq %rax
jmp 0x4997
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/eagle.c
// Function: show_logo
void show_logo(void)
{
	printf(ascii_logo,
		EAGLE_VERSION,
		server->addr,
		server->port,
		get_event_api_name());
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq 0xeaa7(%rip), %rbx      # 0x12270
movq 0xeac0(%rip), %rax      # 0x12290
movq 0x18(%rax), %r14
movl 0x20(%rax), %ebp
callq 0x42e3
leaq 0x8abd(%rip), %rsi      # 0xc2a0
movq %rbx, %rdi
movq %r14, %rdx
movl %ebp, %ecx
movq %rax, %r8
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x2180
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/eagle.c
// Function: parse_args
void parse_args(int argc, char *argv[])
{
	int position = 1;

	if (argc >= 2)
	{
		if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) {
			usage();
			exit(0);
		} else {
			server->config = argv[1];
			position = 2;
			init_config();
		}
	}

	for (; position < argc; position += 2)
	{
		if (position == argc - 1)
			fatal("Error parse command line. Key %s must have value", argv[position]);

		if (strncmp(argv[position], "--", 2))
			fatal("Error parse command line. Use prefix \'--\' for key");

		if (config_parse_key_value(argv[position] + 2, argv[position + 1]) != EG_STATUS_OK)
			fatal("Error parse command line");
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %r14d
movl $0x1, %eax
cmpl $0x2, %edi
jl 0x38b3
movq 0x8(%rbx), %r15
cmpb $0x2d, (%r15)
jne 0x3884
cmpb $0x68, 0x1(%r15)
jne 0x3884
cmpb $0x0, 0x2(%r15)
je 0x3935
leaq 0x8d03(%rip), %rsi      # 0xc58e
movq %r15, %rdi
callq 0x2230
testl %eax, %eax
je 0x3935
movq 0xe9ee(%rip), %rax      # 0x12290
movq %r15, 0x1d8(%rax)
callq 0x3439
movl $0x2, %eax
cmpl %r14d, %eax
jge 0x3926
leal -0x1(%r14), %ebp
movl %eax, %r15d
leaq 0x8d32(%rip), %r12      # 0xc5f8
leaq 0x8cf9(%rip), %r13      # 0xc5c6
cmpq %r15, %rbp
jne 0x38e4
movq (%rbx,%rbp,8), %rsi
leaq 0x8cb8(%rip), %rdi      # 0xc595
xorl %eax, %eax
callq 0x4dc6
movq (%rbx,%r15,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x38f3
cmpb $0x2d, 0x1(%rdi)
je 0x3901
movq %r13, %rdi
xorl %eax, %eax
callq 0x4dc6
movq (%rbx,%r15,8), %rdi
addq $0x2, %rdi
movq 0x8(%rbx,%r15,8), %rsi
callq 0xb504
testl %eax, %eax
je 0x391d
movq %r12, %rdi
xorl %eax, %eax
callq 0x4dc6
addq $0x2, %r15
cmpl %r14d, %r15d
jl 0x38cd
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x37f9
xorl %edi, %edi
callq 0x2440
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/eagle.c
// Function: main
int main(int argc, char *argv[])
{
	setup_signals();
	xmalloc_state_lock_on();

	init_commands();
	init_server_config();

	parse_args(argc, argv);

	show_logo();

	linux_overcommit_memory_warning();

	init_server();
	init_admin();
	init_storage();

	wlog("Server started (version: %s)", EAGLE_VERSION);

	start_main_loop(server->loop);

	delete_time_event(server->loop, server->ufd);
	delete_event_loop(server->loop);

	destroy_server();
	destroy_server_config();

	return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
callq 0x2bbc
callq 0x4a4f
callq 0x2c5c
callq 0x349c
movl %ebp, %edi
movq %rbx, %rsi
callq 0x384d
callq 0x37be
callq 0x2b20
testl %eax, %eax
jne 0x3983
leaq 0x8730(%rip), %rdi      # 0xc0ac
xorl %eax, %eax
callq 0x4bc8
callq 0x31f3
callq 0x313e
callq 0x316f
leaq 0x8c78(%rip), %rdi      # 0xc611
leaq 0x8900(%rip), %rsi      # 0xc2a0
xorl %eax, %eax
callq 0x4e5b
movq 0xe8e2(%rip), %rax      # 0x12290
movq (%rax), %rdi
callq 0x42b0
movq 0xe8d3(%rip), %rax      # 0x12290
movq (%rax), %rdi
movq 0x10(%rax), %rsi
callq 0x3e98
movq 0xe8c0(%rip), %rax      # 0x12290
movq (%rax), %rdi
callq 0x3bc2
callq 0x33b5
callq 0x36ce
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/event.c
// Function: create_event_loop
EventLoop *create_event_loop(int size)
{
	EventLoop *loop;
	int i;

	loop = (EventLoop*)xmalloc(sizeof(*loop));

	loop->events = (FileEvent*)xmalloc(sizeof(FileEvent) * size);
	loop->fired = (FiredEvent*)xmalloc(sizeof(FiredEvent) * size);

	loop->maxfd = -1;
	loop->size = size;
	loop->time_event_id = 0;
	loop->time_event = NULL;
	loop->stop = 0;
	loop->before_sleep_handler = NULL;

	if (event_api_init(loop) == -1) {
		xfree(loop->events);
		xfree(loop->fired);
		xfree(loop);
		return NULL;
	}

	for (i = 0; i < size; i++) {
		loop->events[i].mask = EG_EVENT_NONE;
	}

	return loop;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edi, %r14d
movl $0x40, %edi
callq 0x4770
movq %rax, %rbx
movslq %r14d, %r15
movq %r15, %rdi
shlq $0x5, %rdi
callq 0x4770
movq %rax, 0x10(%rbx)
leaq (,%r15,8), %rdi
callq 0x4770
movq %rax, 0x18(%rbx)
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
movl %r15d, 0x4(%rbx)
xorl %eax, %eax
movq %rax, 0x8(%rbx)
movq %rax, 0x20(%rbx)
movl $0x0, 0x28(%rbx)
movq %rax, 0x38(%rbx)
movl $0x10, %edi
callq 0x4770
movq %rax, %r15
movslq 0x4(%rbx), %rax
shlq $0x2, %rax
leaq (%rax,%rax,2), %rdi
callq 0x4770
movq %rax, 0x8(%r15)
movl $0x400, %edi            # imm = 0x400
callq 0x2420
movl %eax, (%r15)
cmpl $-0x1, %eax
je 0x3b8c
movq %r15, 0x30(%rbx)
testl %r14d, %r14d
jle 0x3bb9
movq 0x10(%rbx), %rax
movl %r14d, %ecx
addl $0x3, %r14d
decq %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
shrl $0x2, %r14d
shlq $0x7, %r14
movdqa 0x8b7f(%rip), %xmm1     # 0xc630
movdqa 0x8b87(%rip), %xmm2     # 0xc640
xorl %ecx, %ecx
movdqa 0x8b8d(%rip), %xmm3     # 0xc650
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movdqa 0x8b8d(%rip), %xmm5     # 0xc660
movdqa %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %edx
notl %edx
testb $0x1, %dl
je 0x3b0e
movl $0x0, (%rax,%rcx)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %edx
testb $0x1, %dl
je 0x3b24
movl $0x0, 0x20(%rax,%rcx)
movdqa %xmm1, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
pxor %xmm4, %xmm6
pextrw $0x0, %xmm6, %edx
testb $0x1, %dl
je 0x3b63
movl $0x0, 0x40(%rax,%rcx)
pextrw $0x4, %xmm6, %edx
testb $0x1, %dl
je 0x3b75
movl $0x0, 0x60(%rax,%rcx)
paddq %xmm5, %xmm2
paddq %xmm5, %xmm1
subq $-0x80, %rcx
cmpq %rcx, %r14
jne 0x3ad3
jmp 0x3bb9
movq 0x8(%r15), %rdi
callq 0x4997
movq %r15, %rdi
callq 0x4997
movq 0x10(%rbx), %rdi
callq 0x4997
movq 0x18(%rbx), %rdi
callq 0x4997
movq %rbx, %rdi
callq 0x4997
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/event.c
// Function: delete_event_loop
void delete_event_loop(EventLoop *loop)
{
	event_api_free(loop);
	xfree(loop->events);
	xfree(loop->fired);
	xfree(loop);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x30(%rdi), %r14
movl (%r14), %edi
callq 0x21d0
movq 0x8(%r14), %rdi
callq 0x4997
movq %r14, %rdi
callq 0x4997
movq 0x10(%rbx), %rdi
callq 0x4997
movq 0x18(%rbx), %rdi
callq 0x4997
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4997
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/event.c
// Function: create_file_event
int create_file_event(EventLoop *loop, int fd, int mask, file_handler *handler, void *data)
{
	FileEvent *file_event;

	if (fd >= loop->size) {
		return EG_EVENT_ERR;
	}

	file_event = &loop->events[fd];

	if (event_api_add(loop, fd, mask) == -1) {
		return EG_EVENT_ERR;
	}

	file_event->mask |= mask;

	if (mask & EG_EVENT_READABLE) {
		file_event->read_handler = handler;
	}

	if (mask & EG_EVENT_WRITABLE) {
		file_event->write_handler = handler;
	}

	file_event->data = data;

	if (fd > loop->maxfd) {
		loop->maxfd = fd;
	}

	return EG_EVENT_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
cmpl %esi, 0x4(%rdi)
jle 0x3cc2
movl %edx, %ebp
movl %esi, %ebx
movq %rdi, %r14
movq %rcx, 0x8(%rsp)
movq %r8, 0x10(%rsp)
movslq %esi, %rdx
movq %rdx, %r12
shlq $0x5, %r12
movq 0x10(%rdi), %r15
movq 0x30(%rdi), %rax
movl (%r15,%r12), %esi
movl %esi, %ecx
orl %ebp, %ecx
movl %ecx, %edi
andl $0x1, %edi
andl $0x2, %ecx
leal (%rdi,%rcx,2), %edi
leaq 0x1c(%rsp), %rcx
movl %edi, (%rcx)
xorl %edi, %edi
testl %esi, %esi
setne %dil
leal 0x1(,%rdi,2), %esi
movq $0x0, 0x4(%rcx)
movl %edx, 0x4(%rcx)
movl (%rax), %edi
callq 0x21f0
cmpl $-0x1, %eax
je 0x3cc2
addq %r12, %r15
orl %ebp, (%r15)
testb $0x1, %bpl
movq 0x8(%rsp), %rcx
je 0x3ca4
movq %rcx, 0x8(%r15)
testb $0x2, %bpl
movq 0x10(%rsp), %rax
je 0x3cb3
movq %rcx, 0x10(%r15)
movq %rax, 0x18(%r15)
xorl %r13d, %r13d
cmpl %ebx, (%r14)
jge 0x3cc2
movl %ebx, (%r14)
movl %r13d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/event.c
// Function: delete_file_event
void delete_file_event(EventLoop *loop, int fd, int mask)
{
	FileEvent *file_event;
	int i;

	if (fd >= loop->size) {
		return;
	}

	file_event = &loop->events[fd];

	if (file_event->mask == EG_EVENT_NONE) {
		return;
	}

	file_event->mask = file_event->mask & (~mask);

	if (fd == loop->maxfd && file_event->mask == EG_EVENT_NONE) {
		for (i = loop->maxfd - 1; i >= 0; i--) {
			if (loop->events[i].mask != EG_EVENT_NONE) {
				break;
			}
		}
		loop->maxfd = i;
	}

	event_api_delete(loop, fd, mask);
}

// Assembly:
cmpl %esi, 0x4(%rdi)
jle 0x3d97
subq $0x18, %rsp
movl %esi, %eax
movq 0x10(%rdi), %rsi
movslq %eax, %r8
shlq $0x5, %r8
movl (%rsi,%r8), %ecx
testl %ecx, %ecx
je 0x3d93
addq %rsi, %r8
notl %edx
andl %edx, %ecx
movl %ecx, (%r8)
jne 0x3d40
cmpl %eax, (%rdi)
jne 0x3d40
movl %eax, %edx
movl %eax, %r8d
sarl $0x1f, %r8d
andl %eax, %r8d
decl %r8d
decq %rdx
movl %eax, %r9d
testl %r9d, %r9d
jle 0x3d3a
movl %edx, %r10d
shlq $0x5, %r10
decl %r9d
decq %rdx
cmpl $0x0, (%rsi,%r10)
je 0x3d1f
jmp 0x3d3d
movl %r8d, %r9d
movl %r9d, (%rdi)
movq 0x30(%rdi), %rdx
movl %ecx, %esi
andl $0x1, %esi
movl %esi, 0xc(%rsp)
testb $0x2, %cl
jne 0x3d6c
movq $0x0, 0x10(%rsp)
movl %eax, 0x10(%rsp)
cmpl $0x1, %ecx
movl $0x3, %esi
sbbl $0x0, %esi
jmp 0x3d85
orl $0x4, %esi
movl %esi, 0xc(%rsp)
movq $0x0, 0x10(%rsp)
movl %eax, 0x10(%rsp)
movl $0x3, %esi
movl (%rdx), %edi
leaq 0xc(%rsp), %rcx
movl %eax, %edx
callq 0x21f0
addq $0x18, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/event.c
// Function: delete_time_event
int delete_time_event(EventLoop *loop, long long id)
{
	TimeEvent *time_event = loop->time_event, *prev = NULL;

	while (time_event)
	{
		if (time_event->id == id)
		{
			if (prev == NULL) {
				loop->time_event = time_event->next;
			} else {
				prev->next = time_event->next;
			}

			if (time_event->finalizer_handler) {
				time_event->finalizer_handler(loop, time_event->data);
			}

			xfree(time_event);
			return EG_EVENT_OK;
		}

		prev = time_event;
		time_event = time_event->next;
	}

	return EG_EVENT_ERR;
}

// Assembly:
pushq %rbx
movq 0x20(%rdi), %rbx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rbx, %rbx
je 0x3ef6
cmpq %rsi, (%rbx)
jne 0x3eb0
xorl %ecx, %ecx
jmp 0x3ec7
movq %rbx, %rdx
movq 0x30(%rdx), %rbx
testq %rbx, %rbx
je 0x3ef6
movq %rdx, %rcx
movq %rbx, %rdx
cmpq %rsi, (%rbx)
jne 0x3eb3
leaq 0x20(%rdi), %rax
leaq 0x30(%rcx), %rdx
testq %rcx, %rcx
cmoveq %rax, %rdx
movq 0x30(%rbx), %rax
movq %rax, (%rdx)
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x3eec
movq 0x28(%rbx), %rsi
callq *%rax
movq %rbx, %rdi
callq 0x4997
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/event.c
// Function: start_main_loop
void start_main_loop(EventLoop *loop)
{
	loop->stop = 0;

	while (!loop->stop)
	{
		if (loop->before_sleep_handler != NULL)
			loop->before_sleep_handler(loop);

		process_events(loop, EG_EVENTS_ALL);
	}
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x0, 0x28(%rdi)
movq 0x38(%rbx), %rax
testq %rax, %rax
je 0x42c9
movq %rbx, %rdi
callq *%rax
movq %rbx, %rdi
movl $0x3, %esi
callq 0x3ef8
cmpl $0x0, 0x28(%rbx)
je 0x42bb
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/network.c
// Function: net_tcp_server
int net_tcp_server(char *err, const char *addr, int port)
{
	int sock;
	struct sockaddr_in sa;

	if ((sock = net_create_socket(err, AF_INET)) == EG_NET_ERR) {
		return EG_NET_ERR;
	}

	memset(&sa, 0, sizeof(sa));

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

	if (addr && inet_aton(addr, &sa.sin_addr) == 0) {
		net_set_error(err, "Invalid bind address");
		close(sock);
		return EG_NET_ERR;
	}

	if (net_listen(err, sock, (struct sockaddr*)&sa, sizeof(sa)) == EG_NET_ERR) {
		return EG_NET_ERR;
	}

	return sock;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edx, %r12d
movq %rsi, %r15
movq %rdi, %r14
movl $0x2, %esi
callq 0x44ee
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $-0x1, %eax
je 0x44df
movl %eax, %ebx
movq $0x0, 0x8(%rsp)
rolw $0x8, %r12w
movw $0x2, (%rsp)
movw %r12w, 0x2(%rsp)
movl $0x0, 0x4(%rsp)
testq %r15, %r15
je 0x44ab
leaq 0x4(%rsp), %rsi
movq %r15, %rdi
callq 0x22c0
testl %eax, %eax
je 0x44c7
movq %rsp, %rdx
movq %r14, %rdi
movl %ebx, %esi
movl $0x10, %ecx
callq 0x4575
cmpl $-0x1, %eax
cmovel %eax, %ebx
movl %ebx, %ebp
jmp 0x44df
leaq 0x81c1(%rip), %rsi      # 0xc68f
movq %r14, %rdi
xorl %eax, %eax
callq 0x4352
movl %ebx, %edi
callq 0x21d0
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/network.c
// Function: net_create_socket
static int net_create_socket(char *err, int domain)
{
	int sock, on = 1;

	if ((sock = socket(domain, SOCK_STREAM, 0)) == -1) {
		net_set_error(err, "socket: %s", strerror(errno));
		return EG_NET_ERR;
	}

	if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) {
		net_set_error(err, "setsockopt: %s", strerror(errno));
		return EG_NET_ERR;
	}

	return sock;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1, 0x4(%rsp)
movl %esi, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x24b0
cmpl $-0x1, %eax
je 0x4547
movl %eax, %ebp
leaq 0x4(%rsp), %rcx
movl %eax, %edi
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x20d0
cmpl $-0x1, %eax
jne 0x456c
callq 0x2050
movl (%rax), %edi
callq 0x2470
leaq 0x813b(%rip), %rsi      # 0xc680
jmp 0x455a
callq 0x2050
movl (%rax), %edi
callq 0x2470
leaq 0x814a(%rip), %rsi      # 0xc6a4
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x4352
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/network.c
// Function: net_listen
static int net_listen(char *err, int sock, struct sockaddr *sa, socklen_t len)
{
	if (bind(sock, sa, len) == -1) {
		net_set_error(err, "bind: %s", strerror(errno));
		warning("bind socket error:\n%s", err);
		close(sock);
		return EG_NET_ERR;
	}

	if (listen(sock, 511) == -1) { /* 511 is optimal backlog value for most OS */
		net_set_error(err, "listen: %s", strerror(errno));
		close(sock);
		return EG_NET_ERR;
	}

	return EG_NET_OK;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movl %esi, %edi
movq %rdx, %rsi
movl %ecx, %edx
callq 0x2370
cmpl $-0x1, %eax
je 0x45c6
movl %ebx, %edi
movl $0x1ff, %esi            # imm = 0x1FF
callq 0x2310
movl %eax, %ecx
xorl %eax, %eax
cmpl $-0x1, %ecx
jne 0x4603
callq 0x2050
movl (%rax), %edi
callq 0x2470
leaq 0x8117(%rip), %rsi      # 0xc6ce
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x4352
jmp 0x45f7
callq 0x2050
movl (%rax), %edi
callq 0x2470
leaq 0x80d6(%rip), %rsi      # 0xc6af
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x4352
leaq 0x80cb(%rip), %rdi      # 0xc6b8
movq %r14, %rsi
xorl %eax, %eax
callq 0x4bc8
movl %ebx, %edi
callq 0x21d0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/network.c
// Function: net_unix_server
int net_unix_server(char *err, const char *path, mode_t perm)
{
	int sock;
	struct sockaddr_un sa;

	if ((sock = net_create_socket(err, AF_LOCAL)) == EG_NET_ERR) {
		return EG_NET_ERR;
	}

	memset(&sa, 0, sizeof(sa));
	sa.sun_family = AF_LOCAL;

	strncpy(sa.sun_path, path, sizeof(sa.sun_path) - 1);

	if (net_listen(err, sock, (struct sockaddr*)&sa, sizeof(sa)) == EG_NET_ERR) {
		return EG_NET_ERR;
	}

	if (perm) {
		chmod(sa.sun_path, perm);
	}

	return sock;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %edx, %ebx
movq %rsi, %r13
movq %rdi, %r12
movl $0x1, %esi
callq 0x44ee
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpl $-0x1, %eax
je 0x4685
movl %eax, %ebp
leaq 0xc(%rsp), %r15
movw $0x0, 0x6a(%r15)
movw $0x1, -0x2(%r15)
movl $0x6b, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x2070
leaq 0xa(%rsp), %rdx
movq %r12, %rdi
movl %ebp, %esi
movl $0x6e, %ecx
callq 0x4575
cmpl $-0x1, %eax
je 0x4685
testl %ebx, %ebx
je 0x4682
movq %r15, %rdi
movl %ebx, %esi
callq 0x2360
movl %ebp, %r14d
movl %r14d, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/network.c
// Function: net_tcp_accept
int net_tcp_accept(char *err, int sock, char *ip, int *port)
{
	int fd;
	struct sockaddr_in sa;
	socklen_t sa_len = sizeof(sa);

	if ((fd = net_generic_accept(err, sock, (struct sockaddr*)&sa, &sa_len)) == EG_NET_ERR) {
		return EG_NET_ERR;
	}

	if (ip) {
		strcpy(ip, inet_ntoa(sa.sin_addr));
	}

	if (port) {
		*port = ntohs(sa.sin_port);
	}

	return fd;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rcx, %rbx
movq %rdx, %r14
leaq 0xc(%rsp), %rcx
movl $0x10, (%rcx)
leaq 0x10(%rsp), %rdx
callq 0x46f8
movl %eax, %ebp
cmpl $-0x1, %eax
je 0x46ed
testq %r14, %r14
je 0x46da
movl 0x14(%rsp), %edi
callq 0x2110
movq %r14, %rdi
movq %rax, %rsi
callq 0x2090
testq %rbx, %rbx
je 0x46ed
movzwl 0x12(%rsp), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, (%rbx)
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/network.c
// Function: net_generic_accept
static int net_generic_accept(char *err, int sock, struct sockaddr *sa, socklen_t *len)
{
	int fd;

	while (1)
	{
		fd = accept(sock, sa, len);
		if (fd == -1)
		{
			if (errno == EINTR) {
				continue;
			} else {
				net_set_error(err, "accept: %s", strerror(errno));
				return EG_NET_ERR;
			}
		}
		break;
	}

	return fd;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %r15
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %r14
movl %ebp, %edi
movq %r12, %rsi
movq %r15, %rdx
callq 0x2400
movl %eax, %ebx
cmpl $-0x1, %eax
jne 0x4744
callq 0x2050
movl (%rax), %edi
cmpl $0x4, %edi
je 0x470b
callq 0x2470
leaq 0x7fa2(%rip), %rsi      # 0xc6d9
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x4352
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/xmalloc.c
// Function: xmalloc
void *xmalloc(size_t size)
{
	void *ptr = malloc(size + PREFIX_SIZE);

	if (!ptr) {
		fatal("Error allocate memory");
	}

#ifdef HAVE_MALLOC_SIZE
	xmalloc_update_stat_alloc(xmalloc_size(ptr));
	return ptr;
#else
	*((size_t*)ptr) = size;
	xmalloc_update_stat_alloc(size + PREFIX_SIZE);
	return (char*)ptr + PREFIX_SIZE;
#endif
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
leaq 0x8(%rdi), %r14
movq %r14, %rdi
callq 0x22f0
movq %rax, %rbx
testq %rax, %rax
jne 0x479d
leaq 0x7f4e(%rip), %rdi      # 0xc6e4
xorl %eax, %eax
callq 0x4dc6
movq %r15, (%rbx)
movq %r15, %r12
andq $-0x8, %r12
addq $0x10, %r12
testb $0x7, %r15b
cmoveq %r14, %r12
cmpb $0x1, 0xe30e(%rip)      # 0x12ac8
jne 0x47dc
leaq 0xe2dd(%rip), %r14      # 0x12aa0
movq %r14, %rdi
callq 0x2490
addq %r12, 0xe2fe(%rip)      # 0x12ad0
movq %r14, %rdi
callq 0x22e0
jmp 0x47e3
addq %r12, 0xe2ed(%rip)      # 0x12ad0
addq $0x8, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/xmalloc.c
// Function: xcalloc
void *xcalloc(size_t size)
{
	void *ptr = calloc(1, size + PREFIX_SIZE);

	if (!ptr) {
		fatal("Error allocate memory");
	}

#ifdef HAVE_MALLOC_SIZE
	xmalloc_update_stat_alloc(xmalloc_size(ptr));
	return ptr;
#else
	*((size_t*)ptr) = size;
	xmalloc_update_stat_alloc(size + PREFIX_SIZE);
	return (char*)ptr + PREFIX_SIZE;
#endif
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
leaq 0x8(%rdi), %r14
movl $0x1, %edi
movq %r14, %rsi
callq 0x2220
movq %rax, %rbx
testq %rax, %rax
jne 0x4828
leaq 0x7ec3(%rip), %rdi      # 0xc6e4
xorl %eax, %eax
callq 0x4dc6
movq %r15, (%rbx)
movq %r15, %r12
andq $-0x8, %r12
addq $0x10, %r12
testb $0x7, %r15b
cmoveq %r14, %r12
cmpb $0x1, 0xe283(%rip)      # 0x12ac8
jne 0x4867
leaq 0xe252(%rip), %r14      # 0x12aa0
movq %r14, %rdi
callq 0x2490
addq %r12, 0xe273(%rip)      # 0x12ad0
movq %r14, %rdi
callq 0x22e0
jmp 0x486e
addq %r12, 0xe262(%rip)      # 0x12ad0
addq $0x8, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/xmalloc.c
// Function: xrealloc
void *xrealloc(void *ptr, size_t size)
{
#ifndef HAVE_MALLOC_SIZE
	void *realptr;
#endif
	size_t oldsize;
	void *newptr;

	if (!ptr) {
		return xmalloc(size);
	}

#ifdef HAVE_MALLOC_SIZE
	oldsize = xmalloc_size(ptr);
	newptr = realloc(ptr, size);

	if (!newptr) {
		fatal("Error allocate memory");
	}

	xmalloc_update_stat_free(oldsize);
	xmalloc_update_stat_alloc(xmalloc_size(newptr));

	return newptr;
#else
	realptr = (char*)ptr - PREFIX_SIZE;
	oldsize = *((size_t*)realptr);
	newptr = realloc(realptr, size + PREFIX_SIZE);

	if (!newptr) {
		fatal("Error allocate memory");
	}

	*((size_t*)newptr) = size;
	xmalloc_update_stat_free(oldsize);
	xmalloc_update_stat_alloc(size);

	return (char*)newptr + PREFIX_SIZE;
#endif
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
testq %rdi, %rdi
je 0x491f
movq -0x8(%rdi), %r12
addq $-0x8, %rdi
leaq 0x8(%rbx), %rsi
callq 0x2330
movq %rax, %r14
testq %rax, %rax
jne 0x48bc
leaq 0x7e2f(%rip), %rdi      # 0xc6e4
xorl %eax, %eax
callq 0x4dc6
movq %rbx, (%r14)
addq $0x7, %r12
andq $-0x8, %r12
cmpb $0x0, 0xe1fa(%rip)      # 0x12ac8
je 0x4932
leaq 0xe1c9(%rip), %r15      # 0x12aa0
movq %r15, %rdi
callq 0x2490
subq %r12, 0xe1ea(%rip)      # 0x12ad0
movq %r15, %rdi
callq 0x22e0
addq $0x7, %rbx
andq $-0x8, %rbx
cmpb $0x0, 0xe1cb(%rip)      # 0x12ac8
je 0x4946
leaq 0xe19a(%rip), %r15      # 0x12aa0
movq %r15, %rdi
callq 0x2490
addq %rbx, 0xe1bb(%rip)      # 0x12ad0
movq %r15, %rdi
callq 0x22e0
jmp 0x4957
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4770
movq 0xe197(%rip), %rax      # 0x12ad0
subq %r12, %rax
addq $0x7, %rbx
andq $-0x8, %rbx
jmp 0x494d
movq 0xe183(%rip), %rax      # 0x12ad0
addq %rbx, %rax
movq %rax, 0xe179(%rip)      # 0x12ad0
addq $0x8, %r14
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/xmalloc.c
// Function: xfree
void xfree(void *ptr)
{
#ifndef HAVE_MALLOC_SIZE
	void *realptr;
	size_t oldsize;
#endif

	if (!ptr) {
		return;
	}

#ifdef HAVE_MALLOC_SIZE
	xmalloc_update_stat_free(xmalloc_size(ptr));
	free(ptr);
#else
	realptr = (char*)ptr - PREFIX_SIZE;
	oldsize = *((size_t*)realptr);
	xmalloc_update_stat_free(oldsize + PREFIX_SIZE);
	free(realptr);
#endif
}

// Assembly:
testq %rdi, %rdi
je 0x49ea
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq -0x8(%rdi), %rax
addq $-0x8, %rbx
leaq 0x8(%rax), %rcx
movq %rax, %r15
andq $-0x8, %r15
addq $0x10, %r15
testb $0x7, %al
cmoveq %rcx, %r15
cmpb $0x1, 0xe100(%rip)      # 0x12ac8
jne 0x49eb
leaq 0xe0cf(%rip), %r14      # 0x12aa0
movq %r14, %rdi
callq 0x2490
subq %r15, 0xe0f0(%rip)      # 0x12ad0
movq %r14, %rdi
callq 0x22e0
jmp 0x49f2
retq
subq %r15, 0xe0de(%rip)      # 0x12ad0
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2030
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/xmalloc.c
// Function: xmalloc_used_memory
size_t xmalloc_used_memory(void)
{
	size_t um;

	if (xmalloc_state_lock) {
#ifdef HAVE_ATOMIC
		um = __sync_add_and_fetch(&used_memory, 0);
#else
		pthread_mutex_lock(&memory_stat_mutex);
		um = used_memory;
		pthread_mutex_unlock(&memory_stat_mutex);
#endif
	} else {
		um = used_memory;
	}

	return um;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpb $0x1, 0xe0ad(%rip)      # 0x12ac8
jne 0x4a3d
leaq 0xe07c(%rip), %r14      # 0x12aa0
movq %r14, %rdi
callq 0x2490
movq 0xe09d(%rip), %rbx      # 0x12ad0
movq %r14, %rdi
callq 0x22e0
jmp 0x4a44
movq 0xe08c(%rip), %rbx      # 0x12ad0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/yakushstanislav[P]EagleMQ/src/xmalloc.c
// Function: xmalloc_memory_rss
size_t xmalloc_memory_rss(void)
{
	int page = sysconf(_SC_PAGESIZE);
	size_t rss;
	char buf[4096];
	char filename[256];
	int fd, count;
	char *p, *x;

	snprintf(filename, 256, "/proc/%d/stat", getpid());
	if ((fd = open(filename, O_RDONLY)) == -1) {
		return 0;
	}

	if (read(fd, buf, 4096) <= 0) {
		close(fd);
		return 0;
	}

	close(fd);

	p = buf;
	count = 23;
	while (p && count--) {
		p = strchr(p, ' ');
		if (p) p++;
	}

	if (!p) {
		return 0;
	}

	x = strchr(p, ' ');
	if (!x) {
		return 0;
	}

	*x = '\0';

	rss = strtoll(p, NULL, 10);
	rss *= page;

	return rss;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1108, %rsp           # imm = 0x1108
movl $0x1e, %edi
callq 0x23e0
movq %rax, %rbx
callq 0x2100
leaq 0x7c7d(%rip), %rdx      # 0xc6fa
xorl %r14d, %r14d
movq %rsp, %r15
movl $0x100, %esi            # imm = 0x100
movq %r15, %rdi
movl %eax, %ecx
xorl %eax, %eax
callq 0x2190
movq %r15, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x2390
cmpl $-0x1, %eax
je 0x4b21
movl %eax, %ebp
leaq 0x100(%rsp), %r15
movl $0x1000, %edx           # imm = 0x1000
movl %eax, %edi
movq %r15, %rsi
callq 0x2200
movq %rax, %r14
movl %ebp, %edi
callq 0x21d0
testq %r14, %r14
jle 0x4b1e
movl $0xffffffe8, %ebp       # imm = 0xFFFFFFE8
xorl %r14d, %r14d
incl %ebp
je 0x4af1
movq %r15, %rdi
movl $0x20, %esi
callq 0x2170
leaq 0x1(%rax), %r15
testq %rax, %rax
jne 0x4ad5
jmp 0x4b21
movq %r15, %rdi
movl $0x20, %esi
callq 0x2170
testq %rax, %rax
je 0x4b1e
movb $0x0, (%rax)
movq %r15, %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x2250
movslq %ebx, %r14
imulq %rax, %r14
jmp 0x4b21
xorl %r14d, %r14d
movq %r14, %rax
addq $0x1108, %rsp           # imm = 0x1108
popq %rbx
popq %r14
popq %r15
popq %rbp
retq