// File: /workspace/github_cpp_makefile_star2_O1/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), %ecx
cmpl $0x4, %ecx
jge 0x6518
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), %edx
xorl %eax, %eax
movl %edx, %esi
addl %eax, %esi
leal 0xfff(%rdx,%rax), %edi
cmovnsl %esi, %edi
andl $0xfffff000, %edi       # imm = 0xFFFFF000
subl %edi, %esi
movslq %esi, %rsi
movb (%rbx,%rsi), %sil
movb %sil, -0x2c(%rbp,%rax)
incq %rax
cmpq $0x4, %rax
jne 0x653a
movl -0x2c(%rbp), %r12d
bswapl %r12d
cmpl %r12d, %ecx
setge %al
jl 0x6741
leal 0x4(%rdx), %eax
leal 0x1003(%rdx), %esi
testl %eax, %eax
cmovnsl %eax, %esi
andl $0xfffff000, %esi       # imm = 0xFFFFF000
negl %esi
leal (%rdx,%rsi), %eax
addl $0x4, %eax
movl %eax, 0x1004(%rbx)
addl $-0x4, %ecx
movl %ecx, 0x100c(%rbx)
movq 0x6a2e(%rip), %r13      # 0xcfd8
leaq 0x3593(%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
cmpq $0xfe8, %rax            # imm = 0xFE8
movq %r14, -0x40(%rbp)
jg 0x6619
movups (%rbx,%rax), %xmm0
movq 0x10(%rbx,%rax), %rax
movq %rax, 0x10(%r15)
movups %xmm0, (%r15)
jmp 0x6652
leaq (%rbx,%rax), %rsi
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), %eax
leaq (%rbx,%r14), %rsi
cmpl $0x1000, %eax           # imm = 0x1000
jg 0x66ba
movq %r12, %rdi
movq %r15, %rdx
jmp 0x66e3
movl $0x1000, %r13d          # imm = 0x1000
subq %r14, %r13
movq %r12, %rdi
movq %r13, %rdx
callq 0x21f0
addq %r12, %r13
leal (%r14,%r15), %eax
addl $0xfffff000, %eax       # imm = 0xFFFFF000
movslq %eax, %rdx
movq %r13, %rdi
movq %rbx, %rsi
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