// File: /workspace/github_c_makefile_star2_O1/erikdubbelboer[P]discnt/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 */
                c->querybuf = sdsempty();
                /* Assume that if we saw a fat argument we'll see another one
                 * likely... */
                c->querybuf = sdsMakeRoomFor(c->querybuf,c->bulklen+2);
                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
xorl %r14d, %r14d
cmpl $0x0, 0x4c(%rdi)
je 0x2399e
cmpl $0x0, 0x4c(%rbx)
jle 0x23bd6
cmpl $0x0, 0x4c(%rbx)
je 0x23970
leaq 0x3143a(%rip), %r15     # 0x54b24
cmpq $-0x1, 0x50(%rbx)
jne 0x23839
movq 0x18(%rbx), %rbp
movslq %r14d, %r13
addq %rbp, %r13
movq %r13, %rdi
movl $0xd, %esi
callq 0x122b0
testq %rax, %rax
je 0x23a1a
movq %rax, %r12
movzbl -0x1(%rbp), %eax
movl %eax, %ecx
andl $0x7, %ecx
cmpl $0x4, %ecx
ja 0x23752
leaq 0x313cf(%rip), %rdx     # 0x54afc
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
shrl $0x3, %eax
jmp 0x23754
movq -0x11(%rbp), %rax
jmp 0x23754
movzwl -0x5(%rbp), %eax
jmp 0x23754
movl -0x9(%rbp), %eax
jmp 0x23754
movzbl -0x3(%rbp), %eax
jmp 0x23754
xorl %eax, %eax
movq %r12, %rcx
subq %rbp, %rcx
shlq $0x20, %rax
movabsq $-0x200000000, %rdx     # imm = 0xFFFFFFFE00000000
addq %rdx, %rax
sarq $0x20, %rax
cmpq %rax, %rcx
jg 0x23970
movsbl (%r13), %edx
cmpl $0x24, %edx
jne 0x23a44
incq %r13
movq %r12, %rsi
subq %r13, %rsi
movq %r13, %rdi
movq %rsp, %rdx
callq 0x25440
testl %eax, %eax
je 0x23a57
movq (%rsp), %rax
cmpq $0x20000001, %rax       # imm = 0x20000001
jae 0x23a57
movq 0x18(%rbx), %rdi
subl %edi, %r12d
subl %r14d, %r12d
addl %r12d, %r14d
addl $0x2, %r14d
cmpq $0x8000, %rax           # imm = 0x8000
jl 0x23831
movl %r14d, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1f352
movq 0x18(%rbx), %rdi
movzbl -0x1(%rdi), %eax
movl %eax, %ecx
andl $0x7, %ecx
cmpl $0x4, %ecx
ja 0x23816
leaq 0x3131f(%rip), %rdx     # 0x54b10
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
shrl $0x3, %eax
jmp 0x23818
movq -0x11(%rdi), %rax
jmp 0x23818
movzwl -0x5(%rdi), %eax
jmp 0x23818
movl -0x9(%rdi), %eax
jmp 0x23818
movzbl -0x3(%rdi), %eax
jmp 0x23818
xorl %eax, %eax
movq (%rsp), %rsi
addq $0x2, %rsi
xorl %r14d, %r14d
subq %rax, %rsi
jbe 0x23831
callq 0x1df85
movq %rax, 0x18(%rbx)
movq (%rsp), %rax
movq %rax, 0x50(%rbx)
movq 0x18(%rbx), %rax
movzbl -0x1(%rax), %ecx
movl %ecx, %edi
andl $0x7, %edi
cmpl $0x4, %edi
ja 0x23877
movslq (%r15,%rdi,4), %rdx
addq %r15, %rdx
jmpq *%rdx
movl %ecx, %r9d
shrl $0x3, %r9d
jmp 0x2387a
movq -0x11(%rax), %r9
jmp 0x2387a
movzwl -0x5(%rax), %r9d
jmp 0x2387a
movl -0x9(%rax), %r9d
jmp 0x2387a
movzbl -0x3(%rax), %r9d
jmp 0x2387a
xorl %r9d, %r9d
movslq %r14d, %rdx
subq %rdx, %r9
movq 0x50(%rbx), %rsi
leaq 0x2(%rsi), %r8
movl %r8d, %r10d
cmpq %r10, %r9
jb 0x23970
testl %r14d, %r14d
setne %r9b
cmpq $0x8000, %rsi           # imm = 0x8000
setl %r10b
orb %r9b, %r10b
jne 0x23938
cmpl $0x4, %edi
ja 0x238e2
movl %edi, %edi
leaq 0x3127b(%rip), %r9      # 0x54b38
movslq (%r9,%rdi,4), %rdi
addq %r9, %rdi
jmpq *%rdi
shrl $0x3, %ecx
jmp 0x238e4
movq -0x11(%rax), %rcx
jmp 0x238e4
movzwl -0x5(%rax), %ecx
jmp 0x238e4
movl -0x9(%rax), %ecx
jmp 0x238e4
movzbl -0x3(%rax), %ecx
jmp 0x238e4
xorl %ecx, %ecx
movslq %ecx, %rcx
cmpq %r8, %rcx
jne 0x23938
xorl %r14d, %r14d
xorl %edi, %edi
movq %rax, %rsi
callq 0x25a2c
movq 0x30(%rbx), %rcx
movslq 0x28(%rbx), %rdx
leal 0x1(%rdx), %esi
movl %esi, 0x28(%rbx)
movq %rax, (%rcx,%rdx,8)
movq 0x18(%rbx), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x1e3ca
callq 0x1de3f
movq %rax, 0x18(%rbx)
movq 0x50(%rbx), %rsi
addq $0x2, %rsi
movq %rax, %rdi
callq 0x1df85
movq %rax, 0x18(%rbx)
jmp 0x2395f
addq %rdx, %rax
movq %rax, %rdi
callq 0x25af0
movq 0x30(%rbx), %rcx
movslq 0x28(%rbx), %rdx
leal 0x1(%rdx), %esi
movl %esi, 0x28(%rbx)
movq %rax, (%rcx,%rdx,8)
movl 0x50(%rbx), %eax
addl %eax, %r14d
addl $0x2, %r14d
movq $-0x1, 0x50(%rbx)
decl 0x4c(%rbx)
jne 0x236ea
testl %r14d, %r14d
je 0x23986
movq 0x18(%rbx), %rdi
movl %r14d, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1f352
xorl %ebp, %ebp
cmpl 0x4c(%rbx), %ebp
sbbl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x0, 0x28(%rbx)
jne 0x23bf1
movq 0x18(%rbx), %r15
movq %r15, %rdi
movl $0xd, %esi
callq 0x122b0
testq %rax, %rax
je 0x239ef
movq %rax, %r14
subq %r15, %rax
movzbl -0x1(%r15), %ecx
movl %ecx, %edx
andl $0x7, %edx
cmpl $0x4, %edx
ja 0x23a90
leaq 0x3110a(%rip), %rsi     # 0x54ae8
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
shrl $0x3, %ecx
jmp 0x23a92
movzbl -0x1(%r15), %eax
movl %eax, %ecx
andl $0x7, %ecx
cmpl $0x4, %ecx
ja 0x23b3f
leaq 0x31157(%rip), %rdx     # 0x54b60
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
shrl $0x3, %eax
jmp 0x23b41
movzbl -0x1(%rbp), %eax
movl %eax, %ecx
andl $0x7, %ecx
cmpl $0x4, %ecx
ja 0x23ba0
leaq 0x31119(%rip), %rdx     # 0x54b4c
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
shrl $0x3, %eax
jmp 0x23ba2
leaq 0x3139f(%rip), %rsi     # 0x54dea
movq %rbx, %rdi
xorl %eax, %eax
callq 0x22331
jmp 0x23a6b
leaq 0x313b3(%rip), %rsi     # 0x54e11
movl $0x23, %edx
movq %rbx, %rdi
callq 0x222c4
movq %rbx, %rdi
movl %r14d, %esi
jmp 0x23bc7
movq -0x11(%r15), %rcx
jmp 0x23a92
movzwl -0x5(%r15), %ecx
jmp 0x23a92
movl -0x9(%r15), %ecx
jmp 0x23a92
movzbl -0x3(%r15), %ecx
jmp 0x23a92
xorl %ecx, %ecx
addl $-0x2, %ecx
movslq %ecx, %rcx
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpq %rcx, %rax
jg 0x2398d
cmpb $0x2a, (%r15)
jne 0x23c0c
incq %r15
movq %r14, %rsi
subq %r15, %rsi
movq %rsp, %r12
movq %r15, %rdi
movq %r12, %rdx
callq 0x25440
testl %eax, %eax
sete %cl
movq (%r12), %rax
cmpq $0x100001, %rax         # imm = 0x100001
setge %dl
orb %cl, %dl
cmpb $0x1, %dl
jne 0x23aee
leaq 0x3129c(%rip), %rsi     # 0x54d83
movl $0x28, %edx
jmp 0x23b5e
movq 0x18(%rbx), %rdi
subl %edi, %r14d
addl $0x2, %r14d
testq %rax, %rax
jle 0x23b75
movl %eax, 0x4c(%rbx)
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x23b0f
callq 0x1ffff
movslq 0x4c(%rbx), %rdi
shlq $0x3, %rdi
callq 0x1fea5
movq %rax, 0x30(%rbx)
jmp 0x236cf
movq -0x11(%r15), %rax
jmp 0x23b41
movzwl -0x5(%r15), %eax
jmp 0x23b41
movl -0x9(%r15), %eax
jmp 0x23b41
movzbl -0x3(%r15), %eax
jmp 0x23b41
xorl %eax, %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpq $0x10001, %rax          # imm = 0x10001
jb 0x2398d
leaq 0x311e9(%rip), %rsi     # 0x54d42
movl $0x2a, %edx
movq %rbx, %rdi
callq 0x222c4
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2364c
jmp 0x2398d
movl %r14d, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1f352
xorl %ebp, %ebp
jmp 0x2398d
movq -0x11(%rbp), %rax
jmp 0x23ba2
movzwl -0x5(%rbp), %eax
jmp 0x23ba2
movl -0x9(%rbp), %eax
jmp 0x23ba2
movzbl -0x3(%rbp), %eax
jmp 0x23ba2
xorl %eax, %eax
cmpq $0x10001, %rax          # imm = 0x10001
jb 0x23970
leaq 0x3120b(%rip), %rsi     # 0x54dc0
movl $0x29, %edx
movq %rbx, %rdi
callq 0x222c4
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2364c
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x2398d
leaq 0x311cf(%rip), %rdx     # 0x54dac
leaq 0x3102e(%rip), %rcx     # 0x54c12
movq %rbx, %rdi
xorl %esi, %esi
movl $0x3e9, %r8d            # imm = 0x3E9
jmp 0x23c25
leaq 0x3113d(%rip), %rdx     # 0x54d35
leaq 0x31013(%rip), %rcx     # 0x54c12
movq %rbx, %rdi
xorl %esi, %esi
movl $0x3c2, %r8d            # imm = 0x3C2
jmp 0x23c25
leaq 0x3115a(%rip), %rdx     # 0x54d6d
leaq 0x30ff8(%rip), %rcx     # 0x54c12
movq %rbx, %rdi
xorl %esi, %esi
movl $0x3d4, %r8d            # imm = 0x3D4
callq 0x2a9bc
movl $0x1, %edi
callq 0x12120