#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 ackr(int, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
double vet(float *, int, int /*<<< orphan*/, int /*<<< orphan*/, int);
int main() {
  char opt;
  float avrg;
  int m, n, tam;
  float *vect;
  printf("Escolha a letra: ");
  scanf("%c", &opt);
  switch (opt) {
  case 'a':
    printf("Entre seus dois argumentos para A(m, n)");
    scanf("%d %d", &m, &n);
    printf("\n \t %d \n", ackr(m, n));
    break;
  case 'b':
    printf("Insira o tamanho do vetor:");
    scanf("%d", &tam);
    vect = (float *)malloc(tam * sizeof(float));
    for (m = 0; m < tam; m++) {
      printf("Vetor[ %d ]", m);
      scanf("%f", &vect[m]);
    }
    avrg = 0;
    avrg = vet(vect, tam, 0, 0, tam);
    printf("\n %f \n", vet(vect, tam, 0, 0, tam));
    break;
  default:
    printf("Opcao inválida");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x25(%rbp)
call   1030 <printf@plt>
mov    -0x25(%rbp),%al
lea    0xe98(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1060 <scanf@plt>
movsbl -0x5(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x61,%eax
je     11a9 <main+0x59>
jmp    1198 <main+0x48>
mov    -0x24(%rbp),%eax
sub    $0x62,%eax
je     11ed <main+0x9d>
jmp    12bb <main+0x16b>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7f(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <ackr@plt>
mov    %eax,%esi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12c9 <main+0x179>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe3e(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    126f <main+0x11f>
mov    -0x10(%rbp),%esi
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1227 <main+0xd7>
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x18(%rbp),%r8d
xor    %ecx,%ecx
mov    %ecx,%edx
call   1070 <vet@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x18(%rbp),%r8d
xor    %ecx,%ecx
mov    %ecx,%edx
call   1070 <vet@plt>
lea    0xdc7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12c9 <main+0x179>
lea    0xdbb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe9d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea1(%rip),%rdi
lea    0x3(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
movsbl 0x3(%rsp),%eax
cmp    $0x62,%eax
je     11d8 <main+0x88>
cmp    $0x61,%eax
jne    128a <main+0x13a>
lea    0xe7e(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe98(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1040 <ackr@plt>
lea    0xe79(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1298 <main+0x148>
lea    0xe6d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe53(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
shl    $0x2,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    0x4(%rsp),%esi
test   %esi,%esi
jle    1258 <main+0x108>
lea    0xe50(%rip),%r15
lea    0xe55(%rip),%r12
mov    %r14,%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
add    $0x1,%ebp
mov    0x4(%rsp),%esi
add    $0x4,%rbx
cmp    %esi,%ebp
jl     1230 <main+0xe0>
mov    %r14,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %esi,%r8d
call   1070 <vet@plt>
mov    0x4(%rsp),%esi
mov    %r14,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %esi,%r8d
call   1070 <vet@plt>
lea    0xdf5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1298 <main+0x148>
lea    0xdec(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Escolha a letra: \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [40 x i8] c"Entre seus dois argumentos para A(m, n)\00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.4 = [9 x i8] c"\0A \09 %d \0A\00"
@.str.5 = [27 x i8] c"Insira o tamanho do vetor:\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [12 x i8] c"Vetor[ %d ]\00"
@.str.8 = [3 x i8] c"%f\00"
@.str.9 = [7 x i8] c"\0A %f \0A\00"
@.str.10 = [16 x i8] c"Opcao inv\C3\A1lida\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca float*
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
switch i32 %11, label %54 [
i32 97, label %12
i32 98, label %19
]
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %4, i32* %5)
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = call i32 @ackr(i32 %15, i32 %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %17)
br label %56
19: ; preds = %0
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %6)
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = mul i64 %23, 4
%25 = trunc i64 %24 to i32
%26 = call i64 @malloc(i32 %25)
%27 = inttoptr i64 %26 to float*
store float* %27, float** %7
store i32 0, i32* %4
br label %28
28: ; preds = %40, %19
%29 = load i32, i32* %4
%30 = load i32, i32* %6
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %43
32: ; preds = %28
%33 = load i32, i32* %4
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 %33)
%35 = load float*, float** %7
%36 = load i32, i32* %4
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds float, float* %35, i64 %37
%39 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), float* %38)
br label %40
40: ; preds = %32
%41 = load i32, i32* %4
%42 = add nsw i32 %41, 1
store i32 %42, i32* %4
br label %28
43: ; preds = %28
store float 0.000000e+00, float* %3
%44 = load float*, float** %7
%45 = load i32, i32* %6
%46 = load i32, i32* %6
%47 = call double @vet(float* %44, i32 %45, i32 0, i32 0, i32 %46)
%48 = fptrunc double %47 to float
store float %48, float* %3
%49 = load float*, float** %7
%50 = load i32, i32* %6
%51 = load i32, i32* %6
%52 = call double @vet(float* %49, i32 %50, i32 0, i32 0, i32 %51)
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), double %52)
br label %56
54: ; preds = %0
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0))
br label %56
56: ; preds = %54, %43, %12
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Escolha a letra: \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [40 x i8] c"Entre seus dois argumentos para A(m, n)\00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.4 = [9 x i8] c"\0A \09 %d \0A\00"
@.str.5 = [27 x i8] c"Insira o tamanho do vetor:\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [12 x i8] c"Vetor[ %d ]\00"
@.str.8 = [3 x i8] c"%f\00"
@.str.9 = [7 x i8] c"\0A %f \0A\00"
@.str.10 = [16 x i8] c"Opcao inv\C3\A1lida\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%10 = load i8, i8* %1
%11 = sext i8 %10 to i32
switch i32 %11, label %43 [
i32 97, label %12
i32 98, label %19
]
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %2, i32* %3)
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = call i32 @ackr(i32 %15, i32 %16)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %17)
br label %45
19: ; preds = %0
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %4)
%22 = load i32, i32* %4
%23 = shl i32 %22, 2
%24 = call i64 @malloc(i32 %23)
%25 = inttoptr i64 %24 to float*
%26 = load i32, i32* %4
%27 = icmp sgt i32 %26, 0
br i1 %27, label %28, label %37
28: ; preds = %19, %28
%29 = phi i32 [ %34, %28 ], [ 0, %19 ]
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 %29)
%31 = zext i32 %29 to i64
%32 = getelementptr inbounds float, float* %25, i64 %31
%33 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), float* %32)
%34 = add nuw nsw i32 %29, 1
%35 = load i32, i32* %4
%36 = icmp slt i32 %34, %35
br i1 %36, label %28, label %37
37: ; preds = %28, %19
%38 = phi i32 [ %26, %19 ], [ %35, %28 ]
%39 = call double @vet(float* %25, i32 %38, i32 0, i32 0, i32 %38)
%40 = load i32, i32* %4
%41 = call double @vet(float* %25, i32 %40, i32 0, i32 0, i32 %40)
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), double %41)
br label %45
43: ; preds = %0
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0))
br label %45
45: ; preds = %43, %37, %12
ret i32 0
}