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

/* Variables and functions */
int BUFSIZ;
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ O_RDONLY;
int close(int);
int creat(char *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ oops(char *, char *);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, char *);
int read(int, char *, int);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int write(int, char *, int);
int main(int argc, char *argv[]) {
  bool prompt_mode = false;
  if (argc == 4) {
    int i = 1;
    while (i < argc) {
      if (strcmp(argv[i], "-i") == 0) {
        prompt_mode = true;
        if (i != 3)
          argv[i] = argv[i + 1];
        --argc;
        break;
      }
      ++i;
    }
  }
  if (argc != 3) {
    fprintf(stderr, "Usage: %s source destination\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  int src_fd = open(argv[1], O_RDONLY);
  if (src_fd == -1) {
    oops("Can not open", argv[1]);
  }
  if (open(argv[2], O_RDONLY) != -1 && prompt_mode) {
    printf("%s: Do you replace \"%s\"?", argv[0], argv[2]);
    char response[BUFSIZ];
    scanf("%s", response);
    if (strcmp(response, "y") != 0 && strcmp(response, "yes") != 0) {
      exit(EXIT_SUCCESS);
    }
  }
  int dst_fd = creat(argv[2], 0644);
  if (dst_fd == -1) {
    oops("Can not create", argv[2]);
  }
  char buf[4096];
  int buf_size;
  while ((buf_size = read(src_fd, buf, 4096)) > 0)
    if (write(dst_fd, buf, buf_size) != buf_size)
      oops("Failed to create", argv[2]);
  if (buf_size == -1)
    oops("Failed to read", argv[1]);
  if (close(src_fd) == -1 || close(dst_fd) == -1)
    oops("Faile to close files.", "");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1050,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x8(%rbp)
jne    125e <main+0xae>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1259 <main+0xa9>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe00(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    124b <main+0x9b>
movl   $0x1,-0x14(%rbp)
cmpl   $0x3,-0x18(%rbp)
je     123d <main+0x8d>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1259 <main+0xa9>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11e1 <main+0x31>
jmp    125e <main+0xae>
cmpl   $0x3,-0x8(%rbp)
je     1292 <main+0xe2>
mov    0x2d69(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xd84(%rip),%rsi
call   1090 <fprintf@plt>
mov    0x2d3d(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2d47(%rip),%rax
mov    (%rax),%esi
call   10b0 <open@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    12c9 <main+0x119>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xd5d(%rip),%rdi
call   1040 <oops@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    0x2d10(%rip),%rax
mov    (%rax),%esi
call   10b0 <open@plt>
cmp    $0xffffffff,%eax
je     1393 <main+0x1e3>
cmpl   $0x0,-0x14(%rbp)
je     1393 <main+0x1e3>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    0x10(%rax),%rdx
lea    0xd2a(%rip),%rdi
call   1050 <printf@plt>
mov    0x2cc0(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,-0x1050(%rbp)
mov    %rsi,%rsp
mov    %rax,-0x30(%rbp)
lea    0xd08(%rip),%rdi
call   10a0 <scanf@plt>
mov    -0x1050(%rbp),%rdi
lea    0xcf8(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     138c <main+0x1dc>
mov    -0x1050(%rbp),%rdi
lea    0xcdd(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     138c <main+0x1dc>
mov    0x2c3b(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    $0x1a4,%esi
call   10c0 <creat@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    13c6 <main+0x216>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xc8f(%rip),%rdi
call   1040 <oops@plt>
jmp    13cb <main+0x21b>
mov    -0x1c(%rbp),%edi
lea    -0x1040(%rbp),%rsi
mov    $0x1000,%edx
call   1070 <read@plt>
mov    %eax,-0x1044(%rbp)
cmp    $0x0,%eax
jle    1428 <main+0x278>
mov    -0x34(%rbp),%edi
lea    -0x1040(%rbp),%rsi
mov    -0x1044(%rbp),%edx
call   1030 <write@plt>
cmp    -0x1044(%rbp),%eax
je     1423 <main+0x273>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xc41(%rip),%rdi
call   1040 <oops@plt>
jmp    13cb <main+0x21b>
cmpl   $0xffffffff,-0x1044(%rbp)
jne    1449 <main+0x299>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xc2c(%rip),%rdi
call   1040 <oops@plt>
mov    -0x1c(%rbp),%edi
call   1060 <close@plt>
cmp    $0xffffffff,%eax
je     146b <main+0x2bb>
mov    -0x34(%rbp),%edi
call   1060 <close@plt>
cmp    $0xffffffff,%eax
jne    147e <main+0x2ce>
lea    0xc0d(%rip),%rdi
lea    0xba7(%rip),%rsi
call   1040 <oops@plt>
mov    0x2b3b(%rip),%rax
mov    (%rax),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1008,%rsp
mov    %rsi,%r13
cmp    $0x3,%edi
je     1239 <main+0x89>
cmp    $0x4,%edi
jne    1212 <main+0x62>
mov    0x8(%r13),%rdi
lea    0xe24(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     123d <main+0x8d>
mov    0x10(%r13),%rdi
lea    0xe0f(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1244 <main+0x94>
mov    0x18(%r13),%rdi
lea    0xdfa(%rip),%rsi
call   1080 <strcmp@plt>
mov    $0x1,%bl
test   %rax,%rax
je     1257 <main+0xa7>
mov    0x2dbf(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xddd(%rip),%rsi
call   1090 <fprintf@plt>
mov    0x2d96(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
xor    %ebx,%ebx
jmp    1257 <main+0xa7>
mov    $0x1,%eax
jmp    1249 <main+0x99>
mov    $0x2,%eax
mov    %eax,%eax
mov    0x8(%r13,%rax,8),%rcx
mov    %rcx,0x0(%r13,%rax,8)
mov    $0x1,%bl
mov    0x8(%r13),%rdi
mov    0x2d86(%rip),%r14
mov    (%r14),%esi
call   10b0 <open@plt>
mov    %eax,%r15d
cmp    $0xffffffff,%eax
jne    1282 <main+0xd2>
mov    0x8(%r13),%rsi
lea    0xda4(%rip),%rdi
call   1040 <oops@plt>
mov    0x10(%r13),%rdi
mov    (%r14),%esi
call   10b0 <open@plt>
cmp    $0xffffffff,%eax
sete   %al
xor    $0x1,%bl
or     %al,%bl
jne    130a <main+0x15a>
mov    0x0(%r13),%rsi
mov    0x10(%r13),%rdx
lea    0xd84(%rip),%rdi
call   1050 <printf@plt>
mov    %rsp,%r14
mov    0x2d17(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xd74(%rip),%rdi
mov    %rbx,%rsi
call   10a0 <scanf@plt>
lea    0xd68(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1307 <main+0x157>
lea    0xd56(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    13f7 <main+0x247>
mov    %r14,%rsp
mov    0x10(%r13),%rdi
mov    $0x1a4,%esi
call   10c0 <creat@plt>
mov    %eax,%r12d
cmp    $0xffffffff,%eax
jne    1330 <main+0x180>
mov    0x10(%r13),%rsi
lea    0xd25(%rip),%rdi
call   1040 <oops@plt>
lea    -0x1030(%rbp),%rsi
mov    %r15d,%edi
mov    $0x1000,%edx
call   1070 <read@plt>
mov    %eax,%r14d
test   %eax,%eax
jle    139c <main+0x1ec>
lea    -0x1030(%rbp),%rbx
jmp    1377 <main+0x1c7>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0x1000,%edx
call   1070 <read@plt>
mov    %eax,%r14d
test   %eax,%eax
jle    139c <main+0x1ec>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1030 <write@plt>
cmp    %r14d,%eax
je     1360 <main+0x1b0>
mov    0x10(%r13),%rsi
lea    0xcca(%rip),%rdi
call   1040 <oops@plt>
jmp    1360 <main+0x1b0>
cmp    $0xffffffff,%r14d
jne    13b2 <main+0x202>
mov    0x8(%r13),%rsi
lea    0xcc3(%rip),%rdi
call   1040 <oops@plt>
mov    %r15d,%edi
call   1060 <close@plt>
cmp    $0xffffffff,%eax
je     13cc <main+0x21c>
mov    %r12d,%edi
call   1060 <close@plt>
cmp    $0xffffffff,%eax
jne    13df <main+0x22f>
lea    0xcac(%rip),%rdi
lea    0xc46(%rip),%rsi
call   1040 <oops@plt>
mov    0x2bda(%rip),%rax
mov    (%rax),%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2bc2(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-i\00"
@stderr = global i32 0
@.str.1 = [30 x i8] c"Usage: %s source destination\0A\00"
@EXIT_FAILURE = global i32 0
@O_RDONLY = global i32 0
@.str.2 = [13 x i8] c"Can not open\00"
@.str.3 = [25 x i8] c"%s: Do you replace \22%s\22?\00"
@BUFSIZ = global i32 0
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [2 x i8] c"y\00"
@.str.6 = [4 x i8] c"yes\00"
@EXIT_SUCCESS = global i32 0
@.str.7 = [15 x i8] c"Can not create\00"
@.str.8 = [17 x i8] c"Failed to create\00"
@.str.9 = [15 x i8] c"Failed to read\00"
@.str.10 = [22 x i8] c"Faile to close files.\00"
@.str.11 = [1 x i8] zeroinitializer
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32
%12 = alloca [4096 x i8]
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 4
br i1 %15, label %16, label %50
16: ; preds = %2
store i32 1, i32* %7
br label %17
17: ; preds = %46, %16
%18 = load i32, i32* %7
%19 = load i32, i32* %4
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %49
21: ; preds = %17
%22 = load i8**, i8*** %5
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %46
29: ; preds = %21
store i32 1, i32* %6
%30 = load i32, i32* %7
%31 = icmp ne i32 %30, 3
br i1 %31, label %32, label %43
32: ; preds = %29
%33 = load i8**, i8*** %5
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %33, i64 %36
%38 = load i8*, i8** %37
%39 = load i8**, i8*** %5
%40 = load i32, i32* %7
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8*, i8** %39, i64 %41
store i8* %38, i8** %42
br label %43
43: ; preds = %32, %29
%44 = load i32, i32* %4
%45 = add nsw i32 %44, -1
store i32 %45, i32* %4
br label %49
46: ; preds = %21
%47 = load i32, i32* %7
%48 = add nsw i32 %47, 1
store i32 %48, i32* %7
br label %17
49: ; preds = %43, %17
br label %50
50: ; preds = %49, %2
%51 = load i32, i32* %4
%52 = icmp ne i32 %51, 3
br i1 %52, label %53, label %61
53: ; preds = %50
%54 = load i32, i32* @stderr
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 0
%57 = load i8*, i8** %56
%58 = call i32 @fprintf(i32 %54, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %57)
%59 = load i32, i32* @EXIT_FAILURE
%60 = call i32 @exit(i32 %59)
unreachable
61: ; preds = %50
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 1
%64 = load i8*, i8** %63
%65 = load i32, i32* @O_RDONLY
%66 = call i32 @open(i8* %64, i32 %65)
store i32 %66, i32* %8
%67 = load i32, i32* %8
%68 = icmp eq i32 %67, -1
br i1 %68, label %69, label %74
69: ; preds = %61
%70 = load i8**, i8*** %5
%71 = getelementptr inbounds i8*, i8** %70, i64 1
%72 = load i8*, i8** %71
%73 = call i32 @oops(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %72)
br label %74
74: ; preds = %69, %61
%75 = load i8**, i8*** %5
%76 = getelementptr inbounds i8*, i8** %75, i64 2
%77 = load i8*, i8** %76
%78 = load i32, i32* @O_RDONLY
%79 = call i32 @open(i8* %77, i32 %78)
%80 = icmp ne i32 %79, -1
br i1 %80, label %81, label %107
81: ; preds = %74
%82 = load i32, i32* %6
%83 = icmp ne i32 %82, 0
br i1 %83, label %84, label %107
84: ; preds = %81
%85 = load i8**, i8*** %5
%86 = getelementptr inbounds i8*, i8** %85, i64 0
%87 = load i8*, i8** %86
%88 = load i8**, i8*** %5
%89 = getelementptr inbounds i8*, i8** %88, i64 2
%90 = load i8*, i8** %89
%91 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %87, i8* %90)
%92 = load i32, i32* @BUFSIZ
%93 = zext i32 %92 to i64
%94 = call i8* @llvm.stacksave()
store i8* %94, i8** %9
%95 = alloca i8, i64 %93
store i64 %93, i64* %10
%96 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %95)
%97 = call i64 @strcmp(i8* %95, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%98 = icmp ne i64 %97, 0
br i1 %98, label %99, label %105
99: ; preds = %84
%100 = call i64 @strcmp(i8* %95, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%101 = icmp ne i64 %100, 0
br i1 %101, label %102, label %105
102: ; preds = %99
%103 = load i32, i32* @EXIT_SUCCESS
%104 = call i32 @exit(i32 %103)
unreachable
105: ; preds = %99, %84
%106 = load i8*, i8** %9
br label %107
107: ; preds = %105, %81, %74
%108 = load i8**, i8*** %5
%109 = getelementptr inbounds i8*, i8** %108, i64 2
%110 = load i8*, i8** %109
%111 = call i32 @creat(i8* %110, i32 420)
store i32 %111, i32* %11
%112 = load i32, i32* %11
%113 = icmp eq i32 %112, -1
br i1 %113, label %114, label %119
114: ; preds = %107
%115 = load i8**, i8*** %5
%116 = getelementptr inbounds i8*, i8** %115, i64 2
%117 = load i8*, i8** %116
%118 = call i32 @oops(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* %117)
br label %119
119: ; preds = %114, %107
br label %120
120: ; preds = %137, %119
%121 = load i32, i32* %8
%122 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 0
%123 = call i32 @read(i32 %121, i8* %122, i32 4096)
store i32 %123, i32* %13
%124 = icmp sgt i32 %123, 0
br i1 %124, label %125, label %138
125: ; preds = %120
%126 = load i32, i32* %11
%127 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 0
%128 = load i32, i32* %13
%129 = call i32 @write(i32 %126, i8* %127, i32 %128)
%130 = load i32, i32* %13
%131 = icmp ne i32 %129, %130
br i1 %131, label %132, label %137
132: ; preds = %125
%133 = load i8**, i8*** %5
%134 = getelementptr inbounds i8*, i8** %133, i64 2
%135 = load i8*, i8** %134
%136 = call i32 @oops(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i8* %135)
br label %137
137: ; preds = %132, %125
br label %120
138: ; preds = %120
%139 = load i32, i32* %13
%140 = icmp eq i32 %139, -1
br i1 %140, label %141, label %146
141: ; preds = %138
%142 = load i8**, i8*** %5
%143 = getelementptr inbounds i8*, i8** %142, i64 1
%144 = load i8*, i8** %143
%145 = call i32 @oops(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* %144)
br label %146
146: ; preds = %141, %138
%147 = load i32, i32* %8
%148 = call i32 @close(i32 %147)
%149 = icmp eq i32 %148, -1
br i1 %149, label %154, label %150
150: ; preds = %146
%151 = load i32, i32* %11
%152 = call i32 @close(i32 %151)
%153 = icmp eq i32 %152, -1
br i1 %153, label %154, label %156
154: ; preds = %150, %146
%155 = call i32 @oops(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.11, i64 0, i64 0))
br label %156
156: ; preds = %154, %150
%157 = load i32, i32* @EXIT_SUCCESS
ret i32 %157
}

LLVM IR (-O2):
@.str = [3 x i8] c"-i\00"
@stderr = global i32 0
@.str.1 = [30 x i8] c"Usage: %s source destination\0A\00"
@EXIT_FAILURE = global i32 0
@O_RDONLY = global i32 0
@.str.2 = [13 x i8] c"Can not open\00"
@.str.3 = [25 x i8] c"%s: Do you replace \22%s\22?\00"
@BUFSIZ = global i32 0
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [2 x i8] c"y\00"
@.str.6 = [4 x i8] c"yes\00"
@EXIT_SUCCESS = global i32 0
@.str.7 = [15 x i8] c"Can not create\00"
@.str.8 = [17 x i8] c"Failed to create\00"
@.str.9 = [15 x i8] c"Failed to read\00"
@.str.10 = [22 x i8] c"Faile to close files.\00"
@.str.11 = [1 x i8] zeroinitializer
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4096 x i8]
switch i32 %0, label %27 [
i32 4, label %4
i32 3, label %33
]
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %17, %4
%10 = phi i32 [ 1, %4 ], [ 2, %17 ]
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds i8*, i8** %1, i64 %11
%13 = add nuw nsw i32 %10, 1
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %1, i64 %14
%16 = load i8*, i8** %15
store i8* %16, i8** %12
br label %33
17: ; preds = %4
%18 = getelementptr inbounds i8*, i8** %1, i64 2
%19 = load i8*, i8** %18
%20 = tail call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %9, label %22
22: ; preds = %17
%23 = getelementptr inbounds i8*, i8** %1, i64 3
%24 = load i8*, i8** %23
%25 = tail call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %33, label %27
27: ; preds = %22, %2
%28 = load i32, i32* @stderr
%29 = load i8*, i8** %1
%30 = tail call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %29)
%31 = load i32, i32* @EXIT_FAILURE
%32 = tail call i32 @exit(i32 %31)
unreachable
33: ; preds = %22, %2, %9
%34 = phi i1 [ false, %2 ], [ true, %9 ], [ true, %22 ]
%35 = getelementptr inbounds i8*, i8** %1, i64 1
%36 = load i8*, i8** %35
%37 = load i32, i32* @O_RDONLY
%38 = tail call i32 @open(i8* %36, i32 %37)
%39 = icmp eq i32 %38, -1
br i1 %39, label %40, label %43
40: ; preds = %33
%41 = load i8*, i8** %35
%42 = tail call i32 @oops(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %41)
br label %43
43: ; preds = %40, %33
%44 = getelementptr inbounds i8*, i8** %1, i64 2
%45 = load i8*, i8** %44
%46 = load i32, i32* @O_RDONLY
%47 = tail call i32 @open(i8* %45, i32 %46)
%48 = icmp ne i32 %47, -1
%49 = and i1 %34, %48
br i1 %49, label %50, label %68
50: ; preds = %43
%51 = load i8*, i8** %1
%52 = load i8*, i8** %44
%53 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %51, i8* %52)
%54 = load i32, i32* @BUFSIZ
%55 = zext i32 %54 to i64
%56 = tail call i8* @llvm.stacksave()
%57 = alloca i8, i64 %55
%58 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %57)
%59 = call i64 @strcmp(i8* %57, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%60 = icmp eq i64 %59, 0
br i1 %60, label %67, label %61
61: ; preds = %50
%62 = call i64 @strcmp(i8* %57, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%63 = icmp eq i64 %62, 0
br i1 %63, label %67, label %64
64: ; preds = %61
%65 = load i32, i32* @EXIT_SUCCESS
%66 = call i32 @exit(i32 %65)
unreachable
67: ; preds = %61, %50
br label %68
68: ; preds = %67, %43
%69 = load i8*, i8** %44
%70 = call i32 @creat(i8* %69, i32 420)
%71 = icmp eq i32 %70, -1
br i1 %71, label %72, label %75
72: ; preds = %68
%73 = load i8*, i8** %44
%74 = call i32 @oops(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* %73)
br label %75
75: ; preds = %72, %68
%76 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%77 = call i32 @read(i32 %38, i8* %76, i32 4096)
%78 = icmp sgt i32 %77, 0
br i1 %78, label %79, label %89
79: ; preds = %75, %86
%80 = phi i32 [ %87, %86 ], [ %77, %75 ]
%81 = call i32 @write(i32 %70, i8* %76, i32 %80)
%82 = icmp eq i32 %81, %80
br i1 %82, label %86, label %83
83: ; preds = %79
%84 = load i8*, i8** %44
%85 = call i32 @oops(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i8* %84)
br label %86
86: ; preds = %83, %79
%87 = call i32 @read(i32 %38, i8* %76, i32 4096)
%88 = icmp sgt i32 %87, 0
br i1 %88, label %79, label %89
89: ; preds = %86, %75
%90 = phi i32 [ %77, %75 ], [ %87, %86 ]
%91 = icmp eq i32 %90, -1
br i1 %91, label %92, label %95
92: ; preds = %89
%93 = load i8*, i8** %35
%94 = call i32 @oops(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* %93)
br label %95
95: ; preds = %92, %89
%96 = call i32 @close(i32 %38)
%97 = icmp eq i32 %96, -1
br i1 %97, label %101, label %98
98: ; preds = %95
%99 = call i32 @close(i32 %70)
%100 = icmp eq i32 %99, -1
br i1 %100, label %101, label %103
101: ; preds = %98, %95
%102 = call i32 @oops(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.11, i64 0, i64 0))
br label %103
103: ; preds = %101, %98
%104 = load i32, i32* @EXIT_SUCCESS
ret i32 %104
}