#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*/ prodEscalar(int);
int /*<<< orphan*/ prodVetorial();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ soma();
int /*<<< orphan*/ subtracao(int);
void main() {
  printf("1 - Somar\n");
  printf("2 - Subtrair\n");
  printf("3 - Produto Vetorial\n");
  printf("4 - Produto Escalar com Vetor\n");
  printf("5 - Produto Escalar com constante real\n");
  int esc;
  int qnt;
  int op;
  scanf("%d", &esc);
  switch (esc) {
  case 1:
    soma();
    break;
  case 2:
    subtracao(qnt);
    break;
  case 3:
    prodVetorial();
    break;
  case 4:
    op = 1;
    prodEscalar(op);
    break;
  case 5:
    op = 2;
    prodEscalar(op);
    break;
  default:
    printf("Operacao invalida!\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
lea    0xea6(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
lea    0xec3(%rip),%rdi
call   1040 <printf@plt>
lea    0xedf(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x4,%eax
ja     122a <main+0xca>
mov    -0x18(%rbp),%rax
lea    0xe2c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1060 <soma@plt>
jmp    1236 <main+0xd6>
mov    -0x8(%rbp),%edi
call   1050 <subtracao@plt>
jmp    1236 <main+0xd6>
mov    $0x0,%al
call   1080 <prodVetorial@plt>
jmp    1236 <main+0xd6>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <prodEscalar@plt>
jmp    1236 <main+0xd6>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <prodEscalar@plt>
jmp    1236 <main+0xd6>
lea    0xe5c(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
lea    0xe70(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     11d3 <main+0x73>
lea    0xe3f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   1060 <soma@plt>
pop    %rax
ret
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
pop    %rax
ret
call   1050 <subtracao@plt>
pop    %rax
ret
xor    %eax,%eax
call   1080 <prodVetorial@plt>
pop    %rax
ret
mov    $0x1,%edi
jmp    11fd <main+0x9d>
mov    $0x2,%edi
call   1040 <prodEscalar@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [11 x i8] c"1 - Somar\0A\00"
@.str.1 = [14 x i8] c"2 - Subtrair\0A\00"
@.str.2 = [22 x i8] c"3 - Produto Vetorial\0A\00"
@.str.3 = [31 x i8] c"4 - Produto Escalar com Vetor\0A\00"
@.str.4 = [40 x i8] c"5 - Produto Escalar com constante real\0A\00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [20 x i8] c"Operacao invalida!\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
switch i32 %10, label %24 [
i32 1, label %11
i32 2, label %13
i32 3, label %16
i32 4, label %18
i32 5, label %21
]
11: ; preds = %0
%12 = call i32 (...) @soma()
br label %26
13: ; preds = %0
%14 = load i32, i32* %2
%15 = call i32 @subtracao(i32 %14)
br label %26
16: ; preds = %0
%17 = call i32 (...) @prodVetorial()
br label %26
18: ; preds = %0
store i32 1, i32* %3
%19 = load i32, i32* %3
%20 = call i32 @prodEscalar(i32 %19)
br label %26
21: ; preds = %0
store i32 2, i32* %3
%22 = load i32, i32* %3
%23 = call i32 @prodEscalar(i32 %22)
br label %26
24: ; preds = %0
%25 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %26
26: ; preds = %24, %21, %18, %16, %13, %11
ret void
}

LLVM IR (-O2):
@.str.5 = [3 x i8] c"%d\00"
@str = [10 x i8] c"1 - Somar\00"
@str.7 = [13 x i8] c"2 - Subtrair\00"
@str.8 = [21 x i8] c"3 - Produto Vetorial\00"
@str.9 = [30 x i8] c"4 - Produto Escalar com Vetor\00"
@str.10 = [39 x i8] c"5 - Produto Escalar com constante real\00"
@str.11 = [19 x i8] c"Operacao invalida!\00"
define void @main() {
%1 = alloca i32
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.7, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.8, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.9, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.10, i64 0, i64 0))
%7 = bitcast i32* %1 to i8*
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
switch i32 %9, label %20 [
i32 1, label %10
i32 2, label %12
i32 3, label %14
i32 4, label %16
i32 5, label %18
]
10: ; preds = %0
%11 = call i32 (...) @soma()
br label %22
12: ; preds = %0
%13 = call i32 @subtracao(i32 undef)
br label %22
14: ; preds = %0
%15 = call i32 (...) @prodVetorial()
br label %22
16: ; preds = %0
%17 = call i32 @prodEscalar(i32 1)
br label %22
18: ; preds = %0
%19 = call i32 @prodEscalar(i32 2)
br label %22
20: ; preds = %0
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.11, i64 0, i64 0))
br label %22
22: ; preds = %20, %18, %16, %14, %12, %10
ret void
}