#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 ssize_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int getline(char **, size_t *, int /*<<< orphan*/ *);
char *malloc(int);
int /*<<< orphan*/ *stderr;
scalar_t__ strcmp(char *, char *);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int laf_add_whitelist(int wl_type, char *path, char *cmd) {
  FILE *fp_r, *fp_w;
  char *line = NULL;
  char *buffer;
  size_t len = 0;
  ssize_t read;
  char flag_search = 0;
  int f_size = 0;
  int f_seek = 0;
  int cmd_len = 0, i = 0, ret = 0;
  if (wl_type > 1)
    return -1;
  fp_r = fopen(path, "r+");
  if (fp_r == NULL) {
    fprintf(stderr, "error: can't read the file %s\n", path);
    return -1;
  }
  cmd_len = strlen(cmd);
  while ((read = getline(&line, &len, fp_r)) != -1) {
    if (cmd_len == (read - 1) && (strncmp(line, cmd, read - 1) == 0)) {
      fclose(fp_r);
      return 1;
    }
    if ((strcmp(line, "[whitelist_exact]\n") == 0 && wl_type == 0) ||
        (strcmp(line, "[whitelist_similar]\n") == 0 && wl_type == 1)) {
      f_seek = ftell(fp_r);
    }
  }
  fseek(fp_r, 0, SEEK_END);
  f_size = ftell(fp_r);
  fseek(fp_r, 0, SEEK_SET);
  buffer = malloc((f_size + 1) * sizeof(char));
  ret = fread(buffer, f_size, 1, fp_r);
  fclose(fp_r);
  fp_w = fopen(path, "w+");
  for (i = 0; i < f_seek; i++)
    fputc(buffer[i], fp_w);
  fprintf(fp_w, "%s\n", cmd);
  for (i = f_seek; i < f_size; i++)
    fputc(buffer[i], fp_w);
  fclose(fp_w);
  free(buffer);
  return 0;
}


