// File: Unreality3D[P]Unreality3D/indie-studio/source/Network/NetManager.cpp
// Function: network::NetManager::onPacketMessage(IndieProtocol::Message)
void  NetManager::onPacketMessage(IndieProtocol::Message msg)
  {
    std::cout << "MESSAGE" << std::endl;
    std::cout << msg.target << std::endl;
    std::cout << msg.topic << std::endl;
    std::cout << msg.event << std::endl;

    if (msg.topic != "")
      {
	auto topicSubs = _netClients.find(msg.topic);
	if (topicSubs != _netClients.end())
	  {
	    for (auto it = (*topicSubs).second.begin();
		 it != (*topicSubs).second.end(); ++it)
	      {
		if (*it)
		  (*it)->message(msg.topic, msg.event, msg.payload, msg.payloadSize);
	      }

	  }
	// warning : if subscribed to the topic and to the global, event will fire twice
	for (auto client = _fullClients.begin(); client != _fullClients.end(); ++client)
	  {
	    if (*client)
	      (*client)->message(msg.topic, msg.event, msg.payload, msg.payloadSize);
	  }
      }
  }

// Assembly:
subq $0x58, %rsp
movq %rsi, 0x10(%rsp)
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x2556c(%rip), %rdi     # 0x52fb0
leaq 0x18a43(%rip), %rsi     # 0x4648e
callq 0x2a030
movq %rax, %rdi
movq 0x25506(%rip), %rsi     # 0x52f60
callq 0x2a150
movq 0x10(%rsp), %rsi
movq 0x25545(%rip), %rdi     # 0x52fb0
callq 0x29c50
movq %rax, %rdi
movq 0x254e6(%rip), %rsi     # 0x52f60
callq 0x2a150
movq 0x10(%rsp), %rsi
addq $0x20, %rsi
movq 0x25521(%rip), %rdi     # 0x52fb0
callq 0x29c50
movq %rax, %rdi
movq 0x254c2(%rip), %rsi     # 0x52f60
callq 0x2a150
movq 0x10(%rsp), %rsi
addq $0x40, %rsi
movq 0x254fd(%rip), %rdi     # 0x52fb0
callq 0x29c50
movq %rax, %rdi
movq 0x2549e(%rip), %rsi     # 0x52f60
callq 0x2a150
movq 0x10(%rsp), %rdi
addq $0x20, %rdi
leaq 0x189a0(%rip), %rsi     # 0x46477
callq 0x29970
testb $0x1, %al
jne 0x2dae5
jmp 0x2dc62
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
addq $0x1f8, %rdi            # imm = 0x1F8
addq $0x20, %rsi
callq 0x2acf0
movq 0x8(%rsp), %rdi
movq %rax, 0x40(%rsp)
addq $0x1f8, %rdi            # imm = 0x1F8
callq 0x2aaa0
movq %rax, 0x38(%rsp)
leaq 0x40(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x2a120
testb $0x1, %al
jne 0x2db32
jmp 0x2dbcf
leaq 0x40(%rsp), %rdi
callq 0x2a800
movq %rax, %rdi
addq $0x20, %rdi
callq 0x2bec0
movq %rax, 0x30(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x2a800
movq %rax, %rdi
addq $0x20, %rdi
callq 0x2bdb0
movq %rax, 0x28(%rsp)
leaq 0x30(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x297e0
testb $0x1, %al
jne 0x2db7d
jmp 0x2dbcd
leaq 0x30(%rsp), %rdi
callq 0x284a0
cmpq $0x0, (%rax)
je 0x2dbbf
leaq 0x30(%rsp), %rdi
callq 0x284a0
movq %rax, %rcx
movq 0x10(%rsp), %rax
movq (%rcx), %rdi
movq %rax, %rsi
addq $0x20, %rsi
movq %rax, %rdx
addq $0x40, %rdx
movq 0x68(%rax), %rcx
movl 0x60(%rax), %eax
movl %eax, %r8d
callq 0x2a730
jmp 0x2dbc1
leaq 0x30(%rsp), %rdi
callq 0x29250
jmp 0x2db4d
jmp 0x2dbcf
movq 0x8(%rsp), %rdi
addq $0x228, %rdi            # imm = 0x228
callq 0x2bec0
movq %rax, 0x20(%rsp)
movq 0x8(%rsp), %rdi
addq $0x228, %rdi            # imm = 0x228
callq 0x2bdb0
movq %rax, 0x18(%rsp)
leaq 0x20(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x297e0
testb $0x1, %al
jne 0x2dc10
jmp 0x2dc60
leaq 0x20(%rsp), %rdi
callq 0x284a0
cmpq $0x0, (%rax)
je 0x2dc52
leaq 0x20(%rsp), %rdi
callq 0x284a0
movq %rax, %rcx
movq 0x10(%rsp), %rax
movq (%rcx), %rdi
movq %rax, %rsi
addq $0x20, %rsi
movq %rax, %rdx
addq $0x40, %rdx
movq 0x68(%rax), %rcx
movl 0x60(%rax), %eax
movl %eax, %r8d
callq 0x2a730
jmp 0x2dc54
leaq 0x20(%rsp), %rdi
callq 0x29250
jmp 0x2dbe5
jmp 0x2dc62
addq $0x58, %rsp
retq
nopw (%rax,%rax)