#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_RDWR;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int open(char *, int /*<<< orphan*/);
int read(int, char *, int);
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char *argv[]) {
  int fd, i;
  char buff;
  int temp1, temp2, ret, count = 1;
  fd = open(argv[1], O_RDWR);
  while (1) {
    ret = read(fd, &buff, 1);
    temp1 = count++;
    if (ret == 0)
      break;
  }
  while (1) {
    if (buff != '\n') {
      if (temp1 - temp2 == 9) {
        while (1) {
          count = 1;
          ret = read(fd, &buff, 1);
          write(1, &buff, ret);
          if (ret == 0)
            exit(0);
          if (buff == '\n')
            count++;
          if (count == 10)
            exit(0);
        }
      }
    }
  }
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2e7c(%rip),%rax
mov    (%rax),%esi
call   1050 <open@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x19(%rbp),%rsi
mov    $0x1,%edx
call   1040 <read@plt>
mov    %eax,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x2c(%rbp)
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x28(%rbp)
jne    11a7 <main+0x67>
jmp    11ac <main+0x6c>
jmp    1176 <main+0x36>
jmp    11b1 <main+0x71>
movsbl -0x19(%rbp),%eax
cmp    $0xa,%eax
je     1240 <main+0x100>
mov    -0x20(%rbp),%eax
sub    -0x24(%rbp),%eax
cmp    $0x9,%eax
jne    123b <main+0xfb>
jmp    11d2 <main+0x92>
movl   $0x1,-0x2c(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x19(%rbp),%rsi
mov    $0x1,%edx
call   1040 <read@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%edx
mov    $0x1,%edi
lea    -0x19(%rbp),%rsi
call   1030 <write@plt>
cmpl   $0x0,-0x28(%rbp)
jne    120f <main+0xcf>
xor    %edi,%edi
call   1060 <exit@plt>
movsbl -0x19(%rbp),%eax
cmp    $0xa,%eax
jne    1225 <main+0xe5>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0xa,-0x2c(%rbp)
jne    1236 <main+0xf6>
xor    %edi,%edi
call   1060 <exit@plt>
jmp    11d2 <main+0x92>
jmp    1240 <main+0x100>
jmp    11b1 <main+0x71>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x8(%rsi),%rdi
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
mov    %eax,%ebx
lea    0x7(%rsp),%r14
nopl   (%rax)
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <read@plt>
test   %eax,%eax
jne    1140 <main+0x20>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
jmp    1160 <main+0x40>

LLVM IR (-O0):
@O_RDWR = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %12
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = load i32, i32* @O_RDWR
%17 = call i32 @open(i8* %15, i32 %16)
store i32 %17, i32* %6
br label %18
18: ; preds = %2, %26
%19 = load i32, i32* %6
%20 = call i32 @read(i32 %19, i8* %8, i32 1)
store i32 %20, i32* %11
%21 = load i32, i32* %12
%22 = add nsw i32 %21, 1
store i32 %22, i32* %12
store i32 %21, i32* %9
%23 = load i32, i32* %11
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %18
br label %27
26: ; preds = %18
br label %18
27: ; preds = %25
br label %28
28: ; preds = %27, %61
%29 = load i8, i8* %8
%30 = sext i8 %29 to i32
%31 = icmp ne i32 %30, 10
br i1 %31, label %32, label %61
32: ; preds = %28
%33 = load i32, i32* %9
%34 = load i32, i32* %10
%35 = sub nsw i32 %33, %34
%36 = icmp eq i32 %35, 9
br i1 %36, label %37, label %60
37: ; preds = %32
br label %38
38: ; preds = %37, %59
store i32 1, i32* %12
%39 = load i32, i32* %6
%40 = call i32 @read(i32 %39, i8* %8, i32 1)
store i32 %40, i32* %11
%41 = load i32, i32* %11
%42 = call i32 @write(i32 1, i8* %8, i32 %41)
%43 = load i32, i32* %11
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %38
%46 = call i32 @exit(i32 0)
unreachable
47: ; preds = %38
%48 = load i8, i8* %8
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %49, 10
br i1 %50, label %51, label %54
51: ; preds = %47
%52 = load i32, i32* %12
%53 = add nsw i32 %52, 1
store i32 %53, i32* %12
br label %54
54: ; preds = %51, %47
%55 = load i32, i32* %12
%56 = icmp eq i32 %55, 10
br i1 %56, label %57, label %59
57: ; preds = %54
%58 = call i32 @exit(i32 0)
unreachable
59: ; preds = %54
br label %38
60: ; preds = %32
br label %61
61: ; preds = %60, %28
br label %28
}

LLVM IR (-O2):
@O_RDWR = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = load i32, i32* @O_RDWR
%7 = tail call i32 @open(i8* %5, i32 %6)
br label %8
8: ; preds = %8, %2
%9 = call i32 @read(i32 %7, i8* %3, i32 1)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %8
11: ; preds = %8, %11
br label %11
}