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

/* Variables and functions */
int /*<<< orphan*/ assembled();
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ *stdin;
scalar_t__ strncmp(char *, char *, int);
void end_of_journey() {
  char end[500];
  char zero[500];
  printf("Please take the unique string (line above the C code) from each of "
         "the four paths, combine them in this order (North, East, West, "
         "South) in one line and submit it.\n");
  fgets(end, sizeof(end), stdin);
  FILE *assembled_pieces;
  assembled_pieces = fopen("0", "r");
  fgets(zero, sizeof(zero), assembled_pieces);
  if (strncmp(zero, end, 5) == 0) {
    printf("Congratz, you've survived the wasteland.\n");
    assembled();
  }
}


x86 assembly (clang, -O0):
<end_of_journey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
lea    -0x200(%rbp),%rdi
mov    0x2e73(%rip),%rax
mov    (%rax),%rdx
mov    $0x1f4,%esi
call   1050 <fgets@plt>
lea    0xf1c(%rip),%rdi
lea    0xf17(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x408(%rbp)
lea    -0x400(%rbp),%rdi
mov    -0x408(%rbp),%rdx
mov    $0x1f4,%esi
call   1050 <fgets@plt>
lea    -0x400(%rbp),%rdi
lea    -0x200(%rbp),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11e9 <end_of_journey+0x99>
lea    0xecc(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <assembled@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<end_of_journey>:
push   %r14
push   %rbx
sub    $0x3f8,%rsp
lea    0xea3(%rip),%rdi
call   1040 <puts@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%rdx
lea    0x200(%rsp),%r14
mov    %r14,%rdi
mov    $0x1f4,%esi
call   1050 <fgets@plt>
lea    0xe74(%rip),%rdi
lea    0xe6f(%rip),%rsi
call   1060 <fopen@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x1f4,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    11d3 <end_of_journey+0x83>
lea    0xee1(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1070 <assembled@plt>
add    $0x3f8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [165 x i8] c"Please take the unique string (line above the C code) from each of the four paths, combine them in this order (North, East, West, South) in one line and submit it.\0A\00"
@stdin = global i32* null
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [42 x i8] c"Congratz, you've survived the wasteland.\0A\00"
define void @end_of_journey() {
%1 = alloca [500 x i8]
%2 = alloca [500 x i8]
%3 = alloca i32*
%4 = call i32 @printf(i8* getelementptr inbounds ([165 x i8], [165 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 0
%6 = load i32*, i32** @stdin
%7 = call i32 @fgets(i8* %5, i32 500, i32* %6)
%8 = call i32* @fopen(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %8, i32** %3
%9 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%10 = load i32*, i32** %3
%11 = call i32 @fgets(i8* %9, i32 500, i32* %10)
%12 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%13 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 0
%14 = call i64 @strncmp(i8* %12, i8* %13, i32 5)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %0
%17 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 (...) @assembled()
br label %19
19: ; preds = %16, %0
ret void
}

LLVM IR (-O2):
@stdin = global i32* null
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [2 x i8] c"r\00"
@str = [164 x i8] c"Please take the unique string (line above the C code) from each of the four paths, combine them in this order (North, East, West, South) in one line and submit it.\00"
@str.4 = [41 x i8] c"Congratz, you've survived the wasteland.\00"
define void @end_of_journey() {
%1 = alloca [500 x i8]
%2 = alloca [500 x i8]
%3 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([164 x i8], [164 x i8]* @str, i64 0, i64 0))
%6 = load i32*, i32** @stdin
%7 = call i32 @fgets(i8* %3, i32 500, i32* %6)
%8 = call i32* @fopen(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @fgets(i8* %4, i32 500, i32* %8)
%10 = call i64 @strncmp(i8* %4, i8* %3, i32 5)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.4, i64 0, i64 0))
%14 = call i32 (...) @assembled()
br label %15
15: ; preds = %12, %0
ret void
}