#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*/ SEEK_END;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, long, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *freopen(char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
scalar_t__ malloc(size_t);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strncat(char *, char *, size_t);
int /*<<< orphan*/ *strstr(char *, char *);
int main(int argc, char *argv[]) {
  FILE *fp;
  long fsize;
  long i;
  char *src;
  char *dest;
  char version[] = "Plaintext Log Wiper v1.0 by XT [DuHo]";
  printf("%s\n\n", version);
  if (argc < 3) {
    printf("Syntax: %s <pattern> <logfile>\n", argv[0]);
    exit(0);
  }
  if ((fp = fopen(argv[2], "r")) == NULL) {
    fprintf(stderr, "Unable to open %s\n", argv[2]);
    exit(1);
  }
  fseek(fp, 0L, SEEK_END);
  if ((fsize = ftell(fp)) < 1) {
    fprintf(stderr, "%s is empty or an error occurred\n", argv[2]);
    exit(1);
  } else
    rewind(fp);
  src = (char *)malloc((size_t)fsize);
  dest = (char *)malloc((size_t)fsize);
  for (i = 0; (fgets(src, fsize, fp)) != NULL;) {
    if ((strstr(src, argv[1])) == NULL) {
      strncat(dest, src, (size_t)fsize);
    } else {
      printf("Selected: %s", src);
      ++i;
    }
  }
  if ((fp = freopen(argv[2], "w", fp)) == NULL) {
    fprintf(stderr, "\nUnable to open file %s for writing\n", argv[2]);
    exit(1);
  }
  if (fputs(dest, fp) < 0) {
    fprintf(stderr, "\nUnable to overwrite file %s\n", argv[2]);
    exit(1);
  } else if (i > 0)
    printf("\nSuccesfully removed %d %s!\n", i,
           i == 1 ? "log-entry" : "log-entries");
  else
    printf("\"%s\" not found in %s\n", argv[1], argv[2]);
  fclose(fp);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xdef(%rip),%rsi
mov    $0x26,%edx
call   10c0 <memcpy@plt>
lea    -0x60(%rbp),%rsi
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x3,-0x8(%rbp)
jge    1253 <main+0x63>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1100 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xde9(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    129c <main+0xac>
mov    0x2d5c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xdc0(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x18(%rbp),%rdi
mov    0x2d41(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   10e0 <fseek@plt>
mov    -0x18(%rbp),%rdi
call   10b0 <ftell@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x1,%rax
jge    12f0 <main+0x100>
mov    0x2d08(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xd7f(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x18(%rbp),%rdi
call   1050 <rewind@plt>
mov    -0x20(%rbp),%rdi
call   10d0 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
call   10d0 <malloc@plt>
mov    %rax,-0x38(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1090 <fgets@plt>
cmp    $0x0,%rax
je     138a <main+0x19a>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1110 <strstr@plt>
cmp    $0x0,%rax
jne    1367 <main+0x177>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1080 <strncat@plt>
jmp    1385 <main+0x195>
mov    -0x30(%rbp),%rsi
lea    0xd10(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    131b <main+0x12b>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x18(%rbp),%rdx
lea    0xcf2(%rip),%rsi
call   1070 <freopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    13d7 <main+0x1e7>
mov    0x2c21(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xcc9(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <fputs@plt>
cmp    $0x0,%rax
jge    1415 <main+0x225>
mov    0x2be3(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xcb0(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
cmpq   $0x0,-0x28(%rbp)
jle    1451 <main+0x261>
mov    -0x28(%rbp),%rsi
mov    -0x28(%rbp),%rcx
lea    0xccc(%rip),%rdx
lea    0xcbb(%rip),%rax
cmp    $0x1,%rcx
cmove  %rax,%rdx
lea    0xc8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    146f <main+0x27f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xc9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1474 <main+0x284>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %edi,%edi
call   1100 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
movaps 0xe16(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xdfa(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x5d6f4875445b20,%rax
mov    %rax,0x2e(%rsp)
lea    0xe05(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x2,%ebx
jg     124a <main+0x6a>
mov    (%r14),%rsi
lea    0xdef(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   10f0 <exit@plt>
mov    0x10(%r14),%rdi
lea    0xdf6(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
jne    1278 <main+0x98>
mov    0x2d72(%rip),%rax
mov    (%rax),%edi
mov    0x10(%r14),%rdx
lea    0xdda(%rip),%rsi
jmp    13a0 <main+0x1c0>
mov    %rax,%r15
mov    0x2d66(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
xor    %esi,%esi
call   10d0 <fseek@plt>
mov    %r15,%rdi
call   10b0 <ftell@plt>
test   %rax,%rax
jg     12b4 <main+0xd4>
mov    0x2d36(%rip),%rax
mov    (%rax),%edi
mov    0x10(%r14),%rdx
lea    0xdb1(%rip),%rsi
jmp    13a0 <main+0x1c0>
mov    %rax,%rbx
mov    %r15,%rdi
call   1050 <rewind@plt>
mov    %rbx,%rdi
call   10c0 <malloc@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   10c0 <malloc@plt>
mov    %rax,0x8(%rsp)
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1090 <fgets@plt>
test   %rax,%rax
jne    131e <main+0x13e>
xor    %r13d,%r13d
mov    0x10(%r14),%rdi
lea    0xd97(%rip),%rsi
mov    %r15,%rdx
call   1070 <freopen@plt>
test   %rax,%rax
jne    1377 <main+0x197>
mov    0x2ccc(%rip),%rax
mov    (%rax),%edi
mov    0x10(%r14),%rdx
lea    0xd78(%rip),%rsi
jmp    13a0 <main+0x1c0>
lea    0xd5d(%rip),%r12
xor    %r13d,%r13d
jmp    1354 <main+0x174>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r13
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1090 <fgets@plt>
test   %rax,%rax
je     12ed <main+0x10d>
mov    0x8(%r14),%rsi
mov    %rbp,%rdi
call   1100 <strstr@plt>
test   %rax,%rax
jne    1330 <main+0x150>
mov    0x8(%rsp),%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
call   1080 <strncat@plt>
jmp    1341 <main+0x161>
mov    %rax,%rbx
mov    0x8(%rsp),%rdi
mov    %rax,%rsi
call   1060 <fputs@plt>
test   %rax,%rax
jns    13af <main+0x1cf>
mov    0x2c45(%rip),%rax
mov    (%rax),%edi
mov    0x10(%r14),%rdx
lea    0xd16(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
test   %r13,%r13
jle    13d6 <main+0x1f6>
cmp    $0x1,%r13
lea    0xd32(%rip),%rax
lea    0xd35(%rip),%rdx
cmove  %rax,%rdx
lea    0xd03(%rip),%rdi
mov    %r13,%rsi
jmp    13e5 <main+0x205>
mov    0x8(%r14),%rsi
mov    0x10(%r14),%rdx
lea    0xd22(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %edi,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
@__const.main.version = [38 x i8] c"Plaintext Log Wiper v1.0 by XT [DuHo]\00"
@.str = [5 x i8] c"%s\0A\0A\00"
@.str.1 = [32 x i8] c"Syntax: %s <pattern> <logfile>\0A\00"
@.str.2 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.3 = [19 x i8] c"Unable to open %s\0A\00"
@SEEK_END = global i32 0
@.str.4 = [34 x i8] c"%s is empty or an error occurred\0A\00"
@.str.5 = [13 x i8] c"Selected: %s\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [37 x i8] c"\0AUnable to open file %s for writing\0A\00"
@.str.8 = [30 x i8] c"\0AUnable to overwrite file %s\0A\00"
@.str.9 = [29 x i8] c"\0ASuccesfully removed %d %s!\0A\00"
@.str.10 = [10 x i8] c"log-entry\00"
@.str.11 = [12 x i8] c"log-entries\00"
@.str.12 = [22 x i8] c"\22%s\22 not found in %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [38 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = bitcast [38 x i8]* %11 to i8*
%13 = getelementptr inbounds [38 x i8], [38 x i8]* %11, i64 0, i64 0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 3
br i1 %16, label %17, label %23
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = call i32 @exit(i32 0)
unreachable
23: ; preds = %2
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = call i32* @fopen(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %27, i32** %6
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %36
29: ; preds = %23
%30 = load i32, i32* @stderr
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 2
%33 = load i8*, i8** %32
%34 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %33)
%35 = call i32 @exit(i32 1)
unreachable
36: ; preds = %23
%37 = load i32*, i32** %6
%38 = load i32, i32* @SEEK_END
%39 = call i32 @fseek(i32* %37, i64 0, i32 %38)
%40 = load i32*, i32** %6
%41 = call i64 @ftell(i32* %40)
store i64 %41, i64* %7
%42 = icmp slt i64 %41, 1
br i1 %42, label %43, label %50
43: ; preds = %36
%44 = load i32, i32* @stderr
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 2
%47 = load i8*, i8** %46
%48 = call i32 @fprintf(i32 %44, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i8* %47)
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %36
%51 = load i32*, i32** %6
%52 = call i32 @rewind(i32* %51)
br label %53
53: ; preds = %50
%54 = load i64, i64* %7
%55 = call i64 @malloc(i64 %54)
%56 = inttoptr i64 %55 to i8*
store i8* %56, i8** %9
%57 = load i64, i64* %7
%58 = call i64 @malloc(i64 %57)
%59 = inttoptr i64 %58 to i8*
store i8* %59, i8** %10
store i64 0, i64* %8
br label %60
60: ; preds = %83, %53
%61 = load i8*, i8** %9
%62 = load i64, i64* %7
%63 = load i32*, i32** %6
%64 = call i32* @fgets(i8* %61, i64 %62, i32* %63)
%65 = icmp ne i32* %64, null
br i1 %65, label %66, label %84
66: ; preds = %60
%67 = load i8*, i8** %9
%68 = load i8**, i8*** %5
%69 = getelementptr inbounds i8*, i8** %68, i64 1
%70 = load i8*, i8** %69
%71 = call i32* @strstr(i8* %67, i8* %70)
%72 = icmp eq i32* %71, null
br i1 %72, label %73, label %78
73: ; preds = %66
%74 = load i8*, i8** %10
%75 = load i8*, i8** %9
%76 = load i64, i64* %7
%77 = call i32 @strncat(i8* %74, i8* %75, i64 %76)
br label %83
78: ; preds = %66
%79 = load i8*, i8** %9
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %79)
%81 = load i64, i64* %8
%82 = add nsw i64 %81, 1
store i64 %82, i64* %8
br label %83
83: ; preds = %78, %73
br label %60
84: ; preds = %60
%85 = load i8**, i8*** %5
%86 = getelementptr inbounds i8*, i8** %85, i64 2
%87 = load i8*, i8** %86
%88 = load i32*, i32** %6
%89 = call i32* @freopen(i8* %87, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i32* %88)
store i32* %89, i32** %6
%90 = icmp eq i32* %89, null
br i1 %90, label %91, label %98
91: ; preds = %84
%92 = load i32, i32* @stderr
%93 = load i8**, i8*** %5
%94 = getelementptr inbounds i8*, i8** %93, i64 2
%95 = load i8*, i8** %94
%96 = call i32 @fprintf(i32 %92, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i8* %95)
%97 = call i32 @exit(i32 1)
unreachable
98: ; preds = %84
%99 = load i8*, i8** %10
%100 = load i32*, i32** %6
%101 = call i64 @fputs(i8* %99, i32* %100)
%102 = icmp slt i64 %101, 0
br i1 %102, label %103, label %110
103: ; preds = %98
%104 = load i32, i32* @stderr
%105 = load i8**, i8*** %5
%106 = getelementptr inbounds i8*, i8** %105, i64 2
%107 = load i8*, i8** %106
%108 = call i32 @fprintf(i32 %104, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i8* %107)
%109 = call i32 @exit(i32 1)
unreachable
110: ; preds = %98
%111 = load i64, i64* %8
%112 = icmp sgt i64 %111, 0
br i1 %112, label %113, label %120
113: ; preds = %110
%114 = load i64, i64* %8
%115 = load i64, i64* %8
%116 = icmp eq i64 %115, 1
%117 = zext i1 %116 to i64
%118 = select i1 %116, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0)
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i64 %114, i8* %118)
br label %128
120: ; preds = %110
%121 = load i8**, i8*** %5
%122 = getelementptr inbounds i8*, i8** %121, i64 1
%123 = load i8*, i8** %122
%124 = load i8**, i8*** %5
%125 = getelementptr inbounds i8*, i8** %124, i64 2
%126 = load i8*, i8** %125
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), i8* %123, i8* %126)
br label %128
128: ; preds = %120, %113
br label %129
129: ; preds = %128
%130 = load i32*, i32** %6
%131 = call i32 @fclose(i32* %130)
%132 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@__const.main.version = [38 x i8] c"Plaintext Log Wiper v1.0 by XT [DuHo]\00"
@.str = [5 x i8] c"%s\0A\0A\00"
@.str.1 = [32 x i8] c"Syntax: %s <pattern> <logfile>\0A\00"
@.str.2 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.3 = [19 x i8] c"Unable to open %s\0A\00"
@SEEK_END = global i32 0
@.str.4 = [34 x i8] c"%s is empty or an error occurred\0A\00"
@.str.5 = [13 x i8] c"Selected: %s\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [37 x i8] c"\0AUnable to open file %s for writing\0A\00"
@.str.8 = [30 x i8] c"\0AUnable to overwrite file %s\0A\00"
@.str.9 = [29 x i8] c"\0ASuccesfully removed %d %s!\0A\00"
@.str.10 = [10 x i8] c"log-entry\00"
@.str.11 = [12 x i8] c"log-entries\00"
@.str.12 = [22 x i8] c"\22%s\22 not found in %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [38 x i8]
%4 = getelementptr inbounds [38 x i8], [38 x i8]* %3, i64 0, i64 0
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = icmp slt i32 %0, 3
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i8*, i8** %1
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = call i32 @exit(i32 0)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %21
16: ; preds = %11
%17 = load i32, i32* @stderr
%18 = load i8*, i8** %12
%19 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %18)
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %11
%22 = load i32, i32* @SEEK_END
%23 = call i32 @fseek(i32* %14, i64 0, i32 %22)
%24 = call i64 @ftell(i32* %14)
%25 = icmp slt i64 %24, 1
br i1 %25, label %26, label %31
26: ; preds = %21
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %12
%29 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i8* %28)
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %21
%32 = call i32 @rewind(i32* %14)
%33 = call i64 @malloc(i64 %24)
%34 = inttoptr i64 %33 to i8*
%35 = call i64 @malloc(i64 %24)
%36 = inttoptr i64 %35 to i8*
%37 = call i32* @fgets(i8* %34, i64 %24, i32* %14)
%38 = icmp eq i32* %37, null
br i1 %38, label %55, label %39
39: ; preds = %31
%40 = getelementptr inbounds i8*, i8** %1, i64 1
br label %41
41: ; preds = %39, %51
%42 = phi i64 [ 0, %39 ], [ %52, %51 ]
%43 = load i8*, i8** %40
%44 = call i32* @strstr(i8* dereferenceable(1) %34, i8* dereferenceable(1) %43)
%45 = icmp eq i32* %44, null
br i1 %45, label %46, label %48
46: ; preds = %41
%47 = call i32 @strncat(i8* %36, i8* %34, i64 %24)
br label %51
48: ; preds = %41
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %34)
%50 = add nsw i64 %42, 1
br label %51
51: ; preds = %48, %46
%52 = phi i64 [ %42, %46 ], [ %50, %48 ]
%53 = call i32* @fgets(i8* %34, i64 %24, i32* %14)
%54 = icmp eq i32* %53, null
br i1 %54, label %55, label %41
55: ; preds = %51, %31
%56 = phi i64 [ 0, %31 ], [ %52, %51 ]
%57 = load i8*, i8** %12
%58 = call i32* @freopen(i8* %57, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i32* %14)
%59 = icmp eq i32* %58, null
br i1 %59, label %60, label %65
60: ; preds = %55
%61 = load i32, i32* @stderr
%62 = load i8*, i8** %12
%63 = call i32 @fprintf(i32 %61, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i8* %62)
%64 = call i32 @exit(i32 1)
unreachable
65: ; preds = %55
%66 = call i64 @fputs(i8* %36, i32* %58)
%67 = icmp slt i64 %66, 0
br i1 %67, label %68, label %73
68: ; preds = %65
%69 = load i32, i32* @stderr
%70 = load i8*, i8** %12
%71 = call i32 @fprintf(i32 %69, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i8* %70)
%72 = call i32 @exit(i32 1)
unreachable
73: ; preds = %65
%74 = icmp sgt i64 %56, 0
br i1 %74, label %75, label %79
75: ; preds = %73
%76 = icmp eq i64 %56, 1
%77 = select i1 %76, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0)
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i64 %56, i8* %77)
br label %84
79: ; preds = %73
%80 = getelementptr inbounds i8*, i8** %1, i64 1
%81 = load i8*, i8** %80
%82 = load i8*, i8** %12
%83 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), i8* %81, i8* %82)
br label %84
84: ; preds = %75, %79
%85 = call i32 @fclose(i32* %58)
%86 = call i32 @exit(i32 0)
unreachable
}