// File: fieryzig[P]GameServer/LogicServer/LogicServer.cpp
// Function: fieryzig::LogicServer::Dispatch(fieryzig::Client*, fieryzig::PacketInfo*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void LogicServer::Dispatch(Client* cli, PacketInfo *ppi, string content)
{
    switch(ppi->srcType) {
        case ServerType::CLIENT:
        {
            // impossible
            break;
        }
        case ServerType::GATEWAY:
        {
            if (content == "Login") {
                fd_map[ppi->uid] = ppi->clifd;
                Player* player = new Player(ppi->uid);
                pl_map[ppi->uid] = player;
                cout << "User " << ppi->uid << "Login" << endl;
            }
            else if (content == "Logout") {
                delete pl_map[ppi->uid];
                pl_map.erase(ppi->uid);
                fd_map.erase(ppi->uid);
                cout << "User " << ppi->uid << "Logout" << endl;
            }
            // Other Msg
            break;
        }
        case ServerType::LOGIC:
        {
            break;
        }
        // DB Cache
    }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rcx, -0x58(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x44(%rbp)
testl %eax, %eax
je 0x2b01
jmp 0x2ae6
movl -0x44(%rbp), %eax
subl $0x1, %eax
je 0x2b06
jmp 0x2af0
movl -0x44(%rbp), %eax
subl $0x2, %eax
je 0x2cbf
jmp 0x2cc1
jmp 0x2cc1
movq -0x58(%rbp), %rdi
leaq 0xb539(%rip), %rsi      # 0xe04a
callq 0x3620
testb $0x1, %al
jne 0x2b1f
jmp 0x2bf8
movq -0x50(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl 0x10(%rsi), %eax
movl %eax, -0x64(%rbp)
addq $0x1c8, %rdi            # imm = 0x1C8
addq $0x8, %rsi
callq 0x3650
movl -0x64(%rbp), %ecx
movl %ecx, (%rax)
movl $0x4, %edi
callq 0x2210
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x3730
jmp 0x2b64
movq -0x50(%rbp), %rdi
movq -0x60(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x70(%rbp)
addq $0x198, %rdi            # imm = 0x198
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x38(%rbp)
leaq -0x38(%rbp), %rsi
callq 0x3750
movq -0x70(%rbp), %rcx
movq %rcx, (%rax)
movq 0x14438(%rip), %rdi     # 0x16fd8
leaq 0xb4a9(%rip), %rsi      # 0xe050
callq 0x2200
movq %rax, %rdi
movq -0x18(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x23a0
movq %rax, %rdi
leaq 0xb485(%rip), %rsi      # 0xe04a
callq 0x2200
movq %rax, %rdi
movq 0x143f4(%rip), %rsi     # 0x16fc8
callq 0x2230
jmp 0x2cbd
movq -0x60(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0x21f0
jmp 0x2cca
movq -0x58(%rbp), %rdi
leaq 0xb453(%rip), %rsi      # 0xe056
callq 0x3620
testb $0x1, %al
jne 0x2c11
jmp 0x2cbb
movq -0x50(%rbp), %rdi
addq $0x198, %rdi            # imm = 0x198
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x3c(%rbp)
leaq -0x3c(%rbp), %rsi
callq 0x3750
movq (%rax), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, %rax
je 0x2c45
movq -0x78(%rbp), %rdi
callq 0x21f0
movq -0x50(%rbp), %rdi
addq $0x198, %rdi            # imm = 0x198
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x40(%rbp)
leaq -0x40(%rbp), %rsi
callq 0x3830
movq -0x50(%rbp), %rdi
addq $0x1c8, %rdi            # imm = 0x1C8
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
callq 0x3860
movq 0x14356(%rip), %rdi     # 0x16fd8
leaq 0xb3c7(%rip), %rsi      # 0xe050
callq 0x2200
movq %rax, %rdi
movq -0x18(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x23a0
movq %rax, %rdi
leaq 0xb3af(%rip), %rsi      # 0xe056
callq 0x2200
movq %rax, %rdi
movq 0x14312(%rip), %rsi     # 0x16fc8
callq 0x2230
jmp 0x2cbd
jmp 0x2cc1
jmp 0x2cc1
addq $0x80, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x23b0
nopw %cs:(%rax,%rax)