// File: /workspace/github_c_makefile_star2_O0/yakushstanislav[P]EagleMQ/src/channel_t.c
// Function: publish_message_channel_t
void publish_message_channel_t(Channel_t *channel, const char *topic, Object *msg)
{
	EagleClient *client;
	KeylistIterator keylist_iterator;
	KeylistNode *keylist_node;
	ListNode *list_node;
	ListIterator list_iterator;
	List *list;
	char *pattern;

	keylist_node = keylist_get_value(channel->topics, (void*)topic);
	if (keylist_node)
	{
		list = EG_KEYLIST_NODE_VALUE(keylist_node);

		if (channel->round_robin)
		{
			list_rotate(list);

			client = EG_LIST_NODE_VALUE(EG_LIST_FIRST(list));
			channel_client_event_message(client, channel, topic, msg);
		}
		else
		{
			list_rewind(list, &list_iterator);
			while ((list_node = list_next_node(&list_iterator)) != NULL)
			{
				client = EG_LIST_NODE_VALUE(list_node);
				channel_client_event_message(client, channel, topic, msg);
			}
		}
	}

	if (EG_KEYLIST_LENGTH(channel->patterns))
	{
		keylist_rewind(channel->patterns, &keylist_iterator);
		while ((keylist_node = keylist_next_node(&keylist_iterator)) != NULL)
		{
			pattern = EG_KEYLIST_NODE_KEY(keylist_node);

			if (pattern_match(topic, pattern, 0))
			{
				list = EG_KEYLIST_NODE_VALUE(keylist_node);

				list_rewind(list, &list_iterator);
				while ((list_node = list_next_node(&list_iterator)) != NULL)
				{
					client = EG_LIST_NODE_VALUE(list_node);
					channel_client_event_pattern_message(client, channel, topic, pattern, msg);
				}
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0xbd50
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0xe500
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x48(%rax)
je 0xe4b9
movq -0x50(%rbp), %rdi
callq 0xc4a0
movq -0x50(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
callq 0xae00
jmp 0xe4fe
movq -0x50(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0xc520
leaq -0x48(%rbp), %rdi
callq 0xc450
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0xe4fc
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
callq 0xae00
jmp 0xe4c6
jmp 0xe4fe
jmp 0xe500
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
cmpl $0x0, 0x20(%rax)
je 0xe5b2
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0xbde0
leaq -0x28(%rbp), %rdi
callq 0xbe00
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0xe5b0
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
movq -0x58(%rbp), %rsi
xorl %edx, %edx
callq 0x6020
cmpl $0x0, %eax
je 0xe5ab
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0xc520
leaq -0x48(%rbp), %rdi
callq 0xc450
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0xe5a9
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x58(%rbp), %rcx
movq -0x18(%rbp), %r8
callq 0xaee0
jmp 0xe56f
jmp 0xe5ab
jmp 0xe523
jmp 0xe5b2
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)