LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: add_status_response
static void add_status_response(EagleClient *client, int cmd, int status)
{
	ProtocolResponseHeader *res;

	if (!client->noack)
	{
		res = (ProtocolResponseHeader*)xmalloc(sizeof(*res));

		set_response_header(res, cmd, status, 0);

		add_response(client, res, sizeof(*res));
	}
}

// Assembly:
cmpl $0x0, 0x28(%rdi)
je 0x4f5d
retq
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
pushq $0x8
popq %rdi
callq 0x40f8
movw $0x80, (%rax)
movb %r14b, 0x2(%rax)
movb %bpl, 0x3(%rax)
andl $0x0, 0x4(%rax)
pushq $0x8
popq %rdx
movq %rbx, %rdi
movq %rax, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x512c
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: ping_command_handler
void ping_command_handler(EagleClient *client)
{
	ProtocolRequestPing *req = (ProtocolRequestPing*)client->request;

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

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

// Assembly:
cmpq $0x7, 0x20(%rdi)
ja 0x4fa2
pushq $0x3
popq %rdx
xorl %esi, %esi
jmp 0x4f56
movq 0x10(%rdi), %rax
movzbl 0x2(%rax), %esi
pushq $0x1
popq %rdx
jmp 0x4f56
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: add_response
static void add_response(EagleClient *client, void *data, int size)
{
	Object *object = create_object(data, size);

	if (set_write_event(client) != EG_STATUS_OK) {
		release_object(object);
		return;
	}

	list_add_value_tail(client->responses, object);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rax
movq %rdi, %rbx
movslq %edx, %rsi
movq %rax, %rdi
callq 0x4e1c
movq %rax, %r14
movq %rbx, %rdi
callq 0x7d3a
testl %eax, %eax
je 0x515f
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4e88
movq 0x48(%rbx), %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x8096
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: save_command_handler
void save_command_handler(EagleClient *client)
{
	ProtocolRequestSave *req = (ProtocolRequestSave*)client->request;

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

	if (!BIT_CHECK(client->perm, EG_USER_ADMIN_PERM)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_ACCESS);
		return;
	}

	if (req->body.async)
	{
		if (storage_save_background(server->storage) != EG_STATUS_OK) {
			add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR);
		}
	}
	else
	{
		if (storage_save(server->storage) != EG_STATUS_OK) {
			add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR);
		}
	}

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

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x8, 0x20(%rdi)
ja 0x518a
pushq $0x3
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x51e0
movq 0x10(%rbx), %r14
testb $0x20, 0x8(%rbx)
jne 0x519d
movzbl 0x2(%r14), %esi
pushq $0x5
jmp 0x51dc
cmpb $0x0, 0x8(%r14)
leaq 0xd0e7(%rip), %rax      # 0x12290
movq (%rax), %rax
movq 0x1c0(%rax), %rdi
je 0x51bc
callq 0xa283
jmp 0x51c1
callq 0x9cfe
testl %eax, %eax
je 0x51d5
movzbl 0x2(%r14), %esi
pushq $0x2
popq %rdx
movq %rbx, %rdi
callq 0x4f56
movzbl 0x2(%r14), %esi
pushq $0x1
popq %rdx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4f56
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: flush_command_handler
void flush_command_handler(EagleClient *client)
{
	ProtocolRequestFlush *req = (ProtocolRequestFlush*)client->request;

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

	if (!BIT_CHECK(client->perm, EG_USER_ADMIN_PERM)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_ACCESS);
		return;
	}

	if (BIT_CHECK(req->body.flags, EG_FLUSH_USER_FLAG)) {
		delete_users();
	}

	if (BIT_CHECK(req->body.flags, EG_FLUSH_QUEUE_FLAG)) {
		delete_queues();
	}

	if (BIT_CHECK(req->body.flags, EG_FLUSH_ROUTE_FLAG)) {
		delete_routes();
	}

	if (BIT_CHECK(req->body.flags, EG_FLUSH_CHANNEL_FLAG)) {
		delete_channels();
	}

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

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
cmpq $0xb, 0x20(%rdi)
ja 0x520b
pushq $0x3
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x5220
movq 0x10(%rbx), %r15
testb $0x20, 0x8(%rbx)
jne 0x5230
movzbl 0x2(%r15), %esi
pushq $0x5
popq %rdx
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4f56
movl 0x8(%r15), %eax
testb $0x1, %al
je 0x5287
leaq 0xd051(%rip), %r12      # 0x12290
movq (%r12), %rax
movq 0x168(%rax), %rdi
leaq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0x8226
movq %r14, %rdi
callq 0x81e5
testq %rax, %rax
je 0x5283
movq 0x10(%rax), %rcx
testb $0x40, 0x40(%rcx)
jne 0x5257
movq (%r12), %rcx
movq 0x168(%rcx), %rdi
movq %rax, %rsi
callq 0x8166
jmp 0x5257
movl 0x8(%r15), %eax
testb $0x2, %al
je 0x52d0
leaq 0xcffe(%rip), %r12      # 0x12290
movq (%r12), %rax
movq 0x170(%rax), %rdi
leaq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0x8226
movq %r14, %rdi
callq 0x81e5
testq %rax, %rax
je 0x52cc
movq (%r12), %rcx
movq 0x170(%rcx), %rdi
movq %rax, %rsi
callq 0x8166
jmp 0x52aa
movl 0x8(%r15), %eax
testb $0x4, %al
je 0x5319
leaq 0xcfb5(%rip), %r12      # 0x12290
movq (%r12), %rax
movq 0x178(%rax), %rdi
leaq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0x8226
movq %r14, %rdi
callq 0x81e5
testq %rax, %rax
je 0x5315
movq (%r12), %rcx
movq 0x178(%rcx), %rdi
movq %rax, %rsi
callq 0x8166
jmp 0x52f3
movl 0x8(%r15), %eax
testb $0x8, %al
jne 0x5339
movzbl 0x2(%r15), %esi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x4f56
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0xcf50(%rip), %r12      # 0x12290
movq (%r12), %rax
movq 0x180(%rax), %rdi
leaq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0x8226
movq %r14, %rdi
callq 0x81e5
testq %rax, %rax
je 0x531d
movq (%r12), %rcx
movq 0x180(%rcx), %rdi
movq %rax, %rsi
callq 0x8166
jmp 0x5358
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: free_client
void free_client(EagleClient *client)
{
	xfree(client->request);
	xfree(client->buffer);

	eject_queue_client(client);
	eject_channel_client(client);

	list_release(client->responses);
	list_release(client->declared_queues);
	list_release(client->subscribed_queues);
	keylist_release(client->subscribed_topics);
	keylist_release(client->subscribed_patterns);

	delete_file_event(server->loop, client->fd, EG_EVENT_READABLE);
	delete_file_event(server->loop, client->fd, EG_EVENT_WRITABLE);

	close(client->fd);

	list_delete_value(server->clients, client);

	xfree(client);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
callq 0x430e
movq 0x30(%rbx), %rdi
callq 0x430e
movq 0x58(%rbx), %rdi
leaq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0x8226
movq %r14, %rdi
callq 0x81e5
testq %rax, %rax
je 0x53db
movq 0x10(%rax), %rdi
movq %rbx, %rsi
callq 0x8b65
jmp 0x53c0
movq 0x50(%rbx), %rdi
leaq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0x8226
movq %r14, %rdi
callq 0x81e5
testq %rax, %rax
je 0x5412
movq 0x10(%rax), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x8b0e
movq %r15, %rdi
callq 0x8cd1
jmp 0x53ec
movq 0x60(%rbx), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x7f19
leaq 0x8(%rsp), %r15
movq %r14, %rdi
callq 0x7f20
testq %rax, %rax
je 0x5465
movq 0x10(%rax), %r12
movq 0x18(%rax), %rdi
movq %r15, %rsi
callq 0x8226
movq %r15, %rdi
callq 0x81e5
testq %rax, %rax
je 0x5426
movq 0x10(%rax), %rax
movq 0x10(%rax), %rdx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x9606
jmp 0x5443
movq 0x68(%rbx), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x7f19
leaq 0x8(%rsp), %r15
movq %r14, %rdi
callq 0x7f20
testq %rax, %rax
je 0x54b8
movq 0x10(%rax), %r12
movq 0x18(%rax), %rdi
movq %r15, %rsi
callq 0x8226
movq %r15, %rdi
callq 0x81e5
testq %rax, %rax
je 0x5479
movq 0x10(%rax), %rax
movq 0x10(%rax), %rdx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x96fb
jmp 0x5496
movq 0x48(%rbx), %rdi
callq 0x8005
movq 0x50(%rbx), %rdi
callq 0x8005
movq 0x58(%rbx), %rdi
callq 0x8005
movq 0x60(%rbx), %rdi
callq 0x7e85
movq 0x68(%rbx), %rdi
callq 0x7e85
leaq 0xcda4(%rip), %r14      # 0x12290
movq (%r14), %rax
movq (%rax), %rdi
movl (%rbx), %esi
pushq $0x1
popq %rdx
callq 0x36ee
movq (%r14), %rax
movq (%rax), %rdi
movl (%rbx), %esi
pushq $0x2
popq %rdx
callq 0x36ee
movl (%rbx), %edi
callq 0x21d0
movq (%r14), %rax
movq 0x160(%rax), %rdi
movq %rbx, %rsi
callq 0x80e7
movq %rbx, %rdi
callq 0x430e
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: user_create_command_handler
void user_create_command_handler(EagleClient *client)
{
	ProtocolRequestUserCreate *req = (ProtocolRequestUserCreate*)client->request;
	EagleUser *user;

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

	if (!BIT_CHECK(client->perm, EG_USER_ADMIN_PERM)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_ACCESS);
		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;
	}

	if (find_user(server->users, req->body.name, NULL)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR);
		return;
	}

	user = create_user(req->body.name, req->body.password, req->body.perm);
	list_add_value_tail(server->users, user);

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

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
cmpq $0x4f, 0x20(%rdi)
ja 0x5556
pushq $0x3
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x55c9
movq 0x10(%rbx), %r12
testb $0x20, 0x8(%rbx)
jne 0x556a
movzbl 0x2(%r12), %esi
pushq $0x5
jmp 0x55c5
leaq 0x8(%r12), %r14
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x4c9e
testl %eax, %eax
je 0x55bd
leaq 0x28(%r12), %r15
pushq $0x20
popq %rsi
movq %r15, %rdi
callq 0x4c1e
testl %eax, %eax
je 0x55bd
leaq 0xccf7(%rip), %r13      # 0x12290
movq (%r13), %rax
movq 0x168(%rax), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x84c4
testq %rax, %rax
je 0x55d7
movzbl 0x2(%r12), %esi
pushq $0x2
jmp 0x55c5
movzbl 0x2(%r12), %esi
pushq $0x7
popq %rdx
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x4f56
movq 0x48(%r12), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x845c
movq (%r13), %rcx
movq 0x168(%rcx), %rdi
movq %rax, %rsi
callq 0x8096
movzbl 0x2(%r12), %esi
pushq $0x1
jmp 0x55c5
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: user_list_command_handler
void user_list_command_handler(EagleClient *client)
{
	ProtocolRequestUserList *req = (ProtocolRequestUserList*)client->request;
	ProtocolResponseHeader res;
	EagleUser *user;
	ListIterator iterator;
	ListNode *node;
	char *list;
	int i;

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

	if (!BIT_CHECK(client->perm, EG_USER_ADMIN_PERM)) {
		add_status_response(client, req->cmd, EG_PROTOCOL_STATUS_ERROR_ACCESS);
		return;
	}

	set_response_header(&res, req->cmd, EG_PROTOCOL_STATUS_SUCCESS,
		EG_LIST_LENGTH(server->users) * (64 + sizeof(uint64_t)));

	list = (char*)xcalloc(sizeof(res) + res.bodylen);

	memcpy(list, &res, sizeof(res));

	i = sizeof(res);
	list_rewind(server->users, &iterator);
	while ((node = list_next_node(&iterator)) != NULL)
	{
		user = EG_LIST_NODE_VALUE(node);
		memcpy(list + i, user->name, strlenz(user->name));
		memcpy(list + i + 32, user->password, strlenz(user->password));
		memcpy(list + i + 64, &user->perm, sizeof(uint64_t));
		i += 64 + sizeof(uint64_t);
	}

	add_response(client, list, sizeof(res) + res.bodylen);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
cmpq $0x7, 0x20(%rdi)
ja 0x5620
pushq $0x3
popq %rdx
xorl %esi, %esi
jmp 0x5635
movq 0x10(%rdi), %rax
testb $0x20, 0x8(%rdi)
movzbl 0x2(%rax), %r12d
jne 0x5648
pushq $0x5
popq %rdx
movl %r12d, %esi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4f56
movq %rdi, 0x10(%rsp)
leaq 0xcc3c(%rip), %rbx      # 0x12290
movq (%rbx), %rax
movq 0x168(%rax), %rax
imull $0x48, 0x20(%rax), %r14d
leaq 0x8(%r14), %rdi
callq 0x417e
movq %rax, %r15
movq %r14, 0x8(%rsp)
movq %r14, %rax
shlq $0x20, %rax
shll $0x10, %r12d
addq %r12, %rax
addq $0x1000080, %rax        # imm = 0x1000080
movq %rax, (%r15)
movq (%rbx), %rax
movq 0x168(%rax), %rdi
leaq 0x18(%rsp), %r12
movq %r12, %rsi
callq 0x8226
pushq $0x8
popq %rbx
movq %r12, %rdi
callq 0x81e5
testq %rax, %rax
je 0x5706
movq 0x10(%rax), %r13
movslq %ebx, %rbx
leaq (%r15,%rbx), %rbp
movq %r13, %rdi
callq 0x2150
leaq 0x1(%rax), %rdx
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2280
leaq (%r15,%rbx), %rbp
addq $0x20, %rbp
leaq 0x20(%r13), %r14
movq %r14, %rdi
callq 0x2150
leaq 0x1(%rax), %rdx
movq %rbp, %rdi
movq %r14, %rsi
callq 0x2280
movq 0x40(%r13), %rax
movq %rax, 0x40(%r15,%rbx)
addq $0x48, %rbx
jmp 0x56a5
movq 0x8(%rsp), %rdx
addl $0x8, %edx
movq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x512c
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/handlers.c
// Function: user_rename_command_handler
void user_rename_command_handler(EagleClient *client)
{
	ProtocolRequestUserRename *req = (ProtocolRequestUserRename*)client->request;
	EagleUser *user;

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

	if (!BIT_CHECK(client->perm, EG_USER_ADMIN_PERM)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_ACCESS);
		return;
	}

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

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

	if (BIT_CHECK(user->perm, EG_USER_NOT_CHANGE_PERM)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR);
		return;
	}

	rename_user(user, req->body.to);

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

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
cmpq $0x47, 0x20(%rdi)
ja 0x574a
pushq $0x3
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x57da
movq 0x10(%rbx), %r12
testb $0x20, 0x8(%rbx)
jne 0x575e
movzbl 0x2(%r12), %esi
pushq $0x5
jmp 0x57d6
leaq 0x8(%r12), %r15
pushq $0x20
popq %rsi
movq %r15, %rdi
callq 0x4c9e
testl %eax, %eax
je 0x57ce
leaq 0x28(%r12), %r14
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x4c9e
testl %eax, %eax
je 0x57ce
leaq 0xcb03(%rip), %r13      # 0x12290
movq (%r13), %rax
movq 0x168(%rax), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x84c4
testq %rax, %rax
je 0x57c4
movq %rax, %r15
movq (%r13), %rax
movq 0x168(%rax), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x84c4
testq %rax, %rax
je 0x57e8
movzbl 0x2(%r12), %esi
pushq $0x9
jmp 0x57d6
movzbl 0x2(%r12), %esi
pushq $0x7
popq %rdx
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x4f56
testb $0x40, 0x40(%r15)
jne 0x5804
movq %r15, %rdi
movq %r14, %rsi
callq 0x852c
movzbl 0x2(%r12), %esi
pushq $0x1
jmp 0x57d6
movzbl 0x2(%r12), %esi
pushq $0x2
jmp 0x57d6
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: user_set_perm_command_handler
void user_set_perm_command_handler(EagleClient *client)
{
	ProtocolRequestUserSetPerm *req = (ProtocolRequestUserSetPerm*)client->request;
	EagleUser *user;

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

	if (!BIT_CHECK(client->perm, EG_USER_ADMIN_PERM)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_ACCESS);
		return;
	}

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

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

	if (BIT_CHECK(user->perm, EG_USER_NOT_CHANGE_PERM)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR);
		return;
	}

	set_user_perm(user, req->body.perm);

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

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpq $0x2f, 0x20(%rdi)
ja 0x5827
pushq $0x3
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x58a5
movq 0x10(%rbx), %r15
testb $0x20, 0x8(%rbx)
jne 0x583a
movzbl 0x2(%r15), %esi
pushq $0x5
jmp 0x58a1
leaq 0x8(%r15), %r14
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x4c9e
testl %eax, %eax
je 0x5888
leaq 0xca3c(%rip), %rax      # 0x12290
movq (%rax), %rax
movq 0x168(%rax), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x84c4
testq %rax, %rax
je 0x5891
testb $0x40, 0x40(%rax)
jne 0x589a
movq 0x28(%r15), %rsi
movq %rax, %rdi
callq 0x8554
movzbl 0x2(%r15), %esi
pushq $0x1
jmp 0x58a1
movzbl 0x2(%r15), %esi
pushq $0x7
jmp 0x58a1
movzbl 0x2(%r15), %esi
pushq $0x9
jmp 0x58a1
movzbl 0x2(%r15), %esi
pushq $0x2
popq %rdx
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x4f56
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: user_delete_command_handler
void user_delete_command_handler(EagleClient *client)
{
	ProtocolRequestUserDelete *req = (ProtocolRequestUserDelete*)client->request;
	EagleUser *user;

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

	if (!BIT_CHECK(client->perm, EG_USER_ADMIN_PERM)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_ACCESS);
		return;
	}

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

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

	if (BIT_CHECK(user->perm, EG_USER_NOT_CHANGE_PERM)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR);
		return;
	}

	if (list_delete_value(server->users, user) == EG_STATUS_ERR) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR);
		return;
	}

	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 $0x27, 0x20(%rdi)
