#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() {
  float M[12][12];
  double sum = 0.0;
  unsigned short L;
  char op;
  scanf("%c%*c", &op);
  for (int i = 0; i < 12; i++)
    for (int j = 0; j < 12; j++)
      scanf(" %f", &M[i][j]);
  for (int i = 0; i < 12; i++)
    for (int j = i + 1; j < 12; j++)
      sum += M[i][j];
  if (op == 'M')
    sum /= (12 * (12 - 1)) / 2;
  printf("%.1lf\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x270,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x258(%rbp)
ff
lea    0xec4(%rip),%rdi
lea    -0x25b(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x260(%rbp)
cmpl   $0xc,-0x260(%rbp)
jge    11de <main+0xbe>
movl   $0x0,-0x264(%rbp)
cmpl   $0xc,-0x264(%rbp)
jge    11c5 <main+0xa5>
movslq -0x260(%rbp),%rax
lea    -0x250(%rbp),%rsi
imul   $0x30,%rax,%rax
add    %rax,%rsi
movslq -0x264(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x264(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x264(%rbp)
jmp    1173 <main+0x53>
jmp    11ca <main+0xaa>
mov    -0x260(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x260(%rbp)
jmp    115c <main+0x3c>
movl   $0x0,-0x268(%rbp)
cmpl   $0xc,-0x268(%rbp)
jge    1273 <main+0x153>
mov    -0x268(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x26c(%rbp)
cmpl   $0xc,-0x26c(%rbp)
jge    125a <main+0x13a>
movslq -0x268(%rbp),%rcx
lea    -0x250(%rbp),%rax
imul   $0x30,%rcx,%rcx
add    %rcx,%rax
movslq -0x26c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  -0x258(%rbp),%xmm0
ff
movsd  %xmm0,-0x258(%rbp)
ff
mov    -0x26c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x26c(%rbp)
jmp    1204 <main+0xe4>
jmp    125f <main+0x13f>
mov    -0x268(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x268(%rbp)
jmp    11e8 <main+0xc8>
movsbl -0x25b(%rbp),%eax
cmp    $0x4d,%eax
jne    129f <main+0x17f>
movsd  -0x258(%rbp),%xmm0
ff
movsd  0xd6d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x258(%rbp)
ff
movsd  -0x258(%rbp),%xmm0
ff
lea    0xd64(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x270,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x258,%rsp
lea    0xed7(%rip),%rdi
lea    0xf(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xeca(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
lea    (%rsp,%rbx,1),%rsi
add    $0x10,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x14,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x18,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x1c,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x20,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x24,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x28,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x2c,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x30,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x34,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x38,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x3c,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
add    $0x30,%rbx
cmp    $0x240,%rbx
jne    1150 <main+0x30>
xorpd  %xmm0,%xmm0
lea    0x10(%rsp),%rax
xor    %edx,%edx
jmp    125a <main+0x13a>
cs nopw 0x0(%rax,%rax,1)
add    $0x68,%rax
cmp    $0xc,%rdx
je     12c1 <main+0x1a1>
mov    %rdx,%rcx
mov    %rdx,%rsi
or     $0x1,%rsi
mov    $0x1,%edx
nopl   0x0(%rax)
movss  (%rax,%rdx,4),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm1,%xmm0
lea    (%rcx,%rdx,1),%rdi
add    $0x1,%rdi
add    $0x1,%rdx
cmp    $0xc,%rdi
jne    1270 <main+0x150>
lea    0x2(%rcx),%rdx
cmp    $0xa,%rsi
ja     1250 <main+0x130>
mov    $0xe,%esi
xchg   %ax,%ax
movss  (%rax,%rsi,4),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm1,%xmm0
lea    (%rcx,%rsi,1),%rdi
add    $0x1,%rdi
add    $0x1,%rsi
cmp    $0x18,%rdi
jne    12a0 <main+0x180>
jmp    1250 <main+0x130>
cmpb   $0x4d,0xf(%rsp)
jne    12d0 <main+0x1b0>
divsd  0xd30(%rip),%xmm0
lea    0xd3b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x258,%rsp
pop    %rbx
pop    %r14
ret

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

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