// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/converters/decsys/decsys.c
// Function: main
int main (int argc, char *argv[])
{
int i, j, k, word;
char *ppos, oname[256];
int fill[256] = { 0 };
FILE *ifile, *ofile;

if ((argc < 2) || (argv[0] == NULL)) {
	printf ("Usage is: verb file [file...]\n");
	exit (0);  }

for (i = 1; i < argc; i++) {
	strcpy (oname, argv[i]);
        if (ppos = strrchr (oname, '.')) strcpy (ppos, ".dtp");
        else strcat (oname, ".dtp");
	ifile = fopen (argv[i], "r");
	if (ifile == NULL) {
	    printf ("Error opening file: %s\n", argv[i]);
	    exit (0);  }
	ofile = fopen (oname, "wb");
	if (ofile == NULL) {
	    printf ("Error opening file: %s\n", oname);
	    exit (0);  }

	printf ("Processing file %s\n", argv[i]);
	fwrite (fill, sizeof (int), 256, ofile);
	for (j = 0;; j++) {
	    k = fscanf (ifile, "%d", &word);
	    if (k == EOF) break;
//	    printf ("%06o\n", word);
	    fwrite (&word, sizeof (int), 1, ofile);
	    }
	fclose (ifile);
	fclose (ofile);
	}

return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x528, %rsp            # imm = 0x528
movq %rsi, %r14
movl %edi, %ebx
leaq 0x120(%rsp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x10a0
cmpl $0x2, %ebx
jl 0x1395
movq %r14, %rcx
cmpq $0x0, (%r14)
je 0x1395
movl %ebx, %eax
movq %rax, 0x10(%rsp)
pushq $0x1
popq %r14
leaq 0x20(%rsp), %r15
pushq $0x4
popq %r13
leaq 0xe03(%rip), %rbp       # 0x203a
leaq 0x1c(%rsp), %r12
movq %r14, %rax
movq %rcx, (%rsp)
cmpq 0x10(%rsp), %rax
je 0x1351
movq (%rcx,%rax,8), %rbx
movq %r15, %rdi
movq %rbx, %rsi
movq %rax, 0x8(%rsp)
callq 0x1030
movq %r15, %rdi
pushq $0x2e
popq %rsi
callq 0x1090
testq %rax, %rax
je 0x128b
movb $0x0, 0x4(%rax)
movl $0x7074642e, (%rax)     # imm = 0x7074642E
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %rbx
jmp 0x12a0
movq %r15, %rdi
callq 0x1070
movl $0x7074642e, 0x20(%rsp,%rax) # imm = 0x7074642E
movb $0x0, 0x24(%rsp,%rax)
movq %rbx, %rdi
leaq 0xd5f(%rip), %rsi       # 0x2009
callq 0x10b0
testq %rax, %rax
je 0x1365
movq %rax, %r15
leaq 0x20(%rsp), %rdi
leaq 0xd5c(%rip), %rsi       # 0x2023
callq 0x10b0
testq %rax, %rax
je 0x137b
movq %rax, %rbx
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0xd3a(%rip), %rdi       # 0x2026
xorl %eax, %eax
callq 0x1080
movl $0x100, %edx            # imm = 0x100
leaq 0x120(%rsp), %rdi
movq %r13, %rsi
movq %rbx, %rcx
callq 0x10d0
movq %r15, %rdi
movq %rbp, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x1040
cmpl $-0x1, %eax
je 0x132b
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
jmp 0x1303
movq %r15, %rdi
callq 0x1060
movq %rbx, %rdi
callq 0x1060
movq 0x8(%rsp), %rax
incq %rax
movq (%rsp), %rcx
leaq 0x20(%rsp), %r15
jmp 0x1243
xorl %eax, %eax
addq $0x528, %rsp            # imm = 0x528
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0xc92(%rip), %rdi       # 0x200b
jmp 0x1387
leaq 0xc89(%rip), %rdi       # 0x200b
leaq 0x20(%rsp), %rsi
xorl %eax, %eax
callq 0x1080
xorl %edi, %edi
callq 0x10c0
leaq 0xca1(%rip), %rdi       # 0x203d
callq 0x1050
jmp 0x138e