ja 0x58ce
pushq $0x3
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x5959
movq 0x10(%rbx), %r15
testb $0x20, 0x8(%rbx)
jne 0x58e1
movzbl 0x2(%r15), %esi
pushq $0x5
jmp 0x5955
leaq 0x8(%r15), %r14
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0x4c9e
testl %eax, %eax
je 0x593c
leaq 0xc995(%rip), %r12      # 0x12290
movq (%r12), %rax
movq 0x168(%rax), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x84c4
testq %rax, %rax
je 0x5945
testb $0x40, 0x40(%rax)
jne 0x594e
movq (%r12), %rcx
movq 0x168(%rcx), %rdi
movq %rax, %rsi
callq 0x80e7
movzbl 0x2(%r15), %esi
cmpl $-0x1, %eax
je 0x5953
pushq $0x1
jmp 0x5955
movzbl 0x2(%r15), %esi
pushq $0x7
jmp 0x5955
movzbl 0x2(%r15), %esi
pushq $0x9
jmp 0x5955
movzbl 0x2(%r15), %esi
pushq $0x2
popq %rdx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4f56
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: queue_create_command_handler
void queue_create_command_handler(EagleClient *client)
{
	ProtocolRequestQueueCreate *req = (ProtocolRequestQueueCreate*)client->request;
	Queue_t *queue_t;

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

	if (!BIT_CHECK(client->perm, EG_USER_ADMIN_PERM) && !BIT_CHECK(client->perm, EG_USER_QUEUE_PERM)
		&& !BIT_CHECK(client->perm, EG_USER_QUEUE_CREATE_PERM)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_ACCESS);
		return;
	}

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

	if (find_queue_t(server->queues, req->body.name)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR);
		return;
	}

	if (!req->body.max_msg || req->body.max_msg_size > EG_MAX_MSG_SIZE) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_VALUE);
		return;
	}

	queue_t = create_queue_t(req->body.name, req->body.max_msg,
		((req->body.max_msg_size == 0) ? EG_MAX_MSG_SIZE : req->body.max_msg_size), req->body.flags);

	list_add_value_tail(server->queues, queue_t);

	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 $0x53, 0x20(%rdi)
