#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*/ bhaska();
int /*<<< orphan*/ c();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ system(char *);
int main() {
  char menuSwitch = 'm';
  while (menuSwitch != 'q') {
    system("clear");
    printf("tecle q para sair\n");
    printf("tecle b pra selecionar bhaskara\n");
    printf("tecle c pra ver C\n");
    scanf(" %c", &menuSwitch);
    switch (menuSwitch) {
    case 'q':
      printf("Tchau\n");
      break;
    case 'c':
      c();
      break;
    case 'b':
      bhaska();
      break;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x6d,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x71,%eax
je     1210 <main+0xc0>
lea    0xe89(%rip),%rdi
call   1030 <system@plt>
lea    0xe83(%rip),%rdi
call   1040 <printf@plt>
lea    0xe8a(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
lea    0xea6(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1070 <scanf@plt>
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x62,%eax
je     1204 <main+0xb4>
jmp    11c5 <main+0x75>
mov    -0xc(%rbp),%eax
sub    $0x63,%eax
je     11f8 <main+0xa8>
jmp    11d6 <main+0x86>
mov    -0xc(%rbp),%eax
sub    $0x71,%eax
jne    120b <main+0xbb>
jmp    11e7 <main+0x97>
lea    0xe63(%rip),%rdi
call   1040 <printf@plt>
jmp    120b <main+0xbb>
mov    $0x0,%al
call   1060 <c@plt>
jmp    120b <main+0xbb>
mov    $0x0,%al
call   1050 <bhaska@plt>
jmp    1163 <main+0x13>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movb   $0x6d,0x7(%rsp)
lea    0xe99(%rip),%r14
lea    0xe9c(%rip),%r15
lea    0xea7(%rip),%r12
lea    0xec0(%rip),%r13
lea    0xe83(%rip),%rbx
lea    0x7(%rsp),%rbp
jmp    11a0 <main+0x50>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <c@plt>
movzbl 0x7(%rsp),%eax
cmp    $0x71,%al
je     11f9 <main+0xa9>
mov    %r14,%rdi
call   1040 <system@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1070 <scanf@plt>
movzbl 0x7(%rsp),%eax
movsbl %al,%ecx
cmp    $0x62,%ecx
je     11f0 <main+0xa0>
cmp    $0x63,%ecx
je     1190 <main+0x40>
cmp    $0x71,%ecx
jne    119c <main+0x4c>
lea    0xe65(%rip),%rdi
call   1030 <puts@plt>
jmp    1197 <main+0x47>
xor    %eax,%eax
call   1050 <bhaska@plt>
jmp    1197 <main+0x47>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [19 x i8] c"tecle q para sair\0A\00"
@.str.2 = [33 x i8] c"tecle b pra selecionar bhaskara\0A\00"
@.str.3 = [19 x i8] c"tecle c pra ver C\0A\00"
@.str.4 = [4 x i8] c" %c\00"
@.str.5 = [7 x i8] c"Tchau\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
store i8 109, i8* %2
br label %3
3: ; preds = %21, %0
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = icmp ne i32 %5, 113
br i1 %6, label %7, label %22
7: ; preds = %3
%8 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
switch i32 %14, label %21 [
i32 113, label %15
i32 99, label %17
i32 98, label %19
]
15: ; preds = %7
%16 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
br label %21
17: ; preds = %7
%18 = call i32 (...) @c()
br label %21
19: ; preds = %7
%20 = call i32 (...) @bhaska()
br label %21
21: ; preds = %7, %19, %17, %15
br label %3
22: ; preds = %3
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.4 = [4 x i8] c" %c\00"
@str = [18 x i8] c"tecle q para sair\00"
@str.6 = [32 x i8] c"tecle b pra selecionar bhaskara\00"
@str.7 = [18 x i8] c"tecle c pra ver C\00"
@str.8 = [6 x i8] c"Tchau\00"
define i32 @main() {
%1 = alloca i8
store i8 109, i8* %1
br label %2
2: ; preds = %0, %18
%3 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.6, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.7, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %1)
%8 = load i8, i8* %1
%9 = sext i8 %8 to i32
switch i32 %9, label %18 [
i32 113, label %10
i32 99, label %12
i32 98, label %14
]
10: ; preds = %2
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.8, i64 0, i64 0))
br label %16
12: ; preds = %2
%13 = call i32 (...) @c()
br label %16
14: ; preds = %2
%15 = call i32 (...) @bhaska()
br label %16
16: ; preds = %10, %12, %14
%17 = load i8, i8* %1
br label %18
18: ; preds = %16, %2
%19 = phi i8 [ %17, %16 ], [ %8, %2 ]
%20 = icmp eq i8 %19, 113
br i1 %20, label %21, label %2
21: ; preds = %18
ret i32 0
}