// File: /workspace/github_c_makefile_star2_O1/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
subq $0x18, %rsp
movq %rsi, %rbp
movq %rdi, %r12
movl $0x0, (%rsi)
xorl %r15d, %r15d
xorl %r13d, %r13d
movq %rsi, 0x10(%rsp)
movq %r13, 0x8(%rsp)
movsbq (%r12), %r14
testq %r14, %r14
sete %bl
je 0x566e
callq 0x2470
movq (%rax), %rax
testb $0x20, 0x1(%rax,%r14,2)
je 0x5417
movsbq 0x1(%r12), %rcx
testq %rcx, %rcx
sete %bl
je 0x566e
incq %r12
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x53fb
testb %bl, %bl
jne 0x566e
testq %r15, %r15
jne 0x5453
movl $0x9, %edi
callq 0x2300
testq %rax, %rax
je 0x5447
movq %rax, %r15
addq $0x8, %r15
movb $0x0, 0x8(%rax)
movq $0x0, (%rax)
jmp 0x544a
xorl %r15d, %r15d
testq %r15, %r15
je 0x5623
xorl %ebp, %ebp
xorl %r13d, %r13d
testl %r13d, %r13d
jne 0x55e8
movzbl (%r12), %eax
testl %ebp, %ebp
je 0x54b4
movl $0x6, %ebx
cmpl $0x22, %eax
je 0x5549
cmpl $0x5c, %eax
je 0x54d8
testl %eax, %eax
je 0x55dc
movslq -0x8(%r15), %rbx
movl $0x1, %esi
movq %r15, %rdi
callq 0x4a44
movl $0x1, %ebp
testq %rax, %rax
je 0x55bf
movq %rax, %r15
movb (%r12), %al
movb %al, (%r15,%rbx)
jmp 0x55ab
cmpl $0x22, %eax
ja 0x5528
movl %eax, %eax
movabsq $0x100002601, %rcx      # imm = 0x100002601
btq %rax, %rcx
jae 0x5518
movl $0x1, %r13d
xorl %ebp, %ebp
jmp 0x55c2
movb 0x1(%r12), %r14b
movzbl %r14b, %ecx
cmpl $0x6d, %ecx
jg 0x5504
testl %ecx, %ecx
je 0x5540
cmpl $0x61, %ecx
je 0x557e
cmpl $0x62, %ecx
jne 0x5586
movb $0x8, %r14b
jmp 0x5586
cmpl $0x6e, %ecx
je 0x5579
cmpl $0x74, %ecx
je 0x5583
cmpl $0x72, %ecx
jne 0x5586
movb $0xd, %r14b
jmp 0x5586
cmpq $0x22, %rax
jne 0x5528
movl $0x1, %ebp
jmp 0x55c2
movslq -0x8(%r15), %rbx
movl $0x1, %esi
movq %r15, %rdi
callq 0x4a44
xorl %ebp, %ebp
jmp 0x549b
cmpl $0x22, %eax
jne 0x547d
movsbq 0x1(%r12), %r14
movl $0x1, %ebp
testq %r14, %r14
je 0x5571
callq 0x2470
movq (%rax), %rax
testb $0x20, 0x1(%rax,%r14,2)
movl $0x1, %r13d
jne 0x55c2
jmp 0x55dc
movl $0x1, %r13d
jmp 0x55c2
movb $0xa, %r14b
jmp 0x5586
movb $0x7, %r14b
jmp 0x5586
movb $0x9, %r14b
incq %r12
movslq -0x8(%r15), %rbx
movl $0x1, %esi
movq %r15, %rdi
callq 0x4a44
movl $0x1, %ebp
testq %rax, %rax
je 0x55bf
movq %rax, %r15
movb %r14b, (%rax,%rbx)
leaq 0x1(%rbx), %rax
movl %eax, -0x8(%r15)
decl -0x4(%r15)
movb $0x0, 0x1(%r15,%rbx)
jmp 0x55c2
xorl %r15d, %r15d
cmpb $0x1, (%r12)
sbbq $-0x1, %r12
testq %r15, %r15
jne 0x5458
movl $0x6, %ebx
xorl %r15d, %r15d
movq 0x8(%rsp), %r13
movq 0x10(%rsp), %rbp
jmp 0x563a
movq 0x10(%rsp), %rbp
movslq (%rbp), %rax
leaq 0x8(,%rax,8), %rsi
movq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x2350
testq %rax, %rax
je 0x5632
movq %rax, %r13
movslq (%rbp), %rax
movq %r15, (%r13,%rax,8)
incl %eax
movl %eax, (%rbp)
xorl %r15d, %r15d
xorl %ebx, %ebx
jmp 0x563a
movl $0x6, %ebx
xorl %r15d, %r15d
movq 0x8(%rsp), %r13
jmp 0x563a
movl $0x6, %ebx
movq %r14, %r13
testl %ebx, %ebx
je 0x53d5
cmpl $0x6, %ebx
movq 0x8(%rsp), %rax
jne 0x5673
movl (%rbp), %eax
subl $0x1, %eax
movl %eax, (%rbp)
jb 0x5682
cltq
movq (%r13,%rax,8), %rdi
testq %rdi, %rdi
je 0x564c
addq $-0x8, %rdi
callq 0x2060
jmp 0x564c
movq 0x8(%rsp), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %r13, %r13
je 0x568f
movq %r13, %rdi
callq 0x2060
testq %r15, %r15
je 0x56a0
addq $-0x8, %r15
movq %r15, %rdi
callq 0x2060
xorl %eax, %eax
jmp 0x5673