// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/networking.c
// Function: readQueryFromClient
void readQueryFromClient(aeEventLoop *el, int fd, void *privdata, int mask) {
    client *c = (client*) privdata;
    int nread, readlen;
    size_t qblen;
    UNUSED(el);
    UNUSED(mask);

    readlen = PROTO_IOBUF_LEN;
    /* If this is a multi bulk request, and we are processing a bulk reply
     * that is large enough, try to maximize the probability that the query
     * buffer contains exactly the SDS string representing the object, even
     * at the risk of requiring more read(2) calls. This way the function
     * processMultiBulkBuffer() can avoid copying buffers to create the
     * Redis Object representing the argument. */
    if (c->reqtype == PROTO_REQ_MULTIBULK && c->multibulklen && c->bulklen != -1
        && c->bulklen >= PROTO_MBULK_BIG_ARG)
    {
        int remaining = (unsigned)(c->bulklen+2)-sdslen(c->querybuf);

        if (remaining < readlen) readlen = remaining;
    }

    qblen = sdslen(c->querybuf);
    if (c->querybuf_peak < qblen) c->querybuf_peak = qblen;
    c->querybuf = sdsMakeRoomFor(c->querybuf, readlen);
    nread = read(fd, c->querybuf+qblen, readlen);
    if (nread == -1) {
        if (errno == EAGAIN) {
            return;
        } else {
            serverLog(LL_VERBOSE, "Reading from client: %s",strerror(errno));
            freeClient(c);
            return;
        }
    } else if (nread == 0) {
        serverLog(LL_VERBOSE, "Client closed connection");
        freeClient(c);
        return;
    }

    sdsIncrLen(c->querybuf,nread);
    c->lastinteraction = server.unixtime;
    if (c->flags & CLIENT_MASTER) c->reploff += nread;
    server.stat_net_input_bytes += nread;
    if (sdslen(c->querybuf) > server.client_max_querybuf_len) {
        sds ci = catClientInfoString(sdsempty(),c), bytes = sdsempty();

        bytes = sdscatrepr(bytes,c->querybuf,64);
        serverLog(LL_WARNING,"Closing client that reached max query buffer length: %s (qbuf initial bytes: %s)", ci, bytes);
        sdsfree(ci);
        sdsfree(bytes);
        freeClient(c);
        return;
    }
    processInputBuffer(c);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movl %esi, %ebp
movl $0x4000, %r14d          # imm = 0x4000
cmpl $0x2, 0x58(%rdx)
jne 0x36381
cmpl $0x0, 0x5c(%rbx)
je 0x36381
movq 0x60(%rbx), %r15
cmpq $0x8000, %r15           # imm = 0x8000
jl 0x36381
movq 0x28(%rbx), %rdi
callq 0x3670c
subq %rax, %r15
addq $0x2, %r15
cmpl $0x4000, %r15d          # imm = 0x4000
movslq %r15d, %rax
movl $0x4000, %r14d          # imm = 0x4000
cmovlq %rax, %r14
movq 0x28(%rbx), %r12
movq %r12, %rdi
callq 0x3670c
movq %rax, %r15
cmpq %rax, 0x30(%rbx)
jae 0x3639a
movq %r15, 0x30(%rbx)
movq %r12, %rdi
movq %r14, %rsi
callq 0x31243
movq %rax, 0x28(%rbx)
addq %rax, %r15
movl %ebp, %edi
movq %r15, %rsi
movq %r14, %rdx
callq 0x26340
movq %rax, %r14
testl %r14d, %r14d
je 0x363e0
cmpl $-0x1, %r14d
jne 0x363f6
callq 0x26880
movl (%rax), %edi
cmpl $0xb, %edi
jne 0x36496
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7b7a7(%rip), %rsi     # 0xb1b8e
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x2b699
jmp 0x364af
movq 0x28(%rbx), %rdi
movl %r14d, %esi
callq 0x31514
leaq 0xc349f(%rip), %r15     # 0xf98a8
movq 0x978(%r15), %rax
movq %rax, 0x88(%rbx)
testb $0x2, 0x98(%rbx)
movslq %r14d, %rax
je 0x3642a
addq %rax, 0xc8(%rbx)
addq %rax, 0x420(%r15)
movq 0x28(%rbx), %rdi
callq 0x3670c
cmpq 0x608(%r15), %rax
jbe 0x364bf
callq 0x3114c
movq %rax, %rdi
movq %rbx, %rsi
callq 0x383ac
movq %rax, %r14
callq 0x3114c
movq 0x28(%rbx), %rsi
pushq $0x40
popq %rdx
movq %rax, %rdi
callq 0x321f1
movq %rax, %r15
leaq 0x7b733(%rip), %rsi     # 0xb1ba7
pushq $0x3
popq %rdi
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x2b699
movq %r14, %rdi
callq 0x311c8
movq %r15, %rdi
callq 0x311c8
jmp 0x364af
callq 0x26680
leaq 0x7b6d4(%rip), %rsi     # 0xb1b76
pushq $0x1
popq %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2b699
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x37527
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x38231