// File: /workspace/github_cpp_makefile_star2_O3/fieryzig[P]GameServer/Common/Client/Client.cpp
// Function: fieryzig::Client::Send(fieryzig::PacketInfo, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int Client::Send(PacketInfo pi, string content)
{
    int tot_len = sizeof(pi) + content.length() + 4;
    unsigned int tmp = htonl(tot_len); 
    sendbuf.copyIntoTail((char*)&tmp ,4);
    sendbuf.push(4);
    sendbuf.copyIntoTail(&pi, sizeof(pi));
    sendbuf.push(sizeof(pi));
    sendbuf.copyIntoTail(content.c_str(), content.length());
    sendbuf.push(content.length());

    int ret = ::write(fd, sendbuf.getHead(), min(sendbuf.count, BUFSIZE-sendbuf.head));
    if (ret == -1) return -1;
    sendbuf.pop(ret);
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
movl 0x8(%rsi), %eax
addl $0x1c, %eax
bswapl %eax
movl %eax, -0x2c(%rbp)
leaq 0x1010(%rdi), %r14
movslq 0x2018(%rdi), %rdi
cmpq $0xffc, %rdi            # imm = 0xFFC
jg 0x654e
movl %eax, (%r14,%rdi)
jmp 0x6597
movl %edi, %eax
cmpl $0x1000, %eax           # imm = 0x1000
jae 0x6742
addq %r14, %rdi
movl $0x1000, %r13d          # imm = 0x1000
movl $0x1000, %edx           # imm = 0x1000
subq %rax, %rdx
leaq -0x2c(%rbp), %r12
movq %r12, %rsi
callq 0x21f0
movslq 0x2018(%rbx), %rdx
subq %rdx, %r12
addq %r13, %r12
addq $-0xffc, %rdx           # imm = 0xF004
movq %r14, %rdi
movq %r12, %rsi
callq 0x21f0
leaq 0x10(%rbp), %r12
movl 0x2018(%rbx), %eax
leal 0x4(%rax), %ecx
leal 0x1003(%rax), %edx
testl %ecx, %ecx
cmovnsl %ecx, %edx
andl $0xfffff000, %edx       # imm = 0xFFFFF000
negl %edx
addl %edx, %eax
addl $0x4, %eax
movl %eax, 0x2018(%rbx)
addl $0x4, 0x201c(%rbx)
cmpl $0xfe8, %eax            # imm = 0xFE8
jg 0x65e8
cltq
movq 0x10(%r12), %rcx
movq %rcx, 0x10(%r14,%rax)
movups (%r12), %xmm0
movups %xmm0, (%r14,%rax)
jmp 0x661f
movl %eax, %edi
addq %r14, %rdi
movl $0x1000, %edx           # imm = 0x1000
subl %eax, %edx
movq %r12, %rsi
callq 0x21f0
movslq 0x2018(%rbx), %rdx
subq %rdx, %r12
addq $0x1000, %r12           # imm = 0x1000
addq $-0xfe8, %rdx           # imm = 0xF018
movq %r14, %rdi
movq %r12, %rsi
callq 0x21f0
movl 0x2018(%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, 0x2018(%rbx)
addl $0x18, 0x201c(%rbx)
movq (%r15), %r12
movq 0x8(%r15), %r13
leal (%rax,%r13), %ecx
movslq %eax, %rdi
addq %r14, %rdi
cmpl $0x1000, %ecx           # imm = 0x1000
jg 0x666b
movslq %r13d, %rdx
jmp 0x669c
movl $0x1000, %edx           # imm = 0x1000
subl %eax, %edx
movq %r12, %rsi
callq 0x2330
movslq 0x2018(%rbx), %rax
subq %rax, %r12
addq $0x1000, %r12           # imm = 0x1000
movslq %r13d, %rcx
leaq (%rcx,%rax), %rdx
addq $-0x1000, %rdx          # imm = 0xF000
movq %r14, %rdi
movq %r12, %rsi
callq 0x2330
movl 0x8(%r15), %eax
movl 0x2018(%rbx), %ecx
leal (%rcx,%rax), %edx
addl $0xfff, %edx            # imm = 0xFFF
addl %eax, %ecx
cmovnsl %ecx, %edx
andl $0xfffff000, %edx       # imm = 0xFFFFF000
subl %edx, %ecx
movl %ecx, 0x2018(%rbx)
addl 0x201c(%rbx), %eax
movl %eax, 0x201c(%rbx)
movslq 0x2014(%rbx), %rcx
cmpq $0x1000, %rcx           # imm = 0x1000
jge 0x6742
movl 0x2020(%rbx), %edi
addq %rcx, %r14
movl $0x1000, %edx           # imm = 0x1000
subl %ecx, %edx
cmpl %eax, %edx
cmovgel %eax, %edx
movslq %edx, %rdx
movq %r14, %rsi
callq 0x20e0
cmpl $-0x1, %eax
je 0x6733
movl 0x2014(%rbx), %ecx
leal (%rcx,%rax), %edx
addl $0xfff, %edx            # imm = 0xFFF
addl %eax, %ecx
cmovnsl %ecx, %edx
andl $0xfffff000, %edx       # imm = 0xFFFFF000
subl %edx, %ecx
movl %ecx, 0x2014(%rbx)
subl %eax, 0x201c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x342a(%rip), %rdi      # 0x9b73
leaq 0x342f(%rip), %rsi      # 0x9b7f
leaq 0x343f(%rip), %rcx      # 0x9b96
movl $0x2a, %edx
callq 0x2190
nop