#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*/ FILE;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ *fopen(char *, char *);
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, unsigned int);
int main() {
  unsigned int number_of_lines = 0;
  FILE *infile = fopen("pat00001_N_1.fq", "r");
  int ch;
  while (EOF != (ch = getc(infile)))
    if ('\n' == ch)
      ++number_of_lines;
  printf("%u\n", number_of_lines);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xeb3(%rip),%rdi
lea    0xebc(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    0x2e84(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <getc@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
mov    %ecx,-0x14(%rbp)
cmp    %ecx,%eax
je     119e <main+0x6e>
mov    $0xa,%eax
cmp    -0x14(%rbp),%eax
jne    1199 <main+0x69>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115d <main+0x2d>
mov    -0x8(%rbp),%esi
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xec1(%rip),%rdi
lea    0xeca(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%r12
mov    0x2e93(%rip),%r14
mov    (%r14),%r15d
mov    %rax,%rdi
call   1050 <getc@plt>
xor    %ebp,%ebp
cmp    %eax,%r15d
je     1189 <main+0x59>
xor    %ebp,%ebp
nopl   0x0(%rax)
xor    %ecx,%ecx
cmp    $0xa,%eax
sete   %cl
add    %ecx,%ebp
mov    (%r14),%ebx
mov    %r12,%rdi
call   1050 <getc@plt>
cmp    %eax,%ebx
jne    1170 <main+0x40>
lea    0xe82(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"pat00001_N_1.fq\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i32 0
@.str.2 = [4 x i8] c"%u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%5 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %5, i32** %3
br label %6
6: ; preds = %17, %0
%7 = load i32, i32* @EOF
%8 = load i32*, i32** %3
%9 = call i32 @getc(i32* %8)
store i32 %9, i32* %4
%10 = icmp ne i32 %7, %9
br i1 %10, label %11, label %18
11: ; preds = %6
%12 = load i32, i32* %4
%13 = icmp eq i32 10, %12
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i32, i32* %2
%16 = add i32 %15, 1
store i32 %16, i32* %2
br label %17
17: ; preds = %14, %11
br label %6
18: ; preds = %6
%19 = load i32, i32* %2
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"pat00001_N_1.fq\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i32 0
@.str.2 = [4 x i8] c"%u\0A\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = load i32, i32* @EOF
%3 = tail call i32 @getc(i32* %1)
%4 = icmp eq i32 %2, %3
br i1 %4, label %14, label %5
5: ; preds = %0, %5
%6 = phi i32 [ %12, %5 ], [ %3, %0 ]
%7 = phi i32 [ %10, %5 ], [ 0, %0 ]
%8 = icmp eq i32 %6, 10
%9 = zext i1 %8 to i32
%10 = add i32 %7, %9
%11 = load i32, i32* @EOF
%12 = tail call i32 @getc(i32* %1)
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %5
14: ; preds = %5, %0
%15 = phi i32 [ 0, %0 ], [ %10, %5 ]
%16 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %15)
ret i32 0
}