ja 0x5988
pushq $0x3
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x5a24
movq 0x10(%rbx), %r15
testl $0x100021, 0x8(%rbx)    # imm = 0x100021
je 0x59d0
leaq 0x8(%r15), %r14
pushq $0x40
popq %rsi
movq %r14, %rdi
callq 0x4c9e
testl %eax, %eax
je 0x5a19
leaq 0xc8e1(%rip), %r12      # 0x12290
movq (%r12), %rax
movq 0x170(%rax), %rdi
movq %r14, %rsi
callq 0x8a49
testq %rax, %rax
je 0x59d9
movzbl 0x2(%r15), %esi
pushq $0x2
jmp 0x5a20
movzbl 0x2(%r15), %esi
pushq $0x5
jmp 0x5a20
movl 0x48(%r15), %esi
testl %esi, %esi
je 0x5a19
movl 0x4c(%r15), %edx
testl %edx, %edx
js 0x5a19
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmovel %eax, %edx
movl 0x50(%r15), %ecx
movq %r14, %rdi
callq 0x85a8
movq (%r12), %rcx
movq 0x170(%rcx), %rdi
movq %rax, %rsi
callq 0x8096
movzbl 0x2(%r15), %esi
pushq $0x1
jmp 0x5a20
movzbl 0x2(%r15), %esi
pushq $0x7
popq %rdx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4f56
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: queue_declare_command_handler
void queue_declare_command_handler(EagleClient *client)
{
	ProtocolRequestQueueDeclare *req = (ProtocolRequestQueueDeclare*)client->request;
	Queue_t *queue_t;

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

	if (!BIT_CHECK(client->perm, EG_USER_ADMIN_PERM) && !BIT_CHECK(client->perm, EG_USER_QUEUE_PERM)
		&& !BIT_CHECK(client->perm, EG_USER_QUEUE_DECLARE_PERM)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_ACCESS);
		return;
	}

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

	queue_t = find_queue_t(server->queues, req->body.name);
	if (!queue_t) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_NOT_FOUND);
		return;
	}

	if (find_queue_t(client->declared_queues, req->body.name)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_SUCCESS);
		return;
	}

	declare_client_queue_t(queue_t, client);

	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 0x5a53
