void kernel_atax(int m, int n, double A[1900 + 0][2100 + 0], double x[2100 + 0],
                 double y[2100 + 0], double tmp[1900 + 0]) {
  int i, j;
#pragma scop
  for (i = 0; i < n; i++)
    y[i] = 0;
  for (i = 0; i < m; i++) {
    tmp[i] = 0.0;
    for (j = 0; j < n; j++)
      tmp[i] = tmp[i] + A[i][j] * x[j];
    for (j = 0; j < n; j++)
      y[j] = y[j] + A[i][j] * tmp[i];
  }
#pragma endscop
}


x86 assembly (clang, -O0):
<kernel_atax>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    114b <kernel_atax+0x4b>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1121 <kernel_atax+0x21>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1257 <kernel_atax+0x157>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d9 <kernel_atax+0xd9>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
imul   $0x41a0,%rcx,%rcx
add    %rcx,%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1175 <kernel_atax+0x75>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1244 <kernel_atax+0x144>
mov    -0x20(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
imul   $0x41a0,%rcx,%rcx
add    %rcx,%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11e0 <kernel_atax+0xe0>
jmp    1249 <kernel_atax+0x149>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1152 <kernel_atax+0x52>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel_atax>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %r9,%rbx
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%rax
mov    %esi,%ebp
mov    %esi,%r13d
test   %esi,%esi
jle    1153 <kernel_atax+0x43>
lea    0x0(,%r13,8),%rdx
mov    %edi,0x10(%rsp)
mov    %r14,%rdi
xor    %esi,%esi
mov    %rax,%r12
call   1030 <memset@plt>
mov    0x10(%rsp),%edi
mov    %r12,%rax
test   %edi,%edi
jle    13d1 <kernel_atax+0x2c1>
mov    %edi,%ecx
mov    %rcx,0x10(%rsp)
lea    0x8(%r14),%rcx
mov    %rcx,0x40(%rsp)
lea    (%r14,%r13,8),%rcx
mov    %rcx,0x38(%rsp)
lea    -0x1(%r13),%rcx
mov    %r13d,%edi
and    $0xfffffffe,%edi
mov    %rcx,0x20(%rsp)
and    $0xfffffffffffffffc,%rcx
mov    %rcx,0x30(%rsp)
add    $0x1,%rcx
mov    %rcx,0x28(%rsp)
mov    %r13,%rcx
neg    %rcx
mov    %rcx,0x60(%rsp)
lea    0x8(%rax),%rdx
xor    %r9d,%r9d
mov    %rax,%r12
mov    %rax,0x18(%rsp)
jmp    11dd <kernel_atax+0xcd>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r9
add    $0x41a0,%rdx
add    $0x41a0,%r12
cmp    0x10(%rsp),%r9
je     13d1 <kernel_atax+0x2c1>
movq   $0x0,(%rbx,%r9,8)
test   %ebp,%ebp
jle    11c0 <kernel_atax+0xb0>
imul   $0x41a0,%r9,%r10
xorpd  %xmm0,%xmm0
xor    %ecx,%ecx
cmp    $0x1,%ebp
je     1235 <kernel_atax+0x125>
nopl   0x0(%rax,%rax,1)
movsd  -0x8(%rdx,%rcx,8),%xmm1
mulsd  (%r15,%rcx,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx,%r9,8)
movsd  (%rdx,%rcx,8),%xmm0
mulsd  0x8(%r15,%rcx,8),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx,%r9,8)
add    $0x2,%rcx
cmp    %rcx,%rdi
jne    1200 <kernel_atax+0xf0>
lea    (%rax,%r10,1),%r8
test   $0x1,%r13b
je     1255 <kernel_atax+0x145>
movsd  (%r8,%rcx,8),%xmm1
mulsd  (%r15,%rcx,8),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx,%r9,8)
test   %ebp,%ebp
jle    11c0 <kernel_atax+0xb0>
mulsd  (%rax,%r10,1),%xmm0
addsd  (%r14),%xmm0
movsd  %xmm0,(%r14)
cmp    $0x1,%ebp
je     11c0 <kernel_atax+0xb0>
mov    $0x1,%r11d
cmpq   $0x4,0x20(%rsp)
jb     1357 <kernel_atax+0x247>
lea    (%rbx,%r9,8),%rcx
mov    %rcx,0x50(%rsp)
lea    (%rbx,%r9,8),%rcx
add    $0x8,%rcx
lea    0x8(%rax,%r10,1),%rax
mov    %rax,0x58(%rsp)
lea    (%r8,%r13,8),%rax
mov    %rax,0x48(%rsp)
mov    0x40(%rsp),%rax
cmp    %rcx,%rax
setb   0xf(%rsp)
mov    0x38(%rsp),%rsi
cmp    %rsi,0x50(%rsp)
setb   %r10b
cmp    0x48(%rsp),%rax
setb   %cl
cmp    %rsi,0x58(%rsp)
setb   %al
test   %r10b,0xf(%rsp)
jne    1352 <kernel_atax+0x242>
and    %al,%cl
mov    0x18(%rsp),%rax
jne    1357 <kernel_atax+0x247>
movsd  (%rbx,%r9,8),%xmm0
unpcklpd %xmm0,%xmm0
xor    %ecx,%ecx
mov    0x30(%rsp),%rsi
nopl   0x0(%rax,%rax,1)
movupd 0x8(%r14,%rcx,8),%xmm1
movupd 0x18(%r14,%rcx,8),%xmm2
movupd (%rdx,%rcx,8),%xmm3
movupd 0x10(%rdx,%rcx,8),%xmm4
mulpd  %xmm0,%xmm3
addpd  %xmm1,%xmm3
mulpd  %xmm0,%xmm4
addpd  %xmm2,%xmm4
movupd %xmm3,0x8(%r14,%rcx,8)
movupd %xmm4,0x18(%r14,%rcx,8)
add    $0x4,%rcx
cmp    %rcx,%rsi
jne    1300 <kernel_atax+0x1f0>
mov    0x28(%rsp),%r11
cmp    %rsi,0x20(%rsp)
je     11c0 <kernel_atax+0xb0>
jmp    1357 <kernel_atax+0x247>
mov    0x18(%rsp),%rax
mov    %r11,%rcx
test   $0x1,%r13b
jne    137c <kernel_atax+0x26c>
movsd  (%r8,%r11,8),%xmm0
mulsd  (%rbx,%r9,8),%xmm0
addsd  (%r14,%r11,8),%xmm0
movsd  %xmm0,(%r14,%r11,8)
lea    0x1(%r11),%rcx
not    %r11
cmp    0x60(%rsp),%r11
je     11c0 <kernel_atax+0xb0>
nopw   0x0(%rax,%rax,1)
movsd  (%r12,%rcx,8),%xmm0
mulsd  (%rbx,%r9,8),%xmm0
addsd  (%r14,%rcx,8),%xmm0
movsd  %xmm0,(%r14,%rcx,8)
movsd  0x8(%r12,%rcx,8),%xmm0
mulsd  (%rbx,%r9,8),%xmm0
addsd  0x8(%r14,%rcx,8),%xmm0
movsd  %xmm0,0x8(%r14,%rcx,8)
add    $0x2,%rcx
cmp    %rcx,%r13
jne    1390 <kernel_atax+0x280>
jmp    11c0 <kernel_atax+0xb0>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @kernel_atax(i32 %0, i32 %1, [2100 x double]* nocapture %2, double* nocapture %3, double* nocapture %4, double* nocapture %5) {
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %12
8: ; preds = %6
%9 = bitcast double* %4 to i8*
%10 = zext i32 %1 to i64
%11 = shl nuw nsw i64 %10, 3
br label %12
12: ; preds = %8, %6
%13 = icmp sgt i32 %0, 0
br i1 %13, label %14, label %148
14: ; preds = %12
%15 = zext i32 %0 to i64
%16 = zext i32 %1 to i64
%17 = zext i32 %1 to i64
%18 = getelementptr double, double* %4, i64 1
%19 = getelementptr double, double* %4, i64 %16
%20 = add nsw i64 %16, -1
%21 = and i64 %16, 1
%22 = icmp eq i32 %1, 1
%23 = and i64 %16, 4294967294
%24 = icmp eq i64 %21, 0
%25 = icmp eq i32 %1, 1
%26 = icmp ult i64 %20, 4
%27 = and i64 %20, -4
%28 = or i64 %27, 1
%29 = icmp eq i64 %20, %27
%30 = and i64 %16, 1
%31 = icmp eq i64 %30, 0
%32 = sub nsw i64 0, %16
br label %33
33: ; preds = %14, %145
%34 = phi i64 [ 0, %14 ], [ %146, %145 ]
%35 = getelementptr double, double* %5, i64 %34
%36 = add nuw i64 %34, 1
%37 = getelementptr double, double* %5, i64 %36
%38 = getelementptr [2100 x double], [2100 x double]* %2, i64 %34, i64 1
%39 = getelementptr [2100 x double], [2100 x double]* %2, i64 %34, i64 %16
%40 = getelementptr inbounds double, double* %5, i64 %34
store double 0.000000e+00, double* %40
br i1 %7, label %41, label %145
41: ; preds = %33
br i1 %22, label %42, label %110
42: ; preds = %110, %41
%43 = phi double [ undef, %41 ], [ %124, %110 ]
%44 = phi double [ 0.000000e+00, %41 ], [ %124, %110 ]
%45 = phi i64 [ 0, %41 ], [ %125, %110 ]
br i1 %24, label %52, label %46
46: ; preds = %42
%47 = getelementptr inbounds [2100 x double], [2100 x double]* %2, i64 %34, i64 %45
%48 = load double, double* %47
%49 = getelementptr inbounds double, double* %3, i64 %45
%50 = load double, double* %49
%51 = tail call double @llvm.fmuladd.f64(double %48, double %50, double %44)
store double %51, double* %40
br label %52
52: ; preds = %42, %46
%53 = phi double [ %43, %42 ], [ %51, %46 ]
br i1 %7, label %54, label %145
54: ; preds = %52
%55 = load double, double* %4
%56 = getelementptr inbounds [2100 x double], [2100 x double]* %2, i64 %34, i64 0
%57 = load double, double* %56
%58 = tail call double @llvm.fmuladd.f64(double %57, double %53, double %55)
store double %58, double* %4
br i1 %25, label %145, label %59
59: ; preds = %54
br i1 %26, label %96, label %60
60: ; preds = %59
%61 = icmp ult double* %18, %37
%62 = icmp ult double* %35, %19
%63 = and i1 %61, %62
%64 = icmp ult double* %18, %39
%65 = icmp ult double* %38, %19
%66 = and i1 %64, %65
%67 = or i1 %63, %66
br i1 %67, label %96, label %68
68: ; preds = %60
%69 = load double, double* %40
%70 = insertelement <2 x double> poison, double %69, i64 0
%71 = shufflevector <2 x double> %70, <2 x double> poison, <2 x i32> zeroinitializer
%72 = insertelement <2 x double> poison, double %69, i64 0
%73 = shufflevector <2 x double> %72, <2 x double> poison, <2 x i32> zeroinitializer
br label %74
74: ; preds = %74, %68
%75 = phi i64 [ 0, %68 ], [ %93, %74 ]
%76 = or i64 %75, 1
%77 = getelementptr inbounds double, double* %4, i64 %76
%78 = bitcast double* %77 to <2 x double>*
%79 = load <2 x double>, <2 x double>* %78
%80 = getelementptr inbounds double, double* %77, i64 2
%81 = bitcast double* %80 to <2 x double>*
%82 = load <2 x double>, <2 x double>* %81
%83 = getelementptr inbounds [2100 x double], [2100 x double]* %2, i64 %34, i64 %76
%84 = bitcast double* %83 to <2 x double>*
%85 = load <2 x double>, <2 x double>* %84
%86 = getelementptr inbounds double, double* %83, i64 2
%87 = bitcast double* %86 to <2 x double>*
%88 = load <2 x double>, <2 x double>* %87
%89 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %85, <2 x double> %71, <2 x double> %79)
%90 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %88, <2 x double> %73, <2 x double> %82)
%91 = bitcast double* %77 to <2 x double>*
store <2 x double> %89, <2 x double>* %91
%92 = bitcast double* %80 to <2 x double>*
store <2 x double> %90, <2 x double>* %92
%93 = add nuw i64 %75, 4
%94 = icmp eq i64 %93, %27
br i1 %94, label %95, label %74
95: ; preds = %74
br i1 %29, label %145, label %96
96: ; preds = %60, %59, %95
%97 = phi i64 [ 1, %60 ], [ 1, %59 ], [ %28, %95 ]
%98 = xor i64 %97, -1
br i1 %31, label %99, label %107
99: ; preds = %96
%100 = load double, double* %40
%101 = getelementptr inbounds double, double* %4, i64 %97
%102 = load double, double* %101
%103 = getelementptr inbounds [2100 x double], [2100 x double]* %2, i64 %34, i64 %97
%104 = load double, double* %103
%105 = tail call double @llvm.fmuladd.f64(double %104, double %100, double %102)
store double %105, double* %101
%106 = add nuw nsw i64 %97, 1
br label %107
107: ; preds = %99, %96
%108 = phi i64 [ %97, %96 ], [ %106, %99 ]
%109 = icmp eq i64 %98, %32
br i1 %109, label %145, label %128
110: ; preds = %41, %110
%111 = phi double [ %124, %110 ], [ 0.000000e+00, %41 ]
%112 = phi i64 [ %125, %110 ], [ 0, %41 ]
%113 = phi i64 [ %126, %110 ], [ 0, %41 ]
%114 = getelementptr inbounds [2100 x double], [2100 x double]* %2, i64 %34, i64 %112
%115 = load double, double* %114
%116 = getelementptr inbounds double, double* %3, i64 %112
%117 = load double, double* %116
%118 = tail call double @llvm.fmuladd.f64(double %115, double %117, double %111)
store double %118, double* %40
%119 = or i64 %112, 1
%120 = getelementptr inbounds [2100 x double], [2100 x double]* %2, i64 %34, i64 %119
%121 = load double, double* %120
%122 = getelementptr inbounds double, double* %3, i64 %119
%123 = load double, double* %122
%124 = tail call double @llvm.fmuladd.f64(double %121, double %123, double %118)
store double %124, double* %40
%125 = add nuw nsw i64 %112, 2
%126 = add i64 %113, 2
%127 = icmp eq i64 %126, %23
br i1 %127, label %42, label %110
128: ; preds = %107, %128
%129 = phi i64 [ %143, %128 ], [ %108, %107 ]
%130 = load double, double* %40
%131 = getelementptr inbounds double, double* %4, i64 %129
%132 = load double, double* %131
%133 = getelementptr inbounds [2100 x double], [2100 x double]* %2, i64 %34, i64 %129
%134 = load double, double* %133
%135 = tail call double @llvm.fmuladd.f64(double %134, double %130, double %132)
store double %135, double* %131
%136 = add nuw nsw i64 %129, 1
%137 = load double, double* %40
%138 = getelementptr inbounds double, double* %4, i64 %136
%139 = load double, double* %138
%140 = getelementptr inbounds [2100 x double], [2100 x double]* %2, i64 %34, i64 %136
%141 = load double, double* %140
%142 = tail call double @llvm.fmuladd.f64(double %141, double %137, double %139)
store double %142, double* %138
%143 = add nuw nsw i64 %129, 2
%144 = icmp eq i64 %143, %17
br i1 %144, label %145, label %128
145: ; preds = %107, %128, %54, %95, %33, %52
%146 = add nuw nsw i64 %34, 1
%147 = icmp eq i64 %146, %15
br i1 %147, label %148, label %33
148: ; preds = %145, %12
ret void
}