// File: /workspace/github_c_makefile_star2_O0/winton[P]redis_parse/hiredis/sds.c
// Function: sdssplitlen
sds *sdssplitlen(char *s, int len, char *sep, int seplen, int *count) {
    int elements = 0, slots = 5, start = 0, j;

    sds *tokens = malloc(sizeof(sds)*slots);
#ifdef SDS_ABORT_ON_OOM
    if (tokens == NULL) sdsOomAbort();
#endif
    if (seplen < 1 || len < 0 || tokens == NULL) return NULL;
    if (len == 0) {
        *count = 0;
        return tokens;
    }
    for (j = 0; j < (len-(seplen-1)); j++) {
        /* make sure there is room for the next element and the final one */
        if (slots < elements+2) {
            sds *newtokens;

            slots *= 2;
            newtokens = realloc(tokens,sizeof(sds)*slots);
            if (newtokens == NULL) {
#ifdef SDS_ABORT_ON_OOM
                sdsOomAbort();
#else
                goto cleanup;
#endif
            }
            tokens = newtokens;
        }
        /* search the separator */
        if ((seplen == 1 && *(s+j) == sep[0]) || (memcmp(s+j,sep,seplen) == 0)) {
            tokens[elements] = sdsnewlen(s+start,j-start);
            if (tokens[elements] == NULL) {
#ifdef SDS_ABORT_ON_OOM
                sdsOomAbort();
#else
                goto cleanup;
#endif
            }
            elements++;
            start = j+seplen;
            j = j+seplen-1; /* skip the separator */
        }
    }
    /* Add the final element. We are sure there is room in the tokens array. */
    tokens[elements] = sdsnewlen(s+start,len-start);
    if (tokens[elements] == NULL) {
#ifdef SDS_ABORT_ON_OOM
                sdsOomAbort();
#else
                goto cleanup;
#endif
    }
    elements++;
    *count = elements;
    return tokens;

#ifndef SDS_ABORT_ON_OOM
cleanup:
    {
        int i;
        for (i = 0; i < elements; i++) sdsfree(tokens[i]);
        free(tokens);
        return NULL;
    }
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq %r8, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x5, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movslq -0x38(%rbp), %rdi
shlq $0x3, %rdi
callq 0x2300
movq %rax, -0x48(%rbp)
cmpl $0x1, -0x24(%rbp)
jl 0x6fa3
cmpl $0x0, -0x14(%rbp)
jl 0x6fa3
cmpq $0x0, -0x48(%rbp)
jne 0x6fb0
movq $0x0, -0x8(%rbp)
jmp 0x715d
cmpl $0x0, -0x14(%rbp)
jne 0x6fcd
movq -0x30(%rbp), %rax
movl $0x0, (%rax)
movq -0x48(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x715d
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
movl -0x14(%rbp), %ecx
movl -0x24(%rbp), %edx
subl $0x1, %edx
subl %edx, %ecx
cmpl %ecx, %eax
jge 0x70cc
movl -0x38(%rbp), %eax
movl -0x34(%rbp), %ecx
addl $0x2, %ecx
cmpl %ecx, %eax
jge 0x7028
movl -0x38(%rbp), %eax
shll %eax
movl %eax, -0x38(%rbp)
movq -0x48(%rbp), %rdi
movslq -0x38(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2340
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x7020
jmp 0x7121
movq -0x50(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpl $0x1, -0x24(%rbp)
jne 0x7045
movq -0x10(%rbp), %rax
movslq -0x40(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movq -0x20(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
je 0x7062
movq -0x10(%rbp), %rdi
movslq -0x40(%rbp), %rax
addq %rax, %rdi
movq -0x20(%rbp), %rsi
movslq -0x24(%rbp), %rdx
callq 0x2230
cmpl $0x0, %eax
jne 0x70bc
movq -0x10(%rbp), %rdi
movslq -0x3c(%rbp), %rax
addq %rax, %rdi
movl -0x40(%rbp), %eax
subl -0x3c(%rbp), %eax
movslq %eax, %rsi
callq 0x2290
movq %rax, %rdx
movq -0x48(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x48(%rbp), %rax
movslq -0x34(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x709e
jmp 0x7121
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movl -0x40(%rbp), %eax
addl -0x24(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x40(%rbp), %eax
addl -0x24(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x70be
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x6fd4
movq -0x10(%rbp), %rdi
movslq -0x3c(%rbp), %rax
addq %rax, %rdi
movl -0x14(%rbp), %eax
subl -0x3c(%rbp), %eax
movslq %eax, %rsi
callq 0x2290
movq %rax, %rdx
movq -0x48(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x48(%rbp), %rax
movslq -0x34(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x7105
jmp 0x7121
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movq -0x48(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x715d
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x714c
movq -0x48(%rbp), %rax
movslq -0x54(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2250
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x7128
movq -0x48(%rbp), %rdi
callq 0x2050
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)