// File: /workspace/github_cpp_makefile_star2_O3/shaovie[P]reactor/src/io_handle.cpp
// Function: io_handle::sync_ordered_send(async_send_buf&)
void io_handle::sync_ordered_send(async_send_buf &asb) {
    if (this->fd == -1) {
        delete[] asb.buf;
        return;
    }
    this->async_send_buf_size += (asb.len - asb.sendn);
    if (this->async_send_buf_q != nullptr && !this->async_send_buf_q->empty()) {
        this->async_send_buf_q->push_back(asb);
        return ;
    }

    int ret = 0;
    do {
        ret = ::send(this->fd, asb.buf + asb.sendn, asb.len - asb.sendn, 0);
    } while (ret == -1 && errno == EINTR);

    if (ret > 0) { // partial
        this->async_send_buf_size -= ret;
        if (ret == (asb.len - asb.sendn)) {
            delete[] asb.buf;
            return ;
        }
        asb.sendn += ret;
    }
    if (this->async_send_buf_q == nullptr)
        this->async_send_buf_q = new ringq<async_send_buf>(2);
    this->async_send_buf_q->push_back(asb);
    if (this->async_send_polling == false) {
        this->poll->append(this->fd, ev_handler::ev_write);
        this->async_send_polling = true;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
cmpl $-0x1, 0x8(%rdi)
je 0x9911
movq %rdi, %r14
movl (%rbx), %ecx
movl 0x4(%rbx), %edx
movl %edx, %eax
subl %ecx, %eax
addl %eax, 0x34(%rdi)
movq 0x38(%rdi), %r15
testq %r15, %r15
je 0x98dd
movl 0xc(%r15), %esi
testl %esi, %esi
je 0x98dd
movl (%r15), %edi
cmpl %edi, %esi
jne 0x989f
movq %r15, %rdi
callq 0x6210
movl (%r15), %edi
movl 0xc(%r15), %esi
movl (%rbx), %ecx
movl 0x4(%rbx), %edx
movq 0x10(%r15), %r8
movslq 0x8(%r15), %r9
leal 0x1(%r9), %eax
shlq $0x4, %r9
movq 0x8(%rbx), %r10
movq %r10, 0x8(%r8,%r9)
movl %edx, 0x4(%r8,%r9)
movl %ecx, (%r8,%r9)
cltd
idivl %edi
movl %edx, 0x8(%r15)
incl %esi
movl %esi, 0xc(%r15)
jmp 0x99dd
callq 0x6040
cmpl $0x4, (%rax)
jne 0x992c
movl 0x8(%r14), %edi
movslq (%rbx), %rax
movq 0x8(%rbx), %rsi
addq %rax, %rsi
movslq 0x4(%rbx), %rdx
subq %rax, %rdx
xorl %ecx, %ecx
callq 0x6260
cmpl $-0x1, %eax
je 0x98d3
testl %eax, %eax
jle 0x992c
subl %eax, 0x34(%r14)
movl (%rbx), %ecx
movl 0x4(%rbx), %edx
subl %ecx, %edx
cmpl %eax, %edx
jne 0x9928
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x99dd
popq %rbx
popq %r14
popq %r15
jmp 0x6570
addl %eax, %ecx
movl %ecx, (%rbx)
movq 0x38(%r14), %r15
testq %r15, %r15
je 0x993a
movl (%r15), %ecx
jmp 0x997c
movl $0x18, %edi
callq 0x6490
movq %rax, %r15
movl $0x2, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x4(%rax)
movl $0x0, 0x14(%rax)
movl $0x20, %edi
callq 0x6030
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq %rax, 0x10(%r15)
movq %r15, 0x38(%r14)
movl $0x2, %ecx
movl 0xc(%r15), %esi
cmpl %ecx, %esi
jne 0x9993
movq %r15, %rdi
callq 0x6210
movl (%r15), %ecx
movl 0xc(%r15), %esi
movq 0x10(%r15), %rdx
movslq 0x8(%r15), %rdi
leal 0x1(%rdi), %eax
shlq $0x4, %rdi
movq 0x8(%rbx), %r8
movq %r8, 0x8(%rdx,%rdi)
movq (%rbx), %r8
movq %r8, (%rdx,%rdi)
cltd
idivl %ecx
movl %edx, 0x8(%r15)
incl %esi
movl %esi, 0xc(%r15)
cmpb $0x0, 0x30(%r14)
jne 0x99dd
movq 0x18(%r14), %rdi
movl 0x8(%r14), %esi
movl $0x4, %edx
callq 0x61f0
movb $0x1, 0x30(%r14)
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %r15, %rdi
callq 0x6470
movq %rbx, %rdi
callq 0x6740