#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ str;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
scalar_t__ isdigit(char);
scalar_t__ isspace(char);
int /*<<< orphan*/ perror(char *);
scalar_t__ remove(char *);
scalar_t__ rename(char *, char *);
int main(int argc, char **argv) {
  FILE *in, *out;
  char str[1024];
  if (argc < 2) {
    perror("No input file(s).");
    return 1;
  }
  char *p;
  char tmpfile[] = "tmp.tmp";
  int i;
  for (i = 1; i < argc; i++) {
    if ((in = fopen(argv[i], "r")) == NULL) {
      perror(argv[i]);
      continue;
    }
    if ((out = fopen(tmpfile, "w")) == NULL) {
      perror(tmpfile);
      continue;
    }
    while (fgets(str, sizeof(str), in) != NULL) {
      p = str;
      while (isspace(*p)) {
        p++;
      }
      while (isdigit(*p)) {
        p++;
      }
      if (*p == '.') {
        p++;
      }
      fputs(p, out);
    }
    fclose(in);
    fclose(out);
    if (remove(argv[i]) != 0) {
      perror("remove");
    }
    if (rename(tmpfile, argv[i]) != 0) {
      perror("rename");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11cb <main+0x3b>
lea    0xe46(%rip),%rdi
call   10a0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    13c4 <main+0x234>
mov    0xe40(%rip),%rax
mov    %rax,-0x430(%rbp)
movl   $0x1,-0x434(%rbp)
mov    -0x434(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    13bd <main+0x22d>
mov    -0x10(%rbp),%rax
movslq -0x434(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe12(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1234 <main+0xa4>
mov    -0x10(%rbp),%rax
movslq -0x434(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10a0 <perror@plt>
jmp    13a9 <main+0x219>
lea    -0x430(%rbp),%rdi
lea    0xdda(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1266 <main+0xd6>
lea    -0x430(%rbp),%rdi
call   10a0 <perror@plt>
jmp    13a9 <main+0x219>
jmp    126b <main+0xdb>
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x400,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     1337 <main+0x1a7>
lea    -0x420(%rbp),%rax
mov    %rax,-0x428(%rbp)
mov    -0x428(%rbp),%rax
movsbl (%rax),%edi
call   1070 <isspace@plt>
cmp    $0x0,%rax
je     12c8 <main+0x138>
mov    -0x428(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x428(%rbp)
jmp    1298 <main+0x108>
jmp    12cd <main+0x13d>
mov    -0x428(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%rax
je     12fd <main+0x16d>
mov    -0x428(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x428(%rbp)
jmp    12cd <main+0x13d>
mov    -0x428(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    1322 <main+0x192>
mov    -0x428(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x428(%rbp)
mov    -0x428(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <fputs@plt>
jmp    126b <main+0xdb>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x10(%rbp),%rax
movslq -0x434(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <remove@plt>
cmp    $0x0,%rax
je     1373 <main+0x1e3>
lea    0xcb0(%rip),%rdi
call   10a0 <perror@plt>
lea    -0x430(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x434(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   10b0 <rename@plt>
cmp    $0x0,%rax
je     13a4 <main+0x214>
lea    0xc86(%rip),%rdi
call   10a0 <perror@plt>
jmp    13a9 <main+0x219>
mov    -0x434(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x434(%rbp)
jmp    11e3 <main+0x53>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
cmp    $0x1,%edi
jle    130e <main+0x17e>
mov    %rsi,%r13
movabs $0x706d742e706d74,%rax
mov    %rax,(%rsp)
mov    %edi,%eax
mov    %rax,0x8(%rsp)
mov    $0x1,%r12d
mov    %rsp,%r14
lea    0x10(%rsp),%rbx
jmp    11ef <main+0x5f>
mov    0x0(%r13,%r12,8),%rdi
call   10a0 <perror@plt>
nopl   0x0(%rax)
add    $0x1,%r12
cmp    0x8(%rsp),%r12
je     12fa <main+0x16a>
mov    0x0(%r13,%r12,8),%rdi
lea    0xe17(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     11d2 <main+0x42>
mov    %rax,%rbp
mov    %r14,%rdi
lea    0xe02(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     12e4 <main+0x154>
mov    %rax,%r15
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %rbp,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     12a0 <main+0x110>
mov    %rbx,%rcx
nopl   0x0(%rax,%rax,1)
mov    %rcx,%r14
movsbl (%rcx),%edi
call   1070 <isspace@plt>
lea    0x1(%r14),%rcx
test   %rax,%rax
jne    1240 <main+0xb0>
add    $0xffffffffffffffff,%r14
nopl   0x0(%rax,%rax,1)
movsbl 0x1(%r14),%edi
add    $0x1,%r14
call   1040 <isdigit@plt>
test   %rax,%rax
jne    1260 <main+0xd0>
xor    %edi,%edi
cmpb   $0x2e,(%r14)
sete   %dil
add    %r14,%rdi
mov    %r15,%rsi
call   1060 <fputs@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %rbp,%rdx
call   1080 <fgets@plt>
mov    %rbx,%rcx
test   %rax,%rax
jne    1240 <main+0xb0>
mov    %rbp,%rdi
call   1050 <fclose@plt>
mov    %r15,%rdi
call   1050 <fclose@plt>
mov    0x0(%r13,%r12,8),%rdi
call   1030 <remove@plt>
test   %rax,%rax
jne    12ec <main+0x15c>
mov    0x0(%r13,%r12,8),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   10b0 <rename@plt>
test   %rax,%rax
je     11e0 <main+0x50>
lea    0xd3e(%rip),%rdi
jmp    11d7 <main+0x47>
mov    %r14,%rdi
jmp    11d7 <main+0x47>
lea    0xd23(%rip),%rdi
call   10a0 <perror@plt>
jmp    12bf <main+0x12f>
xor    %eax,%eax
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xceb(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%eax
jmp    12fc <main+0x16c>

LLVM IR (-O0):
@.str = [18 x i8] c"No input file(s).\00"
@__const.main.tmpfile = [8 x i8] c"tmp.tmp\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [7 x i8] c"remove\00"
@.str.4 = [7 x i8] c"rename\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca [1024 x i8]
%9 = alloca i8*
%10 = alloca [8 x i8]
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 2
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %111
16: ; preds = %2
%17 = bitcast [8 x i8]* %10 to i8*
store i32 1, i32* %11
br label %18
18: ; preds = %107, %16
%19 = load i32, i32* %11
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %110
22: ; preds = %18
%23 = load i8**, i8*** %5
%24 = load i32, i32* %11
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
%28 = call i32* @fopen(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %28, i32** %6
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %37
30: ; preds = %22
%31 = load i8**, i8*** %5
%32 = load i32, i32* %11
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8*, i8** %31, i64 %33
%35 = load i8*, i8** %34
%36 = call i32 @perror(i8* %35)
br label %107
37: ; preds = %22
%38 = getelementptr inbounds [8 x i8], [8 x i8]* %10, i64 0, i64 0
%39 = call i32* @fopen(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %39, i32** %7
%40 = icmp eq i32* %39, null
br i1 %40, label %41, label %44
41: ; preds = %37
%42 = getelementptr inbounds [8 x i8], [8 x i8]* %10, i64 0, i64 0
%43 = call i32 @perror(i8* %42)
br label %107
44: ; preds = %37
br label %45
45: ; preds = %77, %44
%46 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%47 = load i32*, i32** %6
%48 = call i32* @fgets(i8* %46, i32 1024, i32* %47)
%49 = icmp ne i32* %48, null
br i1 %49, label %50, label %81
50: ; preds = %45
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
store i8* %51, i8** %9
br label %52
52: ; preds = %57, %50
%53 = load i8*, i8** %9
%54 = load i8, i8* %53
%55 = call i64 @isspace(i8 signext %54)
%56 = icmp ne i64 %55, 0
br i1 %56, label %57, label %60
57: ; preds = %52
%58 = load i8*, i8** %9
%59 = getelementptr inbounds i8, i8* %58, i32 1
store i8* %59, i8** %9
br label %52
60: ; preds = %52
br label %61
61: ; preds = %66, %60
%62 = load i8*, i8** %9
%63 = load i8, i8* %62
%64 = call i64 @isdigit(i8 signext %63)
%65 = icmp ne i64 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %61
%67 = load i8*, i8** %9
%68 = getelementptr inbounds i8, i8* %67, i32 1
store i8* %68, i8** %9
br label %61
69: ; preds = %61
%70 = load i8*, i8** %9
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = icmp eq i32 %72, 46
br i1 %73, label %74, label %77
74: ; preds = %69
%75 = load i8*, i8** %9
%76 = getelementptr inbounds i8, i8* %75, i32 1
store i8* %76, i8** %9
br label %77
77: ; preds = %74, %69
%78 = load i8*, i8** %9
%79 = load i32*, i32** %7
%80 = call i32 @fputs(i8* %78, i32* %79)
br label %45
81: ; preds = %45
%82 = load i32*, i32** %6
%83 = call i32 @fclose(i32* %82)
%84 = load i32*, i32** %7
%85 = call i32 @fclose(i32* %84)
%86 = load i8**, i8*** %5
%87 = load i32, i32* %11
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i8*, i8** %86, i64 %88
%90 = load i8*, i8** %89
%91 = call i64 @remove(i8* %90)
%92 = icmp ne i64 %91, 0
br i1 %92, label %93, label %95
93: ; preds = %81
%94 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %95
95: ; preds = %93, %81
%96 = getelementptr inbounds [8 x i8], [8 x i8]* %10, i64 0, i64 0
%97 = load i8**, i8*** %5
%98 = load i32, i32* %11
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i8*, i8** %97, i64 %99
%101 = load i8*, i8** %100
%102 = call i64 @rename(i8* %96, i8* %101)
%103 = icmp ne i64 %102, 0
br i1 %103, label %104, label %106
104: ; preds = %95
%105 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %106
106: ; preds = %104, %95
br label %107
107: ; preds = %106, %41, %30
%108 = load i32, i32* %11
%109 = add nsw i32 %108, 1
store i32 %109, i32* %11
br label %18
110: ; preds = %18
store i32 0, i32* %3
br label %111
111: ; preds = %110, %14
%112 = load i32, i32* %3
ret i32 %112
}

LLVM IR (-O2):
@.str = [18 x i8] c"No input file(s).\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [7 x i8] c"remove\00"
@.str.4 = [7 x i8] c"rename\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca i64
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = icmp slt i32 %0, 2
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %69
9: ; preds = %2
%10 = bitcast i64* %4 to i8*
store i64 31645543154347380, i64* %4
%11 = zext i32 %0 to i64
br label %12
12: ; preds = %9, %65
%13 = phi i64 [ 1, %9 ], [ %66, %65 ]
%14 = getelementptr inbounds i8*, i8** %1, i64 %13
%15 = load i8*, i8** %14
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %21
18: ; preds = %12
%19 = load i8*, i8** %14
%20 = call i32 @perror(i8* %19)
br label %65
21: ; preds = %12
%22 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp eq i32* %22, null
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = call i32* @fgets(i8* %5, i32 1024, i32* %16)
%26 = icmp eq i32* %25, null
br i1 %26, label %51, label %29
27: ; preds = %21
%28 = call i32 @perror(i8* %10)
br label %65
29: ; preds = %24, %35
%30 = phi i8* [ %36, %35 ], [ %5, %24 ]
%31 = load i8, i8* %30
%32 = call i64 @isspace(i8 signext %31)
%33 = icmp eq i64 %32, 0
%34 = getelementptr inbounds i8, i8* %30, i64 1
br i1 %33, label %37, label %35
35: ; preds = %29, %43
%36 = phi i8* [ %34, %29 ], [ %5, %43 ]
br label %29
37: ; preds = %29, %37
%38 = phi i8* [ %42, %37 ], [ %30, %29 ]
%39 = load i8, i8* %38
%40 = call i64 @isdigit(i8 signext %39)
%41 = icmp eq i64 %40, 0
%42 = getelementptr inbounds i8, i8* %38, i64 1
br i1 %41, label %43, label %37
43: ; preds = %37
%44 = load i8, i8* %38
%45 = icmp eq i8 %44, 46
%46 = zext i1 %45 to i64
%47 = getelementptr i8, i8* %38, i64 %46
%48 = call i32 @fputs(i8* %47, i32* %22)
%49 = call i32* @fgets(i8* %5, i32 1024, i32* %16)
%50 = icmp eq i32* %49, null
br i1 %50, label %51, label %35
51: ; preds = %43, %24
%52 = call i32 @fclose(i32* %16)
%53 = call i32 @fclose(i32* %22)
%54 = load i8*, i8** %14
%55 = call i64 @remove(i8* %54)
%56 = icmp eq i64 %55, 0
br i1 %56, label %59, label %57
57: ; preds = %51
%58 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %59
59: ; preds = %57, %51
%60 = load i8*, i8** %14
%61 = call i64 @rename(i8* %10, i8* %60)
%62 = icmp eq i64 %61, 0
br i1 %62, label %65, label %63
63: ; preds = %59
%64 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %65
65: ; preds = %59, %63, %27, %18
%66 = add nuw nsw i64 %13, 1
%67 = icmp eq i64 %66, %11
br i1 %67, label %68, label %12
68: ; preds = %65
br label %69
69: ; preds = %68, %7
%70 = phi i32 [ 1, %7 ], [ 0, %68 ]
ret i32 %70
}