#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 */
int /*<<< orphan*/ dois();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, short *);
int /*<<< orphan*/ tres();
int /*<<< orphan*/ um();
int main() {
  short opt;
  printf("Choose your fate:\n");
  scanf("%hi", &opt);
  switch (opt) {
  case 1:
    um();
    break;
  case 2:
    dois();
    break;
  case 3:
    tres();
    break;
  default:
    printf("Invalid");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
lea    0xea1(%rip),%rdi
lea    -0x6(%rbp),%rsi
call   1050 <scanf@plt>
movswl -0x6(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     11b2 <main+0x62>
jmp    1190 <main+0x40>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     11be <main+0x6e>
jmp    11a1 <main+0x51>
mov    -0xc(%rbp),%eax
sub    $0x3,%eax
je     11ca <main+0x7a>
jmp    11d6 <main+0x86>
mov    $0x0,%al
call   1070 <um@plt>
jmp    11e2 <main+0x92>
mov    $0x0,%al
call   1030 <dois@plt>
jmp    11e2 <main+0x92>
mov    $0x0,%al
call   1060 <tres@plt>
jmp    11e2 <main+0x92>
lea    0xe3a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8c(%rip),%rdi
lea    0x6(%rsp),%rsi
call   1060 <scanf@plt>
movswl 0x6(%rsp),%eax
cmp    $0x3,%eax
je     119b <main+0x3b>
cmp    $0x2,%eax
je     11a4 <main+0x44>
cmp    $0x1,%eax
jne    11ad <main+0x4d>
xor    %eax,%eax
call   1080 <um@plt>
jmp    11b9 <main+0x59>
xor    %eax,%eax
call   1070 <tres@plt>
jmp    11b9 <main+0x59>
xor    %eax,%eax
call   1040 <dois@plt>
jmp    11b9 <main+0x59>
lea    0xe50(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Choose your fate:\0A\00"
@.str.1 = [4 x i8] c"%hi\00"
@.str.2 = [8 x i8] c"Invalid\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i16* %2)
%5 = load i16, i16* %2
%6 = sext i16 %5 to i32
switch i32 %6, label %13 [
i32 1, label %7
i32 2, label %9
i32 3, label %11
]
7: ; preds = %0
%8 = call i32 (...) @um()
br label %15
9: ; preds = %0
%10 = call i32 (...) @dois()
br label %15
11: ; preds = %0
%12 = call i32 (...) @tres()
br label %15
13: ; preds = %0
%14 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %13, %11, %9, %7
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%hi\00"
@.str.2 = [8 x i8] c"Invalid\00"
@str = [18 x i8] c"Choose your fate:\00"
define i32 @main() {
%1 = alloca i16
%2 = bitcast i16* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i16* %1)
%5 = load i16, i16* %1
%6 = sext i16 %5 to i32
switch i32 %6, label %13 [
i32 1, label %7
i32 2, label %9
i32 3, label %11
]
7: ; preds = %0
%8 = call i32 (...) @um()
br label %15
9: ; preds = %0
%10 = call i32 (...) @dois()
br label %15
11: ; preds = %0
%12 = call i32 (...) @tres()
br label %15
13: ; preds = %0
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %13, %11, %9, %7
ret i32 0
}