#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 *, double);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  double M[12][12], aux;
  int i, j, contador = 10, flag = 0;
  char escolha;
  scanf("%c", &escolha);
  for (i = 0; i < 12; i++) {
    for (j = 0; j < 12; j++) {
      scanf("%lf", &M[i][j]);
      if (i == j && i < 5) {
        flag = 1;
      } else if (j <= contador && flag) {
        aux += M[i][j];
      }
    }
    contador--;
    flag = 0;
  }
  if (escolha == 'S') {
    printf("%.1lf\n", aux);
  } else {
    printf("%.1lf\n", aux / 30);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4b0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x4a4(%rbp)
movl   $0x0,-0x4a8(%rbp)
lea    0xebb(%rip),%rdi
lea    -0x4a9(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x49c(%rbp)
cmpl   $0xc,-0x49c(%rbp)
jge    1283 <main+0x163>
movl   $0x0,-0x4a0(%rbp)
cmpl   $0xc,-0x4a0(%rbp)
jge    1256 <main+0x136>
movslq -0x49c(%rbp),%rax
lea    -0x490(%rbp),%rsi
imul   $0x60,%rax,%rax
add    %rax,%rsi
movslq -0x4a0(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x49c(%rbp),%eax
cmp    -0x4a0(%rbp),%eax
jne    11e8 <main+0xc8>
cmpl   $0x5,-0x49c(%rbp)
jge    11e8 <main+0xc8>
movl   $0x1,-0x4a8(%rbp)
jmp    123d <main+0x11d>
mov    -0x4a0(%rbp),%eax
cmp    -0x4a4(%rbp),%eax
jg     1238 <main+0x118>
cmpl   $0x0,-0x4a8(%rbp)
je     1238 <main+0x118>
movslq -0x49c(%rbp),%rcx
lea    -0x490(%rbp),%rax
imul   $0x60,%rcx,%rcx
add    %rcx,%rax
movslq -0x4a0(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x498(%rbp),%xmm0
ff
movsd  %xmm0,-0x498(%rbp)
ff
jmp    123d <main+0x11d>
jmp    1242 <main+0x122>
mov    -0x4a0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4a0(%rbp)
jmp    117c <main+0x5c>
mov    -0x4a4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4a4(%rbp)
movl   $0x0,-0x4a8(%rbp)
mov    -0x49c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x49c(%rbp)
jmp    1165 <main+0x45>
movsbl -0x4a9(%rbp),%eax
cmp    $0x53,%eax
jne    12ac <main+0x18c>
movsd  -0x498(%rbp),%xmm0
ff
lea    0xd6d(%rip),%rdi
call   1030 <printf@plt>
jmp    12cc <main+0x1ac>
movsd  -0x498(%rbp),%xmm0
ff
movsd  0xd44(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xd48(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x4b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4a8,%rsp
lea    0xed0(%rip),%rdi
lea    0xf(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    $0xa,%r15d
lea    0x20(%rsp),%rbx
lea    0xeb5(%rip),%r14
xor    %r13d,%r13d
jmp    1177 <main+0x57>
nopl   0x0(%rax,%rax,1)
add    $0xffffffffffffffff,%r15
add    $0x1,%r13
mov    0x18(%rsp),%rbx
add    $0x60,%rbx
cmp    $0xc,%r13
je     11e6 <main+0xc6>
mov    %rbx,0x18(%rsp)
xor    %ebp,%ebp
xor    %r12d,%r12d
jmp    11a4 <main+0x84>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12d,%eax
add    $0x1,%rbp
add    $0x8,%rbx
mov    %eax,%r12d
cmp    $0xc,%rbp
je     1160 <main+0x40>
movsd  %xmm0,0x10(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    $0x1,%eax
cmp    $0x4,%r13
ja     11d0 <main+0xb0>
cmp    %rbp,%r13
jne    11d0 <main+0xb0>
movsd  0x10(%rsp),%xmm0
jmp    1193 <main+0x73>
nop
cmp    %r15,%rbp
movsd  0x10(%rsp),%xmm0
jg     1190 <main+0x70>
test   %r12d,%r12d
je     1190 <main+0x70>
addsd  (%rbx),%xmm0
jmp    1193 <main+0x73>
cmpb   $0x53,0xf(%rsp)
je     11f5 <main+0xd5>
divsd  0xe0b(%rip),%xmm0
lea    0xe13(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x4a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [7 x i8] c"%.1lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [12 x [12 x double]]
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
store i32 0, i32* %1
store i32 10, i32* %6
store i32 0, i32* %7
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8)
store i32 0, i32* %4
br label %10
10: ; preds = %57, %0
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 12
br i1 %12, label %13, label %60
13: ; preds = %10
store i32 0, i32* %5
br label %14
14: ; preds = %51, %13
%15 = load i32, i32* %5
%16 = icmp slt i32 %15, 12
br i1 %16, label %17, label %54
17: ; preds = %14
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [12 x [12 x double]], [12 x [12 x double]]* %2, i64 0, i64 %19
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [12 x double], [12 x double]* %20, i64 0, i64 %22
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %23)
%25 = load i32, i32* %4
%26 = load i32, i32* %5
%27 = icmp eq i32 %25, %26
br i1 %27, label %28, label %32
28: ; preds = %17
%29 = load i32, i32* %4
%30 = icmp slt i32 %29, 5
br i1 %30, label %31, label %32
31: ; preds = %28
store i32 1, i32* %7
br label %50
32: ; preds = %28, %17
%33 = load i32, i32* %5
%34 = load i32, i32* %6
%35 = icmp sle i32 %33, %34
br i1 %35, label %36, label %49
36: ; preds = %32
%37 = load i32, i32* %7
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %49
39: ; preds = %36
%40 = load i32, i32* %4
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [12 x [12 x double]], [12 x [12 x double]]* %2, i64 0, i64 %41
%43 = load i32, i32* %5
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [12 x double], [12 x double]* %42, i64 0, i64 %44
%46 = load double, double* %45
%47 = load double, double* %3
%48 = fadd double %47, %46
store double %48, double* %3
br label %49
49: ; preds = %39, %36, %32
br label %50
50: ; preds = %49, %31
br label %51
51: ; preds = %50
%52 = load i32, i32* %5
%53 = add nsw i32 %52, 1
store i32 %53, i32* %5
br label %14
54: ; preds = %14
%55 = load i32, i32* %6
%56 = add nsw i32 %55, -1
store i32 %56, i32* %6
store i32 0, i32* %7
br label %57
57: ; preds = %54
%58 = load i32, i32* %4
%59 = add nsw i32 %58, 1
store i32 %59, i32* %4
br label %10
60: ; preds = %10
%61 = load i8, i8* %8
%62 = sext i8 %61 to i32
%63 = icmp eq i32 %62, 83
br i1 %63, label %64, label %67
64: ; preds = %60
%65 = load double, double* %3
%66 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %65)
br label %71
67: ; preds = %60
%68 = load double, double* %3
%69 = fdiv double %68, 3.000000e+01
%70 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %69)
br label %71
71: ; preds = %67, %64
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [7 x i8] c"%.1lf\0A\00"
define i32 @main() {
%1 = alloca [12 x [12 x double]]
%2 = alloca i8
%3 = bitcast [12 x [12 x double]]* %1 to i8*
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %5
5: ; preds = %0, %30
%6 = phi i64 [ 0, %0 ], [ %32, %30 ]
%7 = phi i64 [ 10, %0 ], [ %31, %30 ]
%8 = phi double [ undef, %0 ], [ %26, %30 ]
%9 = icmp ult i64 %6, 5
br label %10
10: ; preds = %5, %25
%11 = phi i64 [ 0, %5 ], [ %28, %25 ]
%12 = phi i32 [ 0, %5 ], [ %27, %25 ]
%13 = phi double [ %8, %5 ], [ %26, %25 ]
%14 = getelementptr inbounds [12 x [12 x double]], [12 x [12 x double]]* %1, i64 0, i64 %6, i64 %11
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %14)
%16 = icmp eq i64 %6, %11
%17 = and i1 %9, %16
br i1 %17, label %25, label %18
18: ; preds = %10
%19 = icmp sle i64 %11, %7
%20 = icmp ne i32 %12, 0
%21 = select i1 %19, i1 %20, i1 false
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = load double, double* %14
%24 = fadd double %13, %23
br label %25
25: ; preds = %10, %22, %18
%26 = phi double [ %24, %22 ], [ %13, %18 ], [ %13, %10 ]
%27 = phi i32 [ 1, %22 ], [ %12, %18 ], [ 1, %10 ]
%28 = add nuw nsw i64 %11, 1
%29 = icmp eq i64 %28, 12
br i1 %29, label %30, label %10
30: ; preds = %25
%31 = add nsw i64 %7, -1
%32 = add nuw nsw i64 %6, 1
%33 = icmp eq i64 %32, 12
br i1 %33, label %34, label %5
34: ; preds = %30
%35 = load i8, i8* %2
%36 = icmp eq i8 %35, 83
%37 = fdiv double %26, 3.000000e+01
%38 = select i1 %36, double %26, double %37
%39 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %38)
ret i32 0
}