// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/networking.c
// Function: prepareClientToWrite
int prepareClientToWrite(client *c) {
    /* If it's the Lua client we always return ok without installing any
     * handler since there is no socket at all. */
    if (c->flags & CLIENT_LUA) return C_OK;

    /* CLIENT REPLY OFF / SKIP handling: don't send replies. */
    if (c->flags & (CLIENT_REPLY_OFF|CLIENT_REPLY_SKIP)) return C_ERR;

    /* Masters don't receive replies, unless CLIENT_MASTER_FORCE_REPLY flag
     * is set. */
    if ((c->flags & CLIENT_MASTER) &&
        !(c->flags & CLIENT_MASTER_FORCE_REPLY)) return C_ERR;

    if (c->fd <= 0) return C_ERR; /* Fake client for AOF loading. */

    /* Schedule the client to write the output buffers to the socket only
     * if not already done (there were no pending writes already and the client
     * was yet not flagged), and, for slaves, if the slave can actually
     * receive writes at this stage. */
    if (!clientHasPendingReplies(c) &&
        !(c->flags & CLIENT_PENDING_WRITE) &&
        (c->replstate == REPL_STATE_NONE ||
         (c->replstate == SLAVE_STATE_ONLINE && !c->repl_put_online_on_ack)))
    {
        /* Here instead of installing the write handler, we just flag the
         * client and put it into a list of clients that have something
         * to write to the socket. This way before re-entering the event
         * loop, we can try to directly write to the client sockets avoiding
         * a system call. We'll only really install the write handler if
         * we'll not be able to write the whole reply at once. */
        c->flags |= CLIENT_PENDING_WRITE;
        listAddNodeHead(server.clients_pending_write,c);
    }

    /* Authorize the caller to queue in the output buffer of this client. */
    return C_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x98(%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x423dc
movl $0x0, -0x4(%rbp)
jmp 0x424be
movq -0x10(%rbp), %rax
movl 0x98(%rax), %eax
andl $0x1400000, %eax        # imm = 0x1400000
cmpl $0x0, %eax
je 0x423fc
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x424be
movq -0x10(%rbp), %rax
movl 0x98(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x4242e
movq -0x10(%rbp), %rax
movl 0x98(%rax), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
jne 0x4242e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x424be
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jg 0x42441
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x424be
movq -0x10(%rbp), %rdi
callq 0x424d0
cmpl $0x0, %eax
jne 0x424b7
movq -0x10(%rbp), %rax
movl 0x98(%rax), %eax
andl $0x200000, %eax         # imm = 0x200000
cmpl $0x0, %eax
jne 0x424b7
movq -0x10(%rbp), %rax
cmpl $0x0, 0xa0(%rax)
je 0x4248a
movq -0x10(%rbp), %rax
cmpl $0x9, 0xa0(%rax)
jne 0x424b7
movq -0x10(%rbp), %rax
cmpl $0x0, 0xa4(%rax)
jne 0x424b7
movq -0x10(%rbp), %rax
movl 0x98(%rax), %ecx
orl $0x200000, %ecx         # imm = 0x200000
movl %ecx, 0x98(%rax)
leaq 0x135d31(%rip), %rax    # 0x1781d8
movq 0x1d8(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x26f30
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)