// File: /workspace/github_c_makefile_star2_O3/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 0x3e4db
testl %eax, %eax
jle 0x3e6e0
movq 0x60(%rbx), %rsi
leaq 0x81c6f(%rip), %r15     # 0xbfe80
movq 0x28(%rbx), %r12
cmpq $-0x1, %rsi
jne 0x3e37e
movslq %r14d, %rbp
addq %r12, %rbp
movq %rbp, %rdi
movl $0xd, %esi
callq 0x267f0
testq %rax, %rax
je 0x3e54d
movq %rax, %r13
movzbl -0x1(%r12), %eax
movl %eax, %ecx
andl $0x7, %ecx
cmpl $0x4, %ecx
ja 0x3e281
leaq 0x81c03(%rip), %rdx     # 0xbfe58
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
shrl $0x3, %eax
jmp 0x3e283
movq -0x11(%r12), %rax
jmp 0x3e283
movzwl -0x5(%r12), %eax
jmp 0x3e283
movl -0x9(%r12), %eax
jmp 0x3e283
movzbl -0x3(%r12), %eax
jmp 0x3e283
xorl %eax, %eax
movq %r13, %rcx
subq %r12, %rcx
shlq $0x20, %rax
movabsq $-0x200000000, %rdx     # imm = 0xFFFFFFFE00000000
addq %rdx, %rax
sarq $0x20, %rax
cmpq %rax, %rcx
jg 0x3e4b9
movsbl (%rbp), %edx
cmpl $0x24, %edx
jne 0x3e572
incq %rbp
movq %r13, %rsi
subq %rbp, %rsi
movq %rbp, %rdi
movq %rsp, %rdx
callq 0x40065
testl %eax, %eax
je 0x3e585
movq (%rsp), %rsi
cmpq $0x20000001, %rsi       # imm = 0x20000001
jae 0x3e585
movq 0x28(%rbx), %r12
subl %r12d, %r13d
subl %r14d, %r13d
addl %r13d, %r14d
addl $0x2, %r14d
cmpq $0x8000, %rsi           # imm = 0x8000
jb 0x3e37a
movq %r12, %rdi
movl %r14d, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x377b2
movq 0x28(%rbx), %r12
movzbl -0x1(%r12), %ecx
movl %ecx, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x3e352
leaq 0x81b46(%rip), %rdx     # 0xbfe6c
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
shrl $0x3, %ecx
jmp 0x3e354
movq -0x11(%r12), %rcx
jmp 0x3e354
movzwl -0x5(%r12), %ecx
jmp 0x3e354
movl -0x9(%r12), %ecx
jmp 0x3e354
movzbl -0x3(%r12), %ecx
jmp 0x3e354
xorl %ecx, %ecx
movq (%rsp), %rsi
leaq 0x2(%rsi), %rax
xorl %r14d, %r14d
subq %rcx, %rax
jbe 0x3e37a
movq %r12, %rdi
movq %rax, %rsi
callq 0x363e2
movq %rax, %r12
movq %rax, 0x28(%rbx)
movq (%rsp), %rsi
movq %rsi, 0x60(%rbx)
movzbl -0x1(%r12), %eax
movl %eax, %edx
andl $0x7, %edx
cmpl $0x4, %edx
ja 0x3e3be
movslq (%r15,%rdx,4), %rcx
addq %r15, %rcx
jmpq *%rcx
movl %eax, %r8d
shrl $0x3, %r8d
jmp 0x3e3c1
movq -0x11(%r12), %r8
jmp 0x3e3c1
movzwl -0x5(%r12), %r8d
jmp 0x3e3c1
movl -0x9(%r12), %r8d
jmp 0x3e3c1
movzbl -0x3(%r12), %r8d
jmp 0x3e3c1
xorl %r8d, %r8d
movslq %r14d, %rcx
subq %rcx, %r8
leaq 0x2(%rsi), %rdi
movl %edi, %r9d
cmpq %r9, %r8
jb 0x3e4b9
testl %r14d, %r14d
jne 0x3e47a
cmpq $0x8000, %rsi           # imm = 0x8000
jl 0x3e47a
cmpl $0x4, %edx
ja 0x3e427
movl %edx, %edx
leaq 0x81a99(%rip), %r8      # 0xbfe94
movslq (%r8,%rdx,4), %rdx
addq %r8, %rdx
jmpq *%rdx
shrl $0x3, %eax
jmp 0x3e429
movq -0x11(%r12), %rax
jmp 0x3e429
movzwl -0x5(%r12), %eax
jmp 0x3e429
movl -0x9(%r12), %eax
jmp 0x3e429
movzbl -0x3(%r12), %eax
jmp 0x3e429
xorl %eax, %eax
cltq
cmpq %rdi, %rax
jne 0x3e47a
xorl %r14d, %r14d
xorl %edi, %edi
movq %r12, %rsi
callq 0x40650
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
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x36820
movq 0x60(%rbx), %rsi
addq $0x2, %rsi
xorl %edi, %edi
callq 0x36178
movq %rax, 0x28(%rbx)
movq %rax, %rdi
callq 0x3639d
jmp 0x3e4a1
addq %rcx, %r12
movq %r12, %rdi
callq 0x40744
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
movq $-0x1, 0x60(%rbx)
decl 0x5c(%rbx)
movq $-0x1, %rsi
jne 0x3e211
testl %r14d, %r14d
je 0x3e4cf
movq 0x28(%rbx), %rdi
movl %r14d, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x377b2
xorl %ebp, %ebp
cmpl 0x5c(%rbx), %ebp
sbbl %ebp, %ebp
jmp 0x3e650
cmpl $0x0, 0x38(%rbx)
jne 0x3e6fb
movq 0x28(%rbx), %r15
movq %r15, %rdi
movl $0xd, %esi
callq 0x267f0
testq %rax, %rax
je 0x3e52c
movq %rax, %r14
subq %r15, %rax
movzbl -0x1(%r15), %ecx
movl %ecx, %edx
andl $0x7, %edx
cmpl $0x4, %edx
ja 0x3e5e6
leaq 0x81929(%rip), %rsi     # 0xbfe44
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
shrl $0x3, %ecx
jmp 0x3e5e8
movzbl -0x1(%r15), %eax
andl $0x7, %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x4, %eax
je 0x3e5ae
cmpl $0x3, %eax
jne 0x3e650
movl -0x9(%r15), %eax
jmp 0x3e5b2
movzbl -0x1(%r12), %eax
andl $0x7, %eax
cmpl $0x4, %eax
je 0x3e69d
cmpl $0x3, %eax
jne 0x3e4b9
movl -0x9(%r12), %eax
jmp 0x3e6a2
leaq 0x81bf7(%rip), %rsi     # 0xc0170
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3cc2d
jmp 0x3e599
leaq 0x81c0b(%rip), %rsi     # 0xc0197
movl $0x23, %edx
movq %rbx, %rdi
callq 0x3cbc0
movq %rbx, %rdi
movl %r14d, %esi
callq 0x3e17a
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x3e650
movq -0x11(%r15), %rax
cmpq $0x10001, %rax          # imm = 0x10001
jb 0x3e650
leaq 0x81b03(%rip), %rsi     # 0xc00c8
movl $0x2a, %edx
jmp 0x3e63e
movq -0x11(%r15), %rcx
jmp 0x3e5e8
movzwl -0x5(%r15), %ecx
jmp 0x3e5e8
movl -0x9(%r15), %ecx
jmp 0x3e5e8
movzbl -0x3(%r15), %ecx
jmp 0x3e5e8
xorl %ecx, %ecx
addl $-0x2, %ecx
movslq %ecx, %rcx
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpq %rcx, %rax
jg 0x3e650
cmpb $0x2a, (%r15)
jne 0x3e716
incq %r15
movq %r14, %rsi
subq %r15, %rsi
movq %rsp, %r12
movq %r15, %rdi
movq %r12, %rdx
callq 0x40065
testl %eax, %eax
sete %cl
movq (%r12), %rax
cmpq $0x100001, %rax         # imm = 0x100001
setge %dl
orb %cl, %dl
cmpb $0x1, %dl
jne 0x3e661
leaq 0x81ad0(%rip), %rsi     # 0xc0109
movl $0x28, %edx
movq %rbx, %rdi
callq 0x3cbc0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3e17a
movl %ebp, %eax
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 0x3e6cc
movl %eax, 0x5c(%rbx)
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x3e685
callq 0x38413
movl 0x5c(%rbx), %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x382d1
movq %rax, 0x40(%rbx)
movl 0x5c(%rbx), %eax
jmp 0x3e1fe
movq -0x11(%r12), %rax
cmpq $0x10001, %rax          # imm = 0x10001
jb 0x3e4b9
leaq 0x81a91(%rip), %rsi     # 0xc0146
movl $0x29, %edx
movq %rbx, %rdi
callq 0x3cbc0
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x3e59f
movl %r14d, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x377b2
xorl %ebp, %ebp
jmp 0x3e650
leaq 0x81a4b(%rip), %rdx     # 0xc0132
leaq 0x81868(%rip), %rcx     # 0xbff56
movq %rbx, %rdi
xorl %esi, %esi
movl $0x490, %r8d            # imm = 0x490
jmp 0x3e72f
leaq 0x819b9(%rip), %rdx     # 0xc00bb
leaq 0x8184d(%rip), %rcx     # 0xbff56
movq %rbx, %rdi
xorl %esi, %esi
movl $0x469, %r8d            # imm = 0x469
jmp 0x3e72f
leaq 0x819d6(%rip), %rdx     # 0xc00f3
leaq 0x81832(%rip), %rcx     # 0xbff56
movq %rbx, %rdi
xorl %esi, %esi
movl $0x47b, %r8d            # imm = 0x47B
callq 0x627c3
movl $0x1, %edi
callq 0x263c0