LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/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 0xf7f2(%rip), %rax      # 0x12290
cmpq $0x0, 0x50(%rax)
je 0x2b0e
pushq %rbx
callq 0x4387
movq 0xf7de(%rip), %rcx      # 0x12290
xorl %ebx, %ebx
cmpq 0x50(%rcx), %rax
jbe 0x2b07
movq 0x188(%rcx), %rax
subq 0x1a8(%rcx), %rax
pushq $0x1
popq %rbx
cmpq $0xb, %rax
jl 0x2b07
callq 0x4387
movq 0xf7b3(%rip), %rcx      # 0x12290
movq 0x50(%rcx), %rdx
leaq 0x9648(%rip), %rdi      # 0xc130
movq %rax, %rsi
xorl %eax, %eax
callq 0x4548
movq 0xf797(%rip), %rcx      # 0x12290
movq 0x188(%rcx), %rax
movq %rax, 0x1a8(%rcx)
movl %ebx, 0x1b0(%rcx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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 0xf773(%rip), %rax      # 0x12290
movq 0x170(%rax), %rdi
leaq 0x8(%rsp), %rbx
movq %rbx, %rsi
callq 0x8226
movq %rbx, %rdi
callq 0x81e5
testq %rax, %rax
je 0x2b6e
movq 0x10(%rax), %r14
movq 0xf747(%rip), %rax      # 0x12290
movl 0x190(%rax), %esi
movq %r14, %rdi
callq 0x8cfb
movq 0xf732(%rip), %rax      # 0x12290
movl 0x190(%rax), %esi
movq %r14, %rdi
callq 0x8d5c
jmp 0x2b31
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 0xf712(%rip), %rax      # 0x12290
cmpl $-0x1, 0x34(%rax)
je 0x2bce
leaq 0x4(%rsp), %rdi
pushq $0x1
popq %rsi
xorl %edx, %edx
callq 0x2130
testl %eax, %eax
je 0x2bc7
cmpb $0x0, 0x5(%rsp)
je 0x2bba
movq 0xf6eb(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rsi
leaq 0x9598(%rip), %rdi      # 0xc14b
xorl %eax, %eax
callq 0x4548
movq 0xf6cf(%rip), %rax      # 0x12290
orl $-0x1, 0x34(%rax)
jmp 0x2bce
movq 0xf6c2(%rip), %rax      # 0x12290
movslq 0x5c(%rax), %rcx
testq %rcx, %rcx
je 0x2c46
cmpl $-0x1, 0x34(%rax)
jne 0x2c46
movq 0x188(%rax), %rdx
subq 0x1a0(%rax), %rdx
cmpq %rcx, %rdx
jle 0x2c46
leaq 0x9577(%rip), %rdi      # 0xc16e
xorl %eax, %eax
callq 0x47d2
movq 0xf68b(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rdi
callq 0xa283
testl %eax, %eax
je 0x2c31
movq 0xf674(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rsi
leaq 0x9564(%rip), %rdi      # 0xc18e
xorl %eax, %eax
callq 0x4548
movq 0xf658(%rip), %rax      # 0x12290
movq 0x188(%rax), %rcx
movq %rcx, 0x1a0(%rax)
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rax
xorl %edi, %edi
callq 0x22a0
movq 0xf639(%rip), %rcx      # 0x12290
movq %rax, 0x188(%rcx)
callq 0x27e9
movq 0xf626(%rip), %rcx      # 0x12290
movq %rax, 0x190(%rcx)
andl $0x0, 0x1b4(%rcx)
callq 0x2a97
callq 0x7b18
callq 0x2b0f
callq 0x2b76
movq 0xf5fd(%rip), %rax      # 0x12290
cmpl $0x0, 0x1e0(%rax)
je 0x2ca4
movq (%rax), %rdi
callq 0x3626
pushq $0x64
popq %rax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/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 0xf5b0(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rdi
xorl %esi, %esi
callq 0x23b0
cmpl $-0x1, %eax
jne 0x2d26
movq 0xf596(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rdi
callq 0x9cfe
testl %eax, %eax
je 0x2d26
movq 0xf57f(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rsi
leaq 0x9487(%rip), %rdi      # 0xc1a6
xorl %eax, %eax
callq 0x4548
movq 0xf563(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rdi
callq 0x979c
testl %eax, %eax
je 0x2d5a
movq 0xf54c(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rsi
leaq 0x946b(%rip), %rdi      # 0xc1bd
xorl %eax, %eax
popq %rcx
jmp 0x4548
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/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 0xf370(%rip), %rax      # 0x12290
movl 0x34(%rax), %edi
cmpl $-0x1, %edi
je 0x2f46
pushq $0x9
popq %rsi
callq 0x2290
movq 0xf359(%rip), %rax      # 0x12290
movl 0x34(%rax), %edi
callq 0xa306
movq 0xf34a(%rip), %rax      # 0x12290
movl 0x8(%rax), %edi
testl %edi, %edi
jle 0x2f59
callq 0x21d0
movq 0xf337(%rip), %rax      # 0x12290
movl 0xc(%rax), %edi
testl %edi, %edi
jle 0x2f6c
callq 0x21d0
movq 0xf324(%rip), %rax      # 0x12290
movq 0x1c8(%rax), %rdi
testq %rdi, %rdi
je 0x2f84
callq 0x2060
movq 0xf30c(%rip), %rax      # 0x12290
movq 0x28(%rax), %rdi
testq %rdi, %rdi
je 0x2f92
callq 0x2060
xorl %eax, %eax
popq %rcx
jmp 0x45d9
// File: /workspace/github_c_makefile_star2_O2/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 0xf2ee(%rip), %rax      # 0x12290
movq 0x1d8(%rax), %rdi
xorl %esi, %esi
callq 0x23b0
movq 0xf2d9(%rip), %rcx      # 0x12290
movq 0x1d8(%rcx), %rsi
cmpl $-0x1, %eax
je 0x2fec
movq %rsi, %rdi
callq 0xa804
testl %eax, %eax
je 0x2ffb
movq 0xf2ba(%rip), %rax      # 0x12290
movq 0x1d8(%rax), %rsi
leaq 0x9252(%rip), %rdi      # 0xc236
xorl %eax, %eax
popq %rcx
jmp 0x4741
leaq 0x925d(%rip), %rdi      # 0xc250
xorl %eax, %eax
popq %rcx
jmp 0x4548
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/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 0xf095(%rip), %rax      # 0x12290
movq 0x18(%rax), %rdi
callq 0x430e
movq 0xf085(%rip), %rax      # 0x12290
movq 0x38(%rax), %rdi
callq 0x430e
movq 0xf075(%rip), %rax      # 0x12290
movq 0x40(%rax), %rdi
callq 0x430e
movq 0xf065(%rip), %rax      # 0x12290
movq 0x1c0(%rax), %rdi
callq 0x430e
movq 0xf052(%rip), %rax      # 0x12290
movq 0x1d0(%rax), %rdi
callq 0x430e
movq 0xf03f(%rip), %rax      # 0x12290
movq 0x28(%rax), %rdi
testq %rdi, %rdi
je 0x3266
callq 0x430e
movq 0xf02a(%rip), %rax      # 0x12290
movq 0x1c8(%rax), %rdi
testq %rdi, %rdi
je 0x327e
callq 0x430e
movq 0xf012(%rip), %rax      # 0x12290
movq 0x160(%rax), %rdi
callq 0x8005
movq 0xefff(%rip), %rax      # 0x12290
movq 0x168(%rax), %rdi
callq 0x8005
movq 0xefec(%rip), %rax      # 0x12290
movq 0x170(%rax), %rdi
callq 0x8005
movq 0xefd9(%rip), %rax      # 0x12290
movq 0x178(%rax), %rdi
callq 0x8005
movq 0xefc6(%rip), %rax      # 0x12290
movq 0x180(%rax), %rdi
callq 0x8005
movq 0xefb3(%rip), %rdi      # 0x12290
popq %rax
jmp 0x430e
// File: /workspace/github_c_makefile_star2_O2/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 0xef8a(%rip), %rbx      # 0x12278
movq 0xef9b(%rip), %rax      # 0x12290
movq 0x18(%rax), %r14
movl 0x20(%rax), %ebp
callq 0x3c95
leaq 0x8f98(%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_O2/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
cmpl $0x2, %edi
jl 0x33e0
movq 0x8(%rbx), %r15
cmpb $0x2d, (%r15)
jne 0x33b2
cmpb $0x68, 0x1(%r15)
jne 0x33b2
cmpb $0x0, 0x2(%r15)
je 0x3461
leaq 0x91d5(%rip), %rsi      # 0xc58e
movq %r15, %rdi
callq 0x2230
testl %eax, %eax
je 0x3461
movq 0xeec0(%rip), %rax      # 0x12290
movq %r15, 0x1d8(%rax)
callq 0x2f9a
pushq $0x2
jmp 0x33e2
pushq $0x1
popq %rbp
movslq %r14d, %r15
decl %r14d
leaq 0x9208(%rip), %r12      # 0xc5f8
leaq 0x91cf(%rip), %r13      # 0xc5c6
cmpq %r15, %rbp
jge 0x3452
cmpq %rbp, %r14
jne 0x3413
movq (%rbx,%r14,8), %rsi
leaq 0x9189(%rip), %rdi      # 0xc595
xorl %eax, %eax
callq 0x4741
movq (%rbx,%rbp,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x3422
cmpb $0x2d, 0x1(%rdi)
je 0x3430
movq %r13, %rdi
xorl %eax, %eax
callq 0x4741
movq (%rbx,%rbp,8), %rdi
addq $0x2, %rdi
movq 0x8(%rbx,%rbp,8), %rsi
callq 0xa558
testl %eax, %eax
je 0x344c
movq %r12, %rdi
xorl %eax, %eax
callq 0x4741
addq $0x2, %rbp
jmp 0x33f7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x331e
xorl %edi, %edi
callq 0x2450
// File: /workspace/github_c_makefile_star2_O2/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 0x278e
callq 0x43c6
callq 0x2819
callq 0x2ffd
movl %ebp, %edi
movq %rbx, %rsi
callq 0x3380
callq 0x32e3
callq 0x2751
callq 0x2d5c
callq 0x2ca9
callq 0x2cd8
leaq 0x915e(%rip), %rdi      # 0xc611
leaq 0x8de6(%rip), %rsi      # 0xc2a0
xorl %eax, %eax
callq 0x47d2
movq 0xedc8(%rip), %rax      # 0x12290
movq (%rax), %rdi
callq 0x3c59
movq 0xedb9(%rip), %rax      # 0x12290
movq (%rax), %rdi
movq 0x10(%rax), %rsi
callq 0x38a1
movq 0xeda6(%rip), %rax      # 0x12290
movq (%rax), %rdi
callq 0x35e1
callq 0x2f18
callq 0x31f3
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x40
popq %rdi
callq 0x40f8
movq %rax, %rbx
movslq %r14d, %r15
movq %r15, %rdi
shlq $0x5, %rdi
callq 0x40f8
movq %rax, 0x10(%rbx)
leaq (,%r15,8), %rdi
callq 0x40f8
movq %rax, 0x18(%rbx)
orl $-0x1, (%rbx)
movl %r15d, 0x4(%rbx)
andq $0x0, 0x8(%rbx)
andq $0x0, 0x20(%rbx)
andl $0x0, 0x28(%rbx)
andq $0x0, 0x38(%rbx)
pushq $0x10
popq %rdi
callq 0x40f8
movq %rax, %r15
movslq 0x4(%rbx), %rax
imulq $0xc, %rax, %rdi
callq 0x40f8
movq %rax, 0x8(%r15)
movl $0x400, %edi            # imm = 0x400
callq 0x2430
movl %eax, (%r15)
cmpl $-0x1, %eax
je 0x35ab
movq %r15, 0x30(%rbx)
xorl %eax, %eax
testl %r14d, %r14d
cmovlel %eax, %r14d
shlq $0x5, %r14
cmpq %rax, %r14
je 0x35d8
movq 0x10(%rbx), %rcx
andl $0x0, (%rcx,%rax)
addq $0x20, %rax
jmp 0x3598
movq 0x8(%r15), %rdi
callq 0x430e
movq %r15, %rdi
callq 0x430e
movq 0x10(%rbx), %rdi
callq 0x430e
movq 0x18(%rbx), %rdi
callq 0x430e
movq %rbx, %rdi
callq 0x430e
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x430e
movq %r14, %rdi
callq 0x430e
movq 0x10(%rbx), %rdi
callq 0x430e
movq 0x18(%rbx), %rdi
callq 0x430e
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x430e
// File: /workspace/github_c_makefile_star2_O2/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
pushq $-0x1
popq %r13
cmpl %esi, 0x4(%rdi)
jle 0x36dc
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
andq $0x0, 0x4(%rcx)
leal 0x1(,%rdi,2), %esi
movl %edx, 0x4(%rcx)
movl (%rax), %edi
callq 0x21f0
cmpl $-0x1, %eax
je 0x36dc
addq %r12, %r15
orl %ebp, (%r15)
testb $0x1, %bpl
movq 0x8(%rsp), %rcx
je 0x36be
movq %rcx, 0x8(%r15)
testb $0x2, %bpl
movq 0x10(%rsp), %rax
je 0x36cd
movq %rcx, 0x10(%r15)
movq %rax, 0x18(%r15)
xorl %r13d, %r13d
cmpl %ebx, (%r14)
jge 0x36dc
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_O2/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 0x37a7
subq $0x18, %rsp
movl %esi, %eax
movq 0x10(%rdi), %rsi
movslq %eax, %r8
shlq $0x5, %r8
movl (%rsi,%r8), %ecx
testl %ecx, %ecx
je 0x37a3
addq %rsi, %r8
notl %edx
andl %edx, %ecx
movl %ecx, (%r8)
jne 0x375a
cmpl %eax, (%rdi)
jne 0x375a
movl %eax, %edx
movl %eax, %r8d
sarl $0x1f, %r8d
andl %eax, %r8d
decl %r8d
decq %rdx
movl %eax, %r9d
testl %r9d, %r9d
jle 0x3754
movl %edx, %r10d
shlq $0x5, %r10
decl %r9d
decq %rdx
cmpl $0x0, (%rsi,%r10)
je 0x3739
jmp 0x3757
movl %r8d, %r9d
movl %r9d, (%rdi)
movq 0x30(%rdi), %rdx
movl %ecx, %esi
andl $0x1, %esi
movl %esi, 0xc(%rsp)
testb $0x2, %cl
jne 0x3781
andq $0x0, 0x10(%rsp)
movl %eax, 0x10(%rsp)
cmpl $0x1, %ecx
pushq $0x3
popq %rsi
sbbl $0x0, %esi
jmp 0x3795
orl $0x4, %esi
movl %esi, 0xc(%rsp)
andq $0x0, 0x10(%rsp)
movl %eax, 0x10(%rsp)
pushq $0x3
popq %rsi
movl (%rdx), %edi
leaq 0xc(%rsp), %rcx
movl %eax, %edx
callq 0x21f0
addq $0x18, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %rax
movq %r8, (%rsp)
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
pushq $0x38
popq %rdi
callq 0x40f8
movq %rax, %rbp
movq 0x8(%r13), %rbx
leaq 0x1(%rbx), %rax
movq %rax, 0x8(%r13)
movq %rbx, (%rbp)
leaq 0x8(%rbp), %rsi
leaq 0x10(%rbp), %rdx
movq %r12, %rdi
callq 0x3832
movq %r15, 0x18(%rbp)
movq %r14, 0x20(%rbp)
movq (%rsp), %rax
movq %rax, 0x28(%rbp)
movq 0x20(%r13), %rax
movq %rax, 0x30(%rbp)
movq %rbp, 0x20(%r13)
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_O2/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
leaq 0x20(%rdi), %rcx
xorl %edx, %edx
pushq $-0x1
popq %rax
movq %rcx, %r8
movq (%r8), %rbx
testq %rbx, %rbx
je 0x38ef
cmpq %rsi, (%rbx)
je 0x38c4
leaq 0x30(%rbx), %r8
movq %rbx, %rdx
jmp 0x38ae
leaq 0x30(%rdx), %rax
testq %rdx, %rdx
cmoveq %rcx, %rax
movq 0x30(%rbx), %rcx
movq %rcx, (%rax)
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x38e5
movq 0x28(%rbx), %rsi
callq *%rax
movq %rbx, %rdi
callq 0x430e
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
andl $0x0, 0x28(%rdi)
xorl %eax, %eax
pushq $0x3
popq %rbp
testl %eax, %eax
jne 0x3c89
movq 0x38(%rbx), %rax
testq %rax, %rax
je 0x3c7a
movq %rbx, %rdi
callq *%rax
movq %rbx, %rdi
movl %ebp, %esi
callq 0x38f1
movl 0x28(%rbx), %eax
jmp 0x3c68
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/network.c
// Function: net_set_nonblock
int net_set_nonblock(char *err, int fd)
{
	int flags;

	if ((flags = fcntl(fd, F_GETFL)) == -1) {
		net_set_error(err, "fcntl: %s", strerror(errno));
		return EG_NET_OK;
	}

	if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1) {
		net_set_error(err, "fcntl: %s", strerror(errno));
        return EG_NET_ERR;
	}

	return EG_NET_ERR;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
xorl %ebp, %ebp
pushq $0x3
popq %rsi
movl %r14d, %edi
xorl %eax, %eax
callq 0x20e0
cmpl $-0x1, %eax
je 0x3cda
orl $0x800, %eax            # imm = 0x800
pushq $0x4
popq %rsi
movl %r14d, %edi
movl %eax, %edx
xorl %eax, %eax
callq 0x20e0
pushq $-0x1
popq %rbp
cmpl $-0x1, %eax
jne 0x3cfa
callq 0x2050
movl (%rax), %edi
callq 0x2480
leaq 0x8947(%rip), %rsi      # 0xc634
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3d01
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x2
popq %rsi
callq 0x3e8b
pushq $-0x1
popq %rbp
cmpl $-0x1, %eax
je 0x3e7c
movl %eax, %ebx
andq $0x0, 0x8(%rsp)
movw $0x2, (%rsp)
rolw $0x8, %r12w
movw %r12w, 0x2(%rsp)
andl $0x0, 0x4(%rsp)
testq %r15, %r15
je 0x3e4a
leaq 0x4(%rsp), %rsi
movq %r15, %rdi
callq 0x22c0
testl %eax, %eax
je 0x3e64
movq %rsp, %rdx
pushq $0x10
popq %rcx
movq %r14, %rdi
movl %ebx, %esi
callq 0x3f0a
cmpl $-0x1, %eax
cmovel %eax, %ebx
movl %ebx, %ebp
jmp 0x3e7c
leaq 0x87e2(%rip), %rsi      # 0xc64d
movq %r14, %rdi
xorl %eax, %eax
callq 0x3d01
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_O2/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
movl %esi, %eax
movq %rdi, %rbx
movl $0x1, 0x4(%rsp)
pushq $0x1
popq %rsi
movl %eax, %edi
xorl %edx, %edx
callq 0x24c0
cmpl $-0x1, %eax
je 0x3ede
movl %eax, %ebp
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
leaq 0x4(%rsp), %rcx
pushq $0x4
popq %r8
movl %eax, %edi
callq 0x20d0
cmpl $-0x1, %eax
jne 0x3f01
callq 0x2050
movl (%rax), %edi
callq 0x2480
leaq 0x8762(%rip), %rsi      # 0xc63e
jmp 0x3ef1
callq 0x2050
movl (%rax), %edi
callq 0x2480
leaq 0x8771(%rip), %rsi      # 0xc662
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3d01
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x3f5b
movl %ebx, %edi
movl $0x1ff, %esi            # imm = 0x1FF
callq 0x2310
movl %eax, %ecx
xorl %eax, %eax
cmpl $-0x1, %ecx
jne 0x3f96
callq 0x2050
movl (%rax), %edi
callq 0x2480
leaq 0x8740(%rip), %rsi      # 0xc68c
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3d01
jmp 0x3f8c
callq 0x2050
movl (%rax), %edi
callq 0x2480
leaq 0x86ff(%rip), %rsi      # 0xc66d
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3d01
leaq 0x86f4(%rip), %rdi      # 0xc676
movq %r14, %rsi
xorl %eax, %eax
callq 0x4548
movl %ebx, %edi
callq 0x21d0
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x1
popq %rsi
callq 0x3e8b
pushq $-0x1
popq %r14
cmpl $-0x1, %eax
je 0x400f
movl %eax, %ebp
leaq 0xc(%rsp), %r15
andw $0x0, 0x6a(%r15)
movw $0x1, -0x2(%r15)
pushq $0x6b
popq %rdx
movq %r15, %rdi
movq %r13, %rsi
callq 0x2070
leaq 0xa(%rsp), %rdx
pushq $0x6e
popq %rcx
movq %r12, %rdi
movl %ebp, %esi
callq 0x3f0a
cmpl $-0x1, %eax
je 0x400f
testl %ebx, %ebx
je 0x400c
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_O2/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 0x4082
movl %eax, %ebp
cmpl $-0x1, %eax
je 0x4077
testq %r14, %r14
je 0x4064
movl 0x14(%rsp), %edi
callq 0x2110
movq %r14, %rdi
movq %rax, %rsi
callq 0x2090
testq %rbx, %rbx
je 0x4077
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_O2/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 0x2410
movl %eax, %ebx
cmpl $-0x1, %eax
jne 0x40ce
callq 0x2050
movl (%rax), %edi
cmpl $0x4, %edi
je 0x4095
callq 0x2480
leaq 0x85d6(%rip), %rsi      # 0xc697
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3d01
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x4125
leaq 0x8584(%rip), %rdi      # 0xc6a2
xorl %eax, %eax
callq 0x4741
movq %r15, (%rbx)
movq %r15, %r12
andq $-0x8, %r12
addq $0x10, %r12
testb $0x7, %r15b
cmoveq %r14, %r12
cmpb $0x1, 0xe986(%rip)      # 0x12ac8
jne 0x4164
leaq 0xe955(%rip), %r14      # 0x12aa0
movq %r14, %rdi
callq 0x24a0
addq %r12, 0xe976(%rip)      # 0x12ad0
movq %r14, %rdi
callq 0x22e0
jmp 0x416b
addq %r12, 0xe965(%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_O2/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
pushq $0x1
popq %rdi
movq %r14, %rsi
callq 0x2220
movq %rax, %rbx
testq %rax, %rax
jne 0x41ae
leaq 0x84fb(%rip), %rdi      # 0xc6a2
xorl %eax, %eax
callq 0x4741
movq %r15, (%rbx)
movq %r15, %r12
andq $-0x8, %r12
addq $0x10, %r12
testb $0x7, %r15b
cmoveq %r14, %r12
cmpb $0x1, 0xe8fd(%rip)      # 0x12ac8
jne 0x41ed
leaq 0xe8cc(%rip), %r14      # 0x12aa0
movq %r14, %rdi
callq 0x24a0
addq %r12, 0xe8ed(%rip)      # 0x12ad0
movq %r14, %rdi
callq 0x22e0
jmp 0x41f4
addq %r12, 0xe8dc(%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_O2/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 0x42a5
movq -0x8(%rdi), %r12
addq $-0x8, %rdi
leaq 0x8(%rbx), %rsi
callq 0x2340
movq %rax, %r14
testq %rax, %rax
jne 0x4242
leaq 0x8467(%rip), %rdi      # 0xc6a2
xorl %eax, %eax
callq 0x4741
movq %rbx, (%r14)
addq $0x7, %r12
andq $-0x8, %r12
cmpb $0x0, 0xe874(%rip)      # 0x12ac8
je 0x42b8
leaq 0xe843(%rip), %r15      # 0x12aa0
movq %r15, %rdi
callq 0x24a0
subq %r12, 0xe864(%rip)      # 0x12ad0
movq %r15, %rdi
callq 0x22e0
addq $0x7, %rbx
andq $-0x8, %rbx
cmpb $0x1, 0xe845(%rip)      # 0x12ac8
jne 0x42c7
leaq 0xe814(%rip), %r15      # 0x12aa0
movq %r15, %rdi
callq 0x24a0
addq %rbx, 0xe835(%rip)      # 0x12ad0
movq %r15, %rdi
callq 0x22e0
jmp 0x42ce
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x40f8
subq %r12, 0xe811(%rip)      # 0x12ad0
addq $0x7, %rbx
andq $-0x8, %rbx
addq %rbx, 0xe802(%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_O2/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 0x4361
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, 0xe789(%rip)      # 0x12ac8
jne 0x4362
leaq 0xe758(%rip), %r14      # 0x12aa0
movq %r14, %rdi
callq 0x24a0
subq %r15, 0xe779(%rip)      # 0x12ad0
movq %r14, %rdi
callq 0x22e0
jmp 0x4369
retq
subq %r15, 0xe767(%rip)      # 0x12ad0
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2030
// File: /workspace/github_c_makefile_star2_O2/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, 0xe736(%rip)      # 0x12ac8
jne 0x43b4
leaq 0xe705(%rip), %r14      # 0x12aa0
movq %r14, %rdi
callq 0x24a0
movq 0xe726(%rip), %rbx      # 0x12ad0
movq %r14, %rdi
callq 0x22e0
jmp 0x43bb
movq 0xe715(%rip), %rbx      # 0x12ad0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
subq $0x1100, %rsp           # imm = 0x1100
pushq $0x1e
popq %rdi
callq 0x23f0
movq %rax, %rbx
callq 0x2100
leaq 0x82c4(%rip), %rdx      # 0xc6b8
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 0x23a0
cmpl $-0x1, %eax
je 0x44a2
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 0x449f
pushq $-0x17
popq %r12
xorl %r14d, %r14d
pushq $0x20
popq %rbp
testq %r15, %r15
je 0x44a2
testl %r12d, %r12d
je 0x4476
movq %r15, %rdi
movl %ebp, %esi
callq 0x2170
leaq 0x1(%rax), %r15
testq %rax, %rax
cmoveq %rax, %r15
incl %r12d
jmp 0x4452
pushq $0x20
popq %rsi
movq %r15, %rdi
callq 0x2170
testq %rax, %rax
je 0x449f
movb $0x0, (%rax)
pushq $0xa
popq %rdx
movq %r15, %rdi
xorl %esi, %esi
callq 0x2250
movslq %ebx, %r14
imulq %rax, %r14
jmp 0x44a2
xorl %r14d, %r14d
movq %r14, %rax
addq $0x1100, %rsp           # imm = 0x1100
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/utils.c
// Function: enable_log
void enable_log(const char *logfile)
{
	fd = fopen(logfile, "a");

	if (fd == NULL) {
		warning("Error create log file");
		return;
	}

	log_init = 1;
}

// Assembly:
pushq %rax
leaq 0x81aa(%rip), %rsi      # 0xc6c6
callq 0x23c0
movq %rax, 0xe5b8(%rip)      # 0x12ae0
testq %rax, %rax
je 0x4539
movl $0x1, 0xe5a1(%rip)      # 0x12ad8
popq %rax
retq
leaq 0x8188(%rip), %rdi      # 0xc6c8
xorl %eax, %eax
popq %rcx
jmp 0x4548
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/utils.c
// Function: output_message
static void output_message(int level, const char *fmt, va_list args)
{
	time_t now_time;
	char msg[MESSAGE_BUFFER_SIZE];
	char log[MESSAGE_BUFFER_SIZE];

	vsnprintf(msg, sizeof(msg), fmt, args);

	if (level != LOG_ONLY_LEVEL)
	{
		if (level == FATAL_LEVEL || level == WARNING_LEVEL) {
			fprintf(stderr, "%s\n", msg);
		} else {
			fprintf(stdout, "%s\n", msg);
		}
	}

	if (log_init) {
		time(&now_time);
		sprintf(log, "%s%s\n", ctime(&now_time), msg);
		fputs(log, fd);
		fflush(fd);
	}
}

// Assembly:
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
movq %rdx, %rcx
movq %rsi, %rdx
movl %edi, %ebx
leaq 0x10(%rsp), %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x20c0
cmpl $0x3, %ebx
je 0x4642
decl %ebx
cmpl $0x1, %ebx
jbe 0x46a5
movq 0xd9ac(%rip), %rax      # 0x11fd8
movq (%rax), %rdi
leaq 0x7a33(%rip), %rsi      # 0xc069
leaq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x2260
cmpl $0x0, 0xe48f(%rip)      # 0x12ad8
je 0x469c
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x22a0
movq %rbx, %rdi
callq 0x2140
leaq 0x807d(%rip), %rsi      # 0xc6e4
leaq 0x110(%rsp), %rbx
leaq 0x10(%rsp), %rcx
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2440
movq 0xe458(%rip), %rsi      # 0x12ae0
movq %rbx, %rdi
callq 0x21b0
movq 0xe449(%rip), %rdi      # 0x12ae0
callq 0x2300
addq $0x210, %rsp            # imm = 0x210
popq %rbx
retq
movq 0xd94c(%rip), %rax      # 0x11ff8
jmp 0x462c
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/utils.c
// Function: memtoll
long long memtoll(const char *value, int *err)
{
	char buffer[128];
	const char *ptr;
	unsigned int digits;
	long mul;

	*err = 0;

	ptr = value;
	while (*ptr && isdigit(*ptr)) {
		ptr++;
	}

	if (*ptr == '\0' || !strcasecmp(ptr, "b")) {
		mul = 1;
	} else if (!strcasecmp(ptr, "k")) {
		mul = 1000;
	} else if (!strcasecmp(ptr, "m")) {
		mul = 1000 * 1000;
	} else if (!strcasecmp(ptr, "g")) {
		mul = 1000L * 1000 * 1000;
	} else {
		*err = 1;
		mul = 1;
	}

	digits = ptr - value;
	if (digits >= sizeof(buffer)) {
		*err = 1;
		return LLONG_MAX;
	}

	memcpy(buffer, value, digits);
	buffer[digits] = '\0';

	return strtoll(buffer, NULL, 10) * mul;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x80, %rsp
movq %rsi, %r14
andl $0x0, (%rsi)
movq %rdi, %rbx
xorl %r13d, %r13d
pushq $0x1
popq %r12
movsbq (%rbx,%r13), %r15
testq %r15, %r15
je 0x4bc7
callq 0x24b0
movq (%rax), %rax
testb $0x8, 0x1(%rax,%r15,2)
je 0x4b58
incq %r13
jmp 0x4b35
leaq (%rbx,%r13), %r15
leaq 0x7b7b(%rip), %rsi      # 0xc6de
movq %r15, %rdi
callq 0x2040
testl %eax, %eax
je 0x4bc7
leaq 0x7b6a(%rip), %rsi      # 0xc6e0
movq %r15, %rdi
callq 0x2040
testl %eax, %eax
je 0x4bb1
leaq 0x7b59(%rip), %rsi      # 0xc6e2
movq %r15, %rdi
callq 0x2040
testl %eax, %eax
je 0x4bb9
leaq 0x76f5(%rip), %rsi      # 0xc291
movq %r15, %rdi
callq 0x2040
testl %eax, %eax
je 0x4bc1
movl $0x1, (%r14)
jmp 0x4bc7
movl $0x3e8, %r12d           # imm = 0x3E8
jmp 0x4bc7
movl $0xf4240, %r12d         # imm = 0xF4240
jmp 0x4bc7
movl $0x3b9aca00, %r12d      # imm = 0x3B9ACA00
movl %r13d, %r15d
cmpq $0x80, %r15
jb 0x4be6
movl $0x1, (%r14)
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
jmp 0x4c0d
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2280
movb $0x0, (%rsp,%r15)
pushq $0xa
popq %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x2250
imulq %r12, %rax
addq $0x80, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/utils.c
// Function: check_input_buffer1
int check_input_buffer1(char *buffer, size_t size)
{
	char *ptr = buffer, *end_ptr = buffer + size;
	int length = 0;

	while (ptr < end_ptr) {
		if (*++ptr == '\0') {
			length = ptr - buffer;
			break;
		}
	}

	if (!length) {
		return 0;
	}

	for (ptr = buffer; ptr < (buffer + length); ptr++)
	{
		if (!IS_ALPHANUM(*ptr) && !IS_EXTRA1(*ptr)) {
			return 0;
		}
	}

	return length;
}

// Assembly:
addq %rdi, %rsi
xorl %eax, %eax
movabsq $0x100000000, %r8       # imm = 0x100000000
xorl %r9d, %r9d
xorl %ecx, %ecx
leaq (%rdi,%r9), %rdx
cmpq %rsi, %rdx
jae 0x4c9d
addq %r8, %rcx
leaq 0x1(%r9), %rdx
cmpb $0x0, 0x1(%rdi,%r9)
movq %rdx, %r9
jne 0x4c32
testl %edx, %edx
je 0x4c9d
sarq $0x20, %rcx
addq %rdi, %rcx
movabsq $0x4000000000003, %rsi  # imm = 0x4000000000003
cmpq %rcx, %rdi
jae 0x4c9b
movzbl (%rdi), %r8d
leal -0x30(%r8), %r9d
cmpb $0xa, %r9b
jb 0x4c96
movl %r8d, %r9d
orb $0x20, %r9b
addb $-0x61, %r9b
cmpb $0x1a, %r9b
jb 0x4c96
addl $-0x2d, %r8d
cmpl $0x32, %r8d
ja 0x4c9d
btq %r8, %rsi
jae 0x4c9d
incq %rdi
jmp 0x4c62
movl %edx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/utils.c
// Function: check_input_buffer2
int check_input_buffer2(char *buffer, size_t size)
{
	char *ptr = buffer, *end_ptr = buffer + size;
	int length = 0;
	int extra = 0;

	while (ptr < end_ptr) {
		if (*++ptr == '\0') {
			length = ptr - buffer;
			break;
		}
	}

	if (!length) {
		return 0;
	}

	if (!IS_ALPHA(*buffer) && *buffer != '_' && *buffer != '.') {
		return 0;
	}

	if (*buffer == '_' || *buffer == '.') {
		extra = 1;
	}

	for (ptr = buffer + 1; ptr < (buffer + length - 1); ptr++)
	{
		if (IS_EXTRA1(*ptr) && extra) {
			return 0;
		}

		if (!IS_ALPHANUM(*ptr) && !IS_EXTRA1(*ptr)) {
			return 0;
		}

		extra = 0;
		if (IS_EXTRA1(*ptr)) {
			extra = 1;
		}
	}

	return length;
}

// Assembly:
addq %rdi, %rsi
xorl %eax, %eax
movabsq $0x100000000, %r8       # imm = 0x100000000
xorl %r9d, %r9d
xorl %edx, %edx
leaq (%rdi,%r9), %rcx
cmpq %rsi, %rcx
jae 0x4d98
addq %r8, %rdx
leaq 0x1(%r9), %rcx
cmpb $0x0, 0x1(%rdi,%r9)
movq %rcx, %r9
jne 0x4cb2
testl %ecx, %ecx
je 0x4d98
movzbl (%rdi), %esi
movl %esi, %r8d
orb $0x20, %r8b
addb $-0x61, %r8b
cmpb $0x1a, %r8b
jb 0x4cfb
cmpl $0x5f, %esi
je 0x4cfb
cmpl $0x2e, %esi
jne 0x4d98
cmpl $0x5f, %esi
sete %r8b
cmpl $0x2e, %esi
sete %sil
orb %r8b, %sil
movzbl %sil, %r10d
sarq $0x20, %rdx
addq %rdi, %rdx
decq %rdx
incq %rdi
movabsq $0x4000000000003, %rsi  # imm = 0x4000000000003
pushq $0x1
popq %r8
cmpq %rdx, %rdi
jae 0x4d99
movzbl (%rdi), %r9d
cmpl $0x2d, %r9d
je 0x4d40
cmpl $0x5f, %r9d
jne 0x4d8d
testl %r10d, %r10d
jne 0x4d98
leal -0x30(%r9), %r10d
cmpb $0xa, %r10b
jb 0x4d72
movl %r9d, %r10d
orb $0x20, %r10b
addb $-0x61, %r10b
cmpb $0x1a, %r10b
jb 0x4d72
addl $-0x2d, %r9d
cmpl $0x32, %r9d
ja 0x4d98
btq %r9, %rsi
jb 0x4d85
jmp 0x4d98
xorl %r10d, %r10d
addl $-0x2d, %r9d
cmpl $0x32, %r9d
ja 0x4d88
btq %r9, %rsi
jae 0x4d88
movl %r8d, %r10d
incq %rdi
jmp 0x4d2b
testl %r10d, %r10d
je 0x4d45
cmpb $0x2e, %r9b
jne 0x4d45
retq
movl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/utils.c
// Function: check_input_buffer3
int check_input_buffer3(char *buffer, size_t size)
{
	char *ptr = buffer, *end_ptr = buffer + size;
	int length = 0;

	while (ptr < end_ptr) {
		if (*++ptr == '\0') {
			length = ptr - buffer;
			break;
		}
	}

	if (!length) {
		return 0;
	}

	for (ptr = buffer; ptr < (buffer + length); ptr++)
	{
		if (!IS_ALPHANUM(*ptr) && !IS_EXTRA3(*ptr)) {
			return 0;
		}
	}

	return length;
}

// Assembly:
addq %rdi, %rsi
xorl %eax, %eax
movabsq $0x100000000, %r8       # imm = 0x100000000
xorl %r9d, %r9d
xorl %ecx, %ecx
leaq (%rdi,%r9), %rdx
cmpq %rsi, %rdx
jae 0x4e1b
addq %r8, %rcx
leaq 0x1(%r9), %rdx
cmpb $0x0, 0x1(%rdi,%r9)
movq %rdx, %r9
jne 0x4db0
testl %edx, %edx
je 0x4e1b
sarq $0x20, %rcx
addq %rdi, %rcx
movabsq $0x2e000000200019, %rsi # imm = 0x2E000000200019
cmpq %rcx, %rdi
jae 0x4e19
movzbl (%rdi), %r8d
leal -0x30(%r8), %r9d
cmpb $0xa, %r9b
jb 0x4e14
movl %r8d, %r9d
orb $0x20, %r9b
addb $-0x61, %r9b
cmpb $0x1a, %r9b
jb 0x4e14
addl $-0x2a, %r8d
cmpl $0x35, %r8d
ja 0x4e1b
btq %r8, %rsi
jae 0x4e1b
incq %rdi
jmp 0x4de0
movl %edx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/object.c
// Function: create_object
Object *create_object(void *ptr, size_t size)
{
	Object *object = (Object*)xmalloc(sizeof(*object));

	object->data = ptr;
	object->size = size;
	object->refcount = 1;

	return object;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x18
popq %rdi
callq 0x40f8
movq %r14, (%rax)
movq %rbx, 0x8(%rax)
movl $0x1, 0x10(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/object.c
// Function: create_dup_object
Object *create_dup_object(void *ptr, size_t size)
{
	Object *object = (Object*)xmalloc(sizeof(*object));

	object->data = xmalloc(size);
	object->size = size;
	object->refcount = 1;

	memcpy(object->data, ptr, size);

	return object;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x18
popq %rdi
callq 0x40f8
movq %rax, %r15
movq %rbx, %rdi
callq 0x40f8
movq %rax, (%r15)
movq %rbx, 0x8(%r15)
movl $0x1, 0x10(%r15)
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2280
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: auth_command_handler
void auth_command_handler(EagleClient *client)
{
	ProtocolRequestAuth *req = (ProtocolRequestAuth*)client->request;
	EagleUser *user;

	if (client->pos < sizeof(*req)) {
		add_status_response(client, 0, EG_PROTOCOL_STATUS_ERROR_PACKET);
		return;
	}

	if (!check_input_buffer2(req->body.name, 32) || !check_input_buffer1(req->body.password, 32)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_VALUE);
		return;
	}

	user = find_user(server->users, req->body.name, req->body.password);
	if (!user) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_NOT_FOUND);
		return;
	}

	client->perm = user->perm;

	add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_SUCCESS);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x47, 0x20(%rdi)
ja 0x4ed4
pushq $0x3
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x4f3f
movq 0x10(%rbx), %r12
leaq 0x8(%r12), %r14
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x4c9e
testl %eax, %eax
je 0x4f33
leaq 0x28(%r12), %r15
pushq $0x20
popq %rsi
movq %r15, %rdi
callq 0x4c1e
testl %eax, %eax
je 0x4f33
leaq 0xd389(%rip), %rax      # 0x12290
movq (%rax), %rax
movq 0x168(%rax), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x84c4
testq %rax, %rax
je 0x4f4c
movq 0x40(%rax), %rax
movq %rax, 0x8(%rbx)
movzbl 0x2(%r12), %esi
pushq $0x1
jmp 0x4f3b
movzbl 0x2(%r12), %esi
pushq $0x7
popq %rdx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4f56
movzbl 0x2(%r12), %esi
pushq $0x9
jmp 0x4f3b