#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 */

/* Variables and functions */
unsigned char heaven(char *, int);
unsigned char hell(char *, int);
int /*<<< orphan*/ printf(char *, unsigned char);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, unsigned int *);
int main() {
  char buf[128];
  unsigned int choice;
  unsigned char size;
  puts("PICK YOUR FATE:");
  scanf("%d", &choice);
  if (choice == 0) {
    puts("HEAVEN!");
    size = heaven(buf, 512);
  } else {
    puts("HELL...");
    size = hell(buf, 256);
  }
  printf("Received: %d bytes.\n", size);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9b(%rip),%rdi
lea    -0x94(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,-0x94(%rbp)
jne    11b6 <main+0x66>
lea    0xe7e(%rip),%rdi
call   1040 <puts@plt>
lea    -0x90(%rbp),%rdi
mov    $0x200,%esi
call   1030 <heaven@plt>
mov    %al,-0x95(%rbp)
jmp    11d9 <main+0x89>
lea    0xe5e(%rip),%rdi
call   1040 <puts@plt>
lea    -0x90(%rbp),%rdi
mov    $0x100,%esi
call   1070 <hell@plt>
mov    %al,-0x95(%rbp)
lea    0xe43(%rip),%rdi
movzbl -0x95(%rbp),%esi
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x98,%rsp
lea    0xea2(%rip),%rdi
call   1040 <puts@plt>
lea    0xea6(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
je     1198 <main+0x48>
lea    0xe99(%rip),%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%rdi
mov    $0x100,%esi
call   1070 <hell@plt>
jmp    11b3 <main+0x63>
lea    0xe74(%rip),%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%rdi
mov    $0x200,%esi
call   1030 <heaven@plt>
movzbl %al,%esi
lea    0xe66(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x98,%rsp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"PICK YOUR FATE:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [8 x i8] c"HEAVEN!\00"
@.str.3 = [8 x i8] c"HELL...\00"
@.str.4 = [21 x i8] c"Received: %d bytes.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [128 x i8]
%3 = alloca i32
%4 = alloca i8
store i32 0, i32* %1
%5 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %0
%10 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%12 = call zeroext i8 @heaven(i8* %11, i32 512)
store i8 %12, i8* %4
br label %17
13: ; preds = %0
%14 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%15 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%16 = call zeroext i8 @hell(i8* %15, i32 256)
store i8 %16, i8* %4
br label %17
17: ; preds = %13, %9
%18 = load i8, i8* %4
%19 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8 zeroext %18)
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
@.str = [16 x i8] c"PICK YOUR FATE:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [8 x i8] c"HEAVEN!\00"
@.str.3 = [8 x i8] c"HELL...\00"
@.str.4 = [21 x i8] c"Received: %d bytes.\0A\00"
define i32 @main() {
%1 = alloca [128 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%11 = call zeroext i8 @heaven(i8* %3, i32 512)
br label %15
12: ; preds = %0
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%14 = call zeroext i8 @hell(i8* %3, i32 256)
br label %15
15: ; preds = %12, %9
%16 = phi i8 [ %11, %9 ], [ %14, %12 ]
%17 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8 zeroext %16)
ret i32 0
}