#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 /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
scalar_t__ close(int);
int /*<<< orphan*/ free(char *);
int lseek(int, int, int /*<<< orphan*/);
scalar_t__ malloc(int);
int open(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ read(int, char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char const *argv[]) {
  int end_pos, cur_pos;
  int i, k;
  int table[100];
  for (i = 0; i < 100; i++) {
    table[i] = 0;
  }
  int fd = open(argv[1], O_RDONLY);
  if (-1 == fd) {
    perror("Cannot open file");
    return 0;
  }
  char buf[1];
  i = 1;
  end_pos = lseek(fd, 0, SEEK_END);
  cur_pos = lseek(fd, 0, SEEK_SET);
  while (cur_pos != end_pos) {
    read(fd, buf, 1);
    printf("%c", buf[0]);
    if ('\n' == buf[0]) {
      table[i] = lseek(fd, 0, SEEK_CUR);
      i++;
    }
    cur_pos++;
  }
  printf("\n-1%d lines\n", i);
  int line_number;
  char *str;
  while (1) {
    printf("\nEnter -1 to exit\n");
    printf("Enter line number: ");
    scanf("%d", &line_number);
    if (-1 == line_number) {
      break;
    }
    if (line_number > i - 1) {
      printf("Sorry text has no %dth line. \n", line_number);
    } else {
      int len = table[line_number] - table[line_number - 1] + 1;
      str = (char *)malloc(sizeof(char) * len);
      lseek(fd, table[line_number - 1], SEEK_SET);
      read(fd, str, len);
      str[len - 1] = '\0';
      printf("%d: %s", line_number, str);
      free(str);
    }
  }
  lseek(fd, 0, SEEK_SET);
  if (0 != close(fd)) {
    perror("Cannot close file");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x64,-0x1c(%rbp)
jge    11d7 <main+0x47>
movslq -0x1c(%rbp),%rax
movl   $0x0,-0x1b0(%rbp,%rax,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b0 <main+0x20>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2df2(%rip),%rax
mov    (%rax),%esi
call   10a0 <open@plt>
mov    %eax,-0x1b4(%rbp)
mov    $0xffffffff,%eax
cmp    -0x1b4(%rbp),%eax
jne    121c <main+0x8c>
lea    0xdf5(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x0,-0x4(%rbp)
jmp    145d <main+0x2cd>
movl   $0x1,-0x1c(%rbp)
mov    -0x1b4(%rbp),%edi
mov    0x2db8(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <lseek@plt>
mov    %eax,-0x14(%rbp)
mov    -0x1b4(%rbp),%edi
mov    0x2d7f(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <lseek@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     12db <main+0x14b>
mov    -0x1b4(%rbp),%edi
lea    -0x1b5(%rbp),%rsi
mov    $0x1,%edx
call   1070 <read@plt>
movsbl -0x1b5(%rbp),%esi
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsbl -0x1b5(%rbp),%ecx
mov    $0xa,%eax
cmp    %ecx,%eax
jne    12cd <main+0x13d>
mov    -0x1b4(%rbp),%edi
mov    0x2d32(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <lseek@plt>
mov    %eax,%ecx
movslq -0x1c(%rbp),%rax
mov    %ecx,-0x1b0(%rbp,%rax,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1255 <main+0xc5>
mov    -0x1c(%rbp),%esi
lea    0xd2f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd2e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd33(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd39(%rip),%rdi
lea    -0x1bc(%rbp),%rsi
call   1090 <scanf@plt>
mov    $0xffffffff,%eax
cmp    -0x1bc(%rbp),%eax
jne    1331 <main+0x1a1>
jmp    1422 <main+0x292>
mov    -0x1bc(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jle    135e <main+0x1ce>
mov    -0x1bc(%rbp),%esi
lea    0xcf9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    141d <main+0x28d>
movslq -0x1bc(%rbp),%rax
mov    -0x1b0(%rbp,%rax,4),%eax
mov    -0x1bc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
sub    -0x1b0(%rbp,%rcx,4),%eax
add    $0x1,%eax
mov    %eax,-0x1cc(%rbp)
movslq -0x1cc(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x1c8(%rbp)
mov    -0x1b4(%rbp),%edi
mov    -0x1bc(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x1b0(%rbp,%rax,4),%esi
mov    0x2c08(%rip),%rax
mov    (%rax),%edx
call   1050 <lseek@plt>
mov    -0x1b4(%rbp),%edi
mov    -0x1c8(%rbp),%rsi
mov    -0x1cc(%rbp),%edx
call   1070 <read@plt>
mov    -0x1c8(%rbp),%rax
mov    -0x1cc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x1bc(%rbp),%esi
mov    -0x1c8(%rbp),%rdx
lea    0xc60(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c8(%rbp),%rdi
call   1030 <free@plt>
jmp    12ec <main+0x15c>
mov    -0x1b4(%rbp),%edi
mov    0x2b99(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <lseek@plt>
mov    -0x1b4(%rbp),%edi
call   1060 <close@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     145d <main+0x2cd>
lea    0xc19(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x4(%rbp),%eax
add    $0x1d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1a8,%rsp
mov    %rsi,%rbx
lea    0x10(%rsp),%rdi
mov    $0x190,%edx
xor    %esi,%esi
call   1080 <memset@plt>
mov    0x8(%rbx),%rdi
mov    0x2de8(%rip),%rax
mov    (%rax),%esi
call   10d0 <open@plt>
cmp    $0xffffffff,%eax
je     1416 <main+0x256>
mov    %eax,%r15d
mov    0x2dde(%rip),%rax
mov    (%rax),%edx
mov    %r15d,%edi
xor    %esi,%esi
call   1070 <lseek@plt>
mov    %eax,%ebp
mov    0x2da9(%rip),%rax
mov    (%rax),%edx
mov    %r15d,%edi
xor    %esi,%esi
call   1070 <lseek@plt>
mov    $0x1,%r12d
cmp    %ebp,%eax
jne    13b4 <main+0x1f4>
mov    %r15d,0xc(%rsp)
lea    0xdcc(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe17(%rip),%rdi
call   1050 <puts@plt>
lea    0xdbc(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xdc2(%rip),%rdi
lea    0x8(%rsp),%rsi
call   10c0 <scanf@plt>
mov    0x8(%rsp),%esi
cmp    $0xffffffff,%esi
je     137a <main+0x1ba>
lea    0xddf(%rip),%rbp
lea    0xd89(%rip),%rbx
lea    0xd96(%rip),%r15
lea    0x8(%rsp),%r14
jmp    1361 <main+0x1a1>
cs nopw 0x0(%rax,%rax,1)
movslq %esi,%rax
movslq 0x10(%rsp,%rax,4),%r13
movslq 0xc(%rsp,%rax,4),%rax
sub    %rax,%r13
lea    0x1(%r13),%ebp
mov    %ebp,%edi
call   10b0 <malloc@plt>
mov    %rax,%rbx
movslq 0x8(%rsp),%rax
mov    0xc(%rsp,%rax,4),%esi
mov    0x2cea(%rip),%rax
mov    (%rax),%edx
mov    %r15,%r14
mov    %r12,%r15
mov    0xc(%rsp),%r12d
mov    %r12d,%edi
call   1070 <lseek@plt>
mov    %r12d,%edi
mov    %r15,%r12
mov    %r14,%r15
lea    0x8(%rsp),%r14
mov    %rbx,%rsi
mov    %ebp,%edx
call   10a0 <read@plt>
movb   $0x0,(%rbx,%r13,1)
mov    0x8(%rsp),%esi
lea    0xd39(%rip),%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
lea    0xd3e(%rip),%rbp
lea    0xce8(%rip),%rbx
call   1030 <free@plt>
mov    %rbp,%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   10c0 <scanf@plt>
mov    0x8(%rsp),%esi
cmp    $0xffffffff,%esi
je     137a <main+0x1ba>
cmp    %r12d,%esi
jl     12b0 <main+0xf0>
lea    0xcc4(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    133b <main+0x17b>
mov    0x2c47(%rip),%rax
mov    (%rax),%edx
mov    0xc(%rsp),%ebx
mov    %ebx,%edi
xor    %esi,%esi
call   1070 <lseek@plt>
mov    %ebx,%edi
call   1090 <close@plt>
test   %rax,%rax
jne    141f <main+0x25f>
xor    %eax,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
sub    %eax,%ebp
mov    $0x1,%r12d
lea    0x7(%rsp),%r14
mov    0x2c18(%rip),%r13
jmp    13d9 <main+0x219>
nopw   0x0(%rax,%rax,1)
add    $0xffffffff,%ebp
je     1239 <main+0x79>
mov    %r15d,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   10a0 <read@plt>
movsbl 0x7(%rsp),%ebx
mov    %ebx,%edi
call   1040 <putchar@plt>
cmp    $0xa,%ebx
jne    13d0 <main+0x210>
mov    0x0(%r13),%edx
mov    %r15d,%edi
xor    %esi,%esi
call   1070 <lseek@plt>
movslq %r12d,%r12
mov    %eax,0x10(%rsp,%r12,4)
add    $0x1,%r12d
jmp    13d0 <main+0x210>
lea    0xbe3(%rip),%rdi
jmp    1426 <main+0x266>
lea    0xc35(%rip),%rdi
call   10e0 <perror@plt>
jmp    13a0 <main+0x1e0>

LLVM IR (-O0):
@O_RDONLY = global i32 0
@.str = [17 x i8] c"Cannot open file\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.1 = [3 x i8] c"%c\00"
@SEEK_CUR = global i32 0
@.str.2 = [13 x i8] c"\0A-1%d lines\0A\00"
@.str.3 = [19 x i8] c"\0AEnter -1 to exit\0A\00"
@.str.4 = [20 x i8] c"Enter line number: \00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [31 x i8] c"Sorry text has no %dth line. \0A\00"
@.str.7 = [7 x i8] c"%d: %s\00"
@.str.8 = [18 x i8] c"Cannot close file\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 i32
%9 = alloca i32
%10 = alloca [100 x i32]
%11 = alloca i32
%12 = alloca [1 x i8]
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
br label %16
16: ; preds = %23, %2
%17 = load i32, i32* %8
%18 = icmp slt i32 %17, 100
br i1 %18, label %19, label %26
19: ; preds = %16
%20 = load i32, i32* %8
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [100 x i32], [100 x i32]* %10, i64 0, i64 %21
store i32 0, i32* %22
br label %23
23: ; preds = %19
%24 = load i32, i32* %8
%25 = add nsw i32 %24, 1
store i32 %25, i32* %8
br label %16
26: ; preds = %16
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = load i32, i32* @O_RDONLY
%31 = call i32 @open(i8* %29, i32 %30)
store i32 %31, i32* %11
%32 = load i32, i32* %11
%33 = icmp eq i32 -1, %32
br i1 %33, label %34, label %36
34: ; preds = %26
%35 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %139
36: ; preds = %26
store i32 1, i32* %8
%37 = load i32, i32* %11
%38 = load i32, i32* @SEEK_END
%39 = call i32 @lseek(i32 %37, i32 0, i32 %38)
store i32 %39, i32* %6
%40 = load i32, i32* %11
%41 = load i32, i32* @SEEK_SET
%42 = call i32 @lseek(i32 %40, i32 0, i32 %41)
store i32 %42, i32* %7
br label %43
43: ; preds = %68, %36
%44 = load i32, i32* %7
%45 = load i32, i32* %6
%46 = icmp ne i32 %44, %45
br i1 %46, label %47, label %71
47: ; preds = %43
%48 = load i32, i32* %11
%49 = getelementptr inbounds [1 x i8], [1 x i8]* %12, i64 0, i64 0
%50 = call i32 @read(i32 %48, i8* %49, i32 1)
%51 = getelementptr inbounds [1 x i8], [1 x i8]* %12, i64 0, i64 0
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %53)
%55 = getelementptr inbounds [1 x i8], [1 x i8]* %12, i64 0, i64 0
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = icmp eq i32 10, %57
br i1 %58, label %59, label %68
59: ; preds = %47
%60 = load i32, i32* %11
%61 = load i32, i32* @SEEK_CUR
%62 = call i32 @lseek(i32 %60, i32 0, i32 %61)
%63 = load i32, i32* %8
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [100 x i32], [100 x i32]* %10, i64 0, i64 %64
store i32 %62, i32* %65
%66 = load i32, i32* %8
%67 = add nsw i32 %66, 1
store i32 %67, i32* %8
br label %68
68: ; preds = %59, %47
%69 = load i32, i32* %7
%70 = add nsw i32 %69, 1
store i32 %70, i32* %7
br label %43
71: ; preds = %43
%72 = load i32, i32* %8
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %72)
br label %74
74: ; preds = %71, %129
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%77 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %13)
%78 = load i32, i32* %13
%79 = icmp eq i32 -1, %78
br i1 %79, label %80, label %81
80: ; preds = %74
br label %130
81: ; preds = %74
%82 = load i32, i32* %13
%83 = load i32, i32* %8
%84 = sub nsw i32 %83, 1
%85 = icmp sgt i32 %82, %84
br i1 %85, label %86, label %89
86: ; preds = %81
%87 = load i32, i32* %13
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i32 %87)
br label %129
89: ; preds = %81
%90 = load i32, i32* %13
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [100 x i32], [100 x i32]* %10, i64 0, i64 %91
%93 = load i32, i32* %92
%94 = load i32, i32* %13
%95 = sub nsw i32 %94, 1
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [100 x i32], [100 x i32]* %10, i64 0, i64 %96
%98 = load i32, i32* %97
%99 = sub nsw i32 %93, %98
%100 = add nsw i32 %99, 1
store i32 %100, i32* %15
%101 = load i32, i32* %15
%102 = sext i32 %101 to i64
%103 = mul i64 1, %102
%104 = trunc i64 %103 to i32
%105 = call i64 @malloc(i32 %104)
%106 = inttoptr i64 %105 to i8*
store i8* %106, i8** %14
%107 = load i32, i32* %11
%108 = load i32, i32* %13
%109 = sub nsw i32 %108, 1
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds [100 x i32], [100 x i32]* %10, i64 0, i64 %110
%112 = load i32, i32* %111
%113 = load i32, i32* @SEEK_SET
%114 = call i32 @lseek(i32 %107, i32 %112, i32 %113)
%115 = load i32, i32* %11
%116 = load i8*, i8** %14
%117 = load i32, i32* %15
%118 = call i32 @read(i32 %115, i8* %116, i32 %117)
%119 = load i8*, i8** %14
%120 = load i32, i32* %15
%121 = sub nsw i32 %120, 1
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds i8, i8* %119, i64 %122
store i8 0, i8* %123
%124 = load i32, i32* %13
%125 = load i8*, i8** %14
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 %124, i8* %125)
%127 = load i8*, i8** %14
%128 = call i32 @free(i8* %127)
br label %129
129: ; preds = %89, %86
br label %74
130: ; preds = %80
%131 = load i32, i32* %11
%132 = load i32, i32* @SEEK_SET
%133 = call i32 @lseek(i32 %131, i32 0, i32 %132)
%134 = load i32, i32* %11
%135 = call i64 @close(i32 %134)
%136 = icmp ne i64 0, %135
br i1 %136, label %137, label %139
137: ; preds = %130
%138 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
br label %139
139: ; preds = %34, %137, %130
%140 = load i32, i32* %3
ret i32 %140
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@.str = [17 x i8] c"Cannot open file\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@SEEK_CUR = global i32 0
@.str.2 = [13 x i8] c"\0A-1%d lines\0A\00"
@.str.4 = [20 x i8] c"Enter line number: \00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [31 x i8] c"Sorry text has no %dth line. \0A\00"
@.str.7 = [7 x i8] c"%d: %s\00"
@.str.8 = [18 x i8] c"Cannot close file\00"
@str = [18 x i8] c"\0AEnter -1 to exit\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x i32]
%4 = bitcast [100 x i32]* %3 to i8*
%5 = alloca [1 x i8]
%6 = alloca i32
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = load i32, i32* @O_RDONLY
%10 = tail call i32 @open(i8* %8, i32 %9)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %92
14: ; preds = %2
%15 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
%16 = load i32, i32* @SEEK_END
%17 = tail call i32 @lseek(i32 %10, i32 0, i32 %16)
%18 = load i32, i32* @SEEK_SET
%19 = tail call i32 @lseek(i32 %10, i32 0, i32 %18)
%20 = icmp eq i32 %19, %17
br i1 %20, label %39, label %21
21: ; preds = %14, %35
%22 = phi i32 [ %37, %35 ], [ %19, %14 ]
%23 = phi i32 [ %36, %35 ], [ 1, %14 ]
%24 = call i32 @read(i32 %10, i8* %15, i32 1)
%25 = load i8, i8* %15
%26 = sext i8 %25 to i32
%27 = tail call i32 @putchar(i32 %26)
%28 = icmp eq i8 %25, 10
br i1 %28, label %29, label %35
29: ; preds = %21
%30 = load i32, i32* @SEEK_CUR
%31 = tail call i32 @lseek(i32 %10, i32 0, i32 %30)
%32 = sext i32 %23 to i64
%33 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %32
store i32 %31, i32* %33
%34 = add nsw i32 %23, 1
br label %35
35: ; preds = %29, %21
%36 = phi i32 [ %34, %29 ], [ %23, %21 ]
%37 = add nsw i32 %22, 1
%38 = icmp eq i32 %37, %17
br i1 %38, label %39, label %21
39: ; preds = %35, %14
%40 = phi i32 [ 1, %14 ], [ %36, %35 ]
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %40)
%42 = bitcast i32* %6 to i8*
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%45 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %6)
%46 = load i32, i32* %6
%47 = icmp eq i32 %46, -1
br i1 %47, label %84, label %48
48: ; preds = %39, %78
%49 = phi i32 [ %82, %78 ], [ %46, %39 ]
%50 = icmp slt i32 %49, %40
br i1 %50, label %53, label %51
51: ; preds = %48
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i32 %49)
br label %78
53: ; preds = %48
%54 = sext i32 %49 to i64
%55 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %54
%56 = load i32, i32* %55
%57 = add nsw i32 %49, -1
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %58
%60 = load i32, i32* %59
%61 = sub nsw i32 %56, %60
%62 = add nsw i32 %61, 1
%63 = call i64 @malloc(i32 %62)
%64 = inttoptr i64 %63 to i8*
%65 = load i32, i32* %6
%66 = add nsw i32 %65, -1
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %67
%69 = load i32, i32* %68
%70 = load i32, i32* @SEEK_SET
%71 = call i32 @lseek(i32 %10, i32 %69, i32 %70)
%72 = call i32 @read(i32 %10, i8* %64, i32 %62)
%73 = sext i32 %61 to i64
%74 = getelementptr inbounds i8, i8* %64, i64 %73
store i8 0, i8* %74
%75 = load i32, i32* %6
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 %75, i8* %64)
%77 = call i32 @free(i8* %64)
br label %78
78: ; preds = %53, %51
%79 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%81 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %6)
%82 = load i32, i32* %6
%83 = icmp eq i32 %82, -1
br i1 %83, label %84, label %48
84: ; preds = %78, %39
%85 = load i32, i32* @SEEK_SET
%86 = call i32 @lseek(i32 %10, i32 0, i32 %85)
%87 = call i64 @close(i32 %10)
%88 = icmp eq i64 %87, 0
br i1 %88, label %91, label %89
89: ; preds = %84
%90 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
br label %91
91: ; preds = %89, %84
br label %92
92: ; preds = %91, %12
ret i32 0
}