pushq $0x3
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x5adb
movq 0x10(%rbx), %r12
testl $0x200021, 0x8(%rbx)    # imm = 0x200021
je 0x5abb
leaq 0x8(%r12), %r14
pushq $0x40
popq %rsi
movq %r14, %rdi
callq 0x4c9e
testl %eax, %eax
je 0x5ac5
leaq 0xc815(%rip), %rax      # 0x12290
movq (%rax), %rax
movq 0x170(%rax), %rdi
movq %r14, %rsi
callq 0x8a49
testq %rax, %rax
je 0x5acf
movq %rax, %r15
movq 0x50(%rbx), %rdi
movq %r14, %rsi
callq 0x8a49
testq %rax, %rax
jne 0x5ab1
movq %r15, %rdi
movq %rbx, %rsi
callq 0x8ae5
movzbl 0x2(%r12), %esi
pushq $0x1
jmp 0x5ad7
movzbl 0x2(%r12), %esi
pushq $0x5
jmp 0x5ad7
movzbl 0x2(%r12), %esi
pushq $0x7
jmp 0x5ad7
movzbl 0x2(%r12), %esi
pushq $0x9
popq %rdx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4f56
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: queue_exist_command_handler
void queue_exist_command_handler(EagleClient *client)
{
	ProtocolRequestQueueExist *req = (ProtocolRequestQueueExist*)client->request;
	ProtocolResponseQueueExist *res;

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

	if (!BIT_CHECK(client->perm, EG_USER_ADMIN_PERM) && !BIT_CHECK(client->perm, EG_USER_QUEUE_PERM)
		&& !BIT_CHECK(client->perm, EG_USER_QUEUE_EXIST_PERM)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_ACCESS);
		return;
	}

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

	res = (ProtocolResponseQueueExist*)xcalloc(sizeof(*res));

	set_response_header(&res->header, req->header.cmd, EG_PROTOCOL_STATUS_SUCCESS, sizeof(res->body));

	if (find_queue_t(server->queues, req->body.name)) {
		res->body.status = 1;
	} else {
		res->body.status = 0;
	}

	add_response(client, res, sizeof(*res));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x47, 0x20(%rdi)
