// File: /workspace/github_c_makefile_star2_O0/goghcrow[P]dubbo_ab/dubbo_client.c
// Function: cli_write
static bool cli_write(struct dubbo_client *cli)
{
    struct buffer *buf = cli->snd_buf;
    if (!buf_readable(buf))
    {
        aeDeleteFileEvent(cli->el, cli->fd, AE_WRITABLE);
        return true;
    }

    int nwritten = 0;
    while (buf_readable(buf))
    {
        nwritten = write(cli->fd, buf_peek(buf), buf_readable(buf));
        if (nwritten <= 0)
        {
            if (errno == EINTR)
            {
                continue;
            }
            break;
        }
        buf_retrieve(buf, nwritten);
    }

    if (nwritten <= 0)
    {
        if (errno == EAGAIN)
        {
            if (AE_ERR == aeCreateFileEvent(cli->el, cli->fd, AE_WRITABLE, cli_on_write, cli))
            {
                LOG_ERROR("Dubbo 请求失败: 创建可写事件失败");
                return false;
            }
            return true;
        }
        else
        {
            LOG_ERROR("Dubbo 发送数据失败: %s", strerror(errno));
            return false;
        }
    }

    if (!buf_readable(buf))
    {
        aeDeleteFileEvent(cli->el, cli->fd, AE_WRITABLE);
    }
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x8330
cmpq $0x0, %rax
jne 0xdc78
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x68(%rax), %esi
movl $0x2, %edx
callq 0x2ae0
movb $0x1, -0x1(%rbp)
jmp 0xddd1
movl $0x0, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x8330
cmpq $0x0, %rax
je 0xdce3
movq -0x10(%rbp), %rax
movl 0x68(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x83b0
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
callq 0x8330
movl -0x2c(%rbp), %edi
movq -0x28(%rbp), %rsi
movq %rax, %rdx
callq 0x20c0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jg 0xdcd4
callq 0x2050
cmpl $0x4, (%rax)
jne 0xdcd2
jmp 0xdc7f
jmp 0xdce3
movq -0x18(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
callq 0x86f0
jmp 0xdc7f
cmpl $0x0, -0x1c(%rbp)
jg 0xdda6
callq 0x2050
cmpl $0xb, (%rax)
jne 0xdd5d
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x68(%rax), %esi
movq -0x10(%rbp), %r8
movl $0x2, %edx
leaq 0xcb(%rip), %rcx        # 0xdde0
callq 0x2920
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0xdd57
movq 0x72cc(%rip), %rax      # 0x14ff8
movq (%rax), %rdi
leaq 0x2b46(%rip), %rsi      # 0x1087c
leaq 0x2b95(%rip), %rdx      # 0x108d2
leaq 0x2796(%rip), %rcx      # 0x104da
movl $0x139, %r8d            # imm = 0x139
movb $0x0, %al
callq 0x2220
movb $0x0, -0x1(%rbp)
jmp 0xddd1
movb $0x1, -0x1(%rbp)
jmp 0xddd1
movq 0x7294(%rip), %rax      # 0x14ff8
movq (%rax), %rax
movq %rax, -0x38(%rbp)
callq 0x2050
movl (%rax), %edi
callq 0x23b0
movq -0x38(%rbp), %rdi
movq %rax, %rdx
leaq 0x2b57(%rip), %rsi      # 0x108dc
leaq 0x2b46(%rip), %rcx      # 0x108d2
leaq 0x2747(%rip), %r8       # 0x104da
movl $0x140, %r9d            # imm = 0x140
movb $0x0, %al
callq 0x2220
movb $0x0, -0x1(%rbp)
jmp 0xddd1
movq -0x18(%rbp), %rdi
callq 0x8330
cmpq $0x0, %rax
jne 0xddcd
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x68(%rax), %esi
movl $0x2, %edx
callq 0x2ae0
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)