// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/networking.c
// Function: processMultibulkBuffer
int processMultibulkBuffer(client *c) {
    char *newline = NULL;
    int pos = 0, ok;
    long long ll;

    if (c->multibulklen == 0) {
        /* The client should have been reset */
        serverAssertWithInfo(c,NULL,c->argc == 0);

        /* Multi bulk length cannot be read without a \r\n */
        newline = strchr(c->querybuf,'\r');
        if (newline == NULL) {
            if (sdslen(c->querybuf) > PROTO_INLINE_MAX_SIZE) {
                addReplyError(c,"Protocol error: too big mbulk count string");
                setProtocolError(c,0);
            }
            return C_ERR;
        }

        /* Buffer should also contain \n */
        if (newline-(c->querybuf) > ((signed)sdslen(c->querybuf)-2))
            return C_ERR;

        /* We know for sure there is a whole line since newline != NULL,
         * so go ahead and find out the multi bulk length. */
        serverAssertWithInfo(c,NULL,c->querybuf[0] == '*');
        ok = string2ll(c->querybuf+1,newline-(c->querybuf+1),&ll);
        if (!ok || ll > 1024*1024) {
            addReplyError(c,"Protocol error: invalid multibulk length");
            setProtocolError(c,pos);
            return C_ERR;
        }

        pos = (newline-c->querybuf)+2;
        if (ll <= 0) {
            sdsrange(c->querybuf,pos,-1);
            return C_OK;
        }

        c->multibulklen = ll;

        /* Setup argv array on client structure */
        if (c->argv) zfree(c->argv);
        c->argv = zmalloc(sizeof(robj*)*c->multibulklen);
    }

    serverAssertWithInfo(c,NULL,c->multibulklen > 0);
    while(c->multibulklen) {
        /* Read bulk length if unknown */
        if (c->bulklen == -1) {
            newline = strchr(c->querybuf+pos,'\r');
            if (newline == NULL) {
                if (sdslen(c->querybuf) > PROTO_INLINE_MAX_SIZE) {
                    addReplyError(c,
                        "Protocol error: too big bulk count string");
                    setProtocolError(c,0);
                    return C_ERR;
                }
                break;
            }

            /* Buffer should also contain \n */
            if (newline-(c->querybuf) > ((signed)sdslen(c->querybuf)-2))
                break;

            if (c->querybuf[pos] != '$') {
                addReplyErrorFormat(c,
                    "Protocol error: expected '$', got '%c'",
                    c->querybuf[pos]);
                setProtocolError(c,pos);
                return C_ERR;
            }

            ok = string2ll(c->querybuf+pos+1,newline-(c->querybuf+pos+1),&ll);
            if (!ok || ll < 0 || ll > 512*1024*1024) {
                addReplyError(c,"Protocol error: invalid bulk length");
                setProtocolError(c,pos);
                return C_ERR;
            }

            pos += newline-(c->querybuf+pos)+2;
            if (ll >= PROTO_MBULK_BIG_ARG) {
                size_t qblen;

                /* If we are going to read a large object from network
                 * try to make it likely that it will start at c->querybuf
                 * boundary so that we can optimize object creation
                 * avoiding a large copy of data. */
                sdsrange(c->querybuf,pos,-1);
                pos = 0;
                qblen = sdslen(c->querybuf);
                /* Hint the sds library about the amount of bytes this string is
                 * going to contain. */
                if (qblen < (size_t)ll+2)
                    c->querybuf = sdsMakeRoomFor(c->querybuf,ll+2-qblen);
            }
            c->bulklen = ll;
        }

        /* Read bulk argument */
        if (sdslen(c->querybuf)-pos < (unsigned)(c->bulklen+2)) {
            /* Not enough data (+2 == trailing \r\n) */
            break;
        } else {
            /* Optimization: if the buffer contains JUST our bulk element
             * instead of creating a new object by *copying* the sds we
             * just use the current sds string. */
            if (pos == 0 &&
                c->bulklen >= PROTO_MBULK_BIG_ARG &&
                (signed) sdslen(c->querybuf) == c->bulklen+2)
            {
                c->argv[c->argc++] = createObject(OBJ_STRING,c->querybuf);
                sdsIncrLen(c->querybuf,-2); /* remove CRLF */
                /* Assume that if we saw a fat argument we'll see another one
                 * likely... */
                c->querybuf = sdsnewlen(NULL,c->bulklen+2);
                sdsclear(c->querybuf);
                pos = 0;
            } else {
                c->argv[c->argc++] =
                    createStringObject(c->querybuf+pos,c->bulklen);
                pos += c->bulklen+2;
            }
            c->bulklen = -1;
            c->multibulklen--;
        }
    }

    /* Trim to pos */
    if (pos) sdsrange(c->querybuf,pos,-1);

    /* We're done when c->multibulk == 0 */
    if (c->multibulklen == 0) return C_OK;

    /* Still not read to process the command */
    return C_ERR;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x5c(%rax)
jne 0x44f76
movq -0x10(%rbp), %rax
cmpl $0x0, 0x38(%rax)
jne 0x44d95
jmp 0x44dc0
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0xf5df7(%rip), %rdx     # 0x13ab9b
leaq 0xf5c8b(%rip), %rcx     # 0x13aa36
movl $0x469, %r8d            # imm = 0x469
callq 0x78360
movl $0x1, %edi
callq 0x263c0
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movl $0xd, %esi
callq 0x267f0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x44e19
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x42810
cmpq $0x10000, %rax          # imm = 0x10000
jbe 0x44e0d
movq -0x10(%rbp), %rdi
leaq 0xf5dab(%rip), %rsi     # 0x13aba8
callq 0x42f90
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x44cd0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x45353
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
subq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x42810
movq %rax, %rcx
movq -0x38(%rbp), %rax
subl $0x2, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jle 0x44e57
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x45353
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movsbl (%rax), %eax
cmpl $0x2a, %eax
jne 0x44e69
jmp 0x44e94
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0xf5d5b(%rip), %rdx     # 0x13abd3
leaq 0xf5bb7(%rip), %rcx     # 0x13aa36
movl $0x47b, %r8d            # imm = 0x47B
callq 0x78360
movl $0x1, %edi
callq 0x263c0
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
addq $0x1, %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
addq $0x1, %rax
subq %rax, %rsi
leaq -0x28(%rbp), %rdx
callq 0x47970
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0x44ecf
cmpq $0x100000, -0x28(%rbp)  # imm = 0x100000
jle 0x44ef7
movq -0x10(%rbp), %rdi
leaq 0xf5d0f(%rip), %rsi     # 0x13abe9
callq 0x42f90
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x44cd0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x45353
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
subq %rcx, %rax
addq $0x2, %rax
movl %eax, -0x1c(%rbp)
cmpq $0x0, -0x28(%rbp)
jg 0x44f35
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movl -0x1c(%rbp), %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x39db0
movl $0x0, -0x4(%rbp)
jmp 0x45353
movq -0x28(%rbp), %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x5c(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x44f5a
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x3afa0
movq -0x10(%rbp), %rax
movslq 0x5c(%rax), %rdi
shlq $0x3, %rdi
callq 0x3acd0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x5c(%rax)
jle 0x44f82
jmp 0x44fad
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0xf5c81(%rip), %rdx     # 0x13ac12
leaq 0xf5a9e(%rip), %rcx     # 0x13aa36
movl $0x490, %r8d            # imm = 0x490
callq 0x78360
movl $0x1, %edi
callq 0x263c0
jmp 0x44faf
movq -0x10(%rbp), %rax
cmpl $0x0, 0x5c(%rax)
je 0x4531e
movq -0x10(%rbp), %rax
cmpq $-0x1, 0x60(%rax)
jne 0x451cd
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movslq -0x1c(%rbp), %rax
addq %rax, %rdi
movl $0xd, %esi
callq 0x267f0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x45031
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x42810
cmpq $0x10000, %rax          # imm = 0x10000
jbe 0x4502c
movq -0x10(%rbp), %rdi
leaq 0xf5c16(%rip), %rsi     # 0x13ac26
callq 0x42f90
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x44cd0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x45353
jmp 0x4531e
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
subq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x42810
movq %rax, %rcx
movq -0x40(%rbp), %rax
subl $0x2, %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jle 0x45068
jmp 0x4531e
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x1c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x24, %eax
je 0x450b7
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x1c(%rbp), %rcx
movsbl (%rax,%rcx), %edx
leaq 0xf5bb8(%rip), %rsi     # 0x13ac50
movb $0x0, %al
callq 0x42fd0
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x44cd0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x45353
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movslq -0x1c(%rbp), %rax
addq %rax, %rdi
addq $0x1, %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x1c(%rbp), %rcx
addq %rcx, %rax
addq $0x1, %rax
subq %rax, %rsi
leaq -0x28(%rbp), %rdx
callq 0x47970
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0x45107
cmpq $0x0, -0x28(%rbp)
jl 0x45107
cmpq $0x20000000, -0x28(%rbp) # imm = 0x20000000
jle 0x4512f
movq -0x10(%rbp), %rdi
leaq 0xf5b65(%rip), %rsi     # 0x13ac77
callq 0x42f90
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x44cd0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x45353
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x1c(%rbp), %rdx
addq %rdx, %rax
subq %rax, %rcx
addq $0x2, %rcx
movslq -0x1c(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x1c(%rbp)
cmpq $0x8000, -0x28(%rbp)    # imm = 0x8000
jl 0x451c1
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movl -0x1c(%rbp), %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x39db0
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x42810
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
addq $0x2, %rcx
cmpq %rcx, %rax
jae 0x451bf
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x28(%rbp), %rsi
addq $0x2, %rsi
subq -0x30(%rbp), %rsi
callq 0x38770
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
jmp 0x451c1
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x42810
movslq -0x1c(%rbp), %rcx
subq %rcx, %rax
movq -0x10(%rbp), %rcx
movq 0x60(%rcx), %rcx
addq $0x2, %rcx
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x451f9
jmp 0x4531e
cmpl $0x0, -0x1c(%rbp)
jne 0x452ad
movq -0x10(%rbp), %rax
cmpq $0x8000, 0x60(%rax)     # imm = 0x8000
jl 0x452ad
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x42810
cltq
movq -0x10(%rbp), %rcx
movq 0x60(%rcx), %rcx
addq $0x2, %rcx
cmpq %rcx, %rax
jne 0x452ad
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
xorl %edi, %edi
callq 0x48480
movq %rax, %rdx
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x10(%rbp), %rsi
movl 0x38(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x38(%rsi)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x38ce0
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rsi
addq $0x2, %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x38230
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x38740
movl $0x0, -0x1c(%rbp)
jmp 0x45300
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movslq -0x1c(%rbp), %rax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rsi
callq 0x486a0
movq %rax, %rdx
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x10(%rbp), %rsi
movl 0x38(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x38(%rsi)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rcx
addq $0x2, %rcx
movslq -0x1c(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq $-0x1, 0x60(%rax)
movq -0x10(%rbp), %rax
movl 0x5c(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x5c(%rax)
jmp 0x44faf
cmpl $0x0, -0x1c(%rbp)
je 0x45339
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movl -0x1c(%rbp), %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x39db0
movq -0x10(%rbp), %rax
cmpl $0x0, 0x5c(%rax)
jne 0x4534c
movl $0x0, -0x4(%rbp)
jmp 0x45353
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)