#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 *, char *);
char getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ putchar(char);
void menu_about(void) {
  char c;
  FILE *file;
  file = fopen("about.txt", "r");
  if (file) {
    while ((c = getc(file)) != EOF) {
      putchar(c);
    }
    fclose(file);
  }
}


x86 assembly (clang, -O0):
<menu_about>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
lea    0xeb4(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11a7 <menu_about+0x67>
jmp    116f <menu_about+0x2f>
mov    -0x10(%rbp),%rdi
call   1060 <getc@plt>
mov    %al,-0x1(%rbp)
movsbl %al,%eax
mov    0x2e63(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     119e <menu_about+0x5e>
movsbl -0x1(%rbp),%edi
call   1030 <putchar@plt>
jmp    116f <menu_about+0x2f>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu_about>:
push   %r14
push   %rbx
push   %rax
lea    0xeb5(%rip),%rdi
lea    0xeb8(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     11a4 <menu_about+0x64>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <getc@plt>
mov    0x2e7a(%rip),%r14
cmp    (%r14),%al
je     1195 <menu_about+0x55>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1060 <getc@plt>
cmp    (%r14),%al
jne    1180 <menu_about+0x40>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fclose@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [10 x i8] c"about.txt\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i8 0
define void @menu_about() {
%1 = alloca i8
%2 = alloca i32*
%3 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 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** %2
%4 = load i32*, i32** %2
%5 = icmp ne i32* %4, null
br i1 %5, label %6, label %20
6: ; preds = %0
br label %7
7: ; preds = %14, %6
%8 = load i32*, i32** %2
%9 = call signext i8 @getc(i32* %8)
store i8 %9, i8* %1
%10 = sext i8 %9 to i32
%11 = load i8, i8* @EOF
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %10, %12
br i1 %13, label %14, label %17
14: ; preds = %7
%15 = load i8, i8* %1
%16 = call i32 @putchar(i8 signext %15)
br label %7
17: ; preds = %7
%18 = load i32*, i32** %2
%19 = call i32 @fclose(i32* %18)
br label %20
20: ; preds = %17, %0
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"about.txt\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i8 0
define void @menu_about() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %15, label %3
3: ; preds = %0
%4 = tail call signext i8 @getc(i32* %1)
%5 = load i8, i8* @EOF
%6 = icmp eq i8 %4, %5
br i1 %6, label %13, label %7
7: ; preds = %3, %7
%8 = phi i8 [ %10, %7 ], [ %4, %3 ]
%9 = tail call i32 @putchar(i8 signext %8)
%10 = tail call signext i8 @getc(i32* %1)
%11 = load i8, i8* @EOF
%12 = icmp eq i8 %10, %11
br i1 %12, label %13, label %7
13: ; preds = %7, %3
%14 = tail call i32 @fclose(i32* %1)
br label %15
15: ; preds = %13, %0
ret void
}