#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*/ time_t;
struct pollfd {
  int events;
  int revents;
  int /*<<< orphan*/ fd;
};

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int POLLIN;
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ STDIN_FILENO;
scalar_t__ close(int);
int /*<<< orphan*/ exit(int);
int lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
int open(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int poll(struct pollfd *, int, int);
int /*<<< orphan*/ print_line(int, int, int *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ read(int, char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char const *argv[]) {
  time_t time_end, time_start;
  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++;
  }
  int number_of_strings = i;
  int line_number;
  int is_read = 0;
  struct pollfd fds[1];
  fds[0].fd = STDIN_FILENO;
  fds[0].events = POLLIN;
  while (1) {
    is_read = 0;
    int count = poll(fds, 1, 5 * 1000);
    if (count == -1) {
      perror("poll failed");
      exit(1);
    }
    if (count == 0) {
      printf("No data for reading/writing\n");
    }
    if (fds[0].revents & POLLIN) {
      scanf("%d", &line_number);
      is_read = 1;
    }
    if (!is_read) {
      int j;
      for (j = 1; j < number_of_strings; j++) {
        print_line(j, number_of_strings, table, fd);
      }
      break;
    } else {
      if (-1 == line_number) {
        break;
      }
      print_line(line_number, number_of_strings, table, fd);
    }
  }
  lseek(fd, 0, SEEK_SET);
  if (0 != close(fd)) {
    perror("Cannot close file");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x64,-0x24(%rbp)
jge    11e7 <main+0x47>
movslq -0x24(%rbp),%rax
movl   $0x0,-0x1c0(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11c0 <main+0x20>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2de2(%rip),%rax
mov    (%rax),%esi
call   10a0 <open@plt>
mov    %eax,-0x1c4(%rbp)
mov    $0xffffffff,%eax
cmp    -0x1c4(%rbp),%eax
jne    122c <main+0x8c>
lea    0xde5(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x0,-0x4(%rbp)
jmp    1489 <main+0x2e9>
movl   $0x1,-0x24(%rbp)
mov    -0x1c4(%rbp),%edi
mov    0x2da8(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <lseek@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c4(%rbp),%edi
mov    0x2d67(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <lseek@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     12eb <main+0x14b>
mov    -0x1c4(%rbp),%edi
lea    -0x1c5(%rbp),%rsi
mov    $0x1,%edx
call   1070 <read@plt>
movsbl -0x1c5(%rbp),%esi
lea    0xd7b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsbl -0x1c5(%rbp),%ecx
mov    $0xa,%eax
cmp    %ecx,%eax
jne    12dd <main+0x13d>
mov    -0x1c4(%rbp),%edi
mov    0x2d22(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <lseek@plt>
mov    %eax,%ecx
movslq -0x24(%rbp),%rax
mov    %ecx,-0x1c0(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1265 <main+0xc5>
mov    -0x24(%rbp),%eax
mov    %eax,-0x1cc(%rbp)
movl   $0x0,-0x1d4(%rbp)
mov    0x2cb3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1d8(%rbp)
mov    0x2cbc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1e0(%rbp)
movl   $0x0,-0x1d4(%rbp)
lea    -0x1e0(%rbp),%rdi
mov    $0x1,%esi
mov    $0x1388,%edx
call   1090 <poll@plt>
mov    %eax,-0x1e4(%rbp)
cmpl   $0xffffffff,-0x1e4(%rbp)
jne    1365 <main+0x1c5>
lea    0xcbe(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
cmpl   $0x0,-0x1e4(%rbp)
jne    1380 <main+0x1e0>
lea    0xca7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1dc(%rbp),%eax
mov    0x2c43(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     13b5 <main+0x215>
lea    0xc9e(%rip),%rdi
lea    -0x1d0(%rbp),%rsi
call   1080 <scanf@plt>
movl   $0x1,-0x1d4(%rbp)
cmpl   $0x0,-0x1d4(%rbp)
jne    1415 <main+0x275>
movl   $0x1,-0x1e8(%rbp)
mov    -0x1e8(%rbp),%eax
cmp    -0x1cc(%rbp),%eax
jge    1410 <main+0x270>
mov    -0x1e8(%rbp),%edi
mov    -0x1cc(%rbp),%esi
lea    -0x1c0(%rbp),%rdx
mov    -0x1c4(%rbp),%ecx
call   1030 <print_line@plt>
mov    -0x1e8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e8(%rbp)
jmp    13cc <main+0x22c>
jmp    144e <main+0x2ae>
mov    $0xffffffff,%eax
cmp    -0x1d0(%rbp),%eax
jne    142b <main+0x28b>
jmp    144e <main+0x2ae>
mov    -0x1d0(%rbp),%edi
mov    -0x1cc(%rbp),%esi
lea    -0x1c0(%rbp),%rdx
mov    -0x1c4(%rbp),%ecx
call   1030 <print_line@plt>
jmp    131c <main+0x17c>
mov    -0x1c4(%rbp),%edi
mov    0x2b65(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <lseek@plt>
mov    -0x1c4(%rbp),%edi
call   1060 <close@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1489 <main+0x2e9>
lea    0xbbc(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x4(%rbp),%eax
add    $0x1f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1b8,%rsp
mov    %rsi,%rbx
lea    0x20(%rsp),%rdi
mov    $0x190,%edx
xor    %esi,%esi
call   1070 <memset@plt>
mov    0x8(%rbx),%rdi
mov    0x2de8(%rip),%rax
mov    (%rax),%esi
call   10c0 <open@plt>
cmp    $0xffffffff,%eax
je     13a6 <main+0x1e6>
mov    %eax,%r14d
mov    0x2dde(%rip),%rax
mov    (%rax),%edx
mov    %r14d,%edi
xor    %esi,%esi
call   1060 <lseek@plt>
mov    %eax,%ebp
mov    0x2da1(%rip),%rax
mov    (%rax),%edx
mov    %r14d,%edi
xor    %esi,%esi
call   1060 <lseek@plt>
mov    $0x1,%r12d
cmp    %ebp,%eax
jne    1340 <main+0x180>
mov    0x2d78(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x18(%rsp)
mov    0x2d83(%rip),%rbx
mov    (%rbx),%eax
mov    %eax,0x10(%rsp)
lea    0xdc3(%rip),%r13
lea    0xc(%rsp),%rbp
lea    0x20(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0x10(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1388,%edx
call   10b0 <poll@plt>
test   %eax,%eax
je     12a0 <main+0xe0>
cmp    $0xffffffff,%eax
jne    12ac <main+0xec>
jmp    13c0 <main+0x200>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xd8b(%rip),%rdi
call   1040 <puts@plt>
mov    (%rbx),%eax
test   %eax,0x14(%rsp)
je     12d8 <main+0x118>
mov    %r13,%rdi
mov    %rbp,%rsi
call   10a0 <scanf@plt>
mov    0xc(%rsp),%edi
cmp    $0xffffffff,%edi
je     1308 <main+0x148>
mov    %r12d,%esi
mov    %r15,%rdx
mov    %r14d,%ecx
call   1050 <print_line@plt>
jmp    1270 <main+0xb0>
cmp    $0x2,%r12d
jl     1308 <main+0x148>
mov    $0x1,%ebp
lea    0x20(%rsp),%r15
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r12d,%esi
mov    %r15,%rdx
mov    %r14d,%ecx
call   1050 <print_line@plt>
add    $0x1,%ebp
cmp    %ebp,%r12d
jne    12f0 <main+0x130>
mov    0x2cb1(%rip),%rax
mov    (%rax),%edx
mov    %r14d,%edi
xor    %esi,%esi
call   1060 <lseek@plt>
mov    %r14d,%edi
call   1080 <close@plt>
test   %rax,%rax
jne    13af <main+0x1ef>
xor    %eax,%eax
add    $0x1b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
sub    %eax,%ebp
mov    $0x1,%r12d
lea    0xb(%rsp),%r15
mov    0x2c8c(%rip),%r13
jmp    1369 <main+0x1a9>
cs nopw 0x0(%rax,%rax,1)
add    $0xffffffff,%ebp
je     1239 <main+0x79>
mov    %r14d,%edi
mov    %r15,%rsi
mov    $0x1,%edx
call   1090 <read@plt>
movsbl 0xb(%rsp),%ebx
mov    %ebx,%edi
call   1030 <putchar@plt>
cmp    $0xa,%ebx
jne    1360 <main+0x1a0>
mov    0x0(%r13),%edx
mov    %r14d,%edi
xor    %esi,%esi
call   1060 <lseek@plt>
movslq %r12d,%r12
mov    %eax,0x20(%rsp,%r12,4)
add    $0x1,%r12d
jmp    1360 <main+0x1a0>
lea    0xc53(%rip),%rdi
jmp    13b6 <main+0x1f6>
lea    0xc6a(%rip),%rdi
call   10d0 <perror@plt>
jmp    132c <main+0x16c>
lea    0xc4a(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>

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

LLVM IR (-O2):
%struct.pollfd = type { i32, i32, i32 }
@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
@STDIN_FILENO = global i32 0
@POLLIN = global i32 0
@.str.2 = [12 x i8] c"poll failed\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [18 x i8] c"Cannot close file\00"
@str = [28 x i8] c"No data for reading/writing\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 = alloca [1 x %struct.pollfd]
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = load i32, i32* @O_RDONLY
%11 = tail call i32 @open(i8* %9, i32 %10)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %84
15: ; preds = %2
%16 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
%17 = load i32, i32* @SEEK_END
%18 = tail call i32 @lseek(i32 %11, i32 0, i32 %17)
%19 = load i32, i32* @SEEK_SET
%20 = tail call i32 @lseek(i32 %11, i32 0, i32 %19)
%21 = icmp eq i32 %20, %18
br i1 %21, label %40, label %22
22: ; preds = %15, %36
%23 = phi i32 [ %38, %36 ], [ %20, %15 ]
%24 = phi i32 [ %37, %36 ], [ 1, %15 ]
%25 = call i32 @read(i32 %11, i8* %16, i32 1)
%26 = load i8, i8* %16
%27 = sext i8 %26 to i32
%28 = tail call i32 @putchar(i32 %27)
%29 = icmp eq i8 %26, 10
br i1 %29, label %30, label %36
30: ; preds = %22
%31 = load i32, i32* @SEEK_CUR
%32 = tail call i32 @lseek(i32 %11, i32 0, i32 %31)
%33 = sext i32 %24 to i64
%34 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %33
store i32 %32, i32* %34
%35 = add nsw i32 %24, 1
br label %36
36: ; preds = %30, %22
%37 = phi i32 [ %35, %30 ], [ %24, %22 ]
%38 = add nsw i32 %23, 1
%39 = icmp eq i32 %38, %18
br i1 %39, label %40, label %22
40: ; preds = %36, %15
%41 = phi i32 [ 1, %15 ], [ %37, %36 ]
%42 = bitcast i32* %6 to i8*
%43 = bitcast [1 x %struct.pollfd]* %7 to i8*
%44 = load i32, i32* @STDIN_FILENO
%45 = getelementptr inbounds [1 x %struct.pollfd], [1 x %struct.pollfd]* %7, i64 0, i64 0
%46 = getelementptr inbounds [1 x %struct.pollfd], [1 x %struct.pollfd]* %7, i64 0, i64 0, i32 2
store i32 %44, i32* %46
%47 = load i32, i32* @POLLIN
%48 = getelementptr inbounds [1 x %struct.pollfd], [1 x %struct.pollfd]* %7, i64 0, i64 0, i32 0
store i32 %47, i32* %48
%49 = getelementptr inbounds [1 x %struct.pollfd], [1 x %struct.pollfd]* %7, i64 0, i64 0, i32 1
%50 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 0
br label %51
51: ; preds = %74, %40
%52 = call i32 @poll(%struct.pollfd* %45, i32 1, i32 5000)
switch i32 %52, label %58 [
i32 -1, label %53
i32 0, label %56
]
53: ; preds = %51
%54 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%55 = call i32 @exit(i32 1)
unreachable
56: ; preds = %51
%57 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %58
58: ; preds = %51, %56
%59 = load i32, i32* %49
%60 = load i32, i32* @POLLIN
%61 = and i32 %60, %59
%62 = icmp eq i32 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %58
%64 = icmp sgt i32 %41, 1
br i1 %64, label %69, label %76
65: ; preds = %58
%66 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %6)
%67 = load i32, i32* %6
%68 = icmp eq i32 %67, -1
br i1 %68, label %76, label %74
69: ; preds = %63, %69
%70 = phi i32 [ %72, %69 ], [ 1, %63 ]
%71 = call i32 @print_line(i32 %70, i32 %41, i32* %50, i32 %11)
%72 = add nuw nsw i32 %70, 1
%73 = icmp eq i32 %72, %41
br i1 %73, label %76, label %69
74: ; preds = %65
%75 = call i32 @print_line(i32 %67, i32 %41, i32* %50, i32 %11)
br label %51
76: ; preds = %65, %69, %63
%77 = load i32, i32* @SEEK_SET
%78 = call i32 @lseek(i32 %11, i32 0, i32 %77)
%79 = call i64 @close(i32 %11)
%80 = icmp eq i64 %79, 0
br i1 %80, label %83, label %81
81: ; preds = %76
%82 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
br label %83
83: ; preds = %81, %76
br label %84
84: ; preds = %83, %13
ret i32 0
}