#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*/ handle;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, char **);
scalar_t__ strcmp(char *, char *);
int main() {
  char handle[500];
  scanf("%10s", &handle);
  if ((strcmp(handle, "exit")) == 0) {
    puts("Not so fast, you have a looong way down.");
    exit(0);
  }
  FILE *hope;
  hope = fopen(handle, "r");
  if (hope == NULL) {
    perror("error");
    puts("You really don't have any, do you?");
    exit(0);
  } else {
    fgets(handle, sizeof(handle), hope);
    printf("%s\n", handle);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
lea    -0x200(%rbp),%rsi
lea    0xe67(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x200(%rbp),%rdi
lea    0xe59(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11ce <main+0x4e>
lea    0xe48(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
lea    -0x200(%rbp),%rdi
lea    0xe5b(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x208(%rbp)
cmpq   $0x0,-0x208(%rbp)
jne    1215 <main+0x95>
lea    0xe36(%rip),%rdi
call   1090 <perror@plt>
lea    0xe30(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
lea    -0x200(%rbp),%rdi
mov    -0x208(%rbp),%rdx
mov    $0x1f4,%esi
call   1050 <fgets@plt>
lea    -0x200(%rbp),%rsi
lea    0xe21(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x200,%rsp
lea    0xe71(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1070 <scanf@plt>
lea    0xe64(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11ef <main+0x6f>
lea    0xe82(%rip),%rsi
mov    %rsp,%rdi
call   1080 <fopen@plt>
test   %rax,%rax
je     11f8 <main+0x78>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x1f4,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
lea    0xe80(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
ret
lea    0xe14(%rip),%rdi
jmp    120b <main+0x8b>
lea    0xe34(%rip),%rdi
call   1090 <perror@plt>
lea    0xe2e(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%10s\00"
@.str.1 = [5 x i8] c"exit\00"
@.str.2 = [41 x i8] c"Not so fast, you have a looong way down.\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [6 x i8] c"error\00"
@.str.5 = [35 x i8] c"You really don't have any, do you?\00"
@.str.6 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [500 x i8]
%2 = alloca i32*
%3 = bitcast [500 x i8]* %1 to i8**
%4 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %3)
%5 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 0
%6 = call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = call i32 @puts(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @exit(i32 0)
unreachable
11: ; preds = %0
%12 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 0
%13 = call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %13, i32** %2
%14 = load i32*, i32** %2
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %20
16: ; preds = %11
%17 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%18 = call i32 @puts(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 @exit(i32 0)
unreachable
20: ; preds = %11
%21 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 0
%22 = load i32*, i32** %2
%23 = call i32 @fgets(i8* %21, i32 500, i32* %22)
%24 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 0
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %24)
br label %26
26: ; preds = %20
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%10s\00"
@.str.1 = [5 x i8] c"exit\00"
@.str.2 = [41 x i8] c"Not so fast, you have a looong way down.\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [6 x i8] c"error\00"
@.str.5 = [35 x i8] c"You really don't have any, do you?\00"
@.str.6 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [500 x i8]
%2 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 0
%3 = bitcast [500 x i8]* %1 to i8**
%4 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %3)
%5 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @exit(i32 0)
unreachable
10: ; preds = %0
%11 = call i32* @fopen(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 @exit(i32 0)
unreachable
17: ; preds = %10
%18 = call i32 @fgets(i8* %2, i32 500, i32* %11)
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %2)
ret i32 0
}