// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x5c(%rdi), %eax
xorl %r14d, %r14d
testl %eax, %eax
je 0x38058
testl %eax, %eax
jle 0x381d5
pushq $0x1
popq %rax
testl %eax, %eax
je 0x3812e
movq 0x28(%rbx), %r13
movq 0x60(%rbx), %r12
cmpq $-0x1, %r12
jne 0x37f9e
movslq %r14d, %r12
addq %r13, %r12
movq %r12, %rdi
pushq $0xd
popq %rsi
callq 0x267f0
testq %rax, %rax
je 0x38108
movq %rax, %r15
movq %rax, %rbp
subq %r13, %rbp
movq %r13, %rdi
callq 0x3670c
shlq $0x20, %rax
movabsq $-0x200000000, %rcx     # imm = 0xFFFFFFFE00000000
addq %rcx, %rax
sarq $0x20, %rax
cmpq %rax, %rbp
jg 0x3812e
movsbl (%r12), %edx
cmpl $0x24, %edx
jne 0x3814b
incq %r12
movq %r15, %rsi
subq %r12, %rsi
movq %r12, %rdi
movq %rsp, %rdx
callq 0x39865
testl %eax, %eax
je 0x3815e
movq (%rsp), %r12
cmpq $0x20000001, %r12       # imm = 0x20000001
jae 0x3815e
movq 0x28(%rbx), %r13
subl %r13d, %r15d
subl %r14d, %r15d
addl %r15d, %r14d
addl $0x2, %r14d
cmpq $0x8000, %r12           # imm = 0x8000
jb 0x37f9a
movq %r13, %rdi
movl %r14d, %esi
pushq $-0x1
popq %rdx
callq 0x31e8e
movq 0x28(%rbx), %r13
movq %r13, %rdi
callq 0x3670c
movq (%rsp), %r12
leaq 0x2(%r12), %rsi
xorl %r14d, %r14d
subq %rax, %rsi
jbe 0x37f9a
movq %r13, %rdi
callq 0x31243
movq %rax, %r13
movq %rax, 0x28(%rbx)
movq (%rsp), %r12
movq %r12, 0x60(%rbx)
movq %r13, %rdi
callq 0x3670c
movslq %r14d, %rcx
movq %rax, %rsi
subq %rcx, %rsi
leaq 0x2(%r12), %rdx
movl %edx, %edi
cmpq %rdi, %rsi
jb 0x3812e
testl %r14d, %r14d
jne 0x3801c
cmpq $0x8000, %r12           # imm = 0x8000
jl 0x3801c
cltq
cmpq %rdx, %rax
jne 0x3801c
xorl %r14d, %r14d
xorl %edi, %edi
movq %r13, %rsi
callq 0x39d58
movq 0x40(%rbx), %rcx
movslq 0x38(%rbx), %rdx
leal 0x1(%rdx), %esi
movl %esi, 0x38(%rbx)
movq %rax, (%rcx,%rdx,8)
movq 0x28(%rbx), %rdi
pushq $-0x2
popq %rsi
callq 0x31514
movq 0x60(%rbx), %rsi
addq $0x2, %rsi
xorl %edi, %edi
callq 0x31018
movq %rax, 0x28(%rbx)
movq %rax, %rdi
callq 0x31233
jmp 0x38046
addq %rcx, %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x39e29
movq 0x40(%rbx), %rcx
movslq 0x38(%rbx), %rdx
leal 0x1(%rdx), %esi
movl %esi, 0x38(%rbx)
movq %rax, (%rcx,%rdx,8)
movl 0x60(%rbx), %eax
addl %eax, %r14d
addl $0x2, %r14d
orq $-0x1, 0x60(%rbx)
movl 0x5c(%rbx), %eax
decl %eax
movl %eax, 0x5c(%rbx)
jmp 0x37ea4
cmpl $0x0, 0x38(%rbx)
jne 0x381f0
pushq $-0x1
popq %rbp
movq 0x28(%rbx), %r15
pushq $0xd
popq %rsi
movq %r15, %rdi
callq 0x267f0
testq %rax, %rax
je 0x380db
movq %rax, %r14
movq %rax, %r12
subq %r15, %r12
movq %r15, %rdi
callq 0x3670c
addl $-0x2, %eax
cltq
cmpq %rax, %r12
jg 0x38104
cmpb $0x2a, (%r15)
jne 0x3820b
incq %r15
movq %r14, %rsi
subq %r15, %rsi
movq %rsp, %r12
movq %r15, %rdi
movq %r12, %rdx
callq 0x39865
testl %eax, %eax
sete %cl
movq (%r12), %rax
cmpq $0x100001, %rax         # imm = 0x100001
setge %dl
orb %cl, %dl
cmpb $0x1, %dl
jne 0x3818a
leaq 0x799d4(%rip), %rsi     # 0xb1aad
jmp 0x380f2
movq %r15, %rdi
callq 0x3670c
cmpq $0x10001, %rax          # imm = 0x10001
jb 0x38104
leaq 0x7997a(%rip), %rsi     # 0xb1a6c
movq %rbx, %rdi
callq 0x36b6f
movq %rbx, %rdi
xorl %esi, %esi
callq 0x37e19
movl %ebp, %eax
jmp 0x3817b
movq %r13, %rdi
callq 0x3670c
cmpq $0x10001, %rax          # imm = 0x10001
jb 0x3812e
leaq 0x799cb(%rip), %rsi     # 0xb1aea
movq %rbx, %rdi
callq 0x36b6f
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x38173
testl %r14d, %r14d
je 0x38142
movq 0x28(%rbx), %rdi
pushq $-0x1
popq %rdx
movl %r14d, %esi
callq 0x31e8e
xorl %eax, %eax
cmpl 0x5c(%rbx), %eax
sbbl %eax, %eax
jmp 0x3817b
leaq 0x799c2(%rip), %rsi     # 0xb1b14
movq %rbx, %rdi
xorl %eax, %eax
callq 0x36b96
jmp 0x3816d
leaq 0x799d6(%rip), %rsi     # 0xb1b3b
movq %rbx, %rdi
callq 0x36b6f
movq %rbx, %rdi
movl %r14d, %esi
callq 0x37e19
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x28(%rbx), %rdi
subl %edi, %r14d
addl $0x2, %r14d
testq %rax, %rax
jle 0x381c6
movl %eax, 0x5c(%rbx)
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x381ae
callq 0x328f9
movl 0x5c(%rbx), %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x327b9
movq %rax, 0x40(%rbx)
movl 0x5c(%rbx), %eax
jmp 0x37e99
pushq $-0x1
popq %rdx
movl %r14d, %esi
callq 0x31e8e
xorl %eax, %eax
jmp 0x3817b
leaq 0x798fa(%rip), %rdx     # 0xb1ad6
leaq 0x79717(%rip), %rcx     # 0xb18fa
movq %rbx, %rdi
xorl %esi, %esi
movl $0x490, %r8d            # imm = 0x490
jmp 0x38224
leaq 0x79868(%rip), %rdx     # 0xb1a5f
leaq 0x796fc(%rip), %rcx     # 0xb18fa
movq %rbx, %rdi
xorl %esi, %esi
movl $0x469, %r8d            # imm = 0x469
jmp 0x38224
leaq 0x79885(%rip), %rdx     # 0xb1a97
leaq 0x796e1(%rip), %rcx     # 0xb18fa
movq %rbx, %rdi
xorl %esi, %esi
movl $0x47b, %r8d            # imm = 0x47B
callq 0x588a4
pushq $0x1
popq %rdi
callq 0x263c0