ja 0x5b0a
pushq $0x3
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x5ba6
movq 0x10(%rbx), %r12
testl $0x400021, 0x8(%rbx)    # imm = 0x400021
je 0x5b90
leaq 0x8(%r12), %r14
pushq $0x40
popq %rsi
movq %r14, %rdi
callq 0x4c9e
testl %eax, %eax
je 0x5b9a
pushq $0xc
popq %rdi
callq 0x417e
movq %rax, %r15
movb 0x2(%r12), %al
movw $0x80, (%r15)
movb %al, 0x2(%r15)
movb $0x1, 0x3(%r15)
movl $0x4, 0x4(%r15)
leaq 0xc737(%rip), %rax      # 0x12290
movq (%rax), %rax
movq 0x170(%rax), %rdi
movq %r14, %rsi
callq 0x8a49
xorl %ecx, %ecx
testq %rax, %rax
setne %cl
movl %ecx, 0x8(%r15)
pushq $0xc
popq %rdx
movq %rbx, %rdi
movq %r15, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x512c
movzbl 0x2(%r12), %esi
pushq $0x5
jmp 0x5ba2
movzbl 0x2(%r12), %esi
pushq $0x7
popq %rdx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4f56
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: queue_rename_command_handler
void queue_rename_command_handler(EagleClient *client)
{
	ProtocolRequestQueueRename *req = (ProtocolRequestQueueRename*)client->request;
	Queue_t *queue_t;

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

	if (!BIT_CHECK(client->perm, EG_USER_ADMIN_PERM) && !BIT_CHECK(client->perm, EG_USER_QUEUE_PERM)
		&& !BIT_CHECK(client->perm, EG_USER_QUEUE_RENAME_PERM)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_ACCESS);
		return;
	}

	if (!check_input_buffer2(req->body.from, 64) || !check_input_buffer2(req->body.to, 64)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_VALUE);
		return;
	}

	queue_t = find_queue_t(server->queues, req->body.from);
	if (!queue_t) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_NOT_FOUND);
		return;
	}

	if (find_queue_t(server->queues, req->body.to)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_VALUE);
		return;
	}

	rename_queue_t(queue_t, req->body.to);

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

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
cmpq $0x87, 0x20(%rdi)
ja 0x5d48
pushq $0x3
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x5dcd
movq 0x10(%rbx), %r12
testl $0x1000021, 0x8(%rbx)   # imm = 0x1000021
je 0x5dc1
leaq 0x8(%r12), %r15
pushq $0x40
popq %rsi
movq %r15, %rdi
callq 0x4c9e
testl %eax, %eax
je 0x5db7
leaq 0x48(%r12), %r14
pushq $0x40
popq %rsi
movq %r14, %rdi
callq 0x4c9e
testl %eax, %eax
je 0x5db7
leaq 0xc50c(%rip), %r13      # 0x12290
movq (%r13), %rax
movq 0x170(%rax), %rdi
movq %r15, %rsi
callq 0x8a49
testq %rax, %rax
je 0x5ddb
movq %rax, %r15
movq (%r13), %rax
movq 0x170(%rax), %rdi
movq %r14, %rsi
callq 0x8a49
testq %rax, %rax
je 0x5de5
movzbl 0x2(%r12), %esi
pushq $0x7
jmp 0x5dc9
movzbl 0x2(%r12), %esi
pushq $0x5
popq %rdx
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x4f56
movzbl 0x2(%r12), %esi
pushq $0x9
jmp 0x5dc9
movq %r15, %rdi
movq %r14, %rsi
callq 0x8a92
movzbl 0x2(%r12), %esi
pushq $0x1
jmp 0x5dc9
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: queue_size_command_handler
void queue_size_command_handler(EagleClient *client)
{
	ProtocolRequestQueueSize *req = (ProtocolRequestQueueSize*)client->request;
	ProtocolResponseQueueSize *res;
	Queue_t *queue_t;

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

	if (!BIT_CHECK(client->perm, EG_USER_ADMIN_PERM) && !BIT_CHECK(client->perm, EG_USER_QUEUE_PERM)
		&& !BIT_CHECK(client->perm, EG_USER_QUEUE_SIZE_PERM)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_ACCESS);
		return;
	}

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

	queue_t = find_queue_t(server->queues, req->body.name);
	if (!queue_t) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_NOT_FOUND);
		return;
	}

	res = (ProtocolResponseQueueSize*)xmalloc(sizeof(*res));

	set_response_header(&res->header, req->header.cmd, EG_PROTOCOL_STATUS_SUCCESS, sizeof(res->body));

	res->body.size = get_size_queue_t(queue_t);

	add_response(client, res, sizeof(*res));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x47, 0x20(%rdi)
