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


x86 assembly (clang, -O0):
<computarOperacao>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x9(%rbp)
mov    %esi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
cmpq   $0xc,-0x28(%rbp)
jae    115c <computarOperacao+0x5c>
mov    -0x18(%rbp),%rax
imul   $0x60,-0x28(%rbp),%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1121 <computarOperacao+0x21>
movsbl -0x9(%rbp),%eax
cmp    $0x53,%eax
jne    1178 <computarOperacao+0x78>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    118e <computarOperacao+0x8e>
movsd  -0x20(%rbp),%xmm0
movsd  0xe7b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<computarOperacao>:
movslq %esi,%rax
xorpd  %xmm0,%xmm0
addsd  (%rdx,%rax,8),%xmm0
addsd  0x60(%rdx,%rax,8),%xmm0
addsd  0xc0(%rdx,%rax,8),%xmm0
addsd  0x120(%rdx,%rax,8),%xmm0
addsd  0x180(%rdx,%rax,8),%xmm0
addsd  0x1e0(%rdx,%rax,8),%xmm0
addsd  0x240(%rdx,%rax,8),%xmm0
addsd  0x2a0(%rdx,%rax,8),%xmm0
addsd  0x300(%rdx,%rax,8),%xmm0
addsd  0x360(%rdx,%rax,8),%xmm0
addsd  0x3c0(%rdx,%rax,8),%xmm0
addsd  0x420(%rdx,%rax,8),%xmm0
cmp    $0x53,%dil
je     117a <computarOperacao+0x7a>
divsd  0xe86(%rip),%xmm0
ret

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

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