// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x4000, -0x30(%rbp)    # imm = 0x4000
movq -0x28(%rbp), %rax
cmpl $0x2, 0x58(%rax)
jne 0x421ce
movq -0x28(%rbp), %rax
cmpl $0x0, 0x5c(%rax)
je 0x421ce
movq -0x28(%rbp), %rax
cmpq $-0x1, 0x60(%rax)
je 0x421ce
movq -0x28(%rbp), %rax
cmpq $0x8000, 0x60(%rax)     # imm = 0x8000
jl 0x421ce
movq -0x28(%rbp), %rax
movq 0x60(%rax), %rax
addq $0x2, %rax
movl %eax, %eax
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x42810
movq %rax, %rcx
movq -0x58(%rbp), %rax
subq %rcx, %rax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0x421cc
movl -0x3c(%rbp), %eax
movl %eax, -0x30(%rbp)
jmp 0x421ce
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x42810
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq 0x30(%rax), %rax
cmpq -0x38(%rbp), %rax
jae 0x421f9
movq -0x38(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rdi
movslq -0x30(%rbp), %rsi
callq 0x38770
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x28(%rax)
movl -0xc(%rbp), %edi
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rsi
addq -0x38(%rbp), %rsi
movslq -0x30(%rbp), %rdx
callq 0x26340
movl %eax, -0x2c(%rbp)
cmpl $-0x1, -0x2c(%rbp)
jne 0x42275
callq 0x26880
cmpl $0xb, (%rax)
jne 0x42245
jmp 0x423a5
callq 0x26880
movl (%rax), %edi
callq 0x26690
movq %rax, %rdx
movl $0x1, %edi
leaq 0xf8a52(%rip), %rsi     # 0x13acb2
movb $0x0, %al
callq 0x2fc60
movq -0x28(%rbp), %rdi
callq 0x43ea0
jmp 0x423a5
cmpl $0x0, -0x2c(%rbp)
jne 0x4229c
movl $0x1, %edi
leaq 0xf8a43(%rip), %rsi     # 0x13acca
movb $0x0, %al
callq 0x2fc60
movq -0x28(%rbp), %rdi
callq 0x43ea0
jmp 0x423a5
jmp 0x4229e
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rdi
movl -0x2c(%rbp), %esi
callq 0x38ce0
leaq 0x135f23(%rip), %rax    # 0x1781d8
movq 0x978(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x88(%rax)
movq -0x28(%rbp), %rax
movl 0x98(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x422ef
movslq -0x2c(%rbp), %rcx
movq -0x28(%rbp), %rax
addq 0xc8(%rax), %rcx
movq %rcx, 0xc8(%rax)
movslq -0x2c(%rbp), %rcx
leaq 0x135ede(%rip), %rax    # 0x1781d8
addq 0x420(%rax), %rcx
leaq 0x135ed0(%rip), %rax    # 0x1781d8
movq %rcx, 0x420(%rax)
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x42810
leaq 0x135eb5(%rip), %rcx    # 0x1781d8
cmpq 0x608(%rcx), %rax
jbe 0x4239c
callq 0x384f0
movq %rax, %rdi
movq -0x28(%rbp), %rsi
callq 0x455c0
movq %rax, -0x48(%rbp)
callq 0x384f0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rsi
movl $0x40, %edx
callq 0x3a2c0
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rdx
movq -0x50(%rbp), %rcx
movl $0x3, %edi
leaq 0xf896b(%rip), %rsi     # 0x13ace3
movb $0x0, %al
callq 0x2fc60
movq -0x48(%rbp), %rdi
callq 0x38620
movq -0x50(%rbp), %rdi
callq 0x38620
movq -0x28(%rbp), %rdi
callq 0x43ea0
jmp 0x423a5
movq -0x28(%rbp), %rdi
callq 0x45360
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)