ja 0x5e19
pushq $0x3
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x5ecb
movq 0x10(%rbx), %r12
testl $0x2000021, 0x8(%rbx)   # imm = 0x2000021
je 0x5eab
leaq 0x8(%r12), %r14
pushq $0x40
popq %rsi
movq %r14, %rdi
callq 0x4c9e
testl %eax, %eax
je 0x5eb5
leaq 0xc44b(%rip), %rax      # 0x12290
movq (%rax), %rax
movq 0x170(%rax), %rdi
movq %r14, %rsi
callq 0x8a49
testq %rax, %rax
je 0x5ebf
movq %rax, %r14
pushq $0xc
popq %rdi
callq 0x40f8
movq %rax, %r15
movb 0x2(%r12), %al
movw $0x80, (%r15)
movb %al, 0x2(%r15)
movb $0x1, 0x3(%r15)
movl $0x4, 0x4(%r15)
movq %r14, %rdi
callq 0x8ad4
movl %eax, 0x8(%r15)
pushq $0xc
popq %rdx
movq %rbx, %rdi
movq %r15, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x512c
movzbl 0x2(%r12), %esi
pushq $0x5
jmp 0x5ec7
movzbl 0x2(%r12), %esi
pushq $0x7
jmp 0x5ec7
movzbl 0x2(%r12), %esi
pushq $0x9
popq %rdx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4f56
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: queue_push_command_handler
void queue_push_command_handler(EagleClient *client)
{
	ProtocolRequestHeader *req = (ProtocolRequestHeader*)client->request;
	Queue_t *queue_t;
	Object *msg;
	char *queue_name, *msg_data;
	uint32_t expire;
	size_t msg_size;

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

	if (!BIT_CHECK(client->perm, EG_USER_ADMIN_PERM) && !BIT_CHECK(client->perm, EG_USER_QUEUE_PERM)
		&& !BIT_CHECK(client->perm, EG_USER_QUEUE_PUSH_PERM)) {
		add_status_response(client, req->cmd, EG_PROTOCOL_STATUS_ERROR_ACCESS);
		return;
	}

	queue_name = client->request + sizeof(*req);

	if (!check_input_buffer2(queue_name, 64)) {
		add_status_response(client, req->cmd, EG_PROTOCOL_STATUS_ERROR_VALUE);
		return;
	}

	if (server->nomemory) {
		add_status_response(client, req->cmd, EG_PROTOCOL_STATUS_ERROR_MEMORY);
		return;
	}

	queue_t = find_queue_t(client->declared_queues, queue_name);
	if (!queue_t) {
		add_status_response(client, req->cmd, EG_PROTOCOL_STATUS_ERROR_NOT_DECLARED);
		return;
	}

	msg_data = client->request + sizeof(*req) + 64 + sizeof(uint32_t);
	msg_size = client->pos - (sizeof(*req) + 64 + sizeof(uint32_t));
	expire = *((uint32_t*)(client->request + sizeof(*req) + 64));

	if (expire) {
		expire += server->now_timems;
	}

	msg = create_dup_object(msg_data, msg_size);

	if (push_message_queue_t(queue_t, msg, expire) == EG_STATUS_ERR) {
		add_status_response(client, req->cmd, EG_PROTOCOL_STATUS_ERROR);
		return;
	}

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
cmpq $0x4c, 0x20(%rdi)
ja 0x5ef7
pushq $0x3
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x5f48
movq 0x10(%rbx), %r15
testl $0x4000021, 0x8(%rbx)   # imm = 0x4000021
je 0x5f34
leaq 0x8(%r15), %r14
pushq $0x40
popq %rsi
movq %r14, %rdi
callq 0x4c9e
testl %eax, %eax
je 0x5f3d
leaq 0xc372(%rip), %r12      # 0x12290
movq (%r12), %rax
cmpl $0x0, 0x1b0(%rax)
je 0x5f55
movzbl 0x2(%r15), %esi
pushq $0x6
jmp 0x5f44
movzbl 0x2(%r15), %esi
pushq $0x5
jmp 0x5f44
movzbl 0x2(%r15), %esi
pushq $0x7
popq %rdx
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x4f56
movq 0x50(%rbx), %rdi
movq %r14, %rsi
callq 0x8a49
testq %rax, %rax
je 0x5f8c
movq %rax, %r14
movq 0x10(%rbx), %rdi
movq 0x20(%rbx), %rsi
addq $-0x4c, %rsi
movl 0x48(%rdi), %ebp
addq $0x4c, %rdi
testl %ebp, %ebp
je 0x5f95
movq (%r12), %rax
addl 0x190(%rax), %ebp
jmp 0x5f97
movzbl 0x2(%r15), %esi
pushq $0x8
jmp 0x5f44
xorl %ebp, %ebp
callq 0x4e44
movq %r14, %rdi
movq %rax, %rsi
movl %ebp, %edx
callq 0x8816
movzbl 0x2(%r15), %esi
cmpl $-0x1, %eax
je 0x5fb7
pushq $0x1
jmp 0x5f44
pushq $0x2
jmp 0x5f44
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: queue_get_command_handler
void queue_get_command_handler(EagleClient *client)
{
	ProtocolRequestQueueGet *req = (ProtocolRequestQueueGet*)client->request;
	ProtocolResponseHeader res;
	Queue_t *queue_t;
	Message *msg;
	char *buffer;

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

	if (!BIT_CHECK(client->perm, EG_USER_ADMIN_PERM) && !BIT_CHECK(client->perm, EG_USER_QUEUE_PERM)
		&& !BIT_CHECK(client->perm, EG_USER_QUEUE_GET_PERM)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_ACCESS);
		return;
	}

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

	queue_t = find_queue_t(client->declared_queues, req->body.name);
	if (!queue_t) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_NOT_DECLARED);
		return;
	}

	msg = get_message_queue_t(queue_t);
	if (!msg) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_NO_DATA);
		return;
	}

	set_response_header(&res, req->header.cmd, EG_PROTOCOL_STATUS_SUCCESS, EG_MESSAGE_SIZE(msg) + sizeof(uint64_t));

	buffer = (char*)xmalloc(sizeof(res) + sizeof(uint64_t));

	memcpy(buffer, &res, sizeof(res));
	memcpy(buffer + sizeof(res), &msg->tag, sizeof(uint64_t));

	add_response(client, buffer, sizeof(res) + sizeof(uint64_t));
	add_object_response(client, EG_MESSAGE_OBJECT(msg));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x47, 0x20(%rdi)
