// File: /workspace/github_c_makefile_star2_O3/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 0x237a
movq %rsi, %r14
movl %edi, %r15d
movq 0x8(%rsi), %rdi
leaq 0x1372(%rip), %rsi      # 0x358e
callq 0x1150
movl $0x1, %ebp
testq %rax, %rax
je 0x2362
movq %rax, %rbx
cmpl $0x2, %r15d
je 0x225d
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0x225d
leaq 0x1349(%rip), %rsi      # 0x3591
callq 0x1150
movq %rax, 0x2ef4(%rip)      # 0x5148
testq %rax, %rax
je 0x2362
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq 0x13bc
testq %rax, %rax
je 0x232a
movq %rax, %r12
leaq 0x4(%rsp), %r15
leaq 0xe26(%rip), %rbp       # 0x30a8
leaq 0x135a(%rip), %r14      # 0x35e3
leaq 0x135a(%rip), %r13      # 0x35ea
movzbl (%r12), %esi
leal -0x1(%rsi), %eax
cmpl $0x7, %eax
ja 0x22fd
movslq (%rbp,%rax,4), %rax
addq %rbp, %rax
jmpq *%rax
movl 0x4(%rsp), %esi
movq %r12, %rdi
callq 0x1866
jmp 0x230b
movl 0x4(%rsp), %esi
leaq 0x1299(%rip), %rdi      # 0x3559
jmp 0x2304
movl 0x4(%rsp), %esi
movq %r12, %rdi
callq 0x1c47
jmp 0x230b
movl 0x4(%rsp), %esi
movq %r12, %rdi
callq 0x1cf6
jmp 0x230b
movq %r13, %rdi
jmp 0x22f6
callq 0x1b92
jmp 0x230b
leaq 0x12eb(%rip), %rdi      # 0x35dc
jmp 0x22f6
movq %r14, %rdi
callq 0x1060
jmp 0x230b
leaq 0x1290(%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 0x2290
cmpq $0x0, 0x2e16(%rip)      # 0x5148
je 0x2358
movl 0x2db6(%rip), %edi      # 0x50f0
xorl %esi, %esi
xorl %edx, %edx
callq 0x168f
movq 0x2dfe(%rip), %rdi      # 0x5148
callq 0x1090
cmpl $0x0, 0x2dfa(%rip)      # 0x5150
jne 0x2373
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 0x2358
callq 0x12a4
nop