#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*/ dividir(int, int);
int menu();
int /*<<< orphan*/ multiplicar(int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ restar(int, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int /*<<< orphan*/ sumar(int, int);
int /*<<< orphan*/ system(char *);
int main() {
  int opcion, a, b;
  do {
    opcion = menu();
    switch (opcion) {
    case 1:
      printf("\n Operacion SUMAR...\n");
      printf("------------------------\n");
      printf("\nIngrese 2 numeros a sumar: \n");
      scanf("%d %d", &a, &b);
      sumar(a, b);
      system("pause");
      break;
    case 2:
      printf("\n Operacion RESTAR...\n");
      printf("------------------------\n");
      printf("\nIngrese 2 numeros a restar: \n");
      scanf("%d %d", &a, &b);
      restar(a, b);
      system("pause");
      break;
    case 3:
      printf("\n Operacion MULTIPLICAR...\n");
      printf("------------------------\n");
      printf("\nIngrese 2 numeros a multiplicar: \n");
      scanf("%d %d", &a, &b);
      multiplicar(a, b);
      system("pause");
      break;
    case 4:
      printf("\n Operacion DIVIDIR...\n");
      printf("------------------------\n");
      printf("\nIngrese 2 numeros a dividir: \n");
      scanf("%d %d", &a, &b);
      dividir(a, b);
      system("pause");
      break;
    case 5:
      printf("\n Fin del Programa...\n");
      break;
    }
  } while (opcion != 5);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
call   1030 <menu@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x4,%eax
ja     131e <main+0x19e>
mov    -0x18(%rbp),%rax
lea    0xe47(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe4b(%rip),%rdi
call   1050 <printf@plt>
lea    0xe55(%rip),%rdi
call   1050 <printf@plt>
lea    0xe63(%rip),%rdi
call   1050 <printf@plt>
lea    0xe75(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1090 <scanf@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1060 <sumar@plt>
lea    0xe5c(%rip),%rdi
call   1040 <system@plt>
jmp    131e <main+0x19e>
lea    0xe51(%rip),%rdi
call   1050 <printf@plt>
lea    0xe01(%rip),%rdi
call   1050 <printf@plt>
lea    0xe50(%rip),%rdi
call   1050 <printf@plt>
lea    0xe21(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1090 <scanf@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1080 <restar@plt>
lea    0xe08(%rip),%rdi
call   1040 <system@plt>
jmp    131e <main+0x19e>
lea    0xe33(%rip),%rdi
call   1050 <printf@plt>
lea    0xdad(%rip),%rdi
call   1050 <printf@plt>
lea    0xe37(%rip),%rdi
call   1050 <printf@plt>
lea    0xdcd(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1090 <scanf@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1070 <multiplicar@plt>
lea    0xdb4(%rip),%rdi
call   1040 <system@plt>
jmp    131e <main+0x19e>
lea    0xe1f(%rip),%rdi
call   1050 <printf@plt>
lea    0xd59(%rip),%rdi
call   1050 <printf@plt>
lea    0xe1f(%rip),%rdi
call   1050 <printf@plt>
lea    0xd79(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1090 <scanf@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   10a0 <dividir@plt>
lea    0xd60(%rip),%rdi
call   1040 <system@plt>
jmp    131e <main+0x19e>
lea    0xe03(%rip),%rdi
call   1050 <printf@plt>
jmp    1323 <main+0x1a3>
cmpl   $0x5,-0x8(%rbp)
jne    118f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe6e(%rip),%r15
lea    0xf5a(%rip),%r12
lea    0xe74(%rip),%r13
lea    0x4(%rsp),%rbx
mov    %rsp,%rbp
lea    0xe6b(%rip),%r14
jmp    11f3 <main+0x73>
lea    0xe7e(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
lea    0xe81(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1090 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   10a0 <dividir@plt>
mov    %r14,%rdi
call   1050 <system@plt>
xor    %eax,%eax
call   1040 <menu@plt>
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     11f3 <main+0x73>
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
lea    0xee6(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1090 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1060 <sumar@plt>
jmp    11eb <main+0x6b>
lea    0xe5c(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
lea    0xe5e(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1090 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1080 <restar@plt>
jmp    11eb <main+0x6b>
lea    0xddf(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
lea    0xde6(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1090 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1070 <multiplicar@plt>
jmp    11eb <main+0x6b>
lea    0xd54(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"\0A Operacion SUMAR...\0A\00"
@.str.1 = [26 x i8] c"------------------------\0A\00"
@.str.2 = [30 x i8] c"\0AIngrese 2 numeros a sumar: \0A\00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.4 = [6 x i8] c"pause\00"
@.str.5 = [23 x i8] c"\0A Operacion RESTAR...\0A\00"
@.str.6 = [31 x i8] c"\0AIngrese 2 numeros a restar: \0A\00"
@.str.7 = [28 x i8] c"\0A Operacion MULTIPLICAR...\0A\00"
@.str.8 = [36 x i8] c"\0AIngrese 2 numeros a multiplicar: \0A\00"
@.str.9 = [24 x i8] c"\0A Operacion DIVIDIR...\0A\00"
@.str.10 = [32 x i8] c"\0AIngrese 2 numeros a dividir: \0A\00"
@.str.11 = [23 x i8] c"\0A Fin del Programa...\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %47, %0
%6 = call i32 (...) @menu()
store i32 %6, i32* %2
%7 = load i32, i32* %2
switch i32 %7, label %46 [
i32 1, label %8
i32 2, label %17
i32 3, label %26
i32 4, label %35
i32 5, label %44
]
8: ; preds = %5
%9 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %3, i32* %4)
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = call i32 @sumar(i32 %13, i32 %14)
%16 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %46
17: ; preds = %5
%18 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %3, i32* %4)
%22 = load i32, i32* %3
%23 = load i32, i32* %4
%24 = call i32 @restar(i32 %22, i32 %23)
%25 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %46
26: ; preds = %5
%27 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
%28 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%29 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0))
%30 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %3, i32* %4)
%31 = load i32, i32* %3
%32 = load i32, i32* %4
%33 = call i32 @multiplicar(i32 %31, i32 %32)
%34 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %46
35: ; preds = %5
%36 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%37 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%38 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.10, i64 0, i64 0))
%39 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %3, i32* %4)
%40 = load i32, i32* %3
%41 = load i32, i32* %4
%42 = call i32 @dividir(i32 %40, i32 %41)
%43 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %46
44: ; preds = %5
%45 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0))
br label %46
46: ; preds = %5, %44, %35, %26, %17, %8
br label %47
47: ; preds = %46
%48 = load i32, i32* %2
%49 = icmp ne i32 %48, 5
br i1 %49, label %5, label %50
50: ; preds = %47
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [6 x i8] c"%d %d\00"
@.str.4 = [6 x i8] c"pause\00"
@str = [22 x i8] c"\0A Fin del Programa...\00"
@str.12 = [23 x i8] c"\0A Operacion DIVIDIR...\00"
@str.14 = [31 x i8] c"\0AIngrese 2 numeros a dividir: \00"
@str.15 = [27 x i8] c"\0A Operacion MULTIPLICAR...\00"
@str.17 = [35 x i8] c"\0AIngrese 2 numeros a multiplicar: \00"
@str.18 = [22 x i8] c"\0A Operacion RESTAR...\00"
@str.20 = [30 x i8] c"\0AIngrese 2 numeros a restar: \00"
@str.21 = [21 x i8] c"\0A Operacion SUMAR...\00"
@str.22 = [25 x i8] c"------------------------\00"
@str.23 = [29 x i8] c"\0AIngrese 2 numeros a sumar: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %9, %0
%6 = call i32 (...) @menu()
switch i32 %6, label %9 [
i32 1, label %10
i32 2, label %18
i32 3, label %26
i32 4, label %34
i32 5, label %42
]
7: ; preds = %10, %18, %26, %34
%8 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
br label %5
10: ; preds = %5
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.21, i64 0, i64 0))
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.22, i64 0, i64 0))
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.23, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %1, i32* %2)
%15 = load i32, i32* %1
%16 = load i32, i32* %2
%17 = call i32 @sumar(i32 %15, i32 %16)
br label %7
18: ; preds = %5
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.18, i64 0, i64 0))
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.22, i64 0, i64 0))
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.20, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %1, i32* %2)
%23 = load i32, i32* %1
%24 = load i32, i32* %2
%25 = call i32 @restar(i32 %23, i32 %24)
br label %7
26: ; preds = %5
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.15, i64 0, i64 0))
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.22, i64 0, i64 0))
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.17, i64 0, i64 0))
%30 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %1, i32* %2)
%31 = load i32, i32* %1
%32 = load i32, i32* %2
%33 = call i32 @multiplicar(i32 %31, i32 %32)
br label %7
34: ; preds = %5
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.12, i64 0, i64 0))
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.22, i64 0, i64 0))
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.14, i64 0, i64 0))
%38 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %1, i32* %2)
%39 = load i32, i32* %1
%40 = load i32, i32* %2
%41 = call i32 @dividir(i32 %39, i32 %40)
br label %7
42: ; preds = %5
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
ret i32 0
}