#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int getc(int /*<<< orphan*/ *);
int getchar();
scalar_t__ isatty(int /*<<< orphan*/);
int /*<<< orphan*/ putc(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ putchar(int);
scalar_t__ rename(char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ unlink(char *);
int main(int argc, char **argv) {
  int f, c;
  if (argc <= 1) {
    if (isatty(0)) {
      fprintf(stderr,
              "usage : %s <files>\nStrips ^M characters.\nCan do in-place "
              "conversion of many files or can be used in a pipe\n",
              argv[0]);
      return 1;
    }
    for (;;) {
      c = getchar();
      while (c == '\r') {
        c = getchar();
        if (c != '\n')
          putchar(c);
      }
      if (c < 0)
        break;
      putchar(c);
    }
    return 0;
  }
  for (f = 1; f < argc; f++) {
    char *fname = argv[f];
    char tempname[1024];
    FILE *in = fopen(fname, "rb");
    FILE *out;
    int mod = 0;
    if (!in) {
      fprintf(stderr, "%s : %s\n", fname, strerror(errno));
      return 1;
    }
    strcpy(tempname, fname);
    strcat(tempname, ".temp");
    out = fopen(tempname, "wb");
    if (!out) {
      fprintf(stderr, "%s : %s\n", fname, strerror(errno));
      return 1;
    }
    for (;;) {
      c = getc(in);
      while (c == '\r') {
        c = getc(in);
        if (c == '\n')
          mod = 1;
        else
          putc(c, out);
      }
      if (c < 0)
        break;
      putc(c, out);
    }
    fclose(in);
    fclose(out);
    if (!mod) {
      fprintf(stderr, "%s : no change\n", fname);
      unlink(tempname);
    } else if (rename(tempname, fname)) {
      fprintf(stderr, "Can't mv %s %s : %s\n", tempname, fname,
              strerror(errno));
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x470,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jg     1290 <main+0xc0>
xor    %edi,%edi
call   1060 <isatty@plt>
cmp    $0x0,%rax
je     122e <main+0x5e>
mov    0x2dd5(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xde5(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    153f <main+0x36f>
jmp    1233 <main+0x63>
mov    $0x0,%al
call   1090 <getchar@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xd,-0x18(%rbp)
jne    1268 <main+0x98>
mov    $0x0,%al
call   1090 <getchar@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xa,-0x18(%rbp)
je     1263 <main+0x93>
mov    -0x18(%rbp),%edi
call   1030 <putchar@plt>
jmp    123d <main+0x6d>
cmpl   $0x0,-0x18(%rbp)
jge    1277 <main+0xa7>
jmp    1284 <main+0xb4>
mov    -0x18(%rbp),%edi
call   1030 <putchar@plt>
jmp    1233 <main+0x63>
movl   $0x0,-0x4(%rbp)
jmp    153f <main+0x36f>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1538 <main+0x368>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xdae(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x428(%rbp)
movl   $0x0,-0x434(%rbp)
cmpq   $0x0,-0x428(%rbp)
jne    1334 <main+0x164>
mov    0x2cf7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x444(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x440(%rbp)
mov    0x2cd5(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x444(%rbp),%edi
mov    -0x440(%rbp),%rdx
mov    %rax,%rcx
lea    0xd73(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    153f <main+0x36f>
lea    -0x420(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <strcpy@plt>
lea    -0x420(%rbp),%rdi
lea    0xd1d(%rip),%rsi
call   10d0 <strcat@plt>
lea    -0x420(%rbp),%rdi
lea    0xd10(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x430(%rbp)
cmpq   $0x0,-0x430(%rbp)
jne    13d1 <main+0x201>
mov    0x2c5a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x454(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x450(%rbp)
mov    0x2c38(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x454(%rbp),%edi
mov    -0x450(%rbp),%rdx
mov    %rax,%rcx
lea    0xcd6(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    153f <main+0x36f>
jmp    13d6 <main+0x206>
mov    -0x428(%rbp),%rdi
call   10f0 <getc@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xd,-0x18(%rbp)
jne    142b <main+0x25b>
mov    -0x428(%rbp),%rdi
call   10f0 <getc@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xa,-0x18(%rbp)
jne    1417 <main+0x247>
movl   $0x1,-0x434(%rbp)
jmp    1426 <main+0x256>
mov    -0x18(%rbp),%edi
mov    -0x430(%rbp),%rsi
call   1080 <putc@plt>
jmp    13e5 <main+0x215>
cmpl   $0x0,-0x18(%rbp)
jge    143a <main+0x26a>
jmp    144e <main+0x27e>
mov    -0x18(%rbp),%edi
mov    -0x430(%rbp),%rsi
call   1080 <putc@plt>
jmp    13d6 <main+0x206>
mov    -0x428(%rbp),%rdi
call   1070 <fclose@plt>
mov    -0x430(%rbp),%rdi
call   1070 <fclose@plt>
cmpl   $0x0,-0x434(%rbp)
jne    149f <main+0x2cf>
mov    0x2b66(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xbf1(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
lea    -0x420(%rbp),%rdi
call   1040 <unlink@plt>
jmp    1525 <main+0x355>
lea    -0x420(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10c0 <rename@plt>
cmp    $0x0,%rax
je     1520 <main+0x350>
mov    0x2b20(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x46c(%rbp)
lea    -0x420(%rbp),%rax
mov    %rax,-0x468(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x460(%rbp)
mov    0x2af0(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x46c(%rbp),%edi
mov    -0x468(%rbp),%rdx
mov    -0x460(%rbp),%rcx
mov    %rax,%r8
lea    0xb7b(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    153f <main+0x36f>
jmp    1525 <main+0x355>
jmp    152a <main+0x35a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1297 <main+0xc7>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x470,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
mov    %rsi,0x8(%rsp)
cmp    $0x2,%edi
jge    1267 <main+0x97>
xor    %edi,%edi
call   1060 <isatty@plt>
test   %rax,%rax
je     122f <main+0x5f>
mov    0x2de2(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rax
mov    (%rax),%rdx
lea    0xdf1(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
jmp    1417 <main+0x247>
nopl   0x0(%rax,%rax,1)
test   %ebx,%ebx
js     13e6 <main+0x216>
mov    %ebx,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1090 <getchar@plt>
mov    %eax,%ebx
cmp    $0xd,%eax
jne    1220 <main+0x50>
nopl   (%rax)
xor    %eax,%eax
call   1090 <getchar@plt>
cmp    $0xa,%eax
je     1260 <main+0x90>
mov    %eax,%ebx
mov    %eax,%edi
call   1030 <putchar@plt>
cmp    $0xd,%ebx
je     1240 <main+0x70>
jmp    1220 <main+0x50>
nopl   0x0(%rax)
mov    $0xa,%ebx
jmp    1228 <main+0x58>
mov    %edi,%eax
mov    %rax,0x18(%rsp)
mov    $0x1,%r14d
lea    0x20(%rsp),%rbx
jmp    12b3 <main+0xe3>
nopl   0x0(%rax,%rax,1)
mov    0x2d59(%rip),%rax
mov    (%rax),%edi
lea    0xde8(%rip),%rsi
mov    0x10(%rsp),%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <unlink@plt>
add    $0x1,%r14
cmp    0x18(%rsp),%r14
je     13e6 <main+0x216>
mov    0x8(%rsp),%rax
mov    (%rax,%r14,8),%r15
mov    %r15,%rdi
lea    0xda6(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     13ea <main+0x21a>
mov    %rax,%r13
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <strcpy@plt>
mov    %rbx,%rdi
lea    0xd83(%rip),%rsi
call   10d0 <strcat@plt>
mov    %rbx,%rdi
lea    0xd7a(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     13ea <main+0x21a>
mov    %rax,%rbp
mov    %r15,0x10(%rsp)
xor    %r12d,%r12d
jmp    1330 <main+0x160>
cs nopw 0x0(%rax,%rax,1)
test   %r15d,%r15d
js     1380 <main+0x1b0>
mov    %r15d,%edi
mov    %rbp,%rsi
call   1080 <putc@plt>
mov    %r13,%rdi
call   10f0 <getc@plt>
mov    %eax,%r15d
cmp    $0xd,%eax
jne    1320 <main+0x150>
mov    %r13,%rdi
call   10f0 <getc@plt>
cmp    $0xa,%eax
je     1370 <main+0x1a0>
mov    %eax,%r15d
mov    %eax,%edi
mov    %rbp,%rsi
call   1080 <putc@plt>
cmp    $0xd,%r15d
je     1340 <main+0x170>
jmp    1320 <main+0x150>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xa,%r15d
mov    $0x1,%r12d
jmp    1325 <main+0x155>
xchg   %ax,%ax
mov    %r13,%rdi
call   1070 <fclose@plt>
mov    %rbp,%rdi
call   1070 <fclose@plt>
test   %r12d,%r12d
je     1280 <main+0xb0>
mov    %rbx,%rdi
mov    0x10(%rsp),%rbp
mov    %rbp,%rsi
call   10c0 <rename@plt>
test   %rax,%rax
je     12a4 <main+0xd4>
mov    0x2c27(%rip),%rax
mov    (%rax),%ebx
mov    0x2c16(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xcb8(%rip),%rsi
lea    0x20(%rsp),%rdx
mov    %ebx,%edi
mov    %rbp,%rcx
mov    %rax,%r8
xor    %eax,%eax
call   10a0 <fprintf@plt>
jmp    1417 <main+0x247>
xor    %eax,%eax
jmp    141c <main+0x24c>
mov    0x2bef(%rip),%rax
mov    (%rax),%ebp
mov    0x2bde(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xc8c(%rip),%rsi
mov    %ebp,%edi
mov    %r15,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%eax
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [108 x i8] c"usage : %s <files>\0AStrips ^M characters.\0ACan do in-place conversion of many files or can be used in a pipe\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [9 x i8] c"%s : %s\0A\00"
@errno = global i32 0
@.str.3 = [6 x i8] c".temp\00"
@.str.4 = [3 x i8] c"wb\00"
@.str.5 = [16 x i8] c"%s : no change\0A\00"
@.str.6 = [21 x i8] c"Can't mv %s %s : %s\0A\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 i8*
%9 = alloca [1024 x i8]
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp sle i32 %13, 1
br i1 %14, label %15, label %46
15: ; preds = %2
%16 = call i64 @isatty(i32 0)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %15
%19 = load i32, i32* @stderr
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([108 x i8], [108 x i8]* @.str, i64 0, i64 0), i8* %22)
store i32 1, i32* %3
br label %140
24: ; preds = %15
br label %25
25: ; preds = %42, %24
%26 = call i32 (...) @getchar()
store i32 %26, i32* %7
br label %27
27: ; preds = %37, %25
%28 = load i32, i32* %7
%29 = icmp eq i32 %28, 13
br i1 %29, label %30, label %38
30: ; preds = %27
%31 = call i32 (...) @getchar()
store i32 %31, i32* %7
%32 = load i32, i32* %7
%33 = icmp ne i32 %32, 10
br i1 %33, label %34, label %37
34: ; preds = %30
%35 = load i32, i32* %7
%36 = call i32 @putchar(i32 %35)
br label %37
37: ; preds = %34, %30
br label %27
38: ; preds = %27
%39 = load i32, i32* %7
%40 = icmp slt i32 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %38
br label %45
42: ; preds = %38
%43 = load i32, i32* %7
%44 = call i32 @putchar(i32 %43)
br label %25
45: ; preds = %41
store i32 0, i32* %3
br label %140
46: ; preds = %2
store i32 1, i32* %6
br label %47
47: ; preds = %136, %46
%48 = load i32, i32* %6
%49 = load i32, i32* %4
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %139
51: ; preds = %47
%52 = load i8**, i8*** %5
%53 = load i32, i32* %6
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8*, i8** %52, i64 %54
%56 = load i8*, i8** %55
store i8* %56, i8** %8
%57 = load i8*, i8** %8
%58 = call i32* @fopen(i8* %57, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %58, i32** %10
store i32 0, i32* %12
%59 = load i32*, i32** %10
%60 = icmp ne i32* %59, null
br i1 %60, label %67, label %61
61: ; preds = %51
%62 = load i32, i32* @stderr
%63 = load i8*, i8** %8
%64 = load i32, i32* @errno
%65 = call i8* @strerror(i32 %64)
%66 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %63, i8* %65)
store i32 1, i32* %3
br label %140
67: ; preds = %51
%68 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%69 = load i8*, i8** %8
%70 = call i32 @strcpy(i8* %68, i8* %69)
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%72 = call i32 @strcat(i8* %71, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%73 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%74 = call i32* @fopen(i8* %73, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %74, i32** %11
%75 = load i32*, i32** %11
%76 = icmp ne i32* %75, null
br i1 %76, label %83, label %77
77: ; preds = %67
%78 = load i32, i32* @stderr
%79 = load i8*, i8** %8
%80 = load i32, i32* @errno
%81 = call i8* @strerror(i32 %80)
%82 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %78, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %79, i8* %81)
store i32 1, i32* %3
br label %140
83: ; preds = %67
br label %84
84: ; preds = %105, %83
%85 = load i32*, i32** %10
%86 = call i32 @getc(i32* %85)
store i32 %86, i32* %7
br label %87
87: ; preds = %100, %84
%88 = load i32, i32* %7
%89 = icmp eq i32 %88, 13
br i1 %89, label %90, label %101
90: ; preds = %87
%91 = load i32*, i32** %10
%92 = call i32 @getc(i32* %91)
store i32 %92, i32* %7
%93 = load i32, i32* %7
%94 = icmp eq i32 %93, 10
br i1 %94, label %95, label %96
95: ; preds = %90
store i32 1, i32* %12
br label %100
96: ; preds = %90
%97 = load i32, i32* %7
%98 = load i32*, i32** %11
%99 = call i32 @putc(i32 %97, i32* %98)
br label %100
100: ; preds = %96, %95
br label %87
101: ; preds = %87
%102 = load i32, i32* %7
%103 = icmp slt i32 %102, 0
br i1 %103, label %104, label %105
104: ; preds = %101
br label %109
105: ; preds = %101
%106 = load i32, i32* %7
%107 = load i32*, i32** %11
%108 = call i32 @putc(i32 %106, i32* %107)
br label %84
109: ; preds = %104
%110 = load i32*, i32** %10
%111 = call i32 @fclose(i32* %110)
%112 = load i32*, i32** %11
%113 = call i32 @fclose(i32* %112)
%114 = load i32, i32* %12
%115 = icmp ne i32 %114, 0
br i1 %115, label %122, label %116
116: ; preds = %109
%117 = load i32, i32* @stderr
%118 = load i8*, i8** %8
%119 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %117, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* %118)
%120 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%121 = call i32 @unlink(i8* %120)
br label %135
122: ; preds = %109
%123 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%124 = load i8*, i8** %8
%125 = call i64 @rename(i8* %123, i8* %124)
%126 = icmp ne i64 %125, 0
br i1 %126, label %127, label %134
127: ; preds = %122
%128 = load i32, i32* @stderr
%129 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%130 = load i8*, i8** %8
%131 = load i32, i32* @errno
%132 = call i8* @strerror(i32 %131)
%133 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %128, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %129, i8* %130, i8* %132)
store i32 1, i32* %3
br label %140
134: ; preds = %122
br label %135
135: ; preds = %134, %116
br label %136
136: ; preds = %135
%137 = load i32, i32* %6
%138 = add nsw i32 %137, 1
store i32 %138, i32* %6
br label %47
139: ; preds = %47
store i32 0, i32* %3
br label %140
140: ; preds = %139, %127, %77, %61, %45, %18
%141 = load i32, i32* %3
ret i32 %141
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [108 x i8] c"usage : %s <files>\0AStrips ^M characters.\0ACan do in-place conversion of many files or can be used in a pipe\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [9 x i8] c"%s : %s\0A\00"
@errno = global i32 0
@.str.3 = [6 x i8] c".temp\00"
@.str.4 = [3 x i8] c"wb\00"
@.str.5 = [16 x i8] c"%s : no change\0A\00"
@.str.6 = [21 x i8] c"Can't mv %s %s : %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = icmp slt i32 %0, 2
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = zext i32 %0 to i64
br label %30
8: ; preds = %2
%9 = tail call i64 @isatty(i32 0)
%10 = icmp eq i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %1
%14 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([108 x i8], [108 x i8]* @.str, i64 0, i64 0), i8* %13)
br label %88
15: ; preds = %8, %27
%16 = tail call i32 (...) @getchar()
%17 = icmp eq i32 %16, 13
br i1 %17, label %18, label %24
18: ; preds = %15, %21
%19 = tail call i32 (...) @getchar()
%20 = icmp eq i32 %19, 10
br i1 %20, label %27, label %21
21: ; preds = %18
%22 = tail call i32 @putchar(i32 %19)
%23 = icmp eq i32 %19, 13
br i1 %23, label %18, label %24
24: ; preds = %21, %15
%25 = phi i32 [ %16, %15 ], [ %19, %21 ]
%26 = icmp slt i32 %25, 0
br i1 %26, label %88, label %27
27: ; preds = %18, %24
%28 = phi i32 [ %25, %24 ], [ 10, %18 ]
%29 = tail call i32 @putchar(i32 %28)
br label %15
30: ; preds = %5, %85
%31 = phi i64 [ 1, %5 ], [ %86, %85 ]
%32 = getelementptr inbounds i8*, i8** %1, i64 %31
%33 = load i8*, i8** %32
%34 = call i32* @fopen(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %41
36: ; preds = %30
%37 = load i32, i32* @stderr
%38 = load i32, i32* @errno
%39 = call i8* @strerror(i32 %38)
%40 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %33, i8* %39)
br label %84
41: ; preds = %30
%42 = call i32 @strcpy(i8* %6, i8* %33)
%43 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%44 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%45 = icmp eq i32* %44, null
br i1 %45, label %46, label %51
46: ; preds = %41
%47 = load i32, i32* @stderr
%48 = load i32, i32* @errno
%49 = call i8* @strerror(i32 %48)
%50 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %33, i8* %49)
br label %84
51: ; preds = %41, %64
%52 = phi i32 [ %65, %64 ], [ 0, %41 ]
%53 = call i32 @getc(i32* %34)
%54 = icmp eq i32 %53, 13
br i1 %54, label %55, label %61
55: ; preds = %51, %58
%56 = call i32 @getc(i32* %34)
%57 = icmp eq i32 %56, 10
br i1 %57, label %64, label %58
58: ; preds = %55
%59 = call i32 @putc(i32 %56, i32* %44)
%60 = icmp eq i32 %56, 13
br i1 %60, label %55, label %61
61: ; preds = %58, %51
%62 = phi i32 [ %53, %51 ], [ %56, %58 ]
%63 = icmp slt i32 %62, 0
br i1 %63, label %68, label %64
64: ; preds = %55, %61
%65 = phi i32 [ %52, %61 ], [ 1, %55 ]
%66 = phi i32 [ %62, %61 ], [ 10, %55 ]
%67 = call i32 @putc(i32 %66, i32* %44)
br label %51
68: ; preds = %61
%69 = call i32 @fclose(i32* %34)
%70 = call i32 @fclose(i32* %44)
%71 = icmp eq i32 %52, 0
br i1 %71, label %72, label %76
72: ; preds = %68
%73 = load i32, i32* @stderr
%74 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* %33)
%75 = call i32 @unlink(i8* %6)
br label %85
76: ; preds = %68
%77 = call i64 @rename(i8* %6, i8* %33)
%78 = icmp eq i64 %77, 0
br i1 %78, label %85, label %79
79: ; preds = %76
%80 = load i32, i32* @stderr
%81 = load i32, i32* @errno
%82 = call i8* @strerror(i32 %81)
%83 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %6, i8* %33, i8* %82)
br label %84
84: ; preds = %79, %46, %36
br label %88
85: ; preds = %76, %72
%86 = add nuw nsw i64 %31, 1
%87 = icmp eq i64 %86, %7
br i1 %87, label %88, label %30
88: ; preds = %85, %24, %84, %11
%89 = phi i32 [ 1, %11 ], [ 1, %84 ], [ 0, %24 ], [ 0, %85 ]
ret i32 %89
}