// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/crossassemblers/macro11/extree.c
// Function: print_tree
void print_tree(
    FILE *printfile,
    EX_TREE *tp,
    int depth)
{
    SYMBOL         *sym;

    if (tp == NULL) {
        fprintf(printfile, "(null)");
        return;
    }

    switch (tp->type) {
    case EX_LIT:
        fprintf(printfile, "%o", tp->data.lit & 0177777);
        break;

    case EX_SYM:
    case EX_TEMP_SYM:
        sym = tp->data.symbol;
        fprintf(printfile, "%s{%s%o:%s}", tp->data.symbol->label, symflags(sym), sym->value,
                sym->section->label);
        break;

    case EX_UNDEFINED_SYM:
        fprintf(printfile, "%s{%o:undefined}", tp->data.symbol->label, tp->data.symbol->value);
        break;

    case EX_COM:
        fprintf(printfile, "^C<");
        print_tree(printfile, tp->data.child.left, depth + 4);
        fprintf(printfile, ">");
        break;

    case EX_NEG:
        fprintf(printfile, "-<");
        print_tree(printfile, tp->data.child.left, depth + 4);
        fputc('>', printfile);
        break;

    case EX_ERR:
        fprintf(printfile, "{expression error}");
        if (tp->data.child.left) {
            fputc('<', printfile);
            print_tree(printfile, tp->data.child.left, depth + 4);
            fputc('>', printfile);
        }
        break;

    case EX_ADD:
        fputc('<', printfile);
        print_tree(printfile, tp->data.child.left, depth + 4);
        fputc('+', printfile);
        print_tree(printfile, tp->data.child.right, depth + 4);
        fputc('>', printfile);
        break;

    case EX_SUB:
        fputc('<', printfile);
        print_tree(printfile, tp->data.child.left, depth + 4);
        fputc('-', printfile);
        print_tree(printfile, tp->data.child.right, depth + 4);
        fputc('>', printfile);
        break;

    case EX_MUL:
        fputc('<', printfile);
        print_tree(printfile, tp->data.child.left, depth + 4);
        fputc('*', printfile);
        print_tree(printfile, tp->data.child.right, depth + 4);
        fputc('>', printfile);
        break;

    case EX_DIV:
        fputc('<', printfile);
        print_tree(printfile, tp->data.child.left, depth + 4);
        fputc('/', printfile);
        print_tree(printfile, tp->data.child.right, depth + 4);
        fputc('>', printfile);
        break;

    case EX_AND:
        fputc('<', printfile);
        print_tree(printfile, tp->data.child.left, depth + 4);
        fputc('&', printfile);
        print_tree(printfile, tp->data.child.right, depth + 4);
        fputc('>', printfile);
        break;

    case EX_OR:
        fputc('<', printfile);
        print_tree(printfile, tp->data.child.left, depth + 4);
        fputc('!', printfile);
        print_tree(printfile, tp->data.child.right, depth + 4);
        fputc('>', printfile);
        break;
    }

    if (depth == 0)
        fputc('\n', printfile);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
testq %rsi, %rsi
je 0x6b7d
movl %edx, %r14d
movq %rsi, %r15
movl (%rsi), %eax
decl %eax
cmpl $0xc, %eax
ja 0x6d54
leaq 0x97a6(%rip), %rcx      # 0x102e4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x10(%r15), %r15
movq (%r15), %r12
movq %r15, %rdi
callq 0x9d76
movl 0x8(%r15), %r8d
movq 0x18(%r15), %rcx
movq (%rcx), %r9
leaq 0x988e(%rip), %rsi      # 0x103f6
movq %rbx, %rdi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x21e0
jmp 0x6d54
leaq 0x9868(%rip), %rdi      # 0x103ec
movl $0x6, %esi
movl $0x1, %edx
movq %rbx, %rcx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x22d0
movl $0x3c, %edi
movq %rbx, %rsi
callq 0x2170
movq 0x10(%r15), %rsi
leal 0x4(%r14), %ebp
movq %rbx, %rdi
movl %ebp, %edx
callq 0x6b14
movl $0x26, %edi
jmp 0x6d31
leaq 0x9845(%rip), %rdi      # 0x10413
movl $0x3, %esi
jmp 0x6c9a
movl $0x3c, %edi
movq %rbx, %rsi
callq 0x2170
movq 0x10(%r15), %rsi
leal 0x4(%r14), %ebp
movq %rbx, %rdi
movl %ebp, %edx
callq 0x6b14
movl $0x21, %edi
jmp 0x6d31
movl $0x3c, %edi
movq %rbx, %rsi
callq 0x2170
movq 0x10(%r15), %rsi
leal 0x4(%r14), %ebp
movq %rbx, %rdi
movl %ebp, %edx
callq 0x6b14
movl $0x2a, %edi
jmp 0x6d31
movzwl 0x10(%r15), %edx
leaq 0x97bd(%rip), %rsi      # 0x103f3
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21e0
jmp 0x6d54
movq 0x10(%r15), %rax
movq (%rax), %rdx
movl 0x8(%rax), %ecx
leaq 0x97ac(%rip), %rsi      # 0x10402
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21e0
jmp 0x6d54
movl $0x3c, %edi
movq %rbx, %rsi
callq 0x2170
movq 0x10(%r15), %rsi
leal 0x4(%r14), %ebp
movq %rbx, %rdi
movl %ebp, %edx
callq 0x6b14
movl $0x2b, %edi
jmp 0x6d31
leaq 0x9782(%rip), %rdi      # 0x10417
movl $0x2, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x22d0
jmp 0x6cda
leaq 0x976a(%rip), %rdi      # 0x1041a
movl $0x12, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x22d0
cmpq $0x0, 0x10(%r15)
je 0x6d54
movl $0x3c, %edi
movq %rbx, %rsi
callq 0x2170
movq 0x10(%r15), %rsi
leal 0x4(%r14), %edx
movq %rbx, %rdi
jmp 0x6d42
movl $0x3c, %edi
movq %rbx, %rsi
callq 0x2170
movq 0x10(%r15), %rsi
leal 0x4(%r14), %ebp
movq %rbx, %rdi
movl %ebp, %edx
callq 0x6b14
movl $0x2f, %edi
jmp 0x6d31
movl $0x3c, %edi
movq %rbx, %rsi
callq 0x2170
movq 0x10(%r15), %rsi
leal 0x4(%r14), %ebp
movq %rbx, %rdi
movl %ebp, %edx
callq 0x6b14
movl $0x2d, %edi
movq %rbx, %rsi
callq 0x2170
movq 0x18(%r15), %rsi
movq %rbx, %rdi
movl %ebp, %edx
callq 0x6b14
movl $0x3e, %edi
movq %rbx, %rsi
callq 0x2170
testl %r14d, %r14d
je 0x6d62
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0xa, %edi
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2170