x86 assembly (clang, -O0):
<laf_add_whitelist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x40(%rbp)
movb   $0x0,-0x45(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1230 <laf_add_whitelist+0x60>
movl   $0xffffffff,-0x4(%rbp)
jmp    1456 <laf_add_whitelist+0x286>
mov    -0x10(%rbp),%rdi
lea    0xdc5(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1275 <laf_add_whitelist+0xa5>
mov    0x2d82(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rdx
lea    0xd9f(%rip),%rsi
call   10a0 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1456 <laf_add_whitelist+0x286>
mov    -0x18(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x54(%rbp)
mov    -0x20(%rbp),%rdx
lea    -0x30(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   10f0 <getline@plt>
mov    %eax,-0x44(%rbp)
cmp    $0xffffffff,%eax
je     133a <laf_add_whitelist+0x16a>
mov    -0x54(%rbp),%eax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    12e1 <laf_add_whitelist+0x111>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x44(%rbp),%edx
sub    $0x1,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    12e1 <laf_add_whitelist+0x111>
mov    -0x20(%rbp),%rdi
call   1060 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    1456 <laf_add_whitelist+0x286>
mov    -0x30(%rbp),%rdi
lea    0xd36(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1305 <laf_add_whitelist+0x135>
cmpl   $0x0,-0x8(%rbp)
je     1329 <laf_add_whitelist+0x159>
mov    -0x30(%rbp),%rdi
lea    0xd25(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1335 <laf_add_whitelist+0x165>
cmpl   $0x1,-0x8(%rbp)
jne    1335 <laf_add_whitelist+0x165>
mov    -0x20(%rbp),%rdi
call   10b0 <ftell@plt>
mov    %eax,-0x50(%rbp)
jmp    1281 <laf_add_whitelist+0xb1>
mov    -0x20(%rbp),%rdi
mov    0x2ca3(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10d0 <fseek@plt>
mov    -0x20(%rbp),%rdi
call   10b0 <ftell@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2c6b(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10d0 <fseek@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x4c(%rbp),%esi
mov    -0x20(%rbp),%rcx
mov    $0x1,%edx
call   1050 <fread@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x10(%rbp),%rdi
lea    0xc99(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x50(%rbp),%eax
jge    13f2 <laf_add_whitelist+0x222>
mov    -0x38(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    -0x28(%rbp),%rsi
movsbl %al,%edi
call   1080 <fputc@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    13c1 <laf_add_whitelist+0x1f1>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xc1d(%rip),%rsi
call   10a0 <fprintf@plt>
mov    -0x50(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jge    143d <laf_add_whitelist+0x26d>
mov    -0x38(%rbp),%rax
movslq -0x58(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    -0x28(%rbp),%rsi
movsbl %al,%edi
call   1080 <fputc@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    140c <laf_add_whitelist+0x23c>
mov    -0x28(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<laf_add_whitelist>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
mov    $0xffffffff,%r14d
cmp    $0x1,%edi
jg     13f9 <laf_add_whitelist+0x229>
mov    %rdx,%r12
mov    %rsi,%r15
mov    %edi,%ebp
lea    0xdf2(%rip),%rsi
mov    %r15,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
je     12d8 <laf_add_whitelist+0x108>
mov    %rax,%rbx
mov    %r12,%rdi
call   1070 <strlen@plt>
mov    %eax,%r13d
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    %rbx,%rdx
call   10f0 <getline@plt>
cmp    $0xffffffff,%eax
mov    %r15,0x20(%rsp)
je     12f6 <laf_add_whitelist+0x126>
xor    %r15d,%r15d
lea    0x10(%rsp),%r14
jmp    1280 <laf_add_whitelist+0xb0>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   10b0 <ftell@plt>
mov    %eax,%r15d
lea    0x8(%rsp),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   10f0 <getline@plt>
cmp    $0xffffffff,%eax
je     12f9 <laf_add_whitelist+0x129>
add    $0xffffffff,%eax
cmp    %eax,%r13d
jne    12a1 <laf_add_whitelist+0xd1>
mov    0x8(%rsp),%rdi
mov    %r12,%rsi
mov    %r13d,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     13eb <laf_add_whitelist+0x21b>
mov    0x8(%rsp),%rdi
lea    0xd75(%rip),%rsi
call   1090 <strcmp@plt>
test   %ebp,%ebp
jne    12bb <laf_add_whitelist+0xeb>
test   %rax,%rax
je     1260 <laf_add_whitelist+0x90>
mov    0x8(%rsp),%rdi
lea    0xd6e(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x1,%ebp
jne    126b <laf_add_whitelist+0x9b>
test   %rax,%rax
je     1260 <laf_add_whitelist+0x90>
jmp    126b <laf_add_whitelist+0x9b>
mov    0x2cf9(%rip),%rax
mov    (%rax),%rdi
lea    0xd1a(%rip),%rsi
mov    %r15,%rdx
call   10a0 <fprintf@plt>
jmp    13f9 <laf_add_whitelist+0x229>
xor    %r15d,%r15d
mov    %r12,0x18(%rsp)
mov    0x2ce3(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   10d0 <fseek@plt>
mov    %rbx,%rdi
call   10b0 <ftell@plt>
mov    %eax,%r13d
mov    0x2cad(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   10d0 <fseek@plt>
lea    0x1(%r13),%edi
call   10c0 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %r13d,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fread@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xced(%rip),%rsi
mov    0x20(%rsp),%rdi
call   10e0 <fopen@plt>
mov    %rax,%r12
test   %r15d,%r15d
jle    1396 <laf_add_whitelist+0x1c6>
mov    %r15d,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl (%r14,%rbx,1),%edi
mov    %r12,%rsi
call   1080 <fputc@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1380 <laf_add_whitelist+0x1b0>
lea    0xc81(%rip),%rsi
mov    %r12,%rdi
mov    0x18(%rsp),%rdx
call   10a0 <fprintf@plt>
cmp    %r13d,%r15d
jge    13d6 <laf_add_whitelist+0x206>
mov    %r15d,%ecx
movslq %r15d,%rax
mov    %r14,%r15
add    %rax,%r15
sub    %ecx,%r13d
xor    %ebp,%ebp
movsbl (%r15,%rbp,1),%edi
mov    %r12,%rsi
call   1080 <fputc@plt>
add    $0x1,%rbp
cmp    %ebp,%r13d
jne    13c0 <laf_add_whitelist+0x1f0>
mov    %r12,%rdi
call   1060 <fclose@plt>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %r14d,%r14d
jmp    13f9 <laf_add_whitelist+0x229>
mov    %rbx,%rdi
call   1060 <fclose@plt>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"r+\00"
@stderr = global i32* null
@.str.1 = [31 x i8] c"error: can't read the file %s\0A\00"
@.str.2 = [19 x i8] c"[whitelist_exact]\0A\00"
@.str.3 = [21 x i8] c"[whitelist_similar]\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.4 = [3 x i8] c"w+\00"
@.str.5 = [4 x i8] c"%s\0A\00"
define i32 @laf_add_whitelist(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i32
%14 = alloca i8
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* null, i8** %10
store i64 0, i64* %12
store i8 0, i8* %14
store i32 0, i32* %15
store i32 0, i32* %16
store i32 0, i32* %17
store i32 0, i32* %18
store i32 0, i32* %19
%20 = load i32, i32* %5
%21 = icmp sgt i32 %20, 1
br i1 %21, label %22, label %23
22: ; preds = %3
store i32 -1, i32* %4
br label %135
23: ; preds = %3
%24 = load i8*, i8** %6
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %25, i32** %8
%26 = load i32*, i32** %8
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %32
28: ; preds = %23
%29 = load i32*, i32** @stderr
%30 = load i8*, i8** %6
%31 = call i32 @fprintf(i32* %29, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %30)
store i32 -1, i32* %4
br label %135
32: ; preds = %23
%33 = load i8*, i8** %7
%34 = call i32 @strlen(i8* %33)
store i32 %34, i32* %17
br label %35
35: ; preds = %71, %32
%36 = load i32*, i32** %8
%37 = call i32 @getline(i8** %10, i64* %12, i32* %36)
store i32 %37, i32* %13
%38 = icmp ne i32 %37, -1
br i1 %38, label %39, label %72
39: ; preds = %35
%40 = load i32, i32* %17
%41 = load i32, i32* %13
%42 = sub nsw i32 %41, 1
%43 = icmp eq i32 %40, %42
br i1 %43, label %44, label %54
44: ; preds = %39
%45 = load i8*, i8** %10
%46 = load i8*, i8** %7
%47 = load i32, i32* %13
%48 = sub nsw i32 %47, 1
%49 = call i64 @strncmp(i8* %45, i8* %46, i32 %48)
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %44
%52 = load i32*, i32** %8
%53 = call i32 @fclose(i32* %52)
store i32 1, i32* %4
br label %135
54: ; preds = %44, %39
%55 = load i8*, i8** %10
%56 = call i64 @strcmp(i8* %55, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %54
%59 = load i32, i32* %5
%60 = icmp eq i32 %59, 0
br i1 %60, label %68, label %61
61: ; preds = %58, %54
%62 = load i8*, i8** %10
%63 = call i64 @strcmp(i8* %62, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%64 = icmp eq i64 %63, 0
br i1 %64, label %65, label %71
65: ; preds = %61
%66 = load i32, i32* %5
%67 = icmp eq i32 %66, 1
br i1 %67, label %68, label %71
68: ; preds = %65, %58
%69 = load i32*, i32** %8
%70 = call i32 @ftell(i32* %69)
store i32 %70, i32* %16
br label %71
71: ; preds = %68, %65, %61
br label %35
72: ; preds = %35
%73 = load i32*, i32** %8
%74 = load i32, i32* @SEEK_END
%75 = call i32 @fseek(i32* %73, i32 0, i32 %74)
%76 = load i32*, i32** %8
%77 = call i32 @ftell(i32* %76)
store i32 %77, i32* %15
%78 = load i32*, i32** %8
%79 = load i32, i32* @SEEK_SET
%80 = call i32 @fseek(i32* %78, i32 0, i32 %79)
%81 = load i32, i32* %15
%82 = add nsw i32 %81, 1
%83 = sext i32 %82 to i64
%84 = mul i64 %83, 1
%85 = trunc i64 %84 to i32
%86 = call i8* @malloc(i32 %85)
store i8* %86, i8** %11
%87 = load i8*, i8** %11
%88 = load i32, i32* %15
%89 = load i32*, i32** %8
%90 = call i32 @fread(i8* %87, i32 %88, i32 1, i32* %89)
store i32 %90, i32* %19
%91 = load i32*, i32** %8
%92 = call i32 @fclose(i32* %91)
%93 = load i8*, i8** %6
%94 = call i32* @fopen(i8* %93, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %94, i32** %9
store i32 0, i32* %18
br label %95
95: ; preds = %107, %72
%96 = load i32, i32* %18
%97 = load i32, i32* %16
%98 = icmp slt i32 %96, %97
br i1 %98, label %99, label %110
99: ; preds = %95
%100 = load i8*, i8** %11
%101 = load i32, i32* %18
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds i8, i8* %100, i64 %102
%104 = load i8, i8* %103
%105 = load i32*, i32** %9
%106 = call i32 @fputc(i8 signext %104, i32* %105)
br label %107
107: ; preds = %99
%108 = load i32, i32* %18
%109 = add nsw i32 %108, 1
store i32 %109, i32* %18
br label %95
110: ; preds = %95
%111 = load i32*, i32** %9
%112 = load i8*, i8** %7
%113 = call i32 @fprintf(i32* %111, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %112)
%114 = load i32, i32* %16
store i32 %114, i32* %18
br label %115
115: ; preds = %127, %110
%116 = load i32, i32* %18
%117 = load i32, i32* %15
%118 = icmp slt i32 %116, %117
br i1 %118, label %119, label %130
119: ; preds = %115
%120 = load i8*, i8** %11
%121 = load i32, i32* %18
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds i8, i8* %120, i64 %122
%124 = load i8, i8* %123
%125 = load i32*, i32** %9
%126 = call i32 @fputc(i8 signext %124, i32* %125)
br label %127
127: ; preds = %119
%128 = load i32, i32* %18
%129 = add nsw i32 %128, 1
store i32 %129, i32* %18
br label %115
130: ; preds = %115
%131 = load i32*, i32** %9
%132 = call i32 @fclose(i32* %131)
%133 = load i8*, i8** %11
%134 = call i32 @free(i8* %133)
store i32 0, i32* %4
br label %135
135: ; preds = %130, %51, %28, %22
%136 = load i32, i32* %4
ret i32 %136
}

LLVM IR (-O2):
@.str = [3 x i8] c"r+\00"
@stderr = global i32* null
@.str.1 = [31 x i8] c"error: can't read the file %s\0A\00"
@.str.2 = [19 x i8] c"[whitelist_exact]\0A\00"
@.str.3 = [21 x i8] c"[whitelist_similar]\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.4 = [3 x i8] c"w+\00"
@.str.5 = [4 x i8] c"%s\0A\00"
define i32 @laf_add_whitelist(i32 %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = bitcast i8** %4 to i8*
store i8* null, i8** %4
%7 = bitcast i64* %5 to i8*
store i64 0, i64* %5
%8 = icmp sgt i32 %0, 1
br i1 %8, label %87, label %9
9: ; preds = %3
%10 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i32*, i32** @stderr
%14 = tail call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %87
15: ; preds = %9
%16 = tail call i32 @strlen(i8* %2)
%17 = call i32 @getline(i8** %4, i64* %5, i32* %10)
%18 = icmp eq i32 %17, -1
br i1 %18, label %49, label %19
19: ; preds = %15
%20 = icmp eq i32 %0, 0
%21 = icmp eq i32 %0, 1
br label %22
22: ; preds = %19, %45
%23 = phi i32 [ %17, %19 ], [ %47, %45 ]
%24 = phi i32 [ 0, %19 ], [ %46, %45 ]
%25 = add nsw i32 %23, -1
%26 = icmp eq i32 %16, %25
br i1 %26, label %27, label %33
27: ; preds = %22
%28 = load i8*, i8** %4
%29 = call i64 @strncmp(i8* %28, i8* %2, i32 %16)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 @fclose(i32* %10)
br label %87
33: ; preds = %27, %22
%34 = load i8*, i8** %4
%35 = call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
%37 = and i1 %20, %36
br i1 %37, label %43, label %38
38: ; preds = %33
%39 = load i8*, i8** %4
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
%42 = and i1 %21, %41
br i1 %42, label %43, label %45
43: ; preds = %38, %33
%44 = call i32 @ftell(i32* %10)
br label %45
45: ; preds = %43, %38
%46 = phi i32 [ %44, %43 ], [ %24, %38 ]
%47 = call i32 @getline(i8** %4, i64* %5, i32* %10)
%48 = icmp eq i32 %47, -1
br i1 %48, label %49, label %22
49: ; preds = %45, %15
%50 = phi i32 [ 0, %15 ], [ %46, %45 ]
%51 = load i32, i32* @SEEK_END
%52 = call i32 @fseek(i32* %10, i32 0, i32 %51)
%53 = call i32 @ftell(i32* %10)
%54 = load i32, i32* @SEEK_SET
%55 = call i32 @fseek(i32* %10, i32 0, i32 %54)
%56 = add nsw i32 %53, 1
%57 = call i8* @malloc(i32 %56)
%58 = call i32 @fread(i8* %57, i32 %53, i32 1, i32* %10)
%59 = call i32 @fclose(i32* %10)
%60 = call i32* @fopen(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%61 = icmp sgt i32 %50, 0
br i1 %61, label %62, label %71
62: ; preds = %49
%63 = zext i32 %50 to i64
br label %64
64: ; preds = %62, %64
%65 = phi i64 [ 0, %62 ], [ %69, %64 ]
%66 = getelementptr inbounds i8, i8* %57, i64 %65
%67 = load i8, i8* %66
%68 = call i32 @fputc(i8 signext %67, i32* %60)
%69 = add nuw nsw i64 %65, 1
%70 = icmp eq i64 %69, %63
br i1 %70, label %71, label %64
71: ; preds = %64, %49
%72 = call i32 @fprintf(i32* %60, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %2)
%73 = icmp slt i32 %50, %53
br i1 %73, label %74, label %84
74: ; preds = %71
%75 = sext i32 %50 to i64
br label %76
76: ; preds = %74, %76
%77 = phi i64 [ %75, %74 ], [ %81, %76 ]
%78 = getelementptr inbounds i8, i8* %57, i64 %77
%79 = load i8, i8* %78
%80 = call i32 @fputc(i8 signext %79, i32* %60)
%81 = add nsw i64 %77, 1
%82 = trunc i64 %81 to i32
%83 = icmp eq i32 %53, %82
br i1 %83, label %84, label %76
84: ; preds = %76, %71
%85 = call i32 @fclose(i32* %60)
%86 = call i32 @free(i8* %57)
br label %87
87: ; preds = %3, %84, %31, %12
%88 = phi i32 [ -1, %12 ], [ 1, %31 ], [ 0, %84 ], [ -1, %3 ]
ret i32 %88
}