#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*/ fclose(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int number_of_recombinations_in_file(char *fileName) {
  FILE *file = fopen(fileName, "r");
  int ch, prev = '\n', lines = 0;
  while ((ch = fgetc(file)) != EOF) {
    if (ch == '\n') {
      ++lines;
    }
    prev = ch;
  }
  fclose(file);
  if (prev != '\n') {
    ++lines;
  }
  return (int)lines / 5;
}


x86 assembly (clang, -O0):
<number_of_recombinations_in_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
movl   $0xa,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e77(%rip),%rcx
cmp    (%rcx),%eax
je     1197 <number_of_recombinations_in_file+0x67>
cmpl   $0xa,-0x14(%rbp)
jne    118c <number_of_recombinations_in_file+0x5c>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    115e <number_of_recombinations_in_file+0x2e>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
cmpl   $0xa,-0x18(%rbp)
je     11b3 <number_of_recombinations_in_file+0x83>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<number_of_recombinations_in_file>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1040 <fgetc@plt>
mov    0x2e93(%rip),%r15
cmp    (%r15),%eax
jne    1163 <number_of_recombinations_in_file+0x33>
xor    %ebp,%ebp
mov    $0xa,%ebx
jmp    1189 <number_of_recombinations_in_file+0x59>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %eax,%ebx
xor    %eax,%eax
cmp    $0xa,%ebx
sete   %al
add    %eax,%ebp
mov    %r14,%rdi
call   1040 <fgetc@plt>
cmp    (%r15),%eax
jne    1170 <number_of_recombinations_in_file+0x40>
mov    %r14,%rdi
call   1030 <fclose@plt>
xor    %ecx,%ecx
cmp    $0xa,%ebx
setne  %cl
add    %ebp,%ecx
mov    $0xcccccccd,%eax
imul   %rcx,%rax
shr    $0x22,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@EOF = global i32 0
define i32 @number_of_recombinations_in_file(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %8, i32** %3
store i32 10, i32* %5
store i32 0, i32* %6
br label %9
9: ; preds = %20, %1
%10 = load i32*, i32** %3
%11 = call i32 @fgetc(i32* %10)
store i32 %11, i32* %4
%12 = load i32, i32* @EOF
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %22
14: ; preds = %9
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 10
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
br label %20
20: ; preds = %17, %14
%21 = load i32, i32* %4
store i32 %21, i32* %5
br label %9
22: ; preds = %9
%23 = load i32*, i32** %3
%24 = call i32 @fclose(i32* %23)
%25 = load i32, i32* %5
%26 = icmp ne i32 %25, 10
br i1 %26, label %27, label %30
27: ; preds = %22
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
br label %30
30: ; preds = %27, %22
%31 = load i32, i32* %6
%32 = sdiv i32 %31, 5
ret i32 %32
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@EOF = global i32 0
define i32 @number_of_recombinations_in_file(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @fgetc(i32* %2)
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %15, label %6
6: ; preds = %1, %6
%7 = phi i32 [ %12, %6 ], [ %3, %1 ]
%8 = phi i32 [ %11, %6 ], [ 0, %1 ]
%9 = icmp eq i32 %7, 10
%10 = zext i1 %9 to i32
%11 = add nuw nsw i32 %8, %10
%12 = tail call i32 @fgetc(i32* %2)
%13 = load i32, i32* @EOF
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %6
15: ; preds = %6, %1
%16 = phi i32 [ 10, %1 ], [ %7, %6 ]
%17 = phi i32 [ 0, %1 ], [ %11, %6 ]
%18 = tail call i32 @fclose(i32* %2)
%19 = icmp ne i32 %16, 10
%20 = zext i1 %19 to i32
%21 = add nuw nsw i32 %17, %20
%22 = udiv i32 %21, 5
ret i32 %22
}