#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__ EOF;
int fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
void print_menu(void) {
  FILE *fd;
  int s;
  char menu[2048];
  fd = fopen("menu_client.txt", "r");
  printf("\n");
  while (fscanf(fd, "%s", menu) != EOF) {
    printf("%s", menu);
    printf("\n");
  }
  s = fclose(fd);
}


x86 assembly (clang, -O0):
<print_menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
lea    0xeae(%rip),%rdi
lea    0xeb7(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x810(%rbp),%rdx
lea    0xe92(%rip),%rsi
call   1050 <fscanf@plt>
mov    0x2e5a(%rip),%rcx
cmp    (%rcx),%rax
je     11bf <print_menu+0x7f>
lea    -0x810(%rbp),%rsi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1170 <print_menu+0x30>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
mov    %eax,-0xc(%rbp)
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_menu>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x808,%rsp
lea    0xe9b(%rip),%rdi
lea    0xea4(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe8d(%rip),%rsi
mov    %rsp,%rdx
mov    %r14,%rdi
call   1060 <fscanf@plt>
mov    0x2e51(%rip),%r12
cmp    (%r12),%rax
je     11db <print_menu+0x8b>
lea    0xe6e(%rip),%r15
mov    %rsp,%rbx
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1060 <fscanf@plt>
cmp    (%r12),%rax
jne    11b0 <print_menu+0x60>
mov    %r14,%rdi
call   1040 <fclose@plt>
add    $0x808,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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