#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, short *);
int /*<<< orphan*/ the_closer();
int /*<<< orphan*/ um();
int main() {
  short opt;
start:
  printf("\nEscolha o exercício:");
  scanf("%hi", &opt);
  switch (opt) {
  case 0:
    return 0;
  case 1:
    um();
    break;
  case 2:
    the_closer();
  }
  goto start;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb5(%rip),%rdi
lea    -0x6(%rbp),%rsi
call   1050 <scanf@plt>
movswl -0x6(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     11a1 <main+0x61>
jmp    117f <main+0x3f>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     11a9 <main+0x69>
jmp    1190 <main+0x50>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     11b5 <main+0x75>
jmp    11bc <main+0x7c>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret
mov    $0x0,%al
call   1060 <um@plt>
jmp    11bc <main+0x7c>
mov    $0x0,%al
call   1030 <the_closer@plt>
jmp    114f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xeb0(%rip),%r14
lea    0xec0(%rip),%r15
lea    0xe(%rsp),%rbx
jmp    1167 <main+0x27>
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <the_closer@plt>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
movswl 0xe(%rsp),%eax
cmp    $0x1,%eax
je     1190 <main+0x50>
cmp    $0x2,%eax
je     1160 <main+0x20>
test   %eax,%eax
jne    1167 <main+0x27>
jmp    1199 <main+0x59>
nop
xor    %eax,%eax
call   1060 <um@plt>
jmp    1167 <main+0x27>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [23 x i8] c"\0AEscolha o exerc\C3\ADcio:\00"
@.str.1 = [4 x i8] c"%hi\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
store i32 0, i32* %1
br label %3
3: ; preds = %13, %0
%4 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i16* %2)
%6 = load i16, i16* %2
%7 = sext i16 %6 to i32
switch i32 %7, label %13 [
i32 0, label %8
i32 1, label %9
i32 2, label %11
]
8: ; preds = %3
ret i32 0
9: ; preds = %3
%10 = call i32 (...) @um()
br label %13
11: ; preds = %3
%12 = call i32 (...) @the_closer()
br label %13
13: ; preds = %11, %3, %9
br label %3
}

LLVM IR (-O2):
@.str = [23 x i8] c"\0AEscolha o exerc\C3\ADcio:\00"
@.str.1 = [4 x i8] c"%hi\00"
define i32 @main() {
%1 = alloca i16
%2 = bitcast i16* %1 to i8*
br label %3
3: ; preds = %13, %0
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i16* %1)
%6 = load i16, i16* %1
%7 = sext i16 %6 to i32
switch i32 %7, label %13 [
i32 0, label %8
i32 1, label %9
i32 2, label %11
]
8: ; preds = %3
ret i32 0
9: ; preds = %3
%10 = call i32 (...) @um()
br label %13
11: ; preds = %3
%12 = call i32 (...) @the_closer()
br label %13
13: ; preds = %11, %3, %9
br label %3
}