// File: /workspace/github_c_makefile_star2_O0/simh[P]simtools/crossassemblers/macro11/dumpobj.c
// Function: main
int main(
    int argc,
    char *argv[])
{
    int             len;
    FILE           *fp;
    char           *cp;

    if (argc < 2) {
        fprintf(stderr, "Usage: dumpobj input.obj [ output.obj ]\n");
        exit(1);
    }

    fp = fopen(argv[1], "rb");
    if (fp == NULL)
        return EXIT_FAILURE;
    if (argc > 2 && argv[2]) {
        bin = fopen(argv[2], "wb");
        if (bin == NULL)
            return EXIT_FAILURE;
    }

    while ((cp = readrec(fp, &len)) != NULL) {
        switch (cp[0] & 0xff) {
        case 1:
            got_gsd(cp, len);
            break;
        case 2:
            got_endgsd(cp, len);
            break;
        case 3:
            got_text(cp, len);
            break;
        case 4:
            got_rld(cp, len);
            break;
        case 5:
            got_isd(cp, len);
            break;
        case 6:
            got_endmod(cp, len);
            break;
        case 7:
            got_libhdr(cp, len);
            break;
        case 8:
            got_libend(cp, len);
            break;
        default:
            printf("Unknown record type %o\n", cp[0] & 0xff);
            break;
        }

        free(cp);
    }

    if (bin) {
        dump_bin(xferad, NULL, 0);
        fclose(bin);
        if (badbin)
            fprintf(stderr, "Probable errors in binary file\n");
    }

    fclose(fp);
    return EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x2, -0x8(%rbp)
jge 0x2a6e
movq 0x25a5(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0xb35(%rip), %rsi       # 0x3592
movb $0x0, %al
callq 0x1110
movl $0x1, %edi
callq 0x1160
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xb3e(%rip), %rsi       # 0x35bb
callq 0x1140
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x2a99
movl $0x1, -0x4(%rbp)
jmp 0x2c19
cmpl $0x2, -0x8(%rbp)
jle 0x2add
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x2add
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0xb05(%rip), %rsi       # 0x35be
callq 0x1140
movq %rax, 0x2673(%rip)      # 0x5138
cmpq $0x0, 0x266b(%rip)      # 0x5138
jne 0x2adb
movl $0x1, -0x4(%rbp)
jmp 0x2c19
jmp 0x2add
jmp 0x2adf
movq -0x20(%rbp), %rdi
leaq -0x14(%rbp), %rsi
callq 0x12a0
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0x2bbf
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x30(%rbp)
subl $0x7, %eax
ja 0x2b96
movq -0x30(%rbp), %rax
leaq 0x58b(%rip), %rcx       # 0x30a8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x28(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x1aa0
jmp 0x2bb1
movq -0x28(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x1f10
jmp 0x2bb1
movq -0x28(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x1ff0
jmp 0x2bb1
movq -0x28(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x2110
jmp 0x2bb1
movq -0x28(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x2970
jmp 0x2bb1
movq -0x28(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x29a0
jmp 0x2bb1
movq -0x28(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x29d0
jmp 0x2bb1
movq -0x28(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x2a00
jmp 0x2bb1
movq -0x28(%rbp), %rax
movsbl (%rax), %esi
andl $0xff, %esi
leaq 0xa17(%rip), %rdi       # 0x35c1
movb $0x0, %al
callq 0x10b0
movq -0x28(%rbp), %rdi
callq 0x1030
jmp 0x2adf
cmpq $0x0, 0x2571(%rip)      # 0x5138
je 0x2c09
movl 0x2511(%rip), %edi      # 0x50e0
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x1790
movq 0x2557(%rip), %rdi      # 0x5138
callq 0x1080
cmpl $0x0, 0x2553(%rip)      # 0x5140
je 0x2c07
movq 0x2402(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0x9d9(%rip), %rsi       # 0x35d9
movb $0x0, %al
callq 0x1110
jmp 0x2c09
movq -0x20(%rbp), %rdi
callq 0x1080
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)