// File: /workspace/github_c_makefile_star2_O3/hoobaa[P]ficl/tools.c
// Function: ficlPrimitiveWords
static void ficlPrimitiveWords(ficlVm *vm)
{
    ficlDictionary *dictionary = ficlVmGetDictionary(vm);
    ficlHash *hash = dictionary->wordlists[dictionary->wordlistCount - 1];
    ficlWord *wp;
    int nChars = 0;
    int len;
    unsigned i;
    int nWords = 0;
    char *cp;
    char *pPad = vm->pad;

    for (i = 0; i < hash->size; i++)
    {
        for (wp = hash->table[i]; wp != NULL; wp = wp->link, nWords++)
        {
            if (wp->length == 0) /* ignore :noname defs */
                continue;

            cp = wp->name;
            nChars += sprintf(pPad + nChars, "%s", cp);

            if (nChars > 70)
            {
                pPad[nChars++] = '\n';
                pPad[nChars] = '\0';
                nChars = 0;
                ficlVmTextOut(vm, pPad);
            }
            else
            {
                len = nCOLWIDTH - nChars % nCOLWIDTH;
                while (len-- > 0)
                    pPad[nChars++] = ' ';
            }

            if (nChars > 70)
            {
                pPad[nChars++] = '\n';
                pPad[nChars] = '\0';
                nChars = 0;
                ficlVmTextOut(vm, pPad);
            }
        }
    }

    if (nChars > 0)
    {
        pPad[nChars++] = '\n';
        pPad[nChars] = '\0';
        nChars = 0;
        ficlVmTextOut(vm, pPad);
    }

    sprintf(vm->pad, "Dictionary: %d words, %ld cells used of %u total\n", 
        nWords, (long) (dictionary->here - dictionary->base), dictionary->size);
    ficlVmTextOut(vm, vm->pad);
    return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
callq 0x68f3
movslq 0xa8(%rax), %rcx
movq 0x20(%rax,%rcx,8), %rsi
leaq 0x118(%rbx), %r14
movl 0x10(%rsi), %edx
testl %edx, %edx
je 0x4be7
movq %rax, (%rsp)
xorl %eax, %eax
xorl %r12d, %r12d
xorl %ebp, %ebp
movq %rsi, 0x8(%rsp)
movq 0x18(%rsi,%rax,8), %r13
testq %r13, %r13
je 0x4bb6
movq %rax, 0x10(%rsp)
cmpb $0x0, 0xb(%r13)
je 0x4b9a
movq 0x10(%r13), %rsi
movslq %r12d, %r15
leaq (%r14,%r15), %r12
movq %r12, %rdi
callq 0x30d0
subl %r12d, %eax
addl %eax, %r15d
cmpl $0x46, %r15d
jg 0x4b7f
leal 0x7(%r15), %r12d
testl %r15d, %r15d
cmovnsl %r15d, %r12d
andl $-0x8, %r12d
movl %r12d, %edx
subl %r15d, %edx
addl $0x8, %edx
movslq %r15d, %rdi
addq %r14, %rdi
movl $0x20, %esi
callq 0x3130
addl $0x8, %r12d
movl %r12d, %r15d
cmpl $0x47, %r12d
jl 0x4b9a
movl %r15d, %eax
movw $0xa, 0x118(%rbx,%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6b89
xorl %r12d, %r12d
incl %ebp
movq (%r13), %r13
testq %r13, %r13
jne 0x4b24
movq 0x8(%rsp), %rsi
movl 0x10(%rsi), %edx
movq 0x10(%rsp), %rax
incq %rax
movl %edx, %ecx
cmpq %rcx, %rax
jb 0x4b11
testl %r12d, %r12d
jle 0x4be1
movl %r12d, %eax
movw $0xa, 0x118(%rbx,%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6b89
movq (%rsp), %rax
jmp 0x4be9
xorl %ebp, %ebp
movq (%rax), %rcx
subq %rax, %rcx
addq $-0xb8, %rcx
sarq $0x3, %rcx
movl 0xac(%rax), %r8d
leaq 0x9897(%rip), %rsi      # 0xe49f
movq %r14, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x32f0
movq %rbx, %rdi
movq %r14, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6b89