// File: Unreality3D[P]Unreality3D/indie-studio/source/Network/protocol/Deserializer.cpp
// Function: IndieProtocol::Deserializer::deserializeMessage(IndieProtocol::Serialized const&)
void	Deserializer::deserializeMessage(Serialized const &to_handle)
  {
    Message	msg;
    uint32_t	pos = 0;
    void	*payload;

    if (!_OnMessage)
      return ;

    if (!deserializeString(to_handle, pos, msg.target))
      return ;
    if (!deserializeString(to_handle, pos, msg.topic))
      return ;
    if (!deserializeString(to_handle, pos, msg.event))
      return ;

    memcpy(&msg.payloadSize, to_handle.data + pos, sizeof(msg.payloadSize));
    pos += sizeof(msg.payloadSize);
    // error
    if (pos + msg.payloadSize + sizeof(Header) > _header.size)
      return ;
    payload = new char[msg.payloadSize];
    memcpy(payload, to_handle.data + pos, msg.payloadSize);

    msg.payload = payload;
    _OnMessage(msg);
  }

// Assembly:
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rdi, 0x1c0(%rsp)
movq %rsi, 0x1b8(%rsp)
movq 0x1c0(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x127(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x2b730
movq 0x38(%rsp), %rdx
leaq 0x9295(%rip), %rsi      # 0x46477
leaq 0x128(%rsp), %rdi
callq 0x2aa80
jmp 0x3d1f1
leaq 0xef(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x2b730
movq 0x28(%rsp), %rdx
leaq 0x9268(%rip), %rsi      # 0x46477
leaq 0xf0(%rsp), %rdi
callq 0x2aa80
jmp 0x3d21e
leaq 0xc7(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x2b730
movq 0x20(%rsp), %rdx
leaq 0x923b(%rip), %rsi      # 0x46477
leaq 0xc8(%rsp), %rdi
callq 0x2aa80
jmp 0x3d24b
leaq 0x148(%rsp), %rdi
leaq 0x128(%rsp), %rsi
leaq 0xf0(%rsp), %rdx
leaq 0xc8(%rsp), %rcx
callq 0x299e0
jmp 0x3d272
leaq 0xc8(%rsp), %rdi
callq 0x29360
leaq 0xc7(%rsp), %rdi
callq 0x2a210
leaq 0xf0(%rsp), %rdi
callq 0x29360
leaq 0xef(%rsp), %rdi
callq 0x2a210
leaq 0x128(%rsp), %rdi
callq 0x29360
leaq 0x127(%rsp), %rdi
callq 0x2a210
movq 0x30(%rsp), %rdi
movl $0x0, 0xc0(%rsp)
addq $0x60, %rdi
callq 0x28760
testb $0x1, %al
jne 0x3d39d
movl $0x1, 0xb4(%rsp)
jmp 0x3d581
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
jmp 0x3d38b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
jmp 0x3d371
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
jmp 0x3d357
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x29360
leaq 0xc7(%rsp), %rdi
callq 0x2a210
leaq 0xf0(%rsp), %rdi
callq 0x29360
leaq 0xef(%rsp), %rdi
callq 0x2a210
leaq 0x128(%rsp), %rdi
callq 0x29360
leaq 0x127(%rsp), %rdi
callq 0x2a210
jmp 0x3d5c1
movq 0x30(%rsp), %rdi
movq 0x1b8(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
leaq 0x148(%rsp), %rcx
callq 0x2b610
movb %al, 0x1f(%rsp)
jmp 0x3d3c5
movb 0x1f(%rsp), %al
testb $0x1, %al
jne 0x3d3f8
jmp 0x3d3cf
movl $0x1, 0xb4(%rsp)
jmp 0x3d581
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
jmp 0x3d5b4
movq 0x30(%rsp), %rdi
movq 0x1b8(%rsp), %rsi
leaq 0x168(%rsp), %rcx
leaq 0xc0(%rsp), %rdx
callq 0x2b610
movb %al, 0x1e(%rsp)
jmp 0x3d420
movb 0x1e(%rsp), %al
testb $0x1, %al
jne 0x3d43a
jmp 0x3d42a
movl $0x1, 0xb4(%rsp)
jmp 0x3d581
movq 0x30(%rsp), %rdi
movq 0x1b8(%rsp), %rsi
leaq 0x188(%rsp), %rcx
leaq 0xc0(%rsp), %rdx
callq 0x2b610
movb %al, 0x1d(%rsp)
jmp 0x3d462
movb 0x1d(%rsp), %al
testb $0x1, %al
jne 0x3d47c
jmp 0x3d46c
movl $0x1, 0xb4(%rsp)
jmp 0x3d581
movq 0x30(%rsp), %rcx
movq 0x1b8(%rsp), %rax
movq 0x8(%rax), %rax
movl 0xc0(%rsp), %edx
movl (%rax,%rdx), %eax
movl %eax, 0x1a8(%rsp)
movl 0xc0(%rsp), %eax
addq $0x4, %rax
movl %eax, 0xc0(%rsp)
movl 0xc0(%rsp), %eax
addl 0x1a8(%rsp), %eax
movl %eax, %eax
addq $0x6, %rax
movl (%rcx), %ecx
cmpq %rcx, %rax
jbe 0x3d4db
movl $0x1, 0xb4(%rsp)
jmp 0x3d581
movl 0x1a8(%rsp), %eax
movl %eax, %edi
callq 0x28030
movq %rax, 0x10(%rsp)
jmp 0x3d4f0
movq 0x10(%rsp), %rax
movq %rax, 0xb8(%rsp)
movq 0xb8(%rsp), %rdi
movq 0x1b8(%rsp), %rax
movq 0x8(%rax), %rsi
movl 0xc0(%rsp), %eax
addq %rax, %rsi
movl 0x1a8(%rsp), %eax
movl %eax, %edx
callq 0x29a50
movq 0x30(%rsp), %rax
movq 0xb8(%rsp), %rcx
movq %rcx, 0x1b0(%rsp)
addq $0x60, %rax
movq %rax, 0x8(%rsp)
leaq 0x40(%rsp), %rdi
leaq 0x148(%rsp), %rsi
callq 0x2b190
jmp 0x3d55b
movq 0x8(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x29f40
jmp 0x3d56c
leaq 0x40(%rsp), %rdi
callq 0x28330
movl $0x0, 0xb4(%rsp)
leaq 0x148(%rsp), %rdi
callq 0x28330
addq $0x1c8, %rsp            # imm = 0x1C8
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x28330
leaq 0x148(%rsp), %rdi
callq 0x28330
movq 0x118(%rsp), %rdi
callq 0x2b6f0
nop