ja 0x5fda
pushq $0x3
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x609c
movq 0x10(%rbx), %r15
testl $0x8000021, 0x8(%rbx)   # imm = 0x8000021
je 0x607f
leaq 0x8(%r15), %r14
pushq $0x40
popq %rsi
movq %r14, %rdi
callq 0x4c9e
testl %eax, %eax
je 0x6088
movq 0x50(%rbx), %rdi
movq %r14, %rsi
callq 0x8a49
testq %rax, %rax
je 0x6091
movq %rax, %rdi
callq 0x89df
movzbl 0x2(%r15), %r15d
testq %rax, %rax
je 0x60ac
movq %rax, %r14
movq (%rax), %rax
movq 0x8(%rax), %r12
pushq $0x10
popq %rdi
callq 0x40f8
shlq $0x20, %r12
shll $0x10, %r15d
orq %r12, %r15
movabsq $0x801000080, %rcx      # imm = 0x801000080
addq %r15, %rcx
movq %rcx, (%rax)
movq 0x8(%r14), %rcx
movq %rcx, 0x8(%rax)
pushq $0x10
popq %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x512c
movq (%r14), %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x60b7
movzbl 0x2(%r15), %esi
pushq $0x5
jmp 0x6098
movzbl 0x2(%r15), %esi
pushq $0x7
jmp 0x6098
movzbl 0x2(%r15), %esi
pushq $0x8
popq %rdx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4f56
pushq $0xa
popq %rdx
movq %rbx, %rdi
movl %r15d, %esi
jmp 0x609c
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: add_object_response
static void add_object_response(EagleClient *client, Object *object)
{
	increment_references_count(object);

	if (set_write_event(client) != EG_STATUS_OK) {
		decrement_references_count(object);
		return;
	}

	list_add_value_tail(client->responses, object);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x4e9d
movq %r14, %rdi
callq 0x7d3a
testl %eax, %eax
je 0x60e4
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4ea1
movq 0x48(%r14), %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x8096
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: queue_pop_command_handler
void queue_pop_command_handler(EagleClient *client)
{
	ProtocolRequestQueuePop *req = (ProtocolRequestQueuePop*)client->request;
	ProtocolResponseHeader res;
	Queue_t *queue_t;
	Message *msg;
	char *buffer;

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

	if (!BIT_CHECK(client->perm, EG_USER_ADMIN_PERM) && !BIT_CHECK(client->perm, EG_USER_QUEUE_PERM)
		&& !BIT_CHECK(client->perm, EG_USER_QUEUE_POP_PERM)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_ACCESS);
		return;
	}

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

	queue_t = find_queue_t(client->declared_queues, req->body.name);
	if (!queue_t) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_NOT_DECLARED);
		return;
	}

	msg = get_message_queue_t(queue_t);
	if (!msg) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_NO_DATA);
		return;
	}

	set_response_header(&res, req->header.cmd, EG_PROTOCOL_STATUS_SUCCESS, EG_MESSAGE_SIZE(msg) + sizeof(uint64_t));

	buffer = (char*)xmalloc(sizeof(res) + sizeof(uint64_t));

	memcpy(buffer, &res, sizeof(res));
	memcpy(buffer + sizeof(res), &msg->tag, sizeof(uint64_t));

	add_response(client, buffer, sizeof(res) + sizeof(uint64_t));
	add_object_response(client, EG_MESSAGE_OBJECT(msg));

	pop_message_queue_t(queue_t, req->body.timeout);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x4b, 0x20(%rdi)
ja 0x6119
pushq $0x3
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x61f4
movq 0x10(%rbx), %r13
testl $0x10000021, 0x8(%rbx)  # imm = 0x10000021
je 0x61d7
leaq 0x8(%r13), %r14
pushq $0x40
popq %rsi
movq %r14, %rdi
callq 0x4c9e
testl %eax, %eax
je 0x61e0
movq 0x50(%rbx), %rdi
movq %r14, %rsi
callq 0x8a49
testq %rax, %rax
je 0x61e9
movq %rax, %r14
movq %rax, %rdi
callq 0x89df
movzbl 0x2(%r13), %r12d
testq %rax, %rax
je 0x6207
movq %rax, %r15
movq (%rax), %rax
movq 0x8(%rax), %rbp
pushq $0x10
popq %rdi
callq 0x40f8
shlq $0x20, %rbp
shll $0x10, %r12d
orq %rbp, %r12
movabsq $0x801000080, %rcx      # imm = 0x801000080
addq %r12, %rcx
movq %rcx, (%rax)
movq 0x8(%r15), %rcx
movq %rcx, 0x8(%rax)
pushq $0x10
popq %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x512c
movq (%r15), %rsi
movq %rbx, %rdi
callq 0x60b7
movl 0x48(%r13), %esi
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8983
movzbl 0x2(%r13), %esi
pushq $0x5
jmp 0x61f0
movzbl 0x2(%r13), %esi
pushq $0x7
jmp 0x61f0
movzbl 0x2(%r13), %esi
pushq $0x8
popq %rdx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4f56
pushq $0xa
popq %rdx
movq %rbx, %rdi
movl %r12d, %esi
jmp 0x61f4
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: queue_confirm_command_handler
void queue_confirm_command_handler(EagleClient *client)
{
	ProtocolRequestQueueConfirm *req = (ProtocolRequestQueueConfirm*)client->request;
	Queue_t *queue_t;

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

	if (!BIT_CHECK(client->perm, EG_USER_ADMIN_PERM) && !BIT_CHECK(client->perm, EG_USER_QUEUE_PERM)
		&& !BIT_CHECK(client->perm, EG_USER_QUEUE_CONFIRM_PERM)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_ACCESS);
		return;
	}

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

	queue_t = find_queue_t(client->declared_queues, req->body.name);
	if (!queue_t) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_NOT_DECLARED);
		return;
	}

	if (confirm_message_queue_t(queue_t, req->body.tag) != EG_STATUS_OK) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_NO_DATA);
		return;
	}

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

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpq $0x4f, 0x20(%rdi)
ja 0x622b
pushq $0x3
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x6296
movq 0x10(%rbx), %r15
testl $0x20000021, 0x8(%rbx)  # imm = 0x20000021
je 0x6275
leaq 0x8(%r15), %r14
pushq $0x40
popq %rsi
movq %r14, %rdi
callq 0x4c9e
testl %eax, %eax
je 0x627e
movq 0x50(%rbx), %rdi
movq %r14, %rsi
callq 0x8a49
testq %rax, %rax
je 0x6287
movq 0x48(%r15), %rsi
movq %rax, %rdi
callq 0x89e8
movzbl 0x2(%r15), %esi
testl %eax, %eax
je 0x6290
pushq $0xa
jmp 0x6292
movzbl 0x2(%r15), %esi
pushq $0x5
jmp 0x6292
movzbl 0x2(%r15), %esi
pushq $0x7
jmp 0x6292
movzbl 0x2(%r15), %esi
pushq $0x8
jmp 0x6292
pushq $0x1
popq %rdx
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x4f56
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: queue_subscribe_command_handler
void queue_subscribe_command_handler(EagleClient *client)
{
	ProtocolRequestQueueSubscribe *req = (ProtocolRequestQueueSubscribe*)client->request;
	Queue_t *queue_t;

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

	if (!BIT_CHECK(client->perm, EG_USER_ADMIN_PERM) && !BIT_CHECK(client->perm, EG_USER_QUEUE_PERM)
		&& !BIT_CHECK(client->perm, EG_USER_QUEUE_SUBSCRIBE_PERM)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_ACCESS);
		return;
	}

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

	queue_t = find_queue_t(client->declared_queues, req->body.name);
	if (!queue_t) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_NOT_DECLARED);
		return;
	}

	if (find_queue_t(client->subscribed_queues, req->body.name)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR);
		return;
	}

	subscribe_client_queue_t(queue_t, client, req->body.flags);

	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 $0x4b, 0x20(%rdi)
