LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/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 0x242ff
movl $0x400, %edx            # imm = 0x400
movq %rbx, %rsi
callq 0x30c0
jmp 0x2439b
movl 0x50(%rax), %ecx
movl 0x54(%rax), %r13d
movups 0x3877(%rip), %xmm0     # 0x27b84
movups %xmm0, 0x10(%rbx)
movups 0x385c(%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 0x24377
movl %ecx, %r12d
negl %r12d
cmovsl %ecx, %r12d
testl %ecx, %ecx
cmovsl %eax, %r15d
movq %rbx, %rdi
callq 0x3110
leaq (%rax,%rbx), %rdi
leaq 0x382d(%rip), %rsi      # 0x27b97
movl %r12d, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x3300
testl %r13d, %r13d
je 0x2439b
movq %rbx, %rdi
callq 0x3110
leaq (%rax,%rbx), %rdi
leaq 0x381f(%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_O1/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 0x24588
movl %ebp, %eax
andl $-0x3, %eax
movl %eax, 0xc(%rbx)
movq %rbx, %rdi
callq 0x177b6
testl %eax, %eax
jne 0x245aa
movq %rbx, %rdi
callq 0x19441
testl %eax, %eax
jne 0x245aa
movl $0x3e8, 0x1f274(%rbx)   # imm = 0x3E8
movl %ebp, 0xc(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1495d
// File: /workspace/github_c_makefile_star2_O1/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 0x223a9
testl %eax, %eax
je 0x245e6
movl 0x1f274(%rbx), %eax
cmpl $0xca, %eax
je 0x245da
cmpl $0xe, %eax
jne 0x245ee
movl $0x0, 0x1f274(%rbx)
jmp 0x245ee
movq %rbx, %rdi
callq 0x19ad3
movq %rbx, %rdi
popq %rbx
jmp 0x1495d
// File: /workspace/github_c_makefile_star2_O1/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 0x4044
movq %rbp, (%rax)
testq %r13, %r13
je 0x2462c
movq %r15, %rdi
callq 0x4067
movq %r13, (%rax)
movq %r15, %rdi
callq 0x40c7
movq %r12, (%rax)
testq %r14, %r14
je 0x24652
cmpb $0x0, (%r14)
je 0x24652
movq %r15, %rdi
callq 0x40ea
testq %rax, %rax
je 0x24652
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_O1/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 0x24b78
movq %r14, %rdi
callq 0x3110
movq %rax, %r15
addq %r14, %r15
movq %r15, %rdx
subq %r14, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x102a8
testl %eax, %eax
jne 0x24b9b
leaq 0x1(%r15), %r14
cmpb $0x0, (%r15)
jne 0x24b55
xorl %eax, %eax
jmp 0x24ba1
movl 0x1f274(%rbx), %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x9a99(%rip), %rsi      # 0xc06d
callq 0x23c0
testq %rax, %rax
je 0x2602
movq %rax, %rbx
callq 0x2110
leaq 0x9a82(%rip), %rsi      # 0xc06f
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2270
movq %rbx, %rdi
popq %rbx
jmp 0x2130
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x2490
testl %eax, %eax
jne 0x265f
callq 0x21f0
leaq 0x9a59(%rip), %rdi      # 0xc073
movl $0x2, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x23a0
cmpl $-0x1, %eax
je 0x265d
movl %eax, %ebx
movl %eax, %edi
xorl %esi, %esi
callq 0x2170
movl %ebx, %edi
movl $0x1, %esi
callq 0x2170
movl %ebx, %edi
movl $0x2, %esi
callq 0x2170
cmpl $0x3, %ebx
jl 0x265d
movl %ebx, %edi
popq %rbx
jmp 0x21e0
popq %rbx
retq
xorl %edi, %edi
callq 0x2450
// File: /workspace/github_c_makefile_star2_O1/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 0xfc1c(%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 0x2470
cmpl $-0x1, %eax
je 0x26cb
movq 0x8(%rsp), %rbx
cmpq %r14, %rbx
jae 0x26f8
leaq 0x8(%rsp), %rsi
movq %r14, (%rsi)
movq %r14, 0x8(%rsi)
movl $0x7, %edi
callq 0x2330
cmpl $-0x1, %eax
jne 0x26f8
addq $-0x20, %rbx
jmp 0x26ed
callq 0x2050
movl (%rax), %edi
callq 0x2480
leaq 0x999f(%rip), %rdi      # 0xc07d
movq %rax, %rsi
xorl %eax, %eax
callq 0x4734
movl $0x3e0, %ebx            # imm = 0x3E0
movq 0xfb9c(%rip), %rax      # 0x12290
movq %rbx, 0x48(%rax)
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x997d(%rip), %rdi      # 0xc08d
leaq 0xa14f(%rip), %rsi      # 0xc866
callq 0x23c0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x2753
movq %rax, %r14
movq %rsp, %rdi
movl $0x40, %esi
movq %rax, %rdx
callq 0x2220
movq %rax, %r15
movq %r14, %rdi
callq 0x2130
testq %r15, %r15
je 0x2753
movq %rsp, %rdi
callq 0x2420
movl %eax, %ebx
movl %ebx, %eax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x2250
movl $0x1, %esi
movl $0xd, %edi
callq 0x2250
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x2280
movl $0xc8000000, 0x80(%rbx) # imm = 0xC8000000
leaq -0x66(%rip), %rax       # 0x277a
movq %rax, -0x8(%rbx)
leaq 0x8(%rsp), %rsi
movl $0xf, %edi
xorl %edx, %edx
callq 0x20b0
addq $0xa0, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x21b0
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_O1/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 0xf7cf(%rip), %rax      # 0x12290
cmpq $0x0, 0x50(%rax)
je 0x2b3d
pushq %rax
callq 0x4577
movq 0xf7bb(%rip), %rcx      # 0x12290
xorl %edx, %edx
cmpq 0x50(%rcx), %rax
jbe 0x2b33
movq 0x188(%rcx), %rax
subq 0x1a8(%rcx), %rax
cmpq $0xb, %rax
jl 0x2b27
callq 0x4577
movq 0xf793(%rip), %rcx      # 0x12290
movq 0x50(%rcx), %rdx
leaq 0x9628(%rip), %rdi      # 0xc130
movq %rax, %rsi
xorl %eax, %eax
callq 0x4734
movq 0xf777(%rip), %rax      # 0x12290
movq 0x188(%rax), %rcx
movq %rcx, 0x1a8(%rax)
movl $0x1, %edx
movq 0xf75d(%rip), %rcx      # 0x12290
movl %edx, 0x1b0(%rcx)
addq $0x8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0xf744(%rip), %rax      # 0x12290
movq 0x170(%rax), %rdi
leaq 0x8(%rsp), %rbx
movq %rbx, %rsi
callq 0x8a40
movq %rbx, %rdi
callq 0x89ff
testq %rax, %rax
je 0x2bad
leaq 0x8(%rsp), %rbx
movq 0x10(%rax), %r14
movq 0xf713(%rip), %rax      # 0x12290
movl 0x190(%rax), %esi
movq %r14, %rdi
callq 0x95d8
movq 0xf6fe(%rip), %rax      # 0x12290
movl 0x190(%rax), %esi
movq %r14, %rdi
callq 0x9649
movq %rbx, %rdi
callq 0x89ff
testq %rax, %rax
jne 0x2b72
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 0xf6d3(%rip), %rax      # 0x12290
cmpl $-0x1, 0x34(%rax)
je 0x2c09
leaq 0x4(%rsp), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x2140
testl %eax, %eax
je 0x2c09
cmpb $0x0, 0x5(%rsp)
je 0x2bfb
movq 0xf6aa(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rsi
leaq 0x9557(%rip), %rdi      # 0xc14b
xorl %eax, %eax
callq 0x4734
movq 0xf68e(%rip), %rax      # 0x12290
movl $0xffffffff, 0x34(%rax) # imm = 0xFFFFFFFF
movq 0xf680(%rip), %rax      # 0x12290
movslq 0x5c(%rax), %rcx
testq %rcx, %rcx
je 0x2c88
cmpl $-0x1, 0x34(%rax)
jne 0x2c88
movq 0x188(%rax), %rdx
subq 0x1a0(%rax), %rdx
cmpq %rcx, %rdx
jle 0x2c88
leaq 0x9535(%rip), %rdi      # 0xc16e
xorl %eax, %eax
callq 0x49c7
movq 0xf649(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rdi
callq 0xadbc
testl %eax, %eax
je 0x2c73
movq 0xf632(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rsi
leaq 0x9522(%rip), %rdi      # 0xc18e
xorl %eax, %eax
callq 0x4734
movq 0xf616(%rip), %rax      # 0x12290
movq 0x188(%rax), %rcx
movq %rcx, 0x1a0(%rax)
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x22b0
movq 0xf5f3(%rip), %rcx      # 0x12290
movq %rax, 0x188(%rcx)
movq %rsp, %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x21b0
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 0xf5b2(%rip), %rax      # 0x12290
movq %rdx, 0x190(%rax)
movl $0x0, 0x1b4(%rax)
callq 0x2aba
callq 0x826c
callq 0x2b3e
callq 0x2bb5
movq 0xf586(%rip), %rax      # 0x12290
cmpl $0x0, 0x1e0(%rax)
je 0x2d1b
movq (%rax), %rdi
callq 0x370a
movl $0x64, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/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 0xf531(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rdi
xorl %esi, %esi
callq 0x23b0
cmpl $-0x1, %eax
jne 0x2da5
movq 0xf517(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rdi
callq 0xa744
testl %eax, %eax
je 0x2da5
movq 0xf500(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rsi
leaq 0x9408(%rip), %rdi      # 0xc1a6
xorl %eax, %eax
callq 0x4734
movq 0xf4e4(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rdi
callq 0xa13c
testl %eax, %eax
je 0x2dd9
movq 0xf4cd(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rsi
leaq 0x93ec(%rip), %rdi      # 0xc1bd
xorl %eax, %eax
popq %rcx
jmp 0x4734
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O1/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 0xf2fc(%rip), %rax      # 0x12290
movl 0x34(%rax), %edi
cmpl $-0x1, %edi
je 0x2fb5
movl $0x9, %esi
callq 0x22a0
movq 0xf2e3(%rip), %rax      # 0x12290
movl 0x34(%rax), %edi
callq 0xae41
movq 0xf2d4(%rip), %rax      # 0x12290
movl 0x8(%rax), %edi
testl %edi, %edi
jle 0x2fc8
callq 0x21e0
movq 0xf2c1(%rip), %rax      # 0x12290
movl 0xc(%rax), %edi
testl %edi, %edi
jle 0x2fdb
callq 0x21e0
movq 0xf2ae(%rip), %rax      # 0x12290
movq 0x1c8(%rax), %rdi
testq %rdi, %rdi
je 0x2ff3
callq 0x2060
movq 0xf296(%rip), %rax      # 0x12290
movq 0x28(%rax), %rdi
testq %rdi, %rdi
je 0x3008
callq 0x2060
xorl %eax, %eax
popq %rcx
jmp 0x47c7
// File: /workspace/github_c_makefile_star2_O1/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 0xf278(%rip), %rax      # 0x12290
movq 0x1d8(%rax), %rdi
xorl %esi, %esi
callq 0x23b0
movq 0xf263(%rip), %rcx      # 0x12290
movq 0x1d8(%rcx), %rsi
cmpl $-0x1, %eax
je 0x3062
movq %rsi, %rdi
callq 0xb377
testl %eax, %eax
je 0x3071
movq 0xf244(%rip), %rax      # 0x12290
movq 0x1d8(%rax), %rsi
leaq 0x91dc(%rip), %rdi      # 0xc236
xorl %eax, %eax
popq %rcx
jmp 0x4932
leaq 0x91e7(%rip), %rdi      # 0xc250
xorl %eax, %eax
popq %rcx
jmp 0x4734
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O1/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 0xefe3(%rip), %rax      # 0x12290
movq 0x18(%rax), %rdi
callq 0x44fe
movq 0xefd3(%rip), %rax      # 0x12290
movq 0x38(%rax), %rdi
callq 0x44fe
movq 0xefc3(%rip), %rax      # 0x12290
movq 0x40(%rax), %rdi
callq 0x44fe
movq 0xefb3(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rdi
callq 0x44fe
movq 0xefa0(%rip), %rax      # 0x12290
movq 0x1d0(%rax), %rdi
callq 0x44fe
movq 0xef8d(%rip), %rax      # 0x12290
movq 0x28(%rax), %rdi
testq %rdi, %rdi
je 0x3311
callq 0x44fe
movq 0xef78(%rip), %rax      # 0x12290
movq 0x1c8(%rax), %rdi
testq %rdi, %rdi
je 0x3329
callq 0x44fe
movq 0xef60(%rip), %rax      # 0x12290
movq 0x160(%rax), %rdi
callq 0x87ea
movq 0xef4d(%rip), %rax      # 0x12290
movq 0x168(%rax), %rdi
callq 0x87ea
movq 0xef3a(%rip), %rax      # 0x12290
movq 0x170(%rax), %rdi
callq 0x87ea
movq 0xef27(%rip), %rax      # 0x12290
movq 0x178(%rax), %rdi
callq 0x87ea
movq 0xef14(%rip), %rax      # 0x12290
movq 0x180(%rax), %rdi
callq 0x87ea
movq 0xef01(%rip), %rdi      # 0x12290
popq %rax
jmp 0x44fe
// File: /workspace/github_c_makefile_star2_O1/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 0xeed8(%rip), %rbx      # 0x12278
movq 0xeee9(%rip), %rax      # 0x12290
movq 0x18(%rax), %r14
movl 0x20(%rax), %ebp
callq 0x3e42
leaq 0x8ee6(%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 0x2190
// File: /workspace/github_c_makefile_star2_O1/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 0x3489
movq 0x8(%rbx), %r15
leaq 0x9144(%rip), %rsi      # 0xc58e
movq %r15, %rdi
callq 0x2240
testl %eax, %eax
je 0x3515
leaq 0x9130(%rip), %rsi      # 0xc591
movq %r15, %rdi
callq 0x2240
testl %eax, %eax
je 0x3515
movq 0xee18(%rip), %rax      # 0x12290
movq %r15, 0x1d8(%rax)
callq 0x3010
movl $0x2, %eax
cmpl %r14d, %eax
jge 0x3506
leal -0x1(%r14), %r15d
movl %eax, %r13d
leaq 0x912d(%rip), %r12      # 0xc5c9
leaq 0x9129(%rip), %rbp      # 0xc5cc
cmpq %r13, %r15
jne 0x34ba
movq (%rbx,%r13,8), %rsi
leaq 0x90e5(%rip), %rdi      # 0xc598
xorl %eax, %eax
callq 0x4932
movq (%rbx,%r13,8), %rdi
movl $0x2, %edx
movq %r12, %rsi
callq 0x2080
testl %eax, %eax
je 0x34d9
movq %rbp, %rdi
xorl %eax, %eax
callq 0x4932
movq (%rbx,%r13,8), %rdi
movq 0x8(%rbx,%r13,8), %rsi
addq $0x2, %rdi
callq 0xb0c8
testl %eax, %eax
je 0x34fd
leaq 0x9108(%rip), %rdi      # 0xc5fe
xorl %eax, %eax
callq 0x4932
addq $0x2, %r13
cmpl %r14d, %r13d
jl 0x34a3
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x33d0
xorl %edi, %edi
callq 0x2450
// File: /workspace/github_c_makefile_star2_O1/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 0x279c
callq 0x45b6
callq 0x283c
callq 0x3073
movl %ebp, %edi
movq %rbx, %rsi
callq 0x3424
callq 0x3395
callq 0x2700
testl %eax, %eax
jne 0x3563
leaq 0x8b50(%rip), %rdi      # 0xc0ac
xorl %eax, %eax
callq 0x4734
callq 0x2ddb
callq 0x2d26
callq 0x2d57
leaq 0x909e(%rip), %rdi      # 0xc617
leaq 0x8d20(%rip), %rsi      # 0xc2a0
xorl %eax, %eax
callq 0x49c7
movq 0xed02(%rip), %rax      # 0x12290
movq (%rax), %rdi
callq 0x3e0f
movq 0xecf3(%rip), %rax      # 0x12290
movq (%rax), %rdi
movq 0x10(%rax), %rsi
callq 0x3987
movq 0xece0(%rip), %rax      # 0x12290
movq (%rax), %rdi
callq 0x36c5
callq 0x2f8c
callq 0x32a5
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/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 %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebp
movl $0x40, %edi
callq 0x42f0
movq %rax, %rbx
movslq %ebp, %r14
movq %r14, %rdi
shlq $0x5, %rdi
callq 0x42f0
movq %rax, 0x10(%rbx)
leaq (,%r14,8), %rdi
callq 0x42f0
movq %rax, 0x18(%rbx)
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
movl %r14d, 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 0x42f0
movq %rax, %r14
movslq 0x4(%rbx), %rax
shlq $0x2, %rax
leaq (%rax,%rax,2), %rdi
callq 0x42f0
movq %rax, 0x8(%r14)
movl $0x400, %edi            # imm = 0x400
callq 0x2430
movl %eax, %r15d
movl %eax, (%r14)
cmpl $-0x1, %eax
je 0x3662
movq %r14, 0x30(%rbx)
jmp 0x3673
movq 0x8(%r14), %rdi
callq 0x44fe
movq %r14, %rdi
callq 0x44fe
cmpl $-0x1, %r15d
je 0x369b
testl %ebp, %ebp
jle 0x36b7
movq 0x10(%rbx), %rax
movl %ebp, %ecx
shlq $0x5, %rcx
xorl %edx, %edx
movl $0x0, (%rax,%rdx)
addq $0x20, %rdx
cmpq %rdx, %rcx
jne 0x3689
jmp 0x36b7
movq 0x10(%rbx), %rdi
callq 0x44fe
movq 0x18(%rbx), %rdi
callq 0x44fe
movq %rbx, %rdi
callq 0x44fe
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x21e0
movq 0x8(%r14), %rdi
callq 0x44fe
movq %r14, %rdi
callq 0x44fe
movq 0x10(%rbx), %rdi
callq 0x44fe
movq 0x18(%rbx), %rdi
callq 0x44fe
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x44fe
// File: /workspace/github_c_makefile_star2_O1/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 0x37c5
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 0x2200
cmpl $-0x1, %eax
je 0x37c5
addq %r12, %r15
orl %ebp, (%r15)
testb $0x1, %bpl
movq 0x8(%rsp), %rcx
je 0x37a7
movq %rcx, 0x8(%r15)
testb $0x2, %bpl
movq 0x10(%rsp), %rax
je 0x37b6
movq %rcx, 0x10(%r15)
movq %rax, 0x18(%r15)
xorl %r13d, %r13d
cmpl %ebx, (%r14)
jge 0x37c5
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_O1/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 0x3886
subq $0x18, %rsp
movl %esi, %eax
movq 0x10(%rdi), %rsi
movslq %eax, %rcx
shlq $0x5, %rcx
movl (%rsi,%rcx), %r9d
testl %r9d, %r9d
je 0x3882
addq %rsi, %rcx
notl %edx
andl %edx, %r9d
movl %r9d, (%rcx)
movl (%rdi), %r8d
movl %r8d, %r10d
xorl %eax, %r10d
orl %r9d, %r10d
jne 0x3849
movl %r8d, %r9d
sarl $0x1f, %r9d
andl %r8d, %r9d
decl %r9d
leaq -0x1(%r8), %r10
testl %r8d, %r8d
jle 0x3843
movl %r10d, %r11d
shlq $0x5, %r11
decl %r8d
decq %r10
cmpl $0x0, (%rsi,%r11)
je 0x3828
jmp 0x3846
movl %r9d, %r8d
movl %r8d, (%rdi)
movq 0x30(%rdi), %rsi
andl (%rcx), %edx
movl %edx, %ecx
andl $0x1, %ecx
movl %edx, %edi
andl $0x2, %edi
leal (%rcx,%rdi,2), %edi
leaq 0xc(%rsp), %rcx
movl %edi, (%rcx)
movq $0x0, 0x4(%rcx)
movl %eax, 0x4(%rcx)
movl (%rsi), %edi
cmpl $0x1, %edx
movl $0x3, %esi
sbbl $0x0, %esi
movl %eax, %edx
callq 0x2200
addq $0x18, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/yakushstanislav[P]EagleMQ/src/event.c
// Function: create_time_event
long long create_time_event(EventLoop *loop, long long milliseconds, time_handler *time_handler,
	finalizer_handler *finalizer_handler, void *data)
{
	TimeEvent *time_event = (TimeEvent*)xmalloc(sizeof(*time_event));
	long long id = loop->time_event_id++;

	time_event->id = id;

	add_milliseconds_to_now(milliseconds, &time_event->sec, &time_event->ms);

	time_event->time_handler = time_handler;
	time_event->finalizer_handler = finalizer_handler;
	time_event->data = data;
	time_event->next = loop->time_event;

	loop->time_event = time_event;

	return id;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r14
movl $0x38, %edi
callq 0x42f0
movq %rax, %r13
movq 0x8(%r14), %rbp
leaq 0x1(%rbp), %rax
movq %rax, 0x8(%r14)
movq %rbp, (%r13)
leaq 0x18(%rsp), %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0x21b0
movabsq $0x20c49ba5e353f7cf, %rcx # imm = 0x20C49BA5E353F7CF
movq %rcx, %rax
imulq 0x8(%r15)
movq %rdx, %rsi
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x7, %rsi
addq %rax, %rsi
movq %rbx, %rax
imulq %rcx
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x7, %rdx
addq %rax, %rdx
imulq $0x3e8, %rdx, %rax      # imm = 0x3E8
addq (%r15), %rdx
subq %rax, %rbx
leaq (%rsi,%rbx), %rax
xorl %ecx, %ecx
cmpq $0x3e8, %rax            # imm = 0x3E8
setge %cl
leaq -0x3e8(%rsi,%rbx), %rsi
cmovlq %rax, %rsi
addq %rdx, %rcx
movq %rcx, 0x8(%r13)
movq %rsi, 0x10(%r13)
movq %r12, 0x18(%r13)
movq 0x8(%rsp), %rax
movq %rax, 0x20(%r13)
movq 0x10(%rsp), %rax
movq %rax, 0x28(%r13)
movq 0x20(%r14), %rax
movq %rax, 0x30(%r13)
movq %r13, 0x20(%r14)
movq %rbp, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x39e5
cmpq %rsi, (%rbx)
jne 0x399f
xorl %ecx, %ecx
jmp 0x39b6
movq %rbx, %rdx
movq 0x30(%rdx), %rbx
testq %rbx, %rbx
je 0x39e5
movq %rdx, %rcx
movq %rbx, %rdx
cmpq %rsi, (%rbx)
jne 0x39a2
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 0x39db
movq 0x28(%rbx), %rsi
callq *%rax
movq %rbx, %rdi
callq 0x44fe
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x3e28
movq %rbx, %rdi
callq *%rax
movq %rbx, %rdi
movl $0x3, %esi
callq 0x39e7
cmpl $0x0, 0x28(%rbx)
je 0x3e1a
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x404c
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $-0x1, %eax
je 0x403d
movl %eax, %ebx
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
rolw $0x8, %r12w
movw $0x2, (%rsp)
movw %r12w, 0x2(%rsp)
movl $0x0, 0x4(%rsp)
testq %r15, %r15
je 0x4009
leaq 0x4(%rsp), %rsi
movq %r15, %rdi
callq 0x22d0
testl %eax, %eax
je 0x4025
movq %rsp, %rdx
movq %r14, %rdi
movl %ebx, %esi
movl $0x10, %ecx
callq 0x40d1
cmpl $-0x1, %eax
cmovel %eax, %ebx
movl %ebx, %ebp
jmp 0x403d
leaq 0x8627(%rip), %rsi      # 0xc653
movq %r14, %rdi
xorl %eax, %eax
callq 0x3eb2
movl %ebx, %edi
callq 0x21e0
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x2380
cmpl $-0x1, %eax
je 0x4122
movl %ebx, %edi
movl $0x1ff, %esi            # imm = 0x1FF
callq 0x2320
movl %eax, %ecx
xorl %eax, %eax
cmpl $-0x1, %ecx
jne 0x415f
callq 0x2050
movl (%rax), %edi
callq 0x2480
leaq 0x857f(%rip), %rsi      # 0xc692
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3eb2
jmp 0x4153
callq 0x2050
movl (%rax), %edi
callq 0x2480
leaq 0x853e(%rip), %rsi      # 0xc673
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3eb2
leaq 0x8533(%rip), %rdi      # 0xc67c
movq %r14, %rsi
xorl %eax, %eax
callq 0x4734
movl %ebx, %edi
callq 0x21e0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x404c
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpl $-0x1, %eax
je 0x41fe
movl %eax, %ebp
xorps %xmm0, %xmm0
leaq 0x2(%rsp), %r15
movaps %xmm0, -0x2(%r15)
movups %xmm0, 0x5c(%r15)
movaps %xmm0, 0x4e(%r15)
movaps %xmm0, 0x3e(%r15)
movaps %xmm0, 0x2e(%r15)
movaps %xmm0, 0x1e(%r15)
movaps %xmm0, 0xe(%r15)
movw $0x1, -0x2(%r15)
movl $0x6b, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x2070
movq %rsp, %rdx
movq %r12, %rdi
movl %ebp, %esi
movl $0x6e, %ecx
callq 0x40d1
cmpl $-0x1, %eax
je 0x41fe
testl %ebx, %ebx
je 0x41fb
movq %r15, %rdi
movl %ebx, %esi
callq 0x2370
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_O1/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 0x4278
cmpl $-0x1, %eax
je 0x4268
movl %eax, %ebp
testq %r14, %r14
je 0x4253
movl 0x14(%rsp), %edi
callq 0x2120
movq %r14, %rdi
movq %rax, %rsi
callq 0x20a0
testq %rbx, %rbx
je 0x426d
movzwl 0x12(%rsp), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, (%rbx)
jmp 0x426d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %r15
movl %esi, %ebp
movq %rdi, %rbx
movl %ebp, %edi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2410
cmpl $-0x1, %eax
jne 0x42c6
callq 0x2050
movl (%rax), %edi
cmpl $0x4, %edi
je 0x428a
callq 0x2480
leaq 0x83e9(%rip), %rsi      # 0xc69d
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3eb2
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x2300
movq %rax, %rbx
testq %rax, %rax
jne 0x431d
leaq 0x8392(%rip), %rdi      # 0xc6a8
xorl %eax, %eax
callq 0x4932
movq %r15, (%rbx)
movq %r15, %r12
andq $-0x8, %r12
addq $0x10, %r12
testb $0x7, %r15b
cmoveq %r14, %r12
cmpb $0x1, 0xe78e(%rip)      # 0x12ac8
jne 0x435c
leaq 0xe75d(%rip), %r14      # 0x12aa0
movq %r14, %rdi
callq 0x24a0
addq %r12, 0xe77e(%rip)      # 0x12ad0
movq %r14, %rdi
callq 0x22f0
jmp 0x4363
addq %r12, 0xe76d(%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_O1/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 0x2230
movq %rax, %rbx
testq %rax, %rax
jne 0x43a8
leaq 0x8307(%rip), %rdi      # 0xc6a8
xorl %eax, %eax
callq 0x4932
movq %r15, (%rbx)
movq %r15, %r12
andq $-0x8, %r12
addq $0x10, %r12
testb $0x7, %r15b
cmoveq %r14, %r12
cmpb $0x1, 0xe703(%rip)      # 0x12ac8
jne 0x43e7
leaq 0xe6d2(%rip), %r14      # 0x12aa0
movq %r14, %rdi
callq 0x24a0
addq %r12, 0xe6f3(%rip)      # 0x12ad0
movq %r14, %rdi
callq 0x22f0
jmp 0x43ee
addq %r12, 0xe6e2(%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_O1/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 0x446c
movq -0x8(%rdi), %r12
addq $-0x8, %rdi
leaq 0x8(%rbx), %rsi
callq 0x2340
movq %rax, %r14
testq %rax, %rax
jne 0x4438
leaq 0x8277(%rip), %rdi      # 0xc6a8
xorl %eax, %eax
callq 0x4932
movq %rbx, (%r14)
addq $0x7, %r12
andq $-0x8, %r12
cmpb $0x1, 0xe67e(%rip)      # 0x12ac8
jne 0x447f
leaq 0xe64d(%rip), %r15      # 0x12aa0
movq %r15, %rdi
callq 0x24a0
subq %r12, 0xe66e(%rip)      # 0x12ad0
movq %r15, %rdi
callq 0x22f0
jmp 0x4486
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x42f0
subq %r12, 0xe64a(%rip)      # 0x12ad0
addq $0x7, %rbx
andq $-0x8, %rbx
cmpb $0x1, 0xe633(%rip)      # 0x12ac8
jne 0x44b7
leaq 0xe602(%rip), %r15      # 0x12aa0
movq %r15, %rdi
callq 0x24a0
addq %rbx, 0xe623(%rip)      # 0x12ad0
movq %r15, %rdi
callq 0x22f0
jmp 0x44be
addq %rbx, 0xe612(%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_O1/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 0x4551
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, 0xe599(%rip)      # 0x12ac8
jne 0x4552
leaq 0xe568(%rip), %r14      # 0x12aa0
movq %r14, %rdi
callq 0x24a0
subq %r15, 0xe589(%rip)      # 0x12ad0
movq %r14, %rdi
callq 0x22f0
jmp 0x4559
retq
subq %r15, 0xe577(%rip)      # 0x12ad0
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2030
// File: /workspace/github_c_makefile_star2_O1/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, 0xe546(%rip)      # 0x12ac8
jne 0x45a4
leaq 0xe515(%rip), %r14      # 0x12aa0
movq %r14, %rdi
callq 0x24a0
movq 0xe536(%rip), %rbx      # 0x12ad0
movq %r14, %rdi
callq 0x22f0
jmp 0x45ab
movq 0xe525(%rip), %rbx      # 0x12ad0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x23f0
movq %rax, %rbx
callq 0x2110
leaq 0x80da(%rip), %rdx      # 0xc6be
xorl %r14d, %r14d
movq %rsp, %r15
movl $0x100, %esi            # imm = 0x100
movq %r15, %rdi
movl %eax, %ecx
xorl %eax, %eax
callq 0x21a0
movq %r15, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x23a0
cmpl $-0x1, %eax
je 0x4690
movl %eax, %ebp
leaq 0x100(%rsp), %r15
movl $0x1000, %edx           # imm = 0x1000
movl %eax, %edi
movq %r15, %rsi
callq 0x2210
movq %rax, %r14
movl %ebp, %edi
callq 0x21e0
testq %r14, %r14
jle 0x468d
movl $0xffffffe8, %ebp       # imm = 0xFFFFFFE8
xorl %r14d, %r14d
incl %ebp
je 0x4660
movq %r15, %rdi
movl $0x20, %esi
callq 0x2180
leaq 0x1(%rax), %r15
testq %rax, %rax
cmoveq %rax, %r15
jne 0x4640
jmp 0x4690
movq %r15, %rdi
movl $0x20, %esi
callq 0x2180
testq %rax, %rax
je 0x468d
movb $0x0, (%rax)
movq %r15, %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x2260
movslq %ebx, %r14
imulq %rax, %r14
jmp 0x4690
xorl %r14d, %r14d
movq %r14, %rax
addq $0x1108, %rsp           # imm = 0x1108
popq %rbx
popq %r14
popq %r15
popq %rbp
retq