#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*/ get_root();
int menu();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sin_cos_table();
int /*<<< orphan*/ solve_equation();
int main() {
  int option;
  do {
    option = menu();
    switch (option) {
    case 1:
      get_root();
      break;
    case 2:
      solve_equation();
      break;
    case 3:
      sin_cos_table();
      break;
    case -1:
      printf("\nOpcion no reconocida\n");
      break;
    default:
      break;
    }
  } while (option != -1 && option != 4);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
call   1040 <menu@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x4,%eax
ja     11c7 <main+0x77>
mov    -0x10(%rbp),%rax
lea    0xe77(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1060 <get_root@plt>
jmp    11cc <main+0x7c>
mov    $0x0,%al
call   1030 <solve_equation@plt>
jmp    11cc <main+0x7c>
mov    $0x0,%al
call   1070 <sin_cos_table@plt>
jmp    11cc <main+0x7c>
lea    0xe57(%rip),%rdi
call   1050 <printf@plt>
jmp    11cc <main+0x7c>
jmp    11cc <main+0x7c>
jmp    11d1 <main+0x81>
xor    %eax,%eax
cmpl   $0xffffffff,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     11ea <main+0x9a>
cmpl   $0x4,-0x8(%rbp)
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    115f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xea8(%rip),%rbx
jmp    1167 <main+0x17>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <sin_cos_table@plt>
xor    %eax,%eax
call   1050 <menu@plt>
add    $0x1,%eax
cmp    $0x5,%eax
ja     1167 <main+0x17>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   1060 <get_root@plt>
jmp    1167 <main+0x17>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <solve_equation@plt>
jmp    1167 <main+0x17>
lea    0xe78(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"\0AOpcion no reconocida\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %22, %0
%4 = call i32 (...) @menu()
store i32 %4, i32* %2
%5 = load i32, i32* %2
switch i32 %5, label %14 [
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 -1, label %12
]
6: ; preds = %3
%7 = call i32 (...) @get_root()
br label %15
8: ; preds = %3
%9 = call i32 (...) @solve_equation()
br label %15
10: ; preds = %3
%11 = call i32 (...) @sin_cos_table()
br label %15
12: ; preds = %3
%13 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %15
14: ; preds = %3
br label %15
15: ; preds = %14, %12, %10, %8, %6
br label %16
16: ; preds = %15
%17 = load i32, i32* %2
%18 = icmp ne i32 %17, -1
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* %2
%21 = icmp ne i32 %20, 4
br label %22
22: ; preds = %19, %16
%23 = phi i1 [ false, %16 ], [ %21, %19 ]
br i1 %23, label %3, label %24
24: ; preds = %22
ret i32 0
}

LLVM IR (-O2):
@str = [22 x i8] c"\0AOpcion no reconocida\00"
define i32 @main() {
br label %1
1: ; preds = %9, %0
%2 = tail call i32 (...) @menu()
switch i32 %2, label %9 [
i32 1, label %3
i32 2, label %5
i32 3, label %7
i32 -1, label %10
i32 4, label %12
]
3: ; preds = %1
%4 = tail call i32 (...) @get_root()
br label %9
5: ; preds = %1
%6 = tail call i32 (...) @solve_equation()
br label %9
7: ; preds = %1
%8 = tail call i32 (...) @sin_cos_table()
br label %9
9: ; preds = %7, %5, %3, %1
br label %1
10: ; preds = %1
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %12
12: ; preds = %1, %10
ret i32 0
}