// File: /workspace/github_cpp_makefile_star2_O3/fieryzig[P]GameServer/Common/Client/Client.cpp
// Function: fieryzig::Client::hasMsg(fieryzig::PacketInfo*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
bool Client::hasMsg(PacketInfo* ppi, string &content)
{
    if (recvbuf.count < 4) return false;
    int packetLen = recvbuf.getIntFromHead();

    if (recvbuf.count < packetLen) {
        return false;
    }
    recvbuf.pop(4);
    cout << "RECV PacketLen: " << packetLen << endl;

    int pi_size = sizeof(PacketInfo);
    recvbuf.copyFromHead(ppi, pi_size);
    recvbuf.pop(pi_size);

    int contentLen = ppi->contentLen;
    char conBuf[contentLen];
    recvbuf.copyFromHead(conBuf, contentLen);
    conBuf[contentLen] = '\0';
    content = conBuf;
    
    recvbuf.pop(contentLen);
    return true;
}

// Assembly:
movl 0x100c(%rdi), %eax
cmpl $0x4, %eax
jge 0x62d8
xorl %eax, %eax
retq
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movl 0x1004(%rdi), %ecx
xorl %edx, %edx
movl %ecx, %esi
addl %edx, %esi
leal 0xfff(%rcx,%rdx), %edi
cmovnsl %esi, %edi
andl $0xfffff000, %edi       # imm = 0xFFFFF000
subl %edi, %esi
movslq %esi, %rsi
movb (%rbx,%rsi), %sil
movb %sil, -0x2c(%rbp,%rdx)
incq %rdx
cmpq $0x4, %rdx
jne 0x62fa
movl -0x2c(%rbp), %r12d
bswapl %r12d
cmpl %r12d, %eax
jge 0x6338
xorl %eax, %eax
jmp 0x6502
leal 0x4(%rcx), %edx
leal 0x1003(%rcx), %esi
testl %edx, %edx
cmovnsl %edx, %esi
andl $0xfffff000, %esi       # imm = 0xFFFFF000
negl %esi
addl %esi, %ecx
addl $0x4, %ecx
movl %ecx, 0x1004(%rbx)
addl $-0x4, %eax
movl %eax, 0x100c(%rbx)
movq 0x6c6f(%rip), %r13      # 0xcfd8
leaq 0x37d4(%rip), %rsi      # 0x9b44
movl $0x10, %edx
movq %r13, %rdi
callq 0x2290
movq %r13, %rdi
movl %r12d, %esi
callq 0x2360
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2230
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x21b0
movslq 0x1004(%rbx), %rax
leaq (%rbx,%rax), %rsi
cmpq $0xfe8, %rax            # imm = 0xFE8
movq %r14, -0x40(%rbp)
jg 0x63da
movups (%rsi), %xmm0
movq 0x10(%rsi), %rax
movq %rax, 0x10(%r15)
movups %xmm0, (%r15)
jmp 0x640f
movl $0x1000, %r14d          # imm = 0x1000
movl $0x1000, %edx           # imm = 0x1000
subq %rax, %rdx
movq %r15, %rdi
callq 0x2330
movslq 0x1004(%rbx), %rdx
movq %r15, %rdi
subq %rdx, %rdi
addq %r14, %rdi
addq $-0xfe8, %rdx           # imm = 0xF018
movq %rbx, %rsi
callq 0x2330
movl 0x1004(%rbx), %eax
leal 0x18(%rax), %ecx
leal 0x1017(%rax), %edx
testl %ecx, %ecx
cmovnsl %ecx, %edx
andl $0xfffff000, %edx       # imm = 0xFFFFF000
negl %edx
addl %edx, %eax
addl $0x18, %eax
movl %eax, 0x1004(%rbx)
addl $-0x18, 0x100c(%rbx)
movq %rsp, -0x38(%rbp)
movl 0x14(%r15), %eax
movslq %eax, %r15
movq %rsp, %r12
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %r12
movq %r12, %rsp
movslq 0x1004(%rbx), %r14
leal (%r15,%r14), %r13d
leaq (%rbx,%r14), %rsi
cmpl $0x1000, %r13d          # imm = 0x1000
jg 0x6479
movq %r12, %rdi
movq %r15, %rdx
jmp 0x64a4
movl $0x1000, %edx           # imm = 0x1000
subq %r14, %rdx
movq %r12, %rdi
callq 0x21f0
negq %r14
leaq (%r12,%r14), %rdi
addq $0x1000, %rdi           # imm = 0x1000
addl $0xfffff000, %r13d      # imm = 0xFFFFF000
movq %rbx, %rsi
movq %r13, %rdx
callq 0x21f0
movb $0x0, (%r12,%r15)
movq -0x40(%rbp), %r14
movq 0x8(%r14), %r13
movq %r12, %rdi
callq 0x2120
movq %r14, %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %r12, %rcx
movq %rax, %r8
callq 0x2320
movl 0x1004(%rbx), %eax
leal (%rax,%r15), %ecx
addl $0xfff, %ecx            # imm = 0xFFF
addl %r15d, %eax
cmovnsl %eax, %ecx
andl $0xfffff000, %ecx       # imm = 0xFFFFF000
subl %ecx, %eax
movl %eax, 0x1004(%rbx)
subl %r15d, 0x100c(%rbx)
movb $0x1, %al
movq -0x38(%rbp), %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop