// File: /workspace/github_c_makefile_star2_O3/andyfighting[P]hiredis_timer_cmpt/sds.c
// Function: sdssplitargs
sds *sdssplitargs(const char *line, int *argc) {
    const char *p = line;
    char *current = NULL;
    char **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 insq=0; /* set to 1 if we are in 'single quotes' */
            int done=0;

            if (current == NULL) current = sdsempty();
            while(!done) {
                if (inq) {
                    if (*p == '\\' && *(p+1) == 'x' &&
                                             is_hex_digit(*(p+2)) &&
                                             is_hex_digit(*(p+3)))
                    {
                        unsigned char byte;

                        byte = (hex_digit_to_int(*(p+2))*16)+
                                hex_digit_to_int(*(p+3));
                        current = sdscatlen(current,(char*)&byte,1);
                        p += 3;
                    } else 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 or
                         * nothing at all. */
                        if (*(p+1) && !isspace(*(p+1))) goto err;
                        done=1;
                    } else if (!*p) {
                        /* unterminated quotes */
                        goto err;
                    } else {
                        current = sdscatlen(current,p,1);
                    }
                } else if (insq) {
                    if (*p == '\\' && *(p+1) == '\'') {
                        p++;
                        current = sdscatlen(current,"'",1);
                    } else if (*p == '\'') {
                        /* closing quote must be followed by a space or
                         * nothing at all. */
                        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;
                    case '\'':
                        insq=1;
                        break;
                    default:
                        current = sdscatlen(current,p,1);
                        break;
                    }
                }
                if (*p) p++;
            }
            /* add the token to the vector */
            vector = realloc(vector,((*argc)+1)*sizeof(char*));
            vector[*argc] = current;
            (*argc)++;
            current = NULL;
        } else {
            /* Even on empty input string return something not NULL. */
            if (vector == NULL) vector = malloc(sizeof(void*));
            return vector;
        }
    }

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl $0x0, (%rsi)
movb (%rdi), %bpl
testb %bpl, %bpl
je 0x6d5c
movq %rsi, %r14
movq %rdi, %r15
xorl %r12d, %r12d
callq 0x3520
movq (%rax), %rdx
movsbq %bpl, %rcx
testb $0x20, 0x1(%rdx,%rcx,2)
je 0x6a15
movb 0x1(%r15), %bpl
incq %r15
testb %bpl, %bpl
jne 0x69f9
jmp 0x6d5f
movq %rax, 0x8(%rsp)
movq %r12, 0x10(%rsp)
movq %r14, 0x18(%rsp)
movl $0x1, %edi
movl $0x9, %esi
callq 0x3290
leaq 0x8(%rax), %r13
testq %rax, %rax
cmoveq %rax, %r13
xorl %r12d, %r12d
xorl %ebp, %ebp
testl %ebp, %ebp
je 0x6a7c
movzbl (%r15), %eax
cmpl $0x5c, %eax
je 0x6aa4
testl %eax, %eax
je 0x6d7c
cmpl $0x22, %eax
je 0x6d01
movslq -0x8(%r13), %r14
movl $0x1, %esi
movq %r13, %rdi
callq 0x31c0
movl $0x1, %ebp
jmp 0x6b73
movzbl (%r15), %eax
testl %r12d, %r12d
je 0x6ad6
cmpl $0x5c, %eax
je 0x6b24
testl %eax, %eax
je 0x6d7c
cmpl $0x27, %eax
jne 0x6b5a
jmp 0x6d01
movb 0x1(%r15), %al
movzbl %al, %ecx
cmpl $0x6d, %ecx
jle 0x6b02
cmpl $0x73, %ecx
jg 0x6b9e
movb $0xa, %r14b
cmpl $0x6e, %ecx
je 0x6bfe
cmpl $0x72, %ecx
jne 0x6be4
movb $0xd, %r14b
jmp 0x6bfe
cmpl $0x27, %eax
ja 0x6c52
movl %eax, %eax
cmpq $0x22, %rax
je 0x6be9
cmpq $0x27, %rax
jne 0x6c3e
movl $0x1, %r12d
xorl %ebp, %ebp
jmp 0x6cf4
testl %ecx, %ecx
je 0x6a61
cmpl $0x61, %ecx
je 0x6bfb
cmpl $0x62, %ecx
jne 0x6be4
movb $0x8, %r14b
jmp 0x6bfe
cmpb $0x27, 0x1(%r15)
jne 0x6b5a
incq %r15
movslq -0x8(%r13), %r14
movl $0x1, %esi
movq %r13, %rdi
callq 0x31c0
movl $0x1, %r12d
xorl %ebp, %ebp
testq %rax, %rax
je 0x6cf1
movq %rax, %r13
movb $0x27, (%rax,%r14)
jmp 0x6b87
movslq -0x8(%r13), %r14
movl $0x1, %esi
movq %r13, %rdi
callq 0x31c0
movl $0x1, %r12d
xorl %ebp, %ebp
testq %rax, %rax
je 0x6cf1
movq %rax, %r13
movb (%r15), %al
movb %al, (%r13,%r14)
leaq 0x1(%r14), %rax
movl %eax, -0x8(%r13)
decl -0x4(%r13)
movb $0x0, 0x1(%r13,%r14)
jmp 0x6cf4
cmpl $0x74, %ecx
je 0x6bf6
cmpl $0x78, %ecx
jne 0x6be4
movb 0x2(%r15), %r14b
leal -0x3a(%r14), %ecx
cmpb $-0xb, %cl
ja 0x6bc3
movl %r14d, %ecx
andb $-0x21, %cl
addb $-0x47, %cl
cmpb $-0x6, %cl
jb 0x6be4
movb 0x3(%r15), %bl
leal -0x3a(%rbx), %ecx
cmpb $-0xb, %cl
ja 0x6c91
movl %ebx, %ecx
andb $-0x21, %cl
addb $-0x47, %cl
cmpb $-0x6, %cl
jae 0x6c91
movl %eax, %r14d
jmp 0x6bfe
xorl %r12d, %r12d
movl $0x1, %ebp
jmp 0x6cf4
movb $0x9, %r14b
jmp 0x6bfe
movb $0x7, %r14b
incq %r15
movslq -0x8(%r13), %rbx
movl $0x1, %esi
movq %r13, %rdi
callq 0x31c0
movl $0x1, %ebp
testq %rax, %rax
je 0x6cf1
movq %rax, %r13
movb %r14b, (%rax,%rbx)
leaq 0x1(%rbx), %rax
movl %eax, -0x8(%r13)
decl -0x4(%r13)
movb $0x0, 0x1(%r13,%rbx)
jmp 0x6cf4
movabsq $0x100002601, %rcx      # imm = 0x100002601
btq %rax, %rcx
jb 0x6d1a
movslq -0x8(%r13), %r14
movl $0x1, %esi
movq %r13, %rdi
callq 0x31c0
xorl %ebp, %ebp
testq %rax, %rax
je 0x6c89
movq %rax, %r13
movb (%r15), %al
movb %al, (%r13,%r14)
leaq 0x1(%r14), %rax
movl %eax, -0x8(%r13)
decl -0x4(%r13)
movb $0x0, 0x1(%r13,%r14)
jmp 0x6c8c
xorl %r13d, %r13d
xorl %r12d, %r12d
jmp 0x6cf4
addq $0x3, %r15
movslq -0x8(%r13), %rax
movq %rax, 0x20(%rsp)
movl $0x1, %esi
movq %r13, %rdi
callq 0x31c0
movl $0x1, %ebp
testq %rax, %rax
je 0x6cf1
movq %rax, %r13
movsbl %r14b, %edi
callq 0x30a0
movl %eax, %r14d
shll $0x4, %r14d
movsbl %bl, %edi
callq 0x30a0
orl %r14d, %eax
movq 0x20(%rsp), %rcx
movb %al, (%r13,%rcx)
leaq 0x1(%rcx), %rax
movl %eax, -0x8(%r13)
decl -0x4(%r13)
movb $0x0, 0x1(%r13,%rcx)
jmp 0x6cf4
xorl %r13d, %r13d
cmpb $0x1, (%r15)
sbbq $-0x1, %r15
jmp 0x6a43
movsbq 0x1(%r15), %rax
testq %rax, %rax
je 0x6d1a
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
testb $0x20, 0x1(%rcx,%rax,2)
je 0x6d7c
cmpb $0x1, (%r15)
sbbq $-0x1, %r15
movq 0x18(%rsp), %r14
movslq (%r14), %rbx
leaq 0x8(,%rbx,8), %rsi
movq 0x10(%rsp), %rdi
callq 0x33a0
movq %rax, %r12
movq %r13, (%rax,%rbx,8)
leal 0x1(%rbx), %eax
movl %eax, (%r14)
movb (%r15), %bpl
testb %bpl, %bpl
movq 0x8(%rsp), %rax
jne 0x69f6
jmp 0x6d5f
xorl %r12d, %r12d
testq %r12, %r12
jne 0x6dcf
movl $0x8, %edi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3340
movq 0x18(%rsp), %rbx
movl (%rbx), %eax
subl $0x1, %eax
movl %eax, (%rbx)
movq 0x10(%rsp), %r14
jb 0x6dad
movslq %eax, %rcx
movq (%r14,%rcx,8), %rdi
testq %rdi, %rdi
je 0x6da6
addq $-0x8, %rdi
callq 0x3050
movl (%rbx), %eax
subl $0x1, %eax
movl %eax, (%rbx)
jae 0x6d8f
movq %r14, %rdi
callq 0x3050
testq %r13, %r13
je 0x6dc6
addq $-0x8, %r13
movq %r13, %rdi
callq 0x3050
movl $0x0, (%rbx)
xorl %r12d, %r12d
movq %r12, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq