// File: /workspace/github_c_makefile_star2_O3/hoobaa[P]ficl/dictionary.c
// Function: ficlDictionarySee
void ficlDictionarySee(ficlDictionary *dictionary, ficlWord *word, ficlCallback *callback)
{
    char *trace;
    ficlCell *cell = word->param;
    ficlCell *param0 = cell;
    char buffer[128];

    for (; cell->i != ficlInstructionSemiParen; cell++)
    {
        ficlWord *word = (ficlWord *)(cell->p);

        trace = buffer;
        if ((void *)cell == (void *)buffer)
            *trace++ = '>';
        else
            *trace++ = ' ';
        trace += sprintf(trace, "%3d   ", cell - param0);
        
        if (ficlDictionaryIsAWord(dictionary, word))
        {
            ficlWordKind kind = ficlWordClassify(word);
            ficlCell c, c2;

            switch (kind)
            {
            case FICL_WORDKIND_INSTRUCTION:
                sprintf(trace, "%s (instruction %ld)", ficlDictionaryInstructionNames[(long)word], (long)word);
                break;
            case FICL_WORDKIND_INSTRUCTION_WITH_ARGUMENT:
                c = *++cell;
                sprintf(trace, "%s (instruction %ld), with argument %ld (%#lx)", ficlDictionaryInstructionNames[(long)word], (long)word, c.i, c.u);
                break;
            case FICL_WORDKIND_INSTRUCTION_WORD:
                sprintf(trace, "%s :: executes %s (instruction word %ld)", word->name, ficlDictionaryInstructionNames[(long)word->code], (long)word->code);
                break;
            case FICL_WORDKIND_LITERAL:
                c = *++cell;
                if (ficlDictionaryIsAWord(dictionary, c.p) && (c.i >= ficlInstructionLast))
                {
                    ficlWord *word = (ficlWord *)c.p;
                    sprintf(trace, "%.*s ( %#lx literal )", 
                        word->length, word->name, c.u);
                }
                else
                    sprintf(trace, "literal %ld (%#lx)", c.i, c.u);
                break;
            case FICL_WORDKIND_2LITERAL:
                c = *++cell;
                c2 = *++cell;
                sprintf(trace, "2literal %d %d (%#lx %#lx)", c2.i, c.i, c2.u, c.u);
                break;
#if FICL_WANT_FLOAT
            case FICL_WORDKIND_FLITERAL:
                c = *++cell;
                sprintf(trace, "fliteral %f (%#lx)", c.f, c.u);
                break;
#endif /* FICL_WANT_FLOAT */
            case FICL_WORDKIND_STRING_LITERAL:
                {
                    ficlCountedString *counted = (ficlCountedString *)(void *)++cell;
                    cell = (ficlCell *)ficlAlignPointer(counted->text + counted->length + 1) - 1;
                    sprintf(trace, "s\" %.*s\"", counted->length, counted->text);
                }
                break;
            case FICL_WORDKIND_CSTRING_LITERAL:
                {
                    ficlCountedString *counted = (ficlCountedString *)(void *)++cell;
                    cell = (ficlCell *)ficlAlignPointer(counted->text + counted->length + 1) - 1;
                    sprintf(trace, "c\" %.*s\"", counted->length, counted->text);
                }
                break;
            case FICL_WORDKIND_BRANCH0:
                c = *++cell;
                sprintf(trace, "branch0 %d", cell + c.i - param0);
                break;                                                           
            case FICL_WORDKIND_BRANCH:
                c = *++cell;
                sprintf(trace, "branch %d",     cell + c.i - param0);
                break;

            case FICL_WORDKIND_QDO:
                c = *++cell;
                sprintf(trace, "?do (leave %d)",  (ficlCell *)c.p - param0);
                break;
            case FICL_WORDKIND_DO:
                c = *++cell;
                sprintf(trace, "do (leave %d)", (ficlCell *)c.p - param0);
                break;
            case FICL_WORDKIND_LOOP:
                c = *++cell;
                sprintf(trace, "loop (branch %d)", cell + c.i - param0);
                break;
            case FICL_WORDKIND_OF:
                c = *++cell;
                sprintf(trace, "of (branch %d)",      cell + c.i - param0);
                break;
            case FICL_WORDKIND_PLOOP:
                c = *++cell;
                sprintf(trace, "+loop (branch %d)", cell + c.i - param0);
                break;
            default:
                sprintf(trace, "%.*s", word->length, word->name);
                break;
            }
 
        }
        else /* probably not a word - punt and print value */
        {
            sprintf(trace, "%ld ( %#lx )", cell->i, cell->u);
        }

        ficlCallbackTextOut(callback, buffer);
        ficlCallbackTextOut(callback, "\n");
    }

    ficlCallbackTextOut(callback, ";\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, %rbx
movq %rdi, 0x8(%rsp)
movq 0x28(%rsi), %r12
cmpq $0x2b, %r12
jne 0xc75a
leaq 0x3062(%rip), %rsi      # 0xf7a2
movq %rbx, %rdi
callq 0xb894
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %r14
addq $0x28, %r14
leaq 0x10(%rsp), %r15
movq %r14, (%rsp)
movq %r15, %r13
cmpq %r15, %r14
movl $0x20, %eax
movl $0x3e, %ecx
cmovel %ecx, %eax
movb %al, 0x10(%rsp)
movq %r14, %rdx
subq (%rsp), %rdx
sarq $0x3, %rdx
leaq 0x11(%rsp), %r15
movq %r15, %rdi
leaq 0x2ed3(%rip), %rsi      # 0xf66e
xorl %eax, %eax
callq 0x32f0
movslq %eax, %rbp
addq %r15, %rbp
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0xc61c
testl %eax, %eax
je 0xc806
movq %r12, %rdi
callq 0xb94e
cmpl $0x16, %eax
movq %r13, %r15
ja 0xc91b
movl %eax, %eax
leaq 0x2dd6(%rip), %rcx      # 0xf5ac
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x8(%r14), %r12
movq 0x8(%r14), %rax
leaq (%r14,%rax,8), %rdx
addq $0x8, %rdx
subq (%rsp), %rdx
sarq $0x3, %rdx
movq %rbp, %rdi
leaq 0x2f55(%rip), %rsi      # 0xf756
jmp 0xca97
movq (%r14), %rcx
movq %rbp, %rdi
leaq 0x2f82(%rip), %rsi      # 0xf795
movq %rcx, %rdx
xorl %eax, %eax
callq 0x32f0
movq %r13, %r15
jmp 0xcaa1
movq 0x10(%r12), %rdx
movq 0x18(%r12), %r8
leaq 0xb6ba(%rip), %rax      # 0x17ef0
movq (%rax,%r8,8), %rcx
movq %rbp, %rdi
leaq 0x2e75(%rip), %rsi      # 0xf6b9
xorl %eax, %eax
callq 0x32f0
jmp 0xcaa1
leaq 0x9(%r14), %r13
movzbl 0x8(%r14), %eax
leaq (%r14,%rax), %rdi
addq $0xa, %rdi
callq 0xb39c
movq %rax, %r12
addq $-0x8, %r12
movzbl 0x8(%r14), %edx
movq %rbp, %rdi
leaq 0x2ebd(%rip), %rsi      # 0xf739
jmp 0xc90c
leaq 0xb668(%rip), %rax      # 0x17ef0
movq (%rax,%r12,8), %rdx
movq %rbp, %rdi
leaq 0x2ddf(%rip), %rsi      # 0xf675
jmp 0xcadf
movq 0x8(%r14), %rdx
addq $0x8, %r14
subq (%rsp), %rdx
sarq $0x3, %rdx
movq %rbp, %rdi
leaq 0x2eac(%rip), %rsi      # 0xf761
jmp 0xca6c
movq 0x8(%r14), %rdx
addq $0x8, %r14
movd %edx, %xmm0
cvtss2sd %xmm0, %xmm0
movq %rbp, %rdi
leaq 0x2e52(%rip), %rsi      # 0xf726
movb $0x1, %al
callq 0x32f0
jmp 0xcaa1
leaq 0x9(%r14), %r13
movzbl 0x8(%r14), %eax
leaq (%r14,%rax), %rdi
addq $0xa, %rdi
callq 0xb39c
movq %rax, %r12
addq $-0x8, %r12
movzbl 0x8(%r14), %edx
movq %rbp, %rdi
leaq 0x2e36(%rip), %rsi      # 0xf742
movq %r13, %rcx
xorl %eax, %eax
callq 0x32f0
jmp 0xca9e
movzbl 0xb(%r12), %edx
movq 0x10(%r12), %rcx
movq %rbp, %rdi
leaq 0x2e60(%rip), %rsi      # 0xf790
xorl %eax, %eax
callq 0x32f0
jmp 0xcaa1
leaq 0x8(%r14), %r12
movq 0x8(%r14), %rax
leaq (%r14,%rax,8), %rdx
addq $0x8, %rdx
subq (%rsp), %rdx
sarq $0x3, %rdx
movq %rbp, %rdi
leaq 0x2ded(%rip), %rsi      # 0xf74b
jmp 0xca97
leaq 0x8(%r14), %r12
movq 0x8(%r14), %rax
leaq (%r14,%rax,8), %rdx
addq $0x8, %rdx
subq (%rsp), %rdx
sarq $0x3, %rdx
movq %rbp, %rdi
leaq 0x2dfa(%rip), %rsi      # 0xf77f
jmp 0xca97
leaq 0x8(%r14), %r12
movq 0x8(%r14), %rax
leaq (%r14,%rax,8), %rdx
addq $0x8, %rdx
subq (%rsp), %rdx
sarq $0x3, %rdx
movq %rbp, %rdi
leaq 0x2dc3(%rip), %rsi      # 0xf76f
jmp 0xca97
leaq 0xb538(%rip), %rax      # 0x17ef0
movq (%rax,%r12,8), %rdx
movq 0x8(%r14), %r8
addq $0x8, %r14
movq %rbp, %rdi
leaq 0x2cbc(%rip), %rsi      # 0xf68a
movq %r12, %rcx
movq %r8, %r9
xorl %eax, %eax
callq 0x32f0
jmp 0xcaa1
movq 0x8(%r14), %r12
addq $0x8, %r14
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0xc61c
testl %eax, %eax
sete %al
cmpq $0xb4, %r12
setl %cl
orb %al, %cl
jne 0xcad2
movzbl 0xb(%r12), %edx
movq 0x10(%r12), %rcx
movq %rbp, %rdi
leaq 0x2cc1(%rip), %rsi      # 0xf6e2
movq %r12, %r8
xorl %eax, %eax
callq 0x32f0
jmp 0xcaa1
leaq 0x10(%r14), %r12
movq 0x8(%r14), %rcx
movq 0x10(%r14), %rdx
movq %rbp, %rdi
leaq 0x2cc8(%rip), %rsi      # 0xf70b
movq %rdx, %r8
movq %rcx, %r9
xorl %eax, %eax
callq 0x32f0
jmp 0xca9e
movq 0x8(%r14), %rdx
addq $0x8, %r14
subq (%rsp), %rdx
sarq $0x3, %rdx
movq %rbp, %rdi
leaq 0x2cf4(%rip), %rsi      # 0xf760
xorl %eax, %eax
callq 0x32f0
jmp 0xcaa1
leaq 0x8(%r14), %r12
movq 0x8(%r14), %rax
leaq (%r14,%rax,8), %rdx
addq $0x8, %rdx
subq (%rsp), %rdx
sarq $0x3, %rdx
movq %rbp, %rdi
leaq 0x2ce7(%rip), %rsi      # 0xf77e
xorl %eax, %eax
callq 0x32f0
movq %r12, %r14
movq %rbx, %rdi
movq %r15, %rsi
callq 0xb894
movq %rbx, %rdi
leaq 0x18b3(%rip), %rsi      # 0xe369
callq 0xb894
movq 0x8(%r14), %r12
addq $0x8, %r14
cmpq $0x2b, %r12
jne 0xc76a
jmp 0xc739
movq %rbp, %rdi
leaq 0x2c1c(%rip), %rsi      # 0xf6f8
movq %r12, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x32f0
jmp 0xcaa1