// File: /workspace/github_c_makefile_star2_O0/Seclabs-htc[P]slip39/slip39.c
// Function: mnemonic_to_indices
static int mnemonic_to_indices(char *ml, uint32_t *words, int *wc)
{
    int i, j, k, c;
    char current_word[12];

    if (!ml)
        return -1;

    i = 0; c = 0;

    while (ml[i])
    {
        if (ml[i] == ' ')
            c++;
        i++;
    }
    c++;

    if (c > 33)
        return -2;

    i = 0; c = 0;
    while (ml[i])
    {
        j = 0;
        while (ml[i] != ' ' && ml[i] != 0)
        {
            if (j >= sizeof(current_word) - 1)
                return -3;
            current_word[j] = ml[i];
            i++; j++;
        }

        current_word[j] = 0;
        if (ml[i] != 0)
            i++;

        k = 0;
        for (;;)
        {
            if (!slip39_wordlist[k])    // word not found
                return -4;
            if (strcmp(current_word, slip39_wordlist[k]) == 0) // word found on index k
            {
                if (c >= *wc)
                    return -5;
                words[c++] = k;
                break;
            }
            k++;
        }
    }
    *wc = c;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xccd7
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xce7b
movl $0x0, -0x24(%rbp)
movl $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0xcd18
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
jne 0xcd0d
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xcce5
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
cmpl $0x21, -0x30(%rbp)
jle 0xcd33
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0xce7b
movl $0x0, -0x24(%rbp)
movl $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0xce6b
movl $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x20, %ecx
movb %al, -0x3d(%rbp)
je 0xcd85
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x3d(%rbp)
movb -0x3d(%rbp), %al
testb $0x1, %al
jne 0xcd8e
jmp 0xcdcb
movslq -0x28(%rbp), %rax
cmpq $0xb, %rax
jb 0xcda4
movl $0xfffffffd, -0x4(%rbp) # imm = 0xFFFFFFFD
jmp 0xce7b
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movb (%rax,%rcx), %cl
movslq -0x28(%rbp), %rax
movb %cl, -0x3c(%rbp,%rax)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xcd5a
movslq -0x28(%rbp), %rax
movb $0x0, -0x3c(%rbp,%rax)
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0xcdee
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movl $0x0, -0x2c(%rbp)
movslq -0x2c(%rbp), %rcx
leaq 0x8ff0(%rip), %rax      # 0x15df0
cmpq $0x0, (%rax,%rcx,8)
jne 0xce10
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0xce7b
leaq -0x3c(%rbp), %rdi
movslq -0x2c(%rbp), %rcx
leaq 0x8fd1(%rip), %rax      # 0x15df0
movq (%rax,%rcx,8), %rsi
callq 0x8080
cmpl $0x0, %eax
jne 0xce5b
movl -0x30(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
jl 0xce41
movl $0xfffffffb, -0x4(%rbp) # imm = 0xFFFFFFFB
jmp 0xce7b
movl -0x2c(%rbp), %edx
movq -0x18(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x30(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0xce66
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xcdf5
jmp 0xcd41
movl -0x30(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)