#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 */
char EOF;
char getc(int /*<<< orphan*/ *);
int quantidade_linhas(FILE *fileTabela) {
  char caractere = getc(fileTabela);
  int linhas = 0;
  while (caractere != EOF) {
    if (caractere == '\n') {
      caractere = getc(fileTabela);
      linhas++;
    } else
      caractere = getc(fileTabela);
  }
  return linhas;
}


x86 assembly (clang, -O0):
<quantidade_linhas>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getc@plt>
mov    %al,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
movsbl -0x9(%rbp),%eax
mov    0x2eae(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     117d <quantidade_linhas+0x6d>
movsbl -0x9(%rbp),%eax
cmp    $0xa,%eax
jne    116c <quantidade_linhas+0x5c>
mov    -0x8(%rbp),%rdi
call   1030 <getc@plt>
mov    %al,-0x9(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1178 <quantidade_linhas+0x68>
mov    -0x8(%rbp),%rdi
call   1030 <getc@plt>
mov    %al,-0x9(%rbp)
jmp    112f <quantidade_linhas+0x1f>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quantidade_linhas>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
call   1030 <getc@plt>
mov    0x2ec2(%rip),%r14
xor    %ebp,%ebp
cmp    (%r14),%al
je     1146 <quantidade_linhas+0x36>
xor    %ebp,%ebp
nop
xor    %ebx,%ebx
cmp    $0xa,%al
sete   %bl
mov    %r15,%rdi
call   1030 <getc@plt>
add    %ebx,%ebp
cmp    (%r14),%al
jne    1130 <quantidade_linhas+0x20>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i8 0
define i32 @quantidade_linhas(i32* %0) {
%2 = alloca i32*
%3 = alloca i8
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = call signext i8 @getc(i32* %5)
store i8 %6, i8* %3
store i32 0, i32* %4
br label %7
7: ; preds = %25, %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = load i8, i8* @EOF
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %9, %11
br i1 %12, label %13, label %26
13: ; preds = %7
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 10
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = load i32*, i32** %2
%19 = call signext i8 @getc(i32* %18)
store i8 %19, i8* %3
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %25
22: ; preds = %13
%23 = load i32*, i32** %2
%24 = call signext i8 @getc(i32* %23)
store i8 %24, i8* %3
br label %25
25: ; preds = %22, %17
br label %7
26: ; preds = %7
%27 = load i32, i32* %4
ret i32 %27
}

LLVM IR (-O2):
@EOF = global i8 0
define i32 @quantidade_linhas(i32* nocapture %0) {
%2 = tail call signext i8 @getc(i32* %0)
%3 = load i8, i8* @EOF
%4 = icmp eq i8 %2, %3
br i1 %4, label %14, label %5
5: ; preds = %1, %5
%6 = phi i32 [ %11, %5 ], [ 0, %1 ]
%7 = phi i8 [ %9, %5 ], [ %2, %1 ]
%8 = icmp eq i8 %7, 10
%9 = tail call signext i8 @getc(i32* %0)
%10 = zext i1 %8 to i32
%11 = add nuw nsw i32 %6, %10
%12 = load i8, i8* @EOF
%13 = icmp eq i8 %9, %12
br i1 %13, label %14, label %5
14: ; preds = %5, %1
%15 = phi i32 [ 0, %1 ], [ %11, %5 ]
ret i32 %15
}