ja 0x62bf
pushq $0x3
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x6349
movq 0x10(%rbx), %r12
testl $0x40000021, 0x8(%rbx)  # imm = 0x40000021
je 0x630f
leaq 0x8(%r12), %r14
pushq $0x40
popq %rsi
movq %r14, %rdi
callq 0x4c9e
testl %eax, %eax
je 0x6319
movq 0x50(%rbx), %rdi
movq %r14, %rsi
callq 0x8a49
testq %rax, %rax
je 0x6323
movq %rax, %r15
movq 0x58(%rbx), %rdi
movq %r14, %rsi
callq 0x8a49
testq %rax, %rax
je 0x632d
movzbl 0x2(%r12), %esi
pushq $0x2
jmp 0x6345
movzbl 0x2(%r12), %esi
pushq $0x5
jmp 0x6345
movzbl 0x2(%r12), %esi
pushq $0x7
jmp 0x6345
movzbl 0x2(%r12), %esi
pushq $0x8
jmp 0x6345
movl 0x48(%r12), %edx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x8b37
movzbl 0x2(%r12), %esi
pushq $0x1
popq %rdx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4f56
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: queue_unsubscribe_command_handler
void queue_unsubscribe_command_handler(EagleClient *client)
{
	ProtocolRequestQueueUnsubscribe *req = (ProtocolRequestQueueUnsubscribe*)client->request;
	Queue_t *queue_t;

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

	if (!BIT_CHECK(client->perm, EG_USER_ADMIN_PERM) && !BIT_CHECK(client->perm, EG_USER_QUEUE_PERM)
		&& !BIT_CHECK(client->perm, EG_USER_QUEUE_UNSUBSCRIBE_PERM)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_ACCESS);
		return;
	}

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

	queue_t = find_queue_t(client->declared_queues, req->body.name);
	if (!queue_t) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_NOT_DECLARED);
		return;
	}

	if (!find_queue_t(client->subscribed_queues, req->body.name)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR);
		return;
	}

	unsubscribe_client_queue_t(queue_t, client);

	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 0x6378
pushq $0x3
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x63fd
movq 0x10(%rbx), %r12
testl $0x80000021, 0x8(%rbx)  # imm = 0x80000021
je 0x63d3
leaq 0x8(%r12), %r14
pushq $0x40
popq %rsi
movq %r14, %rdi
callq 0x4c9e
testl %eax, %eax
je 0x63dd
movq 0x50(%rbx), %rdi
movq %r14, %rsi
callq 0x8a49
testq %rax, %rax
je 0x63e7
movq %rax, %r15
movq 0x58(%rbx), %rdi
movq %r14, %rsi
callq 0x8a49
testq %rax, %rax
je 0x63f1
movq %r15, %rdi
movq %rbx, %rsi
callq 0x8b65
movzbl 0x2(%r12), %esi
pushq $0x1
jmp 0x63f9
movzbl 0x2(%r12), %esi
pushq $0x5
jmp 0x63f9
movzbl 0x2(%r12), %esi
pushq $0x7
jmp 0x63f9
movzbl 0x2(%r12), %esi
pushq $0x8
jmp 0x63f9
movzbl 0x2(%r12), %esi
pushq $0x2
popq %rdx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4f56
// File: /workspace/github_c_makefile_star2_O2/yakushstanislav[P]EagleMQ/src/handlers.c
// Function: queue_purge_command_handler
void queue_purge_command_handler(EagleClient *client)
{
	ProtocolRequestQueuePurge *req = (ProtocolRequestQueuePurge*)client->request;
	Queue_t *queue_t;

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

	if (!BIT_CHECK(client->perm, EG_USER_ADMIN_PERM) && !BIT_CHECK(client->perm, EG_USER_QUEUE_PERM)
		&& !BIT_CHECK(client->perm, EG_USER_QUEUE_PURGE_PERM)) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_ACCESS);
		return;
	}

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

	queue_t = find_queue_t(client->declared_queues, req->body.name);
	if (!queue_t) {
		add_status_response(client, req->header.cmd, EG_PROTOCOL_STATUS_ERROR_NOT_DECLARED);
		return;
	}

	purge_queue_t(queue_t);

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

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpq $0x47, 0x20(%rdi)
ja 0x6426
pushq $0x3
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x648c
movq 0x10(%rbx), %r15
movabsq $0x100000021, %rax      # imm = 0x100000021
testq %rax, 0x8(%rbx)
je 0x646f
leaq 0x8(%r15), %r14
pushq $0x40
popq %rsi
movq %r14, %rdi
callq 0x4c9e
testl %eax, %eax
je 0x6478
movq 0x50(%rbx), %rdi
movq %r14, %rsi
callq 0x8a49
testq %rax, %rax
je 0x6481
movq %rax, %rdi
callq 0x8adc
movzbl 0x2(%r15), %esi
pushq $0x1
jmp 0x6488
movzbl 0x2(%r15), %esi
pushq $0x5
jmp 0x6488
movzbl 0x2(%r15), %esi
pushq $0x7
jmp 0x6488
movzbl 0x2(%r15), %esi
pushq $0x8
popq %rdx
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x4f56