// File: /workspace/github_c_makefile_star2_O3/winton[P]redis_parse/hiredis/sds.c
// Function: sdssplitargs
sds *sdssplitargs(char *line, int *argc) {
    char *p = line;
    char *current = NULL;
    char **vector = NULL, **_vector = NULL;

    *argc = 0;
    while(1) {
        /* skip blanks */
        while(*p && isspace(*p)) p++;
        if (*p) {
            /* get a token */
            int inq=0; /* set to 1 if we are in "quotes" */
            int done=0;

            if (current == NULL) {
                current = sdsempty();
                if (current == NULL) goto err;
            }

            while(!done) {
                if (inq) {
                    if (*p == '\\' && *(p+1)) {
                        char c;

                        p++;
                        switch(*p) {
                        case 'n': c = '\n'; break;
                        case 'r': c = '\r'; break;
                        case 't': c = '\t'; break;
                        case 'b': c = '\b'; break;
                        case 'a': c = '\a'; break;
                        default: c = *p; break;
                        }
                        current = sdscatlen(current,&c,1);
                    } else if (*p == '"') {
                        /* closing quote must be followed by a space */
                        if (*(p+1) && !isspace(*(p+1))) goto err;
                        done=1;
                    } else if (!*p) {
                        /* unterminated quotes */
                        goto err;
                    } else {
                        current = sdscatlen(current,p,1);
                    }
                } else {
                    switch(*p) {
                    case ' ':
                    case '\n':
                    case '\r':
                    case '\t':
                    case '\0':
                        done=1;
                        break;
                    case '"':
                        inq=1;
                        break;
                    default:
                        current = sdscatlen(current,p,1);
                        break;
                    }
                }
                if (*p) p++;
                if (current == NULL) goto err;
            }
            /* add the token to the vector */
            _vector = realloc(vector,((*argc)+1)*sizeof(char*));
            if (_vector == NULL) goto err;

            vector = _vector;
            vector[*argc] = current;
            (*argc)++;
            current = NULL;
        } else {
            return vector;
        }
    }

err:
    while((*argc)--)
        sdsfree(vector[*argc]);
    if (vector != NULL) free(vector);
    if (current != NULL) sdsfree(current);
    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0x0, (%rsi)
movb (%rdi), %bpl
testb %bpl, %bpl
je 0x55a8
movq %rsi, %rbx
movq %rdi, %r15
callq 0x2470
movq %rax, %rdx
xorl %r14d, %r14d
movq (%rdx), %rax
movsbq %bpl, %rcx
testb $0x20, 0x1(%rax,%rcx,2)
je 0x5385
movb 0x1(%r15), %bpl
incq %r15
testb %bpl, %bpl
jne 0x5369
jmp 0x5559
movq %rdx, (%rsp)
movl $0x1, %edi
movl $0x9, %esi
callq 0x2270
testq %rax, %rax
je 0x555e
movq %rax, %r12
addq $0x8, %r12
xorl %ebp, %ebp
movzbl (%r15), %eax
testl %ebp, %ebp
je 0x5404
cmpl $0x22, %eax
je 0x548f
cmpl $0x5c, %eax
je 0x546b
testl %eax, %eax
je 0x5561
movslq -0x8(%r12), %r13
movl $0x1, %esi
movq %r12, %rdi
callq 0x49f2
testq %rax, %rax
je 0x555e
movq %rax, %r12
movb (%r15), %al
movb %al, (%r12,%r13)
leaq 0x1(%r13), %rax
movl %eax, -0x8(%r12)
decl -0x4(%r12)
jmp 0x5504
xorl %ebp, %ebp
cmpl $0x22, %eax
ja 0x542b
movl %eax, %eax
movabsq $0x100002601, %rcx      # imm = 0x100002601
btq %rax, %rcx
jb 0x54b0
cmpq $0x22, %rax
je 0x550a
movslq -0x8(%r12), %r13
movl $0x1, %esi
movq %r12, %rdi
callq 0x49f2
testq %rax, %rax
je 0x555e
movq %rax, %r12
movb (%r15), %al
movb %al, (%r12,%r13)
leaq 0x1(%r13), %rax
movl %eax, -0x8(%r12)
decl -0x4(%r12)
movb $0x0, 0x1(%r12,%r13)
movb $0x1, %al
jmp 0x5511
movb 0x1(%r15), %bpl
movzbl %bpl, %eax
cmpl $0x6d, %eax
jg 0x54b4
testl %eax, %eax
je 0x53cc
cmpl $0x61, %eax
je 0x54cd
cmpl $0x62, %eax
jne 0x54d5
movb $0x8, %bpl
jmp 0x54d5
movsbq 0x1(%r15), %rax
movl $0x1, %ebp
testq %rax, %rax
je 0x54b0
movq (%rsp), %rcx
movq (%rcx), %rcx
testb $0x20, 0x1(%rcx,%rax,2)
je 0x5561
xorl %eax, %eax
jmp 0x5511
cmpl $0x6e, %eax
je 0x54c8
cmpl $0x74, %eax
je 0x54d2
cmpl $0x72, %eax
jne 0x54d5
movb $0xd, %bpl
jmp 0x54d5
movb $0xa, %bpl
jmp 0x54d5
movb $0x7, %bpl
jmp 0x54d5
movb $0x9, %bpl
movslq -0x8(%r12), %r13
movl $0x1, %esi
movq %r12, %rdi
callq 0x49f2
testq %rax, %rax
je 0x555e
movq %rax, %r12
movb %bpl, (%rax,%r13)
leaq 0x1(%r13), %rax
movl %eax, -0x8(%r12)
decl -0x4(%r12)
incq %r15
movb $0x0, 0x1(%r12,%r13)
movb $0x1, %al
movl $0x1, %ebp
cmpb $0x1, (%r15)
sbbq $-0x1, %r15
testb %al, %al
jne 0x53aa
movslq (%rbx), %rax
leaq 0x8(,%rax,8), %rsi
movq %r14, %rdi
callq 0x2350
testq %rax, %rax
je 0x5561
movslq (%rbx), %rcx
movq %r12, (%rax,%rcx,8)
incl %ecx
movl %ecx, (%rbx)
movb (%r15), %bpl
movq %rax, %r14
testb %bpl, %bpl
movq (%rsp), %rdx
jne 0x5366
jmp 0x55aa
movq %r14, %rax
jmp 0x55aa
xorl %r12d, %r12d
movl (%rbx), %eax
subl $0x1, %eax
movl %eax, (%rbx)
jae 0x5571
testq %r14, %r14
jne 0x558f
jmp 0x5597
movslq %eax, %rcx
movq (%r14,%rcx,8), %rdi
testq %rdi, %rdi
je 0x5588
addq $-0x8, %rdi
callq 0x2060
movl (%rbx), %eax
subl $0x1, %eax
movl %eax, (%rbx)
jae 0x5571
movq %r14, %rdi
callq 0x2060
testq %r12, %r12
je 0x55a8
addq $-0x8, %r12
movq %r12, %rdi
callq 0x2060
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)