// File: /workspace/github_c_makefile_star2_O0/sachinites[P]CommandParser/string_util.c
// Function: tokenizer
char** tokenizer(char* _a_str, const char a_delim, size_t *token_cnt){
   
    char *token = NULL;
    int i = 0;
    char delim[2];
    memset(a_str, 0, CONS_INPUT_BUFFER_SIZE);
    strncpy(a_str, _a_str, strlen(_a_str));
    a_str[strlen(_a_str)] = '\0';

    string_space_trim(a_str);

    if(strlen(a_str) < 1){
        *token_cnt = 0;
        return NULL;
    }

    delim[0] = a_delim;
    delim[1] = '\0';

    token = strtok(a_str, delim);
    if(token){
        untokenize(i);
        strncpy(tokens[i], token, strlen(token));
        i++;
    }
    else{
        *token_cnt = 0;
        return NULL;
    }
    
    /* walk through other tokens */
    while( token != NULL ) 
    {
        token = strtok(NULL, delim);
        if(token){
            untokenize(i);
            strncpy(tokens[i], token, strlen(token));
            i++;
            if(i == MAX_CMD_TREE_DEPTH + 1){
                //printf("Warning : Max token limit (= %d) support exceeded\n", MAX_CMD_TREE_DEPTH);
                re_init_tokens(MAX_CMD_TREE_DEPTH);
                *token_cnt = 0;
                return &tokens[0];
            }
        }
    } 
    *token_cnt = i;
    return &tokens[0];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movb %sil, %al
movq %rdi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq %rdx, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
leaq 0xe4e4(%rip), %rdi      # 0x14780
xorl %esi, %esi
movl $0x800, %edx            # imm = 0x800
callq 0x10d0
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1090
movq -0x38(%rbp), %rsi
movq %rax, %rdx
leaq 0xe4b9(%rip), %rdi      # 0x14780
callq 0x1050
movq -0x10(%rbp), %rdi
callq 0x1090
movq %rax, %rcx
leaq 0xe4a1(%rip), %rax      # 0x14780
movb $0x0, (%rax,%rcx)
leaq 0xe496(%rip), %rdi      # 0x14780
callq 0x6460
leaq 0xe48a(%rip), %rdi      # 0x14780
callq 0x1090
cmpq $0x1, %rax
jae 0x6319
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movq $0x0, -0x8(%rbp)
jmp 0x644c
movb -0x11(%rbp), %al
movb %al, -0x2e(%rbp)
movb $0x0, -0x2d(%rbp)
leaq -0x2e(%rbp), %rsi
leaq 0xe452(%rip), %rdi      # 0x14780
callq 0x11c0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x6385
movl -0x2c(%rbp), %edi
callq 0x6220
movslq -0x2c(%rbp), %rcx
leaq 0xe3af(%rip), %rax      # 0x14700
movq (%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rdi
callq 0x1090
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq %rax, %rdx
callq 0x1050
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x639d
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movq $0x0, -0x8(%rbp)
jmp 0x644c
jmp 0x639f
cmpq $0x0, -0x28(%rbp)
je 0x6436
leaq -0x2e(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x11c0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x6431
movl -0x2c(%rbp), %edi
callq 0x6220
movslq -0x2c(%rbp), %rcx
leaq 0xe32b(%rip), %rax      # 0x14700
movq (%rax,%rcx,8), %rax
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x28(%rbp), %rdi
callq 0x1090
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq %rax, %rdx
callq 0x1050
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
cmpl $0x11, -0x2c(%rbp)
jne 0x642f
movl $0x10, %edi
callq 0x6170
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
leaq 0xe2d7(%rip), %rax      # 0x14700
movq %rax, -0x8(%rbp)
jmp 0x644c
jmp 0x6431
jmp 0x639f
movslq -0x2c(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
leaq 0xe2b8(%rip), %rax      # 0x14700
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)