// File: /workspace/github_c_makefile_star2_O0/simh[P]simtools/converters/strrem/strrem.c
// Function: main
int main (int argc, char *argv[])
{
int i, slen;
char *ppos, *fpos, *tpos, oname[256], line[256];
FILE *ifile, *ofile;

if ((argc < 2) || (argv[0] == NULL)) {
	printf ("Usage is: strrem file [file...]\n");
	exit (0);  }

slen = strlen (srem);
for (i = 1; i < argc; i++) {
	strcpy (oname, argv[i]);
        if (ppos = strrchr (oname, '.')) strcpy (ppos, ".new");
            else strcat (oname, ".new");
	ifile = fopen (argv[i], "r");
	if (ifile == NULL) {
	    printf ("Error opening file: %s\n", argv[i]);
	    exit (0);  }
	ofile = fopen (oname, "w");
	if (ofile == NULL) {
	    printf ("Error opening file: %s\n", oname);
	    exit (0);  }

	printf ("Processing file %s\n", argv[i]);
	while (fgets (line, 255, ifile) != NULL) {
	    tpos = strstr (line, srem);
	    if (tpos) {
		    fpos = tpos + slen;
		    while (*fpos) *tpos++ = *fpos++;
            *tpos = 0;
		    }
	    fputs (line, 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 0x1209
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x121e
leaq 0xdfd(%rip), %rdi       # 0x200d
movb $0x0, %al
callq 0x1060
xorl %edi, %edi
callq 0x10c0
movq 0x2e5b(%rip), %rdi      # 0x4080
callq 0x1050
movl %eax, -0x18(%rbp)
movl $0x1, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x13f9
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, -0x20(%rbp)
cmpq $0x0, %rax
je 0x1285
movq -0x20(%rbp), %rdi
leaq 0xdb0(%rip), %rsi       # 0x202e
callq 0x1030
jmp 0x1298
leaq -0x130(%rbp), %rdi
leaq 0xd9b(%rip), %rsi       # 0x202e
callq 0x10b0
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xd88(%rip), %rsi       # 0x2033
callq 0x10a0
movq %rax, -0x238(%rbp)
cmpq $0x0, -0x238(%rbp)
jne 0x12e2
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0xd61(%rip), %rdi       # 0x2035
movb $0x0, %al
callq 0x1060
xorl %edi, %edi
callq 0x10c0
leaq -0x130(%rbp), %rdi
leaq 0xd41(%rip), %rsi       # 0x2031
callq 0x10a0
movq %rax, -0x240(%rbp)
cmpq $0x0, -0x240(%rbp)
jne 0x1322
leaq -0x130(%rbp), %rsi
leaq 0xd21(%rip), %rdi       # 0x2035
movb $0x0, %al
callq 0x1060
xorl %edi, %edi
callq 0x10c0
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0xd18(%rip), %rdi       # 0x204d
movb $0x0, %al
callq 0x1060
leaq -0x230(%rbp), %rdi
movq -0x238(%rbp), %rdx
movl $0xff, %esi
callq 0x1090
cmpq $0x0, %rax
je 0x13d3
leaq -0x230(%rbp), %rdi
movq 0x2d18(%rip), %rsi      # 0x4080
callq 0x10d0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x13bb
movq -0x30(%rbp), %rax
movslq -0x18(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpb $0x0, (%rax)
je 0x13b4
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb (%rax), %cl
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb %cl, (%rax)
jmp 0x1387
movq -0x30(%rbp), %rax
movb $0x0, (%rax)
leaq -0x230(%rbp), %rdi
movq -0x240(%rbp), %rsi
callq 0x1080
jmp 0x133c
movq -0x238(%rbp), %rdi
callq 0x1040
movq -0x240(%rbp), %rdi
callq 0x1040
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1234
xorl %eax, %eax
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq