#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;

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int read(int, char *, int);
int /*<<< orphan*/ remember_line(char *, int, int *, int *);
int strlen(char *);
int write(int, char *, int);
void file_write(int argc, char *arg) {
  char memory;
  char *buffer = &memory;
  char new_lines[10];
  int file_size = 0, count_found = 0, found = 0, hole_file = 1;
  ssize_t read_return_value;
  int fd = open(arg, O_RDONLY);
  ssize_t write_return_value;
  if (fd < 0) {
    perror("Error while opening");
  }
  do {
    read_return_value = read(fd, buffer, 1);
    if (read_return_value <= 0) {
      if (read_return_value < 0) {
        perror("Error while reading");
      }
      break;
    } else {
      file_size++;
      if (*buffer == '\n') {
        remember_line(new_lines, file_size, &count_found, &hole_file);
      }
    }
  } while ((read_return_value != 0) && (read_return_value != -1));
  int i = 0;
  if (argc > 1) {
    write_return_value = write(1, "\n", strlen("\n"));
    write_return_value = write(1, arg, strlen(arg));
    if (write_return_value < 0) {
      perror("Error while writing");
    }
    write_return_value = write(1, ":\n", strlen(":\n"));
    if (write_return_value < 0) {
      perror("Error while writing");
    }
  }
  fd = open(arg, O_RDONLY);
  if (fd < 0) {
    perror("Error while opening");
  }
  do {
    read_return_value = read(fd, buffer, 1);
    if (read_return_value <= 0) {
      if (read_return_value < 0) {
        perror("Error while reading");
      }
      break;
    } else {
      if (hole_file == 0) {
        file_size++;
        if ((file_size == new_lines[count_found]) || (found == 1)) {
          if ((file_size != new_lines[count_found])) {
            write_return_value = write(1, buffer, 1);
            if (write_return_value < 0) {
              perror("Error while writing");
            }
          }
          found = 1;
        }
      } else {
        write_return_value = write(1, buffer, 1);
        if (write_return_value < 0) {
          perror("Error while writing");
        }
      }
    }
  } while ((read_return_value != 0) && (read_return_value != -1));
}


x86 assembly (clang, -O0):
<file_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x11(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x1,-0x3c(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e4a(%rip),%rax
mov    (%rax),%esi
call   1070 <open@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jge    11be <file_write+0x5e>
lea    0xe47(%rip),%rdi
call   1080 <perror@plt>
jmp    11c3 <file_write+0x63>
mov    -0x44(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    $0x1,%edx
call   1060 <read@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
jg     11fc <file_write+0x9c>
cmpl   $0x0,-0x40(%rbp)
jge    11f7 <file_write+0x97>
lea    0xe22(%rip),%rdi
call   1080 <perror@plt>
jmp    1257 <file_write+0xf7>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    1229 <file_write+0xc9>
lea    -0x2a(%rbp),%rdi
mov    -0x30(%rbp),%esi
lea    -0x34(%rbp),%rdx
lea    -0x3c(%rbp),%rcx
call   1050 <remember_line@plt>
jmp    122e <file_write+0xce>
jmp    1233 <file_write+0xd3>
xor    %eax,%eax
cmpl   $0x0,-0x40(%rbp)
mov    %al,-0x4d(%rbp)
je     124c <file_write+0xec>
cmpl   $0xffffffff,-0x40(%rbp)
setne  %al
mov    %al,-0x4d(%rbp)
mov    -0x4d(%rbp),%al
test   $0x1,%al
jne    11c3 <file_write+0x63>
movl   $0x0,-0x4c(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    1301 <file_write+0x1a1>
lea    0xdce(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%edx
mov    $0x1,%edi
lea    0xdbb(%rip),%rsi
call   1030 <write@plt>
mov    %eax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x58(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1030 <write@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
jge    12c4 <file_write+0x164>
lea    0xd69(%rip),%rdi
call   1080 <perror@plt>
lea    0xd71(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%edx
mov    $0x1,%edi
lea    0xd5e(%rip),%rsi
call   1030 <write@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
jge    12fc <file_write+0x19c>
lea    0xd31(%rip),%rdi
call   1080 <perror@plt>
jmp    1301 <file_write+0x1a1>
mov    -0x10(%rbp),%rdi
mov    0x2cdc(%rip),%rax
mov    (%rax),%esi
call   1070 <open@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jge    132c <file_write+0x1cc>
lea    0xcd9(%rip),%rdi
call   1080 <perror@plt>
jmp    1331 <file_write+0x1d1>
mov    -0x44(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    $0x1,%edx
call   1060 <read@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
jg     136a <file_write+0x20a>
cmpl   $0x0,-0x40(%rbp)
jge    1365 <file_write+0x205>
lea    0xcb4(%rip),%rdi
call   1080 <perror@plt>
jmp    1445 <file_write+0x2e5>
cmpl   $0x0,-0x3c(%rbp)
jne    13e9 <file_write+0x289>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
movslq -0x34(%rbp),%rcx
movsbl -0x2a(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     139b <file_write+0x23b>
cmpl   $0x1,-0x38(%rbp)
jne    13e4 <file_write+0x284>
mov    -0x30(%rbp),%eax
movslq -0x34(%rbp),%rcx
movsbl -0x2a(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     13dd <file_write+0x27d>
mov    -0x20(%rbp),%rsi
mov    $0x1,%edx
mov    %edx,%edi
call   1030 <write@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
jge    13d8 <file_write+0x278>
lea    0xc55(%rip),%rdi
call   1080 <perror@plt>
jmp    13dd <file_write+0x27d>
movl   $0x1,-0x38(%rbp)
jmp    1417 <file_write+0x2b7>
mov    -0x20(%rbp),%rsi
mov    $0x1,%edx
mov    %edx,%edi
call   1030 <write@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
jge    1412 <file_write+0x2b2>
lea    0xc1b(%rip),%rdi
call   1080 <perror@plt>
jmp    1417 <file_write+0x2b7>
jmp    141c <file_write+0x2bc>
jmp    1421 <file_write+0x2c1>
xor    %eax,%eax
cmpl   $0x0,-0x40(%rbp)
mov    %al,-0x59(%rbp)
je     143a <file_write+0x2da>
cmpl   $0xffffffff,-0x40(%rbp)
setne  %al
mov    %al,-0x59(%rbp)
mov    -0x59(%rbp),%al
test   $0x1,%al
jne    1331 <file_write+0x1d1>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_write>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %edi,%r12d
movl   $0x0,0x8(%rsp)
movl   $0x1,0x4(%rsp)
mov    0x2e5d(%rip),%r15
mov    (%r15),%esi
mov    %r14,%rdi
call   1070 <open@plt>
mov    %eax,%ebp
test   %eax,%eax
js     1371 <file_write+0x211>
lea    0x3(%rsp),%rsi
mov    %ebp,%edi
mov    $0x1,%edx
call   1060 <read@plt>
test   %eax,%eax
jle    134c <file_write+0x1ec>
mov    %r12d,0xc(%rsp)
mov    %r14,0x10(%rsp)
xor    %ebx,%ebx
lea    0x1e(%rsp),%r12
lea    0x8(%rsp),%r13
lea    0x4(%rsp),%r15
lea    0x3(%rsp),%r14
jmp    11f3 <file_write+0x93>
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1060 <read@plt>
test   %eax,%eax
jle    120f <file_write+0xaf>
add    $0x1,%ebx
cmpb   $0xa,0x3(%rsp)
jne    11e0 <file_write+0x80>
mov    %r12,%rdi
mov    %ebx,%esi
mov    %r13,%rdx
mov    %r15,%rcx
call   1050 <remember_line@plt>
jmp    11e0 <file_write+0x80>
mov    0x10(%rsp),%r14
mov    0x2dcd(%rip),%r15
mov    0xc(%rsp),%r12d
test   %eax,%eax
js     1356 <file_write+0x1f6>
cmp    $0x2,%r12d
jl     1291 <file_write+0x131>
lea    0xe08(%rip),%rbp
mov    %rbp,%rdi
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %rbp,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <write@plt>
test   %eax,%eax
js     13a1 <file_write+0x241>
lea    0xdca(%rip),%rbp
mov    %rbp,%rdi
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %rbp,%rsi
mov    %eax,%edx
call   1030 <write@plt>
test   %eax,%eax
js     13b2 <file_write+0x252>
mov    (%r15),%esi
mov    %r14,%rdi
call   1070 <open@plt>
mov    %eax,%r12d
test   %eax,%eax
js     1382 <file_write+0x222>
lea    0x3(%rsp),%rsi
mov    %r12d,%edi
mov    $0x1,%edx
call   1060 <read@plt>
test   %eax,%eax
jle    1339 <file_write+0x1d9>
xor    %ebp,%ebp
lea    0x3(%rsp),%r14
lea    0xd5d(%rip),%r15
jmp    12fc <file_write+0x19c>
mov    $0x1,%ebp
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
test   %eax,%eax
js     132f <file_write+0x1cf>
mov    %r12d,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1060 <read@plt>
test   %eax,%eax
jle    1339 <file_write+0x1d9>
cmpl   $0x0,0x4(%rsp)
jne    12d2 <file_write+0x172>
add    $0x1,%ebx
movslq 0x8(%rsp),%rax
movsbl 0x1e(%rsp,%rax,1),%ecx
cmp    %ecx,%ebx
setne  %dl
cmp    $0x1,%ebp
setne  %al
and    %dl,%al
mov    %eax,%edx
xor    $0x1,%dl
movzbl %dl,%ebp
cmp    %ecx,%ebx
je     12e8 <file_write+0x188>
test   %al,%al
je     12cd <file_write+0x16d>
jmp    12e8 <file_write+0x188>
mov    %r15,%rdi
call   1080 <perror@plt>
jmp    12e8 <file_write+0x188>
test   %eax,%eax
js     1393 <file_write+0x233>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebx,%ebx
test   %eax,%eax
jns    1228 <file_write+0xc8>
lea    0xcb7(%rip),%rdi
call   1080 <perror@plt>
cmp    $0x2,%r12d
jge    122e <file_write+0xce>
jmp    1291 <file_write+0x131>
lea    0xc88(%rip),%rdi
call   1080 <perror@plt>
jmp    11a0 <file_write+0x40>
lea    0xc77(%rip),%rdi
call   1080 <perror@plt>
jmp    12a7 <file_write+0x147>
lea    0xc7a(%rip),%rdi
call   1080 <perror@plt>
jmp    133d <file_write+0x1dd>
lea    0xc80(%rip),%rdi
call   1080 <perror@plt>
jmp    126b <file_write+0x10b>
lea    0xc6f(%rip),%rdi
call   1080 <perror@plt>
jmp    1291 <file_write+0x131>

LLVM IR (-O0):
@O_RDONLY = global i32 0
@.str = [20 x i8] c"Error while opening\00"
@.str.1 = [20 x i8] c"Error while reading\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [20 x i8] c"Error while writing\00"
@.str.4 = [3 x i8] c":\0A\00"
define void @file_write(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8*
%7 = alloca [10 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
store i8* %5, i8** %6
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 1, i32* %11
%16 = load i8*, i8** %4
%17 = load i32, i32* @O_RDONLY
%18 = call i32 @open(i8* %16, i32 %17)
store i32 %18, i32* %13
%19 = load i32, i32* %13
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %2
%22 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %23
23: ; preds = %21, %2
br label %24
24: ; preds = %55, %23
%25 = load i32, i32* %13
%26 = load i8*, i8** %6
%27 = call i32 @read(i32 %25, i8* %26, i32 1)
store i32 %27, i32* %12
%28 = load i32, i32* %12
%29 = icmp sle i32 %28, 0
br i1 %29, label %30, label %36
30: ; preds = %24
%31 = load i32, i32* %12
%32 = icmp slt i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %35
35: ; preds = %33, %30
br label %57
36: ; preds = %24
%37 = load i32, i32* %8
%38 = add nsw i32 %37, 1
store i32 %38, i32* %8
%39 = load i8*, i8** %6
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 10
br i1 %42, label %43, label %47
43: ; preds = %36
%44 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%45 = load i32, i32* %8
%46 = call i32 @remember_line(i8* %44, i32 %45, i32* %9, i32* %11)
br label %47
47: ; preds = %43, %36
br label %48
48: ; preds = %47
br label %49
49: ; preds = %48
%50 = load i32, i32* %12
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %49
%53 = load i32, i32* %12
%54 = icmp ne i32 %53, -1
br label %55
55: ; preds = %52, %49
%56 = phi i1 [ false, %49 ], [ %54, %52 ]
br i1 %56, label %24, label %57
57: ; preds = %55, %35
store i32 0, i32* %15
%58 = load i32, i32* %3
%59 = icmp sgt i32 %58, 1
br i1 %59, label %60, label %79
60: ; preds = %57
%61 = call i32 @strlen(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%62 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %61)
store i32 %62, i32* %14
%63 = load i8*, i8** %4
%64 = load i8*, i8** %4
%65 = call i32 @strlen(i8* %64)
%66 = call i32 @write(i32 1, i8* %63, i32 %65)
store i32 %66, i32* %14
%67 = load i32, i32* %14
%68 = icmp slt i32 %67, 0
br i1 %68, label %69, label %71
69: ; preds = %60
%70 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %71
71: ; preds = %69, %60
%72 = call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%73 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %72)
store i32 %73, i32* %14
%74 = load i32, i32* %14
%75 = icmp slt i32 %74, 0
br i1 %75, label %76, label %78
76: ; preds = %71
%77 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %78
78: ; preds = %76, %71
br label %79
79: ; preds = %78, %57
%80 = load i8*, i8** %4
%81 = load i32, i32* @O_RDONLY
%82 = call i32 @open(i8* %80, i32 %81)
store i32 %82, i32* %13
%83 = load i32, i32* %13
%84 = icmp slt i32 %83, 0
br i1 %84, label %85, label %87
85: ; preds = %79
%86 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %87
87: ; preds = %85, %79
br label %88
88: ; preds = %150, %87
%89 = load i32, i32* %13
%90 = load i8*, i8** %6
%91 = call i32 @read(i32 %89, i8* %90, i32 1)
store i32 %91, i32* %12
%92 = load i32, i32* %12
%93 = icmp sle i32 %92, 0
br i1 %93, label %94, label %100
94: ; preds = %88
%95 = load i32, i32* %12
%96 = icmp slt i32 %95, 0
br i1 %96, label %97, label %99
97: ; preds = %94
%98 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %99
99: ; preds = %97, %94
br label %152
100: ; preds = %88
%101 = load i32, i32* %11
%102 = icmp eq i32 %101, 0
br i1 %102, label %103, label %134
103: ; preds = %100
%104 = load i32, i32* %8
%105 = add nsw i32 %104, 1
store i32 %105, i32* %8
%106 = load i32, i32* %8
%107 = load i32, i32* %9
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 %108
%110 = load i8, i8* %109
%111 = sext i8 %110 to i32
%112 = icmp eq i32 %106, %111
br i1 %112, label %116, label %113
113: ; preds = %103
%114 = load i32, i32* %10
%115 = icmp eq i32 %114, 1
br i1 %115, label %116, label %133
116: ; preds = %113, %103
%117 = load i32, i32* %8
%118 = load i32, i32* %9
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 %119
%121 = load i8, i8* %120
%122 = sext i8 %121 to i32
%123 = icmp ne i32 %117, %122
br i1 %123, label %124, label %132
124: ; preds = %116
%125 = load i8*, i8** %6
%126 = call i32 @write(i32 1, i8* %125, i32 1)
store i32 %126, i32* %14
%127 = load i32, i32* %14
%128 = icmp slt i32 %127, 0
br i1 %128, label %129, label %131
129: ; preds = %124
%130 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %131
131: ; preds = %129, %124
br label %132
132: ; preds = %131, %116
store i32 1, i32* %10
br label %133
133: ; preds = %132, %113
br label %142
134: ; preds = %100
%135 = load i8*, i8** %6
%136 = call i32 @write(i32 1, i8* %135, i32 1)
store i32 %136, i32* %14
%137 = load i32, i32* %14
%138 = icmp slt i32 %137, 0
br i1 %138, label %139, label %141
139: ; preds = %134
%140 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %141
141: ; preds = %139, %134
br label %142
142: ; preds = %141, %133
br label %143
143: ; preds = %142
br label %144
144: ; preds = %143
%145 = load i32, i32* %12
%146 = icmp ne i32 %145, 0
br i1 %146, label %147, label %150
147: ; preds = %144
%148 = load i32, i32* %12
%149 = icmp ne i32 %148, -1
br label %150
150: ; preds = %147, %144
%151 = phi i1 [ false, %144 ], [ %149, %147 ]
br i1 %151, label %88, label %152
152: ; preds = %150, %99
ret void
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@.str = [20 x i8] c"Error while opening\00"
@.str.1 = [20 x i8] c"Error while reading\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [20 x i8] c"Error while writing\00"
@.str.4 = [3 x i8] c":\0A\00"
define void @file_write(i32 %0, i8* %1) {
%3 = alloca i8
%4 = alloca [10 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%8 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%9 = bitcast i32* %6 to i8*
store i32 1, i32* %6
%10 = load i32, i32* @O_RDONLY
%11 = tail call i32 @open(i8* %1, i32 %10)
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = tail call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %2
%16 = call i32 @read(i32 %11, i8* %3, i32 1)
%17 = icmp slt i32 %16, 1
br i1 %17, label %18, label %24
18: ; preds = %31, %15
%19 = phi i32 [ 0, %15 ], [ %26, %31 ]
%20 = phi i32 [ %16, %15 ], [ %32, %31 ]
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %34
22: ; preds = %18
%23 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %34
24: ; preds = %15, %31
%25 = phi i32 [ %26, %31 ], [ 0, %15 ]
%26 = add nuw nsw i32 %25, 1
%27 = load i8, i8* %3
%28 = icmp eq i8 %27, 10
br i1 %28, label %29, label %31
29: ; preds = %24
%30 = call i32 @remember_line(i8* %7, i32 %26, i32* %5, i32* %6)
br label %31
31: ; preds = %29, %24
%32 = call i32 @read(i32 %11, i8* %3, i32 1)
%33 = icmp slt i32 %32, 1
br i1 %33, label %18, label %24
34: ; preds = %18, %22
%35 = icmp sgt i32 %0, 1
br i1 %35, label %36, label %50
36: ; preds = %34
%37 = call i32 @strlen(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%38 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %37)
%39 = call i32 @strlen(i8* %1)
%40 = call i32 @write(i32 1, i8* %1, i32 %39)
%41 = icmp slt i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %36
%43 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %44
44: ; preds = %42, %36
%45 = call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%46 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %45)
%47 = icmp slt i32 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %50
50: ; preds = %44, %48, %34
%51 = load i32, i32* @O_RDONLY
%52 = call i32 @open(i8* %1, i32 %51)
%53 = icmp slt i32 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %56
56: ; preds = %54, %50
%57 = call i32 @read(i32 %52, i8* %3, i32 1)
%58 = icmp slt i32 %57, 1
br i1 %58, label %59, label %64
59: ; preds = %93, %56
%60 = phi i32 [ %57, %56 ], [ %96, %93 ]
%61 = icmp slt i32 %60, 0
br i1 %61, label %62, label %98
62: ; preds = %59
%63 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %98
64: ; preds = %56, %93
%65 = phi i32 [ %95, %93 ], [ %19, %56 ]
%66 = phi i32 [ %94, %93 ], [ 0, %56 ]
%67 = load i32, i32* %6
%68 = icmp eq i32 %67, 0
br i1 %68, label %69, label %86
69: ; preds = %64
%70 = add nsw i32 %65, 1
%71 = load i32, i32* %5
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 %72
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = icmp eq i32 %70, %75
%77 = icmp ne i32 %66, 1
%78 = xor i1 %76, true
%79 = select i1 %78, i1 %77, i1 false
%80 = or i1 %76, %79
%81 = xor i1 %79, true
%82 = zext i1 %81 to i32
br i1 %80, label %93, label %83
83: ; preds = %69
%84 = call i32 @write(i32 1, i8* %3, i32 1)
%85 = icmp slt i32 %84, 0
br i1 %85, label %89, label %93
86: ; preds = %64
%87 = call i32 @write(i32 1, i8* %3, i32 1)
%88 = icmp slt i32 %87, 0
br i1 %88, label %89, label %93
89: ; preds = %86, %83
%90 = phi i32 [ 1, %83 ], [ %66, %86 ]
%91 = phi i32 [ %70, %83 ], [ %65, %86 ]
%92 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %93
93: ; preds = %89, %69, %83, %86
%94 = phi i32 [ %82, %69 ], [ %66, %86 ], [ 1, %83 ], [ %90, %89 ]
%95 = phi i32 [ %70, %69 ], [ %65, %86 ], [ %70, %83 ], [ %91, %89 ]
%96 = call i32 @read(i32 %52, i8* %3, i32 1)
%97 = icmp slt i32 %96, 1
br i1 %97, label %59, label %64
98: ; preds = %59, %62
ret void
}