// File: /workspace/github_c_makefile_star2_O1/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 0x699a
movslq 0xa8(%rax), %rcx
movq %rax, (%rsp)
movq 0x20(%rax,%rcx,8), %rcx
leaq 0x118(%rbx), %r14
cmpl $0x0, 0x10(%rcx)
je 0x4c2c
xorl %edx, %edx
xorl %r12d, %r12d
xorl %ebp, %ebp
movq %rcx, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
movq 0x18(%rcx,%rdx,8), %r13
testq %r13, %r13
je 0x4c11
cmpb $0x0, 0xb(%r13)
je 0x4c06
movq 0x10(%r13), %rsi
movslq %r12d, %r15
leaq (%r14,%r15), %r12
movq %r12, %rdi
callq 0x30d0
subl %r12d, %eax
addl %eax, %r15d
cmpl $0x47, %r15d
jl 0x4bb9
movl %r15d, %eax
movw $0xa, 0x118(%rbx,%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6c86
xorl %r12d, %r12d
jmp 0x4be5
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
cmpl $0x47, %r12d
jl 0x4c06
movl %r12d, %eax
movw $0xa, 0x118(%rbx,%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6c86
xorl %r12d, %r12d
incl %ebp
movq (%r13), %r13
jmp 0x4b69
movq 0x10(%rsp), %rdx
incq %rdx
movq 0x8(%rsp), %rcx
movl 0x10(%rcx), %eax
cmpq %rax, %rdx
jb 0x4b5f
jmp 0x4c31
xorl %ebp, %ebp
xorl %r12d, %r12d
testl %r12d, %r12d
jle 0x4c4e
movl %r12d, %eax
movw $0xa, 0x118(%rbx,%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6c86
movq (%rsp), %rax
movq (%rax), %rcx
subq %rax, %rcx
addq $-0xb8, %rcx
sarq $0x3, %rcx
movl 0xac(%rax), %r8d
leaq 0x982e(%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 0x6c86