// File: /workspace/github_cpp_makefile_star2_O1/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), %rax
cmpq $0xffc, %rax            # imm = 0xFFC
jg 0x678e
movl -0x2c(%rbp), %ecx
movl %ecx, (%r14,%rax)
jmp 0x67d6
cmpl $0x1000, %eax           # imm = 0x1000
jge 0x698b
leaq (%r14,%rax), %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 0x6827
cltq
movq 0x10(%r12), %rcx
movq %rcx, 0x10(%r14,%rax)
movups (%r12), %xmm0
movups %xmm0, (%r14,%rax)
jmp 0x685e
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 0x68aa
movslq %r13d, %rdx
jmp 0x68db
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 %eax, 0x201c(%rbx)
movslq 0x2014(%rbx), %rax
cmpq $0x1000, %rax           # imm = 0x1000
jge 0x698b
movl 0x201c(%rbx), %ecx
movl 0x2020(%rbx), %edi
addq %rax, %r14
movl $0x1000, %eax           # imm = 0x1000
subl 0x2014(%rbx), %eax
cmpl %ecx, %eax
cmovgel %ecx, %eax
movslq %eax, %rdx
movq %r14, %rsi
callq 0x20e0
cmpl $-0x1, %eax
je 0x6977
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)
jmp 0x697c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x31e1(%rip), %rdi      # 0x9b73
leaq 0x31e6(%rip), %rsi      # 0x9b7f
leaq 0x31f6(%rip), %rcx      # 0x9b96
movl $0x2a, %edx
callq 0x2190