// File: /workspace/github_c_makefile_star2_O0/AK6DN[P]dec-utilities-for-pdp/d8tape/dasm.c
// Function: header
static void
header (void)
{
    struct  tm *tm;
    time_t  now;
    int     nused, ndata, ncode;
    int     i;

    time (&now);
    tm = localtime (&now);

    nused = ndata = ncode = 0;
    for (i = 0; i < CORE_SIZE; i++) {
        if (core [i] >= 0) {
            nused++;
            if (tags [i] & TAG_DATA) {
                ndata++;
            } else {
                ncode++;
            }
        }
    }

    printf ("TITLE \"AUTOMATIC DISASSEMBLY OF %s BY D8TAPE\"\n", tapename);
    printf ("////////////////////////////////////////////////////////////////////////////////\n");
    printf ("/\n");
    printf ("/\tAutomatic Disassembly of %s\n", tapename);
    printf ("/\tGenerated %04d %02d %02d %02d:%02d:%02d\n", tm -> tm_year + 1900, tm -> tm_mon + 1, tm -> tm_mday, tm -> tm_hour, tm -> tm_min, tm -> tm_sec);
    printf ("/\tGenerated by d8tape version %s\n", version);
    printf ("/\tVisit http://www.pdp12.org/pdp8/software/index.html for updates\n");
    printf ("/\n");
    printf ("/\tSymbol format:\n");
    printf ("/\t\tAIx   -- Auto-index variables (address range 001x)\n");
    printf ("/\t\tCaaaa -- Constants (non-unique)\n");
    printf ("/\t\tDaaaa -- Data (read/write variables)\n");
    printf ("/\t\tKvvvv -- Program-wide unique constants\n");
    printf ("/\t\tLaaaa -- Labels for control flow targets\n");
    printf ("/\t\tSaaaa -- Subroutines\n");
    printf ("/\n");
    printf ("/\tWhere:\n");
    printf ("/\t\taaaa is the definition address\n");
    printf ("/\t\tvvvv is the value of the constant\n");
    printf ("/\t\tx    is the last digit of the address 001x for auto-index variables\n");
    printf ("/\n");
    printf ("/\t%04o locations used, %04o code and %04o data\n", nused, ncode, ndata);
    printf ("////////////////////////////////////////////////////////////////////////////////\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
leaq -0x10(%rbp), %rdi
callq 0x3100
leaq -0x10(%rbp), %rdi
callq 0x3040
movq %rax, -0x8(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x20(%rbp)
cmpl $0x1000, -0x20(%rbp)    # imm = 0x1000
jge 0x61da
movslq -0x20(%rbp), %rcx
leaq 0x8dd2(%rip), %rax      # 0xef60
movswl (%rax,%rcx,2), %eax
cmpl $0x0, %eax
jl 0x61cd
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movslq -0x20(%rbp), %rcx
leaq 0xadb5(%rip), %rax      # 0x10f60
movzwl (%rax,%rcx,2), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x61c2
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x61cb
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x61cd
jmp 0x61cf
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x617a
leaq 0xcd8f(%rip), %rax      # 0x12f70
movq (%rax), %rsi
leaq 0x57fa(%rip), %rdi      # 0xb9e5
movb $0x0, %al
callq 0x30a0
leaq 0x53d9(%rip), %rdi      # 0xb5d2
movb $0x0, %al
callq 0x30a0
leaq 0x541a(%rip), %rdi      # 0xb621
movb $0x0, %al
callq 0x30a0
leaq 0xcd5b(%rip), %rax      # 0x12f70
movq (%rax), %rsi
leaq 0x57f5(%rip), %rdi      # 0xba14
movb $0x0, %al
callq 0x30a0
movq -0x8(%rbp), %rax
movl 0x14(%rax), %esi
addl $0x76c, %esi            # imm = 0x76C
movq -0x8(%rbp), %rax
movl 0x10(%rax), %edx
addl $0x1, %edx
movq -0x8(%rbp), %rax
movl 0xc(%rax), %ecx
movq -0x8(%rbp), %rax
movl 0x8(%rax), %r8d
movq -0x8(%rbp), %rax
movl 0x4(%rax), %r9d
movq -0x8(%rbp), %rax
movl (%rax), %eax
leaq 0x57d2(%rip), %rdi      # 0xba33
movl %eax, (%rsp)
movb $0x0, %al
callq 0x30a0
leaq 0x8cae(%rip), %rax      # 0xef20
movq (%rax), %rsi
leaq 0x57e2(%rip), %rdi      # 0xba5e
movb $0x0, %al
callq 0x30a0
leaq 0x57f6(%rip), %rdi      # 0xba80
movb $0x0, %al
callq 0x30a0
leaq 0x5389(%rip), %rdi      # 0xb621
movb $0x0, %al
callq 0x30a0
leaq 0x581d(%rip), %rdi      # 0xbac3
movb $0x0, %al
callq 0x30a0
leaq 0x5821(%rip), %rdi      # 0xbad5
movb $0x0, %al
callq 0x30a0
leaq 0x584a(%rip), %rdi      # 0xbb0c
movb $0x0, %al
callq 0x30a0
leaq 0x5860(%rip), %rdi      # 0xbb30
movb $0x0, %al
callq 0x30a0
leaq 0x587b(%rip), %rdi      # 0xbb59
movb $0x0, %al
callq 0x30a0
leaq 0x5898(%rip), %rdi      # 0xbb84
movb $0x0, %al
callq 0x30a0
leaq 0x58b7(%rip), %rdi      # 0xbbb1
movb $0x0, %al
callq 0x30a0
leaq 0x5319(%rip), %rdi      # 0xb621
movb $0x0, %al
callq 0x30a0
leaq 0x58b4(%rip), %rdi      # 0xbbca
movb $0x0, %al
callq 0x30a0
leaq 0x58b0(%rip), %rdi      # 0xbbd4
movb $0x0, %al
callq 0x30a0
leaq 0x58c5(%rip), %rdi      # 0xbbf7
movb $0x0, %al
callq 0x30a0
leaq 0x58dd(%rip), %rdi      # 0xbc1d
movb $0x0, %al
callq 0x30a0
leaq 0x52d3(%rip), %rdi      # 0xb621
movb $0x0, %al
callq 0x30a0
movl -0x14(%rbp), %esi
movl -0x1c(%rbp), %edx
movl -0x18(%rbp), %ecx
leaq 0x5900(%rip), %rdi      # 0xbc65
movb $0x0, %al
callq 0x30a0
leaq 0x525f(%rip), %rdi      # 0xb5d2
movb $0x0, %al
callq 0x30a0
addq $0x30, %rsp
popq %rbp
retq