void update_k(double *k, double *t) {
  int i, j;
  double ref_k = 100.;
  double ref_temp = 500.;
  double thermal_factor = 0.001;
#pragma omp parallel for
  for (j = 0; j < 51; j++) {
    for (i = 0; i < 101; i++) {
      k[101 * j + i] =
          ref_k * (1. - (thermal_factor * (t[101 * j + i] - ref_temp)));
    }
  }
}


x86 assembly (clang, -O0):
<update_k>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xefc(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xee7(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xed2(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x33,-0x18(%rbp)
jge    11d6 <update_k+0xd6>
movl   $0x0,-0x14(%rbp)
cmpl   $0x65,-0x14(%rbp)
jge    11c3 <update_k+0xc3>
movsd  -0x20(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
mov    -0x10(%rbp),%rax
imul   $0x65,-0x18(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
subsd  -0x28(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xe7e(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
imul   $0x65,-0x18(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114b <update_k+0x4b>
jmp    11c8 <update_k+0xc8>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113a <update_k+0x3a>
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_k>:
push   %r15
push   %r14
push   %rbx
lea    0x10(%rdi),%rax
lea    0x10(%rsi),%rcx
lea    0x8(%rsi),%rdx
xor    %r8d,%r8d
movsd  0xf24(%rip),%xmm0
movsd  0xf24(%rip),%xmm1
movsd  0xf24(%rip),%xmm2
movsd  0xf24(%rip),%xmm3
movapd 0xec3(%rip),%xmm8
movapd 0xecb(%rip),%xmm5
movapd 0xed3(%rip),%xmm6
movapd 0xedb(%rip),%xmm7
jmp    1182 <update_k+0x82>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r8
add    $0x328,%rax
add    $0x328,%rcx
add    $0x328,%rdx
cmp    $0x33,%r8
je     1295 <update_k+0x195>
imul   $0x65,%r8,%r11
lea    (%rsi,%r11,8),%r14
add    $0x328,%r14
lea    (%rsi,%r11,8),%r9
lea    (%rdi,%r11,8),%r10
add    $0x328,%r10
lea    (%rdi,%r11,8),%r15
cmp    %r14,%r15
jae    11c0 <update_k+0xc0>
cmp    %r10,%r9
jae    11c0 <update_k+0xc0>
xor    %ebx,%ebx
jmp    1217 <update_k+0x117>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movupd -0x10(%rcx,%rbx,8),%xmm4
addpd  %xmm8,%xmm4
mulpd  %xmm5,%xmm4
addpd  %xmm6,%xmm4
mulpd  %xmm7,%xmm4
movupd %xmm4,-0x10(%rax,%rbx,8)
movupd (%rcx,%rbx,8),%xmm4
addpd  %xmm8,%xmm4
mulpd  %xmm5,%xmm4
addpd  %xmm6,%xmm4
mulpd  %xmm7,%xmm4
movupd %xmm4,(%rax,%rbx,8)
add    $0x4,%rbx
cmp    $0x64,%rbx
jne    11d0 <update_k+0xd0>
mov    $0x64,%ebx
add    %rbx,%r11
movsd  (%rsi,%r11,8),%xmm4
addsd  %xmm0,%xmm4
mulsd  %xmm1,%xmm4
addsd  %xmm2,%xmm4
mulsd  %xmm3,%xmm4
movsd  %xmm4,(%rdi,%r11,8)
cmp    %r14,%r15
jae    1160 <update_k+0x60>
cmp    %r10,%r9
jae    1160 <update_k+0x60>
nopl   0x0(%rax,%rax,1)
movsd  (%rdx,%rbx,8),%xmm4
addsd  %xmm0,%xmm4
mulsd  %xmm1,%xmm4
addsd  %xmm2,%xmm4
mulsd  %xmm3,%xmm4
movsd  %xmm4,-0x8(%rax,%rbx,8)
movsd  0x8(%rdx,%rbx,8),%xmm4
addsd  %xmm0,%xmm4
mulsd  %xmm1,%xmm4
addsd  %xmm2,%xmm4
mulsd  %xmm3,%xmm4
movsd  %xmm4,(%rax,%rbx,8)
add    $0x2,%rbx
cmp    $0x64,%rbx
jne    1250 <update_k+0x150>
jmp    1160 <update_k+0x60>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @update_k(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double* %0, double** %3
store double* %1, double** %4
store double 1.000000e+02, double* %7
store double 5.000000e+02, double* %8
store double 1.000000e-03, double* %9
store i32 0, i32* %6
br label %10
10: ; preds = %44, %2
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 51
br i1 %12, label %13, label %47
13: ; preds = %10
store i32 0, i32* %5
br label %14
14: ; preds = %40, %13
%15 = load i32, i32* %5
%16 = icmp slt i32 %15, 101
br i1 %16, label %17, label %43
17: ; preds = %14
%18 = load double, double* %7
%19 = load double, double* %9
%20 = load double*, double** %4
%21 = load i32, i32* %6
%22 = mul nsw i32 101, %21
%23 = load i32, i32* %5
%24 = add nsw i32 %22, %23
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %20, i64 %25
%27 = load double, double* %26
%28 = load double, double* %8
%29 = fsub double %27, %28
%30 = fneg double %19
%31 = call double @llvm.fmuladd.f64(double %30, double %29, double 1.000000e+00)
%32 = fmul double %18, %31
%33 = load double*, double** %3
%34 = load i32, i32* %6
%35 = mul nsw i32 101, %34
%36 = load i32, i32* %5
%37 = add nsw i32 %35, %36
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %33, i64 %38
store double %32, double* %39
br label %40
40: ; preds = %17
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 1
store i32 %42, i32* %5
br label %14
43: ; preds = %14
br label %44
44: ; preds = %43
%45 = load i32, i32* %6
%46 = add nsw i32 %45, 1
store i32 %46, i32* %6
br label %10
47: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @update_k(double* nocapture writeonly %0, double* nocapture %1) {
br label %3
3: ; preds = %2, %68
%4 = phi i64 [ 0, %2 ], [ %69, %68 ]
%5 = mul nuw nsw i64 %4, 101
%6 = add nuw i64 %5, 101
%7 = mul nuw nsw i64 %4, 101
%8 = getelementptr double, double* %1, i64 %6
%9 = getelementptr double, double* %1, i64 %5
%10 = getelementptr double, double* %0, i64 %6
%11 = getelementptr double, double* %0, i64 %5
%12 = icmp ult double* %11, %8
%13 = icmp ult double* %9, %10
%14 = and i1 %12, %13
br i1 %14, label %38, label %15
15: ; preds = %3, %15
%16 = phi i64 [ %36, %15 ], [ 0, %3 ]
%17 = add nuw nsw i64 %16, %7
%18 = getelementptr inbounds double, double* %1, i64 %17
%19 = bitcast double* %18 to <2 x double>*
%20 = load <2 x double>, <2 x double>* %19
%21 = fadd <2 x double> %20, <double -5.000000e+02, double -5.000000e+02>
%22 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %21, <2 x double> <double -1.000000e-03, double -1.000000e-03>, <2 x double> <double 1.000000e+00, double 1.000000e+00>)
%23 = fmul <2 x double> %22, <double 1.000000e+02, double 1.000000e+02>
%24 = getelementptr inbounds double, double* %0, i64 %17
%25 = bitcast double* %24 to <2 x double>*
store <2 x double> %23, <2 x double>* %25
%26 = or i64 %16, 2
%27 = add nuw nsw i64 %26, %7
%28 = getelementptr inbounds double, double* %1, i64 %27
%29 = bitcast double* %28 to <2 x double>*
%30 = load <2 x double>, <2 x double>* %29
%31 = fadd <2 x double> %30, <double -5.000000e+02, double -5.000000e+02>
%32 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %31, <2 x double> <double -1.000000e-03, double -1.000000e-03>, <2 x double> <double 1.000000e+00, double 1.000000e+00>)
%33 = fmul <2 x double> %32, <double 1.000000e+02, double 1.000000e+02>
%34 = getelementptr inbounds double, double* %0, i64 %27
%35 = bitcast double* %34 to <2 x double>*
store <2 x double> %33, <2 x double>* %35
%36 = add nuw nsw i64 %16, 4
%37 = icmp eq i64 %36, 100
br i1 %37, label %38, label %15
38: ; preds = %15, %3
%39 = phi i64 [ 0, %3 ], [ 100, %15 ]
%40 = and i1 %12, %13
%41 = add nuw nsw i64 %39, %7
%42 = getelementptr inbounds double, double* %1, i64 %41
%43 = load double, double* %42
%44 = fadd double %43, -5.000000e+02
%45 = tail call double @llvm.fmuladd.f64(double %44, double -1.000000e-03, double 1.000000e+00)
%46 = fmul double %45, 1.000000e+02
%47 = getelementptr inbounds double, double* %0, i64 %41
store double %46, double* %47
%48 = or i64 %39, 1
br i1 %40, label %49, label %68
49: ; preds = %38, %49
%50 = phi i64 [ %66, %49 ], [ %48, %38 ]
%51 = add nuw nsw i64 %50, %7
%52 = getelementptr inbounds double, double* %1, i64 %51
%53 = load double, double* %52
%54 = fadd double %53, -5.000000e+02
%55 = tail call double @llvm.fmuladd.f64(double %54, double -1.000000e-03, double 1.000000e+00)
%56 = fmul double %55, 1.000000e+02
%57 = getelementptr inbounds double, double* %0, i64 %51
store double %56, double* %57
%58 = add nuw nsw i64 %50, 1
%59 = add nuw nsw i64 %58, %7
%60 = getelementptr inbounds double, double* %1, i64 %59
%61 = load double, double* %60
%62 = fadd double %61, -5.000000e+02
%63 = tail call double @llvm.fmuladd.f64(double %62, double -1.000000e-03, double 1.000000e+00)
%64 = fmul double %63, 1.000000e+02
%65 = getelementptr inbounds double, double* %0, i64 %59
store double %64, double* %65
%66 = add nuw nsw i64 %50, 2
%67 = icmp eq i64 %66, 101
br i1 %67, label %68, label %49
68: ; preds = %49, %38
%69 = add nuw nsw i64 %4, 1
%70 = icmp eq i64 %69, 51
br i1 %70, label %71, label %3
71: ; preds = %68
ret void
}