// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x540, %rsp            # imm = 0x540
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x530(%rbp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x1080
cmpl $0x2, -0x8(%rbp)
jl 0x120c
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x1221
leaq 0xdf1(%rip), %rdi       # 0x2004
movb $0x0, %al
callq 0x1060
xorl %edi, %edi
callq 0x10b0
movl $0x1, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x13c3
leaq -0x130(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x1030
leaq -0x130(%rbp), %rdi
movl $0x2e, %esi
callq 0x1070
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0x1279
movq -0x28(%rbp), %rdi
leaq 0xdb1(%rip), %rsi       # 0x2023
callq 0x1030
jmp 0x128c
leaq -0x130(%rbp), %rdi
leaq 0xd9c(%rip), %rsi       # 0x2023
callq 0x10a0
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xd89(%rip), %rsi       # 0x2028
callq 0x1090
movq %rax, -0x538(%rbp)
cmpq $0x0, -0x538(%rbp)
jne 0x12d6
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0xd62(%rip), %rdi       # 0x202a
movb $0x0, %al
callq 0x1060
xorl %edi, %edi
callq 0x10b0
leaq -0x130(%rbp), %rdi
leaq 0xd5e(%rip), %rsi       # 0x2042
callq 0x1090
movq %rax, -0x540(%rbp)
cmpq $0x0, -0x540(%rbp)
jne 0x1316
leaq -0x130(%rbp), %rsi
leaq 0xd22(%rip), %rdi       # 0x202a
movb $0x0, %al
callq 0x1060
xorl %edi, %edi
callq 0x10b0
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0xd1c(%rip), %rdi       # 0x2045
movb $0x0, %al
callq 0x1060
leaq -0x530(%rbp), %rdi
movq -0x540(%rbp), %rcx
movl $0x4, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x10c0
movl $0x0, -0x18(%rbp)
movq -0x538(%rbp), %rdi
leaq 0xcf7(%rip), %rsi       # 0x2059
leaq -0x20(%rbp), %rdx
movb $0x0, %al
callq 0x1040
movl %eax, -0x1c(%rbp)
cmpl $-0x1, -0x1c(%rbp)
jne 0x1378
jmp 0x139d
movq -0x540(%rbp), %rcx
leaq -0x20(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x10c0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x1354
movq -0x538(%rbp), %rdi
callq 0x1050
movq -0x540(%rbp), %rdi
callq 0x1050
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1228
xorl %eax, %eax
addq $0x540, %rsp            # imm = 0x540
popq %rbp
retq