void kernel_bicg(int m, int n, double A[2100 + 0][1900 + 0], double s[1900 + 0],
                 double q[2100 + 0], double p[1900 + 0], double r[2100 + 0]) {
  int i, j;
#pragma scop
  for (i = 0; i < m; i++)
    s[i] = 0;
  for (i = 0; i < n; i++) {
    q[i] = 0.0;
    for (j = 0; j < m; j++) {
      s[j] = s[j] + r[i] * A[i][j];
      q[i] = q[i] + A[i][j] * p[j];
    }
  }
#pragma endscop
}


x86 assembly (clang, -O0):
<kernel_bicg>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%rax
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    -0x4(%rbp),%eax
jge    114f <kernel_bicg+0x4f>
mov    -0x18(%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    1125 <kernel_bicg+0x25>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    123a <kernel_bicg+0x13a>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1227 <kernel_bicg+0x127>
mov    -0x18(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
imul   $0x3b60,%rcx,%rcx
add    %rcx,%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
imul   $0x3b60,%rcx,%rcx
add    %rcx,%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1179 <kernel_bicg+0x79>
jmp    122c <kernel_bicg+0x12c>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1156 <kernel_bicg+0x56>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel_bicg>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8,%r12
mov    %rcx,%r15
mov    %rdx,%rbx
mov    %edi,%ebp
mov    %edi,%r13d
test   %edi,%edi
jle    114a <kernel_bicg+0x3a>
lea    0x0(,%r13,8),%rdx
mov    %r15,%rdi
mov    %esi,0x4(%rsp)
xor    %esi,%esi
call   1030 <memset@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
jle    11b8 <kernel_bicg+0xa8>
mov    0x40(%rsp),%rax
mov    %esi,%ecx
xor    %edx,%edx
jmp    1170 <kernel_bicg+0x60>
nopl   0x0(%rax)
add    $0x1,%rdx
add    $0x3b60,%rbx
cmp    %rcx,%rdx
je     11b8 <kernel_bicg+0xa8>
movq   $0x0,(%r12,%rdx,8)
test   %ebp,%ebp
jle    1160 <kernel_bicg+0x50>
xor    %esi,%esi
xchg   %ax,%ax
movsd  (%rax,%rdx,8),%xmm0
mulsd  (%rbx,%rsi,8),%xmm0
addsd  (%r15,%rsi,8),%xmm0
movsd  %xmm0,(%r15,%rsi,8)
movsd  (%rbx,%rsi,8),%xmm0
mulsd  (%r14,%rsi,8),%xmm0
addsd  (%r12,%rdx,8),%xmm0
movsd  %xmm0,(%r12,%rdx,8)
add    $0x1,%rsi
cmp    %rsi,%r13
jne    1180 <kernel_bicg+0x70>
jmp    1160 <kernel_bicg+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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