// File: /workspace/github_c_makefile_star2_O0/simh[P]simtools/converters/dtos8cvt/dtos8cvt.c
// Function: main
int main (int argc, char *argv[])
{
int i, k;
unsigned short buf[BLKSIZ];
char *ppos, oname[256];
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, ".dt8");
                else strcat (oname, ".dt8");
	ifile = fopen (argv[i], "rb");
	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]);
	for (;;) {
		k = fread (buf, sizeof (short), BLKSIZ - 1, ifile);
		if (k == 0) break;
		for ( ; k < BLKSIZ; k++) buf[k] = 0;
		fwrite (buf, sizeof (short), BLKSIZ, ofile);
		}
	fclose (ifile);
	fclose (ofile);
	}

return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x240, %rsp            # imm = 0x240
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x2, -0x8(%rbp)
jl 0x11e9
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x11fe
leaq 0xe14(%rip), %rdi       # 0x2004
movb $0x0, %al
callq 0x1060
xorl %edi, %edi
callq 0x10a0
movl $0x1, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x13a4
leaq -0x230(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x1030
leaq -0x230(%rbp), %rdi
movl $0x2e, %esi
callq 0x1070
movq %rax, -0x128(%rbp)
cmpq $0x0, %rax
je 0x125c
movq -0x128(%rbp), %rdi
leaq 0xdce(%rip), %rsi       # 0x2023
callq 0x1030
jmp 0x126f
leaq -0x230(%rbp), %rdi
leaq 0xdb9(%rip), %rsi       # 0x2023
callq 0x1090
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xda6(%rip), %rsi       # 0x2028
callq 0x1080
movq %rax, -0x238(%rbp)
cmpq $0x0, -0x238(%rbp)
jne 0x12b9
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0xd80(%rip), %rdi       # 0x202b
movb $0x0, %al
callq 0x1060
xorl %edi, %edi
callq 0x10a0
leaq -0x230(%rbp), %rdi
leaq 0xd7c(%rip), %rsi       # 0x2043
callq 0x1080
movq %rax, -0x240(%rbp)
cmpq $0x0, -0x240(%rbp)
jne 0x12f9
leaq -0x230(%rbp), %rsi
leaq 0xd40(%rip), %rdi       # 0x202b
movb $0x0, %al
callq 0x1060
xorl %edi, %edi
callq 0x10a0
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0xd3a(%rip), %rdi       # 0x2046
movb $0x0, %al
callq 0x1060
leaq -0x120(%rbp), %rdi
movq -0x238(%rbp), %rcx
movl $0x2, %esi
movl $0x80, %edx
callq 0x1040
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x133b
jmp 0x137e
jmp 0x133d
cmpl $0x81, -0x18(%rbp)
jge 0x135f
movslq -0x18(%rbp), %rax
movw $0x0, -0x120(%rbp,%rax,2)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x133d
leaq -0x120(%rbp), %rdi
movq -0x240(%rbp), %rcx
movl $0x2, %esi
movl $0x81, %edx
callq 0x10b0
jmp 0x1313
movq -0x238(%rbp), %rdi
callq 0x1050
movq -0x240(%rbp), %rdi
callq 0x1050
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1205
xorl %eax, %eax
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq