#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], soma = 0;
  int i, j, L;
  char T;
  scanf(" %d %c", &L, &T);
  ;
  for (i = 0; i < 12; i++) {
    for (j = 0; j < 12; j++) {
      scanf(" %lf", &M[i][j]);
      if (j == L) {
        soma += M[i][j];
      }
    }
  }
  switch (T) {
  case 'S':
    printf("%0.1lf\n", soma);
    break;
  case 'M':
    printf("%0.1lf\n", soma / 12);
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4b0,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x498(%rbp)
ff
lea    0xec4(%rip),%rdi
lea    -0x4a4(%rbp),%rsi
lea    -0x4a5(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x49c(%rbp)
cmpl   $0xc,-0x49c(%rbp)
jge    122d <main+0x10d>
movl   $0x0,-0x4a0(%rbp)
cmpl   $0xc,-0x4a0(%rbp)
jge    1214 <main+0xf4>
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    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x4a0(%rbp),%eax
cmp    -0x4a4(%rbp),%eax
jne    11fb <main+0xdb>
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    1200 <main+0xe0>
mov    -0x4a0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4a0(%rbp)
jmp    117a <main+0x5a>
jmp    1219 <main+0xf9>
mov    -0x49c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x49c(%rbp)
jmp    1163 <main+0x43>
movsbl -0x4a5(%rbp),%eax
mov    %eax,-0x4ac(%rbp)
sub    $0x4d,%eax
je     1275 <main+0x155>
jmp    1248 <main+0x128>
mov    -0x4ac(%rbp),%eax
sub    $0x53,%eax
jne    1295 <main+0x175>
jmp    125c <main+0x13c>
movsd  -0x498(%rbp),%xmm0
ff
lea    0xda9(%rip),%rdi
call   1030 <printf@plt>
jmp    1295 <main+0x175>
movsd  -0x498(%rbp),%xmm0
ff
movsd  0xd7b(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xd84(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x4b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x4a0,%rsp
lea    0xed5(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x1f(%rsp),%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
xorpd  %xmm0,%xmm0
lea    0xec0(%rip),%r14
xor    %r15d,%r15d
jmp    117b <main+0x5b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  0x10(%rsp),%xmm0
addsd  (%rbx),%xmm0
add    $0x60,%r15
cmp    $0x480,%r15
je     1390 <main+0x270>
movsd  %xmm0,0x10(%rsp)
lea    (%rsp,%r15,1),%rbx
add    $0x20,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jne    11ad <main+0x8d>
movsd  0x10(%rsp),%xmm0
addsd  (%rbx),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    (%rsp,%r15,1),%rbx
add    $0x28,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x1,0xc(%rsp)
jne    11d9 <main+0xb9>
movsd  0x10(%rsp),%xmm0
addsd  (%rbx),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    (%rsp,%r15,1),%rbx
add    $0x30,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x2,0xc(%rsp)
jne    1205 <main+0xe5>
movsd  0x10(%rsp),%xmm0
addsd  (%rbx),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    (%rsp,%r15,1),%rbx
add    $0x38,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x3,0xc(%rsp)
jne    1231 <main+0x111>
movsd  0x10(%rsp),%xmm0
addsd  (%rbx),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    (%rsp,%r15,1),%rbx
add    $0x40,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x4,0xc(%rsp)
jne    125d <main+0x13d>
movsd  0x10(%rsp),%xmm0
addsd  (%rbx),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    (%rsp,%r15,1),%rbx
add    $0x48,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x5,0xc(%rsp)
jne    1289 <main+0x169>
movsd  0x10(%rsp),%xmm0
addsd  (%rbx),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    (%rsp,%r15,1),%rbx
add    $0x50,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x6,0xc(%rsp)
jne    12b5 <main+0x195>
movsd  0x10(%rsp),%xmm0
addsd  (%rbx),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    (%rsp,%r15,1),%rbx
add    $0x58,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x7,0xc(%rsp)
jne    12e1 <main+0x1c1>
movsd  0x10(%rsp),%xmm0
addsd  (%rbx),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    (%rsp,%r15,1),%rbx
add    $0x60,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x8,0xc(%rsp)
jne    130d <main+0x1ed>
movsd  0x10(%rsp),%xmm0
addsd  (%rbx),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    (%rsp,%r15,1),%rbx
add    $0x68,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x9,0xc(%rsp)
jne    1339 <main+0x219>
movsd  0x10(%rsp),%xmm0
addsd  (%rbx),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    (%rsp,%r15,1),%rbx
add    $0x70,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0xa,0xc(%rsp)
jne    1365 <main+0x245>
movsd  0x10(%rsp),%xmm0
addsd  (%rbx),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    (%rsp,%r15,1),%rbx
add    $0x78,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0xb,0xc(%rsp)
je     1160 <main+0x40>
movsd  0x10(%rsp),%xmm0
jmp    116a <main+0x4a>
movsbl 0x1f(%rsp),%eax
cmp    $0x53,%eax
je     13a7 <main+0x287>
cmp    $0x4d,%eax
jne    13b3 <main+0x293>
divsd  0xc59(%rip),%xmm0
lea    0xc66(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x4a0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c" %d %c\00"
@.str.1 = [5 x i8] c" %lf\00"
@.str.2 = [8 x i8] c"%0.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 i8
store i32 0, i32* %1
store double 0.000000e+00, double* %3
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %6, i8* %7)
store i32 0, i32* %4
br label %9
9: ; preds = %42, %0
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 12
br i1 %11, label %12, label %45
12: ; preds = %9
store i32 0, i32* %5
br label %13
13: ; preds = %38, %12
%14 = load i32, i32* %5
%15 = icmp slt i32 %14, 12
br i1 %15, label %16, label %41
16: ; preds = %13
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [12 x [12 x double]], [12 x [12 x double]]* %2, i64 0, i64 %18
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [12 x double], [12 x double]* %19, i64 0, i64 %21
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %22)
%24 = load i32, i32* %5
%25 = load i32, i32* %6
%26 = icmp eq i32 %24, %25
br i1 %26, label %27, label %37
27: ; preds = %16
%28 = load i32, i32* %4
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [12 x [12 x double]], [12 x [12 x double]]* %2, i64 0, i64 %29
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [12 x double], [12 x double]* %30, i64 0, i64 %32
%34 = load double, double* %33
%35 = load double, double* %3
%36 = fadd double %35, %34
store double %36, double* %3
br label %37
37: ; preds = %27, %16
br label %38
38: ; preds = %37
%39 = load i32, i32* %5
%40 = add nsw i32 %39, 1
store i32 %40, i32* %5
br label %13
41: ; preds = %13
br label %42
42: ; preds = %41
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
br label %9
45: ; preds = %9
%46 = load i8, i8* %7
%47 = sext i8 %46 to i32
switch i32 %47, label %55 [
i32 83, label %48
i32 77, label %51
]
48: ; preds = %45
%49 = load double, double* %3
%50 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double %49)
br label %55
51: ; preds = %45
%52 = load double, double* %3
%53 = fdiv double %52, 1.200000e+01
%54 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double %53)
br label %55
55: ; preds = %45, %51, %48
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c" %d %c\00"
@.str.1 = [5 x i8] c" %lf\00"
@.str.2 = [8 x i8] c"%0.1lf\0A\00"
define i32 @main() {
%1 = alloca [12 x [12 x double]]
%2 = alloca i32
%3 = alloca i8
%4 = bitcast [12 x [12 x double]]* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %2, i8* %3)
br label %7
7: ; preds = %0, %116
%8 = phi i64 [ 0, %0 ], [ %118, %116 ]
%9 = phi double [ 0.000000e+00, %0 ], [ %117, %116 ]
%10 = getelementptr inbounds [12 x [12 x double]], [12 x [12 x double]]* %1, i64 0, i64 %8, i64 0
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %10)
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %7
%15 = load double, double* %10
%16 = fadd double %9, %15
br label %17
17: ; preds = %7, %14
%18 = phi double [ %16, %14 ], [ %9, %7 ]
%19 = getelementptr inbounds [12 x [12 x double]], [12 x [12 x double]]* %1, i64 0, i64 %8, i64 1
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %19)
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %26
23: ; preds = %17
%24 = load double, double* %19
%25 = fadd double %18, %24
br label %26
26: ; preds = %23, %17
%27 = phi double [ %25, %23 ], [ %18, %17 ]
%28 = getelementptr inbounds [12 x [12 x double]], [12 x [12 x double]]* %1, i64 0, i64 %8, i64 2
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %28)
%30 = load i32, i32* %2
%31 = icmp eq i32 %30, 2
br i1 %31, label %32, label %35
32: ; preds = %26
%33 = load double, double* %28
%34 = fadd double %27, %33
br label %35
35: ; preds = %32, %26
%36 = phi double [ %34, %32 ], [ %27, %26 ]
%37 = getelementptr inbounds [12 x [12 x double]], [12 x [12 x double]]* %1, i64 0, i64 %8, i64 3
%38 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %37)
%39 = load i32, i32* %2
%40 = icmp eq i32 %39, 3
br i1 %40, label %41, label %44
41: ; preds = %35
%42 = load double, double* %37
%43 = fadd double %36, %42
br label %44
44: ; preds = %41, %35
%45 = phi double [ %43, %41 ], [ %36, %35 ]
%46 = getelementptr inbounds [12 x [12 x double]], [12 x [12 x double]]* %1, i64 0, i64 %8, i64 4
%47 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %46)
%48 = load i32, i32* %2
%49 = icmp eq i32 %48, 4
br i1 %49, label %50, label %53
50: ; preds = %44
%51 = load double, double* %46
%52 = fadd double %45, %51
br label %53
53: ; preds = %50, %44
%54 = phi double [ %52, %50 ], [ %45, %44 ]
%55 = getelementptr inbounds [12 x [12 x double]], [12 x [12 x double]]* %1, i64 0, i64 %8, i64 5
%56 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %55)
%57 = load i32, i32* %2
%58 = icmp eq i32 %57, 5
br i1 %58, label %59, label %62
59: ; preds = %53
%60 = load double, double* %55
%61 = fadd double %54, %60
br label %62
62: ; preds = %59, %53
%63 = phi double [ %61, %59 ], [ %54, %53 ]
%64 = getelementptr inbounds [12 x [12 x double]], [12 x [12 x double]]* %1, i64 0, i64 %8, i64 6
%65 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %64)
%66 = load i32, i32* %2
%67 = icmp eq i32 %66, 6
br i1 %67, label %68, label %71
68: ; preds = %62
%69 = load double, double* %64
%70 = fadd double %63, %69
br label %71
71: ; preds = %68, %62
%72 = phi double [ %70, %68 ], [ %63, %62 ]
%73 = getelementptr inbounds [12 x [12 x double]], [12 x [12 x double]]* %1, i64 0, i64 %8, i64 7
%74 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %73)
%75 = load i32, i32* %2
%76 = icmp eq i32 %75, 7
br i1 %76, label %77, label %80
77: ; preds = %71
%78 = load double, double* %73
%79 = fadd double %72, %78
br label %80
80: ; preds = %77, %71
%81 = phi double [ %79, %77 ], [ %72, %71 ]
%82 = getelementptr inbounds [12 x [12 x double]], [12 x [12 x double]]* %1, i64 0, i64 %8, i64 8
%83 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %82)
%84 = load i32, i32* %2
%85 = icmp eq i32 %84, 8
br i1 %85, label %86, label %89
86: ; preds = %80
%87 = load double, double* %82
%88 = fadd double %81, %87
br label %89
89: ; preds = %86, %80
%90 = phi double [ %88, %86 ], [ %81, %80 ]
%91 = getelementptr inbounds [12 x [12 x double]], [12 x [12 x double]]* %1, i64 0, i64 %8, i64 9
%92 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %91)
%93 = load i32, i32* %2
%94 = icmp eq i32 %93, 9
br i1 %94, label %95, label %98
95: ; preds = %89
%96 = load double, double* %91
%97 = fadd double %90, %96
br label %98
98: ; preds = %95, %89
%99 = phi double [ %97, %95 ], [ %90, %89 ]
%100 = getelementptr inbounds [12 x [12 x double]], [12 x [12 x double]]* %1, i64 0, i64 %8, i64 10
%101 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %100)
%102 = load i32, i32* %2
%103 = icmp eq i32 %102, 10
br i1 %103, label %104, label %107
104: ; preds = %98
%105 = load double, double* %100
%106 = fadd double %99, %105
br label %107
107: ; preds = %104, %98
%108 = phi double [ %106, %104 ], [ %99, %98 ]
%109 = getelementptr inbounds [12 x [12 x double]], [12 x [12 x double]]* %1, i64 0, i64 %8, i64 11
%110 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %109)
%111 = load i32, i32* %2
%112 = icmp eq i32 %111, 11
br i1 %112, label %113, label %116
113: ; preds = %107
%114 = load double, double* %109
%115 = fadd double %108, %114
br label %116
116: ; preds = %113, %107
%117 = phi double [ %115, %113 ], [ %108, %107 ]
%118 = add nuw nsw i64 %8, 1
%119 = icmp eq i64 %118, 12
br i1 %119, label %120, label %7
120: ; preds = %116
%121 = load i8, i8* %3
%122 = sext i8 %121 to i32
switch i32 %122, label %128 [
i32 83, label %125
i32 77, label %123
]
123: ; preds = %120
%124 = fdiv double %117, 1.200000e+01
br label %125
125: ; preds = %120, %123
%126 = phi double [ %124, %123 ], [ %117, %120 ]
%127 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), double %126)
br label %128
128: ; preds = %125, %120
ret i32 0
}