// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x1, %edi
jle 0x2325
movq %rsi, %r14
movl %edi, %r15d
movq 0x8(%rsi), %rdi
leaq 0x13c7(%rip), %rsi      # 0x358e
callq 0x1150
movl $0x1, %ebp
testq %rax, %rax
je 0x230d
movq %rax, %rbx
cmpl $0x2, %r15d
je 0x2208
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0x2208
leaq 0x139e(%rip), %rsi      # 0x3591
callq 0x1150
movq %rax, 0x2f49(%rip)      # 0x5148
testq %rax, %rax
je 0x230d
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq 0x13bc
testq %rax, %rax
je 0x22d5
movq %rax, %r12
leaq 0x4(%rsp), %r15
leaq 0xe7b(%rip), %rbp       # 0x30a8
leaq 0x13af(%rip), %r14      # 0x35e3
leaq 0x13af(%rip), %r13      # 0x35ea
movzbl (%r12), %esi
leal -0x1(%rsi), %eax
cmpl $0x7, %eax
ja 0x22a8
movslq (%rbp,%rax,4), %rax
addq %rbp, %rax
jmpq *%rax
movl 0x4(%rsp), %esi
movq %r12, %rdi
callq 0x186a
jmp 0x22b6
movl 0x4(%rsp), %esi
leaq 0x12ee(%rip), %rdi      # 0x3559
jmp 0x22af
movl 0x4(%rsp), %esi
movq %r12, %rdi
callq 0x1c52
jmp 0x22b6
movl 0x4(%rsp), %esi
movq %r12, %rdi
callq 0x1d01
jmp 0x22b6
movq %r13, %rdi
jmp 0x22a1
callq 0x1b9d
jmp 0x22b6
leaq 0x1340(%rip), %rdi      # 0x35dc
jmp 0x22a1
movq %r14, %rdi
callq 0x1060
jmp 0x22b6
leaq 0x12e5(%rip), %rdi      # 0x3594
xorl %eax, %eax
callq 0x10c0
movq %r12, %rdi
callq 0x1040
movq %rbx, %rdi
movq %r15, %rsi
callq 0x13bc
movq %rax, %r12
testq %rax, %rax
jne 0x223b
cmpq $0x0, 0x2e6b(%rip)      # 0x5148
je 0x2303
movl 0x2e0b(%rip), %edi      # 0x50f0
xorl %esi, %esi
xorl %edx, %edx
callq 0x1697
movq 0x2e53(%rip), %rdi      # 0x5148
callq 0x1090
cmpl $0x0, 0x2e4f(%rip)      # 0x5150
jne 0x231e
movq %rbx, %rdi
callq 0x1090
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1288
jmp 0x2303
callq 0x12a4
nop