#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;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
char getc(int /*<<< orphan*/ *);
scalar_t__ parse_line(char *);
int /*<<< orphan*/ read_line(int /*<<< orphan*/ *, char *, char *);
void file_reader(const char *path, char *buffert, int *row) {
  char c;
  int line;
  line = 0;
  FILE *file;
  file = fopen(path, "r");
  while ((c = getc(file)) != EOF) {
    *buffert = c;
    ++buffert;
    read_line(file, &c, buffert);
    if (parse_line(buffert)) {
      *row = line;
      ++row;
    }
    ++line;
    --buffert;
  }
  fclose(file);
}


x86 assembly (clang, -O0):
<file_reader>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe8a(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1070 <getc@plt>
mov    %al,-0x19(%rbp)
movsbl %al,%eax
mov    0x2e53(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1208 <file_reader+0xb8>
mov    -0x19(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    -0x19(%rbp),%rsi
call   1050 <read_line@plt>
mov    -0x10(%rbp),%rdi
call   1040 <parse_line@plt>
cmp    $0x0,%rax
je     11ee <file_reader+0x9e>
mov    -0x20(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    117f <file_reader+0x2f>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_reader>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%r14
lea    0xe98(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r12
mov    %rax,%rdi
call   1070 <getc@plt>
mov    %al,0x7(%rsp)
mov    0x2e65(%rip),%rcx
cmp    (%rcx),%al
jne    119e <file_reader+0x4e>
mov    %r12,%rdi
call   1030 <fclose@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x1(%r14),%rbx
xor    %ebp,%ebp
lea    0x7(%rsp),%r13
jmp    11ca <file_reader+0x7a>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    %r12,%rdi
call   1070 <getc@plt>
mov    %al,0x7(%rsp)
mov    0x2e22(%rip),%rcx
cmp    (%rcx),%al
je     1187 <file_reader+0x37>
mov    %al,(%r14)
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1050 <read_line@plt>
mov    %rbx,%rdi
call   1040 <parse_line@plt>
test   %rax,%rax
je     11b0 <file_reader+0x60>
mov    %ebp,(%r15)
add    $0x4,%r15
jmp    11b0 <file_reader+0x60>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@EOF = global i8 0
define void @file_reader(i8* %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i8
%8 = alloca i32
%9 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
store i32 0, i32* %8
%10 = load i8*, i8** %4
%11 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %11, i32** %9
br label %12
12: ; preds = %35, %3
%13 = load i32*, i32** %9
%14 = call signext i8 @getc(i32* %13)
store i8 %14, i8* %7
%15 = sext i8 %14 to i32
%16 = load i8, i8* @EOF
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %15, %17
br i1 %18, label %19, label %40
19: ; preds = %12
%20 = load i8, i8* %7
%21 = load i8*, i8** %5
store i8 %20, i8* %21
%22 = load i8*, i8** %5
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %5
%24 = load i32*, i32** %9
%25 = load i8*, i8** %5
%26 = call i32 @read_line(i32* %24, i8* %7, i8* %25)
%27 = load i8*, i8** %5
%28 = call i64 @parse_line(i8* %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %19
%31 = load i32, i32* %8
%32 = load i32*, i32** %6
store i32 %31, i32* %32
%33 = load i32*, i32** %6
%34 = getelementptr inbounds i32, i32* %33, i32 1
store i32* %34, i32** %6
br label %35
35: ; preds = %30, %19
%36 = load i32, i32* %8
%37 = add nsw i32 %36, 1
store i32 %37, i32* %8
%38 = load i8*, i8** %5
%39 = getelementptr inbounds i8, i8* %38, i32 -1
store i8* %39, i8** %5
br label %12
40: ; preds = %12
%41 = load i32*, i32** %9
%42 = call i32 @fclose(i32* %41)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@EOF = global i8 0
define void @file_reader(i8* nocapture %0, i8* %1, i32* nocapture writeonly %2) {
%4 = alloca i8
%5 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = call signext i8 @getc(i32* %5)
store i8 %6, i8* %4
%7 = load i8, i8* @EOF
%8 = icmp eq i8 %6, %7
br i1 %8, label %26, label %9
9: ; preds = %3
%10 = getelementptr inbounds i8, i8* %1, i64 1
br label %11
11: ; preds = %9, %20
%12 = phi i8 [ %6, %9 ], [ %23, %20 ]
%13 = phi i32 [ 0, %9 ], [ %22, %20 ]
%14 = phi i32* [ %2, %9 ], [ %21, %20 ]
store i8 %12, i8* %1
%15 = call i32 @read_line(i32* %5, i8* %4, i8* %10)
%16 = call i64 @parse_line(i8* %10)
%17 = icmp eq i64 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %11
store i32 %13, i32* %14
%19 = getelementptr inbounds i32, i32* %14, i64 1
br label %20
20: ; preds = %18, %11
%21 = phi i32* [ %19, %18 ], [ %14, %11 ]
%22 = add nuw nsw i32 %13, 1
%23 = call signext i8 @getc(i32* %5)
store i8 %23, i8* %4
%24 = load i8, i8* @EOF
%25 = icmp eq i8 %23, %24
br i1 %25, label %26, label %11
26: ; preds = %20, %3
%27 = call i32 @fclose(i32* %5)
ret void
}