void kernel_symm(int m, int n, double alpha, double beta,
                 double C[1000 + 0][1200 + 0], double A[1000 + 0][1000 + 0],
                 double B[1000 + 0][1200 + 0]) {
  int i, j, k;
  double temp2;
#pragma scop
  for (i = 0; i < m; i++)
    for (j = 0; j < n; j++) {
      temp2 = 0;
      for (k = 0; k < i; k++) {
        C[k][j] += alpha * B[i][j] * A[i][k];
        temp2 += B[k][j] * A[i][k];
      }
      C[i][j] = beta * C[i][j] + alpha * B[i][j] * A[i][i] + alpha * temp2;
    }
#pragma endscop
}


x86 assembly (clang, -O0):
<kernel_symm>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    12cb <kernel_symm+0x1cb>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12b8 <kernel_symm+0x1b8>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    121a <kernel_symm+0x11a>
movsd  -0x10(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
imul   $0x2580,%rcx,%rcx
add    %rcx,%rax
movslq -0x38(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
imul   $0x1f40,%rcx,%rcx
add    %rcx,%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
imul   $0x2580,%rcx,%rcx
add    %rcx,%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
imul   $0x2580,%rcx,%rcx
add    %rcx,%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
imul   $0x1f40,%rcx,%rcx
add    %rcx,%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1155 <kernel_symm+0x55>
movsd  -0x18(%rbp),%xmm1
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
imul   $0x2580,%rcx,%rcx
add    %rcx,%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x10(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
imul   $0x2580,%rcx,%rcx
add    %rcx,%rax
movslq -0x38(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
imul   $0x1f40,%rcx,%rcx
add    %rcx,%rax
movslq -0x34(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
imul   $0x2580,%rcx,%rcx
add    %rcx,%rax
movslq -0x38(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    113a <kernel_symm+0x3a>
jmp    12bd <kernel_symm+0x1bd>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1127 <kernel_symm+0x27>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel_symm>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rcx,-0x8(%rsp)
test   %edi,%edi
jle    121a <kernel_symm+0x11a>
mov    %edi,%r9d
mov    %esi,%r11d
xor    %r13d,%r13d
mov    -0x8(%rsp),%rcx
xor    %r15d,%r15d
jmp    114b <kernel_symm+0x4b>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r15
add    $0x1f40,%rcx
add    $0x2580,%r13
cmp    %r9,%r15
je     121a <kernel_symm+0x11a>
test   %esi,%esi
jle    1130 <kernel_symm+0x30>
imul   $0x1f40,%r15,%rax
add    -0x8(%rsp),%rax
lea    (%rax,%r15,8),%r14
mov    %r8,%rbx
mov    %rdx,%rdi
xor    %r12d,%r12d
jmp    11c4 <kernel_symm+0xc4>
nopw   0x0(%rax,%rax,1)
xorpd  %xmm2,%xmm2
imul   $0x2580,%r15,%rax
lea    (%rdx,%rax,1),%rbp
add    %r8,%rax
movsd  (%rax,%r12,8),%xmm3
mulsd  %xmm0,%xmm3
mulsd  (%r14),%xmm3
movsd  0x0(%rbp,%r12,8),%xmm4
mulsd  %xmm1,%xmm4
addsd  %xmm3,%xmm4
mulsd  %xmm0,%xmm2
addsd  %xmm4,%xmm2
movsd  %xmm2,0x0(%rbp,%r12,8)
add    $0x1,%r12
add    $0x8,%rdi
add    $0x8,%rbx
cmp    %r11,%r12
je     1130 <kernel_symm+0x30>
test   %r15,%r15
je     1170 <kernel_symm+0x70>
imul   $0x2580,%r15,%rax
add    %r8,%rax
lea    (%rax,%r12,8),%rax
xorpd  %xmm2,%xmm2
xor    %ebp,%ebp
mov    %rcx,%r10
movsd  (%rax),%xmm3
mulsd  %xmm0,%xmm3
mulsd  (%r10),%xmm3
addsd  (%rdi,%rbp,1),%xmm3
movsd  %xmm3,(%rdi,%rbp,1)
movsd  (%rbx,%rbp,1),%xmm3
mulsd  (%r10),%xmm3
addsd  %xmm3,%xmm2
add    $0x8,%r10
add    $0x2580,%rbp
cmp    %rbp,%r13
jne    11e0 <kernel_symm+0xe0>
jmp    1174 <kernel_symm+0x74>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @kernel_symm(i32 %0, i32 %1, double %2, double %3, [1200 x double]* nocapture %4, [1000 x double]* nocapture %5, [1200 x double]* nocapture %6) {
%8 = icmp sgt i32 %0, 0
br i1 %8, label %9, label %54
9: ; preds = %7
%10 = icmp sgt i32 %1, 0
%11 = zext i32 %0 to i64
%12 = zext i32 %1 to i64
br label %13
13: ; preds = %9, %51
%14 = phi i64 [ 0, %9 ], [ %52, %51 ]
br i1 %10, label %15, label %51
15: ; preds = %13
%16 = icmp eq i64 %14, 0
%17 = getelementptr inbounds [1000 x double], [1000 x double]* %5, i64 %14, i64 %14
br label %18
18: ; preds = %15, %38
%19 = phi i64 [ 0, %15 ], [ %49, %38 ]
br i1 %16, label %38, label %20
20: ; preds = %18
%21 = getelementptr inbounds [1200 x double], [1200 x double]* %6, i64 %14, i64 %19
br label %22
22: ; preds = %20, %22
%23 = phi i64 [ 0, %20 ], [ %36, %22 ]
%24 = phi double [ 0.000000e+00, %20 ], [ %35, %22 ]
%25 = load double, double* %21
%26 = fmul double %25, %2
%27 = getelementptr inbounds [1000 x double], [1000 x double]* %5, i64 %14, i64 %23
%28 = load double, double* %27
%29 = getelementptr inbounds [1200 x double], [1200 x double]* %4, i64 %23, i64 %19
%30 = load double, double* %29
%31 = tail call double @llvm.fmuladd.f64(double %26, double %28, double %30)
store double %31, double* %29
%32 = getelementptr inbounds [1200 x double], [1200 x double]* %6, i64 %23, i64 %19
%33 = load double, double* %32
%34 = load double, double* %27
%35 = tail call double @llvm.fmuladd.f64(double %33, double %34, double %24)
%36 = add nuw nsw i64 %23, 1
%37 = icmp eq i64 %36, %14
br i1 %37, label %38, label %22
38: ; preds = %22, %18
%39 = phi double [ 0.000000e+00, %18 ], [ %35, %22 ]
%40 = getelementptr inbounds [1200 x double], [1200 x double]* %4, i64 %14, i64 %19
%41 = load double, double* %40
%42 = getelementptr inbounds [1200 x double], [1200 x double]* %6, i64 %14, i64 %19
%43 = load double, double* %42
%44 = fmul double %43, %2
%45 = load double, double* %17
%46 = fmul double %44, %45
%47 = tail call double @llvm.fmuladd.f64(double %3, double %41, double %46)
%48 = tail call double @llvm.fmuladd.f64(double %2, double %39, double %47)
store double %48, double* %40
%49 = add nuw nsw i64 %19, 1
%50 = icmp eq i64 %49, %12
br i1 %50, label %51, label %18
51: ; preds = %38, %13
%52 = add nuw nsw i64 %14, 1
%53 = icmp eq i64 %52, %11
br i1 %53, label %54, label %13
54: ; preds = %51, %7
ret void
}