#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 /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ findAndPrint(char *);
int /*<<< orphan*/ *fopen(char *, char *);
int getline(char **, size_t *, int /*<<< orphan*/ *);
void printStatus(char *path) {
  FILE *fp = fopen(path, "r");
  char *lineBuffer = NULL;
  size_t len;
  while (getline(&lineBuffer, &len, fp) != -1)
    findAndPrint(lineBuffer);
  fclose(fp);
}


x86 assembly (clang, -O0):
<printStatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <getline@plt>
cmp    $0xffffffff,%eax
je     1190 <printStatus+0x50>
mov    -0x18(%rbp),%rdi
call   1040 <findAndPrint@plt>
jmp    1168 <printStatus+0x28>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printStatus>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xeb0(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
movq   $0x0,(%rsp)
mov    %rsp,%rdi
lea    0x8(%rsp),%rsi
mov    %rax,%rdx
call   1060 <getline@plt>
cmp    $0xffffffff,%eax
je     119c <printStatus+0x5c>
mov    %rsp,%r14
lea    0x8(%rsp),%r15
nopl   (%rax)
mov    (%rsp),%rdi
call   1040 <findAndPrint@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1060 <getline@plt>
cmp    $0xffffffff,%eax
jne    1180 <printStatus+0x40>
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
define void @printStatus(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %7, i32** %3
store i8* null, i8** %4
br label %8
8: ; preds = %12, %1
%9 = load i32*, i32** %3
%10 = call i32 @getline(i8** %4, i64* %5, i32* %9)
%11 = icmp ne i32 %10, -1
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = load i8*, i8** %4
%14 = call i32 @findAndPrint(i8* %13)
br label %8
15: ; preds = %8
%16 = load i32*, i32** %3
%17 = call i32 @fclose(i32* %16)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define void @printStatus(i8* nocapture %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%6 = bitcast i64* %3 to i8*
%7 = call i32 @getline(i8** %2, i64* %3, i32* %4)
%8 = icmp eq i32 %7, -1
br i1 %8, label %14, label %9
9: ; preds = %1, %9
%10 = load i8*, i8** %2
%11 = call i32 @findAndPrint(i8* %10)
%12 = call i32 @getline(i8** %2, i64* %3, i32* %4)
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %9
14: ; preds = %9, %1
%15 = call i32 @fclose(i32* %4)
ret void
}