#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 */
float computarOperacao(char operacao, double *valores) {
  double soma = 0;
  size_t j;
  for (j = 0; j < 12; j++) {
    soma += valores[j];
  }
  if (operacao == 'S') {
    return soma;
  } else {
    return soma / 12;
  }
}


x86 assembly (clang, -O0):
<computarOperacao>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0xc,-0x20(%rbp)
jae    1151 <computarOperacao+0x51>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    111e <computarOperacao+0x1e>
movsbl -0x5(%rbp),%eax
cmp    $0x53,%eax
jne    1171 <computarOperacao+0x71>
movsd  -0x18(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    118b <computarOperacao+0x8b>
movsd  -0x18(%rbp),%xmm0
movsd  0xe82(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<computarOperacao>:
xorpd  %xmm0,%xmm0
addsd  (%rsi),%xmm0
addsd  0x8(%rsi),%xmm0
addsd  0x10(%rsi),%xmm0
addsd  0x18(%rsi),%xmm0
addsd  0x20(%rsi),%xmm0
addsd  0x28(%rsi),%xmm0
addsd  0x30(%rsi),%xmm0
addsd  0x38(%rsi),%xmm0
addsd  0x40(%rsi),%xmm0
addsd  0x48(%rsi),%xmm0
addsd  0x50(%rsi),%xmm0
addsd  0x58(%rsi),%xmm0
cmp    $0x53,%dil
je     114d <computarOperacao+0x4d>
divsd  0xeb3(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @computarOperacao(i8 signext %0, double* %1) {
%3 = alloca float
%4 = alloca i8
%5 = alloca double*
%6 = alloca double
%7 = alloca i64
store i8 %0, i8* %4
store double* %1, double** %5
store double 0.000000e+00, double* %6
store i64 0, i64* %7
br label %8
8: ; preds = %18, %2
%9 = load i64, i64* %7
%10 = icmp ult i64 %9, 12
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = load double*, double** %5
%13 = load i64, i64* %7
%14 = getelementptr inbounds double, double* %12, i64 %13
%15 = load double, double* %14
%16 = load double, double* %6
%17 = fadd double %16, %15
store double %17, double* %6
br label %18
18: ; preds = %11
%19 = load i64, i64* %7
%20 = add i64 %19, 1
store i64 %20, i64* %7
br label %8
21: ; preds = %8
%22 = load i8, i8* %4
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 83
br i1 %24, label %25, label %28
25: ; preds = %21
%26 = load double, double* %6
%27 = fptrunc double %26 to float
store float %27, float* %3
br label %32
28: ; preds = %21
%29 = load double, double* %6
%30 = fdiv double %29, 1.200000e+01
%31 = fptrunc double %30 to float
store float %31, float* %3
br label %32
32: ; preds = %28, %25
%33 = load float, float* %3
ret float %33
}

LLVM IR (-O2):
define float @computarOperacao(i8 signext %0, double* nocapture %1) {
%3 = load double, double* %1
%4 = fadd double %3, 0.000000e+00
%5 = getelementptr inbounds double, double* %1, i64 1
%6 = load double, double* %5
%7 = fadd double %4, %6
%8 = getelementptr inbounds double, double* %1, i64 2
%9 = load double, double* %8
%10 = fadd double %7, %9
%11 = getelementptr inbounds double, double* %1, i64 3
%12 = load double, double* %11
%13 = fadd double %10, %12
%14 = getelementptr inbounds double, double* %1, i64 4
%15 = load double, double* %14
%16 = fadd double %13, %15
%17 = getelementptr inbounds double, double* %1, i64 5
%18 = load double, double* %17
%19 = fadd double %16, %18
%20 = getelementptr inbounds double, double* %1, i64 6
%21 = load double, double* %20
%22 = fadd double %19, %21
%23 = getelementptr inbounds double, double* %1, i64 7
%24 = load double, double* %23
%25 = fadd double %22, %24
%26 = getelementptr inbounds double, double* %1, i64 8
%27 = load double, double* %26
%28 = fadd double %25, %27
%29 = getelementptr inbounds double, double* %1, i64 9
%30 = load double, double* %29
%31 = fadd double %28, %30
%32 = getelementptr inbounds double, double* %1, i64 10
%33 = load double, double* %32
%34 = fadd double %31, %33
%35 = getelementptr inbounds double, double* %1, i64 11
%36 = load double, double* %35
%37 = fadd double %34, %36
%38 = icmp eq i8 %0, 83
%39 = fdiv double %37, 1.200000e+01
%40 = select i1 %38, double %37, double %39
%41 = fptrunc double %40 to float
ret float %41
}