#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 */
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int printNote() {
  FILE *f;
  char buffer[200];
  f = fopen("./myNotes.note", "r");
  if (f) {
    while (fgets(buffer, 200, f)) {
      printf("\n -\t%s", buffer);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<printNote>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
lea    0xebe(%rip),%rdi
lea    0xec6(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     119e <printNote+0x6e>
jmp    1162 <printNote+0x32>
lea    -0xd0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0xc8,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     1199 <printNote+0x69>
lea    -0xd0(%rbp),%rsi
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
jmp    1162 <printNote+0x32>
jmp    119e <printNote+0x6e>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printNote>:
push   %r15
push   %r14
push   %rbx
sub    $0xd0,%rsp
lea    0xebd(%rip),%rdi
lea    0xec5(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     11a0 <printNote+0x70>
mov    %rax,%r15
mov    %rsp,%rdi
mov    $0xc8,%esi
mov    %rax,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     11a0 <printNote+0x70>
lea    0xe9e(%rip),%r14
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xc8,%esi
mov    %r15,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
jne    1180 <printNote+0x50>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [15 x i8] c"./myNotes.note\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"\0A -\09%s\00"
define i32 @printNote() {
%1 = alloca i32*
%2 = alloca [200 x i8]
%3 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = icmp ne i32* %4, null
br i1 %5, label %6, label %16
6: ; preds = %0
br label %7
7: ; preds = %12, %6
%8 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%9 = load i32*, i32** %1
%10 = call i64 @fgets(i8* %8, i32 200, i32* %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%14 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %13)
br label %7
15: ; preds = %7
br label %16
16: ; preds = %15, %0
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"./myNotes.note\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"\0A -\09%s\00"
define i32 @printNote() {
%1 = alloca [200 x i8]
%2 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %12, label %5
5: ; preds = %0
%6 = call i64 @fgets(i8* %2, i32 200, i32* %3)
%7 = icmp eq i64 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %5, %8
%9 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%10 = call i64 @fgets(i8* %2, i32 200, i32* %3)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %8
12: ; preds = %8, %5, %0
ret i32 0
}