// File: /workspace/github_c_makefile_star2_O0/Seclabs-htc[P]slip39/vectors.c
// Function: test_vectors
int test_vectors(void)
{

    int i, gn, sl;
    char **ml;
    char pass[] = "TREZOR";
    uint8_t ms[32];
    int msl;
    uint8_t vs[32];
    int vsl;
    int ret;


    for (i = 0; i < 40; i++)
    {
        ml = vectors[i].mnemonic;

        gn = 0;
        while (ml[gn] != 0)
            gn++;

        printf("%s\n", vectors[i].description);
        sl = strlen(vectors[i].secret);
        msl = sizeof(ms);
        ret = combine_mnemonics(gn ,ml, pass, strlen(pass), ms, &msl);

        if (ret == 0)
        {
            vsl = sizeof(vs);
            fromhex(vs, &vsl, vectors[i].secret);

            if (vsl == msl)
            {
                if (memcmp(ms, vs, msl) == 0)
                    printf("--> PASS\n");
                else
                {
                    printf("--> FAIL <--------\n");
                }
            }
            else
            {
                printf("--> FAIL <--------\n");
            }
        }
        else
        {
            if (strlen(vectors[i].secret) == 0)
                printf("--> PASS\n");
            else
                printf("--> FAIL <--------\n");
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movl 0x5d9e(%rip), %eax      # 0x1413f
movl %eax, -0x1f(%rbp)
movw 0x5d98(%rip), %ax       # 0x14143
movw %ax, -0x1b(%rbp)
movb 0x5d90(%rip), %al       # 0x14145
movb %al, -0x19(%rbp)
movl $0x0, -0x8(%rbp)
cmpl $0x28, -0x8(%rbp)
jge 0xe57b
movslq -0x8(%rbp), %rcx
leaq 0x9efc(%rip), %rax      # 0x182d0
imulq $0x110, %rcx, %rcx      # imm = 0x110
addq %rcx, %rax
addq $0x8, %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x18(%rbp), %rax
movslq -0xc(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0xe407
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xe3ed
movslq -0x8(%rbp), %rcx
leaq 0x9ebe(%rip), %rax      # 0x182d0
imulq $0x110, %rcx, %rcx      # imm = 0x110
addq %rcx, %rax
movq (%rax), %rsi
leaq 0x101c(%rip), %rdi      # 0xf442
movb $0x0, %al
callq 0x8050
movslq -0x8(%rbp), %rcx
leaq 0x9e98(%rip), %rax      # 0x182d0
imulq $0x110, %rcx, %rcx      # imm = 0x110
addq %rcx, %rax
movq 0x108(%rax), %rdi
callq 0x8040
movl %eax, -0x10(%rbp)
movl $0x20, -0x44(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x8c(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x1f(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x1f(%rbp), %rdi
callq 0x8040
movl -0x8c(%rbp), %edi
movq -0x88(%rbp), %rsi
movq -0x80(%rbp), %rdx
movl %eax, %ecx
leaq -0x40(%rbp), %r8
leaq -0x44(%rbp), %r9
callq 0xcf20
movl %eax, -0x78(%rbp)
cmpl $0x0, -0x78(%rbp)
jne 0xe524
movl $0x20, -0x74(%rbp)
leaq -0x70(%rbp), %rdi
movslq -0x8(%rbp), %rcx
leaq 0x9e14(%rip), %rax      # 0x182d0
imulq $0x110, %rcx, %rcx      # imm = 0x110
addq %rcx, %rax
movq 0x108(%rax), %rdx
leaq -0x74(%rbp), %rsi
callq 0xdfb0
movl -0x74(%rbp), %eax
cmpl -0x44(%rbp), %eax
jne 0xe514
leaq -0x40(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movslq -0x44(%rbp), %rdx
callq 0x8070
cmpl $0x0, %eax
jne 0xe504
leaq 0x5c4b(%rip), %rdi      # 0x14146
movb $0x0, %al
callq 0x8050
jmp 0xe512
leaq 0x5c45(%rip), %rdi      # 0x14150
movb $0x0, %al
callq 0x8050
jmp 0xe522
leaq 0x5c35(%rip), %rdi      # 0x14150
movb $0x0, %al
callq 0x8050
jmp 0xe56b
movslq -0x8(%rbp), %rcx
leaq 0x9da1(%rip), %rax      # 0x182d0
imulq $0x110, %rcx, %rcx      # imm = 0x110
addq %rcx, %rax
movq 0x108(%rax), %rdi
callq 0x8040
cmpq $0x0, %rax
jne 0xe55b
leaq 0x5bf4(%rip), %rdi      # 0x14146
movb $0x0, %al
callq 0x8050
jmp 0xe569
leaq 0x5bee(%rip), %rdi      # 0x14150
movb $0x0, %al
callq 0x8050
jmp 0xe56b
jmp 0xe56d
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0xe3bf
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq