#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*/ apply_thermal_boundary_conditions(double *);
void solve_advection_diffusion(double *t, double *u, double *v, double dx,
                               double dy, double *rho, double dt, double cp,
                               double *k, double H) {
  int i, j;
  double tn[51 * 101];
  double kx;
  double ky;
  double dx2 = dx * dx;
  double dy2 = dy * dy;
  double twodx = 2. * dx;
  double twody = 2. * dy;
#pragma omp parallel for
  for (j = 0; j < 51; j++) {
    for (i = 0; i < 101; i++) {
      tn[101 * j + i] = t[101 * j + i];
    }
  }
  unsigned int n = 0;
  unsigned int s = 0;
  unsigned int m = 0;
  unsigned int e = 0;
  unsigned int w = 0;
#pragma omp parallel for
  for (j = 1; j < 51 - 1; j++) {
#pragma omp simd safelen(3)
    for (i = 1; i < 101 - 1; i++) {
      m = 101 * j + i;
      n = 101 * (j - 1) + i;
      s = 101 * (j + 1) + i;
      e = 101 * j + (i + 1);
      w = 101 * j + (i - 1);
      kx = k[m] * (tn[e] - 2. * tn[m] + tn[w]) / dx2;
      ky = k[m] * (tn[s] - 2. * tn[m] + tn[n]) / dy2;
      t[m] = tn[m] + dt * ((H + kx + ky) / (rho[m] * cp) -
                           (u[m] * ((tn[e] - tn[w]) / twodx)) -
                           (v[m] * ((tn[s] - tn[n]) / twody)));
    }
  }
  apply_thermal_boundary_conditions(t);
}


x86 assembly (clang, -O0):
<solve_advection_diffusion>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa1a0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
movsd  %xmm2,-0x38(%rbp)
movsd  %xmm3,-0x40(%rbp)
mov    %r8,-0x48(%rbp)
movsd  %xmm4,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0xa168(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xa170(%rbp)
ff
movsd  0xe8c(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0xa178(%rbp)
ff
movsd  0xe77(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xa180(%rbp)
ff
movl   $0x0,-0x58(%rbp)
cmpl   $0x33,-0x58(%rbp)
jge    11fe <solve_advection_diffusion+0xee>
movl   $0x0,-0x54(%rbp)
cmpl   $0x65,-0x54(%rbp)
jge    11eb <solve_advection_diffusion+0xdb>
mov    -0x8(%rbp),%rax
imul   $0x65,-0x58(%rbp),%ecx
add    -0x54(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
imul   $0x65,-0x58(%rbp),%eax
add    -0x54(%rbp),%eax
cltq
movsd  %xmm0,-0xa150(%rbp,%rax,8)
ff ff
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11ae <solve_advection_diffusion+0x9e>
jmp    11f0 <solve_advection_diffusion+0xe0>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    119d <solve_advection_diffusion+0x8d>
movl   $0x0,-0xa184(%rbp)
movl   $0x0,-0xa188(%rbp)
movl   $0x0,-0xa18c(%rbp)
movl   $0x0,-0xa190(%rbp)
movl   $0x0,-0xa194(%rbp)
movl   $0x1,-0x58(%rbp)
cmpl   $0x32,-0x58(%rbp)
jge    1478 <solve_advection_diffusion+0x368>
movl   $0x1,-0x54(%rbp)
cmpl   $0x64,-0x54(%rbp)
jge    1465 <solve_advection_diffusion+0x355>
imul   $0x65,-0x58(%rbp),%eax
add    -0x54(%rbp),%eax
mov    %eax,-0xa18c(%rbp)
mov    -0x58(%rbp),%eax
sub    $0x1,%eax
imul   $0x65,%eax,%eax
add    -0x54(%rbp),%eax
mov    %eax,-0xa184(%rbp)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
imul   $0x65,%eax,%eax
add    -0x54(%rbp),%eax
mov    %eax,-0xa188(%rbp)
imul   $0x65,-0x58(%rbp),%eax
mov    -0x54(%rbp),%ecx
add    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0xa190(%rbp)
imul   $0x65,-0x58(%rbp),%eax
mov    -0x54(%rbp),%ecx
sub    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0xa194(%rbp)
mov    -0x48(%rbp),%rax
mov    -0xa18c(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
mov    -0xa190(%rbp),%eax
movsd  -0xa150(%rbp,%rax,8),%xmm1
ff ff
mov    -0xa18c(%rbp),%eax
movsd  -0xa150(%rbp,%rax,8),%xmm2
ff ff
addsd  %xmm2,%xmm2
subsd  %xmm2,%xmm1
mov    -0xa194(%rbp),%eax
addsd  -0xa150(%rbp,%rax,8),%xmm1
ff ff
mulsd  %xmm1,%xmm0
divsd  -0xa168(%rbp),%xmm0
ff
movsd  %xmm0,-0xa158(%rbp)
ff
mov    -0x48(%rbp),%rax
mov    -0xa18c(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
mov    -0xa188(%rbp),%eax
movsd  -0xa150(%rbp,%rax,8),%xmm1
ff ff
mov    -0xa18c(%rbp),%eax
movsd  -0xa150(%rbp,%rax,8),%xmm2
ff ff
addsd  %xmm2,%xmm2
subsd  %xmm2,%xmm1
mov    -0xa184(%rbp),%eax
addsd  -0xa150(%rbp,%rax,8),%xmm1
ff ff
mulsd  %xmm1,%xmm0
divsd  -0xa170(%rbp),%xmm0
ff
movsd  %xmm0,-0xa160(%rbp)
ff
mov    -0xa18c(%rbp),%eax
movsd  -0xa150(%rbp,%rax,8),%xmm1
ff ff
movsd  -0x38(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
addsd  -0xa158(%rbp),%xmm2
ff
addsd  -0xa160(%rbp),%xmm2
ff
mov    -0x30(%rbp),%rax
mov    -0xa18c(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm3
mulsd  -0x40(%rbp),%xmm3
divsd  %xmm3,%xmm2
mov    -0x10(%rbp),%rax
mov    -0xa18c(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm3
mov    -0xa190(%rbp),%eax
movsd  -0xa150(%rbp,%rax,8),%xmm4
ff ff
mov    -0xa194(%rbp),%eax
subsd  -0xa150(%rbp,%rax,8),%xmm4
ff ff
divsd  -0xa178(%rbp),%xmm4
ff
movq   %xmm3,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm3
mulsd  %xmm4,%xmm3
addsd  %xmm2,%xmm3
mov    -0x18(%rbp),%rax
mov    -0xa18c(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm2
mov    -0xa188(%rbp),%eax
movsd  -0xa150(%rbp,%rax,8),%xmm4
ff ff
mov    -0xa184(%rbp),%eax
subsd  -0xa150(%rbp,%rax,8),%xmm4
ff ff
divsd  -0xa180(%rbp),%xmm4
ff
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    -0xa18c(%rbp),%ecx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1248 <solve_advection_diffusion+0x138>
jmp    146a <solve_advection_diffusion+0x35a>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1237 <solve_advection_diffusion+0x127>
mov    -0x8(%rbp),%rdi
call   1030 <apply_thermal_boundary_conditions@plt>
add    $0xa1a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve_advection_diffusion>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa218,%rsp
movapd %xmm4,0x70(%rsp)
mov    %r8,%r14
movaps %xmm3,0x80(%rsp)
movaps %xmm2,0xb0(%rsp)
mov    %rcx,%r15
movaps %xmm1,0x40(%rsp)
mov    %rdx,%rbx
mov    %rsi,%r12
mov    %rdi,%rbp
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,0xa0(%rsp)
addsd  %xmm0,%xmm0
movapd %xmm0,0x90(%rsp)
lea    0x120(%rsp),%rdi
mov    $0xa0f8,%edx
mov    %rbp,%rsi
call   1030 <memcpy@plt>
movapd 0xa0(%rsp),%xmm5
mov    %rbp,%rdi
movapd 0x90(%rsp),%xmm14
movapd 0x40(%rsp),%xmm13
movapd 0xb0(%rsp),%xmm12
movapd 0x80(%rsp),%xmm9
movapd 0x70(%rsp),%xmm8
movapd %xmm13,%xmm11
mulsd  %xmm13,%xmm11
addsd  %xmm13,%xmm13
movapd %xmm5,%xmm2
unpcklpd %xmm5,%xmm2
movapd %xmm2,0xf0(%rsp)
movapd %xmm11,%xmm2
unpcklpd %xmm11,%xmm2
movapd %xmm2,0xe0(%rsp)
movapd %xmm8,%xmm2
unpcklpd %xmm8,%xmm2
movapd %xmm2,0xd0(%rsp)
movapd %xmm9,%xmm10
unpcklpd %xmm9,%xmm10
movapd %xmm14,%xmm2
unpcklpd %xmm14,%xmm2
movapd %xmm2,0x40(%rsp)
movapd %xmm13,%xmm2
unpcklpd %xmm13,%xmm2
movapd %xmm2,0x110(%rsp)
movapd %xmm12,%xmm2
unpcklpd %xmm12,%xmm2
movapd %xmm2,0x100(%rsp)
lea    0x778(%rsp),%rax
lea    0x330(%rbp),%rcx
mov    %rbx,0x18(%rsp)
lea    0x330(%rbx),%rdx
mov    %r12,0x10(%rsp)
lea    0x330(%r12),%r11
mov    %r15,0x20(%rsp)
lea    0x330(%r15),%r10
mov    %r14,0x28(%rsp)
lea    0x330(%r14),%rbx
mov    $0x1,%esi
mov    $0x65,%ebp
mov    %rbp,0x8(%rsp)
xor    %ebp,%ebp
movsd  0xd6b(%rip),%xmm3
movapd 0xd53(%rip),%xmm7
movapd %xmm5,%xmm15
mov    %rdi,0x58(%rsp)
movapd %xmm11,0xc0(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rsi,0x68(%rsp)
mov    %rdx,0x30(%rsp)
mov    %rcx,0x38(%rsp)
mov    %rbp,0x60(%rsp)
imul   $0x328,%rbp,%rdx
lea    (%rdi,%rdx,1),%rbp
add    $0x330,%rbp
lea    0x648(%rdi,%rdx,1),%rcx
mov    0x10(%rsp),%r12
lea    0x648(%r12,%rdx,1),%r8
mov    0x20(%rsp),%rdi
lea    0x648(%rdi,%rdx,1),%r9
mov    0x28(%rsp),%rsi
lea    (%rsi,%rdx,1),%r14
add    $0x648,%r14
lea    (%rsi,%rdx,1),%r15
add    $0x330,%r15
cmp    %r14,%rbp
setb   0x7(%rsp)
cmp    %rcx,%r15
lea    0x330(%rdi,%rdx,1),%r15
setb   %r14b
cmp    %r9,%rbp
setb   %r13b
cmp    %rcx,%r15
lea    0x330(%r12,%rdx,1),%r9
setb   %r15b
cmp    %r8,%rbp
setb   %r12b
cmp    %rcx,%r9
mov    0x18(%rsp),%rsi
lea    0x648(%rsi,%rdx,1),%r8
setb   %r9b
cmp    %r8,%rbp
lea    0x330(%rsi,%rdx,1),%rdx
setb   %r8b
cmp    %rcx,%rdx
setb   %cl
mov    $0x1,%edx
test   %r14b,0x7(%rsp)
jne    1507 <solve_advection_diffusion+0x3e7>
mov    $0x1,%edx
and    %r15b,%r13b
jne    1507 <solve_advection_diffusion+0x3e7>
mov    $0x1,%edx
and    %r9b,%r12b
jne    1507 <solve_advection_diffusion+0x3e7>
mov    $0x1,%edx
and    %cl,%r8b
jne    1507 <solve_advection_diffusion+0x3e7>
xor    %ecx,%ecx
movapd 0xf0(%rsp),%xmm1
movapd 0xe0(%rsp),%xmm0
movapd %xmm10,%xmm11
movapd 0xd0(%rsp),%xmm10
mov    0x38(%rsp),%rdx
mov    0x30(%rsp),%rsi
nopw   0x0(%rax,%rax,1)
movupd (%rbx,%rcx,1),%xmm6
movupd -0x320(%rax,%rcx,1),%xmm4
ff ff
movupd -0x328(%rax,%rcx,1),%xmm3
ff ff
movapd %xmm3,%xmm2
mulpd  %xmm7,%xmm2
movapd %xmm2,%xmm7
addpd  %xmm4,%xmm7
movupd -0x330(%rax,%rcx,1),%xmm9
fc ff ff
addpd  %xmm9,%xmm7
mulpd  %xmm6,%xmm7
divpd  %xmm1,%xmm7
addpd  %xmm10,%xmm7
movupd (%rax,%rcx,1),%xmm5
addpd  %xmm5,%xmm2
movupd -0x650(%rax,%rcx,1),%xmm8
f9 ff ff
addpd  %xmm8,%xmm2
mulpd  %xmm6,%xmm2
divpd  %xmm0,%xmm2
addpd  %xmm7,%xmm2
movapd 0xb91(%rip),%xmm7
movupd (%r10,%rcx,1),%xmm6
mulpd  %xmm11,%xmm6
divpd  %xmm6,%xmm2
movupd (%r11,%rcx,1),%xmm6
subpd  %xmm9,%xmm4
divpd  0x40(%rsp),%xmm4
mulpd  %xmm6,%xmm4
subpd  %xmm4,%xmm2
movupd (%rsi,%rcx,1),%xmm4
subpd  %xmm8,%xmm5
divpd  0x110(%rsp),%xmm5
mulpd  %xmm4,%xmm5
subpd  %xmm5,%xmm2
mulpd  0x100(%rsp),%xmm2
addpd  %xmm3,%xmm2
movupd %xmm2,(%rdx,%rcx,1)
add    $0x10,%rcx
cmp    $0x310,%rcx
jne    1400 <solve_advection_diffusion+0x2e0>
mov    $0x63,%edx
movapd 0x70(%rsp),%xmm8
movapd 0x80(%rsp),%xmm9
movapd %xmm15,%xmm5
movapd %xmm11,%xmm10
movapd 0xc0(%rsp),%xmm11
movsd  0xb09(%rip),%xmm3
lea    -0x320(,%rdx,8),%rbp
ff
add    0x8(%rsp),%rdx
mov    0x58(%rsp),%rdi
lea    (%rdi,%rdx,8),%rcx
mov    0x28(%rsp),%rsi
lea    (%rsi,%rdx,8),%r15
lea    0x120(%rsp,%rdx,8),%r12
mov    0x20(%rsp),%rsi
lea    (%rsi,%rdx,8),%r13
mov    0x10(%rsp),%rsi
lea    (%rsi,%rdx,8),%r14
mov    0x18(%rsp),%rsi
lea    (%rsi,%rdx,8),%r8
xor    %r9d,%r9d
nopl   0x0(%rax)
movsd  (%r15,%r9,1),%xmm6
movsd  0x8(%r12,%r9,1),%xmm4
movsd  (%r12,%r9,1),%xmm2
movapd %xmm2,%xmm7
mulsd  %xmm3,%xmm7
movapd %xmm7,%xmm3
addsd  %xmm4,%xmm3
movsd  -0x8(%r12,%r9,1),%xmm1
addsd  %xmm1,%xmm3
mulsd  %xmm6,%xmm3
divsd  %xmm5,%xmm3
movsd  0x328(%r12,%r9,1),%xmm5
addsd  %xmm5,%xmm7
movsd  -0x328(%r12,%r9,1),%xmm0
fc ff ff
addsd  %xmm0,%xmm7
mulsd  %xmm6,%xmm7
divsd  %xmm11,%xmm7
addsd  %xmm8,%xmm3
addsd  %xmm7,%xmm3
movapd %xmm14,%xmm7
movsd  0x0(%r13,%r9,1),%xmm6
mulsd  %xmm9,%xmm6
subsd  %xmm1,%xmm4
movapd %xmm13,%xmm1
divsd  %xmm14,%xmm4
mulsd  (%r14,%r9,1),%xmm4
divsd  %xmm6,%xmm3
subsd  %xmm4,%xmm3
subsd  %xmm0,%xmm5
movapd %xmm12,%xmm0
divsd  %xmm13,%xmm5
mulsd  (%r8,%r9,1),%xmm5
subsd  %xmm5,%xmm3
movapd %xmm15,%xmm5
mulsd  %xmm12,%xmm3
addsd  %xmm2,%xmm3
movsd  %xmm3,(%rcx,%r9,1)
movsd  0x9fb(%rip),%xmm3
add    $0x8,%r9
mov    %rbp,%rdx
add    %r9,%rdx
jne    1550 <solve_advection_diffusion+0x430>
mov    0x68(%rsp),%rsi
add    $0x1,%rsi
mov    0x60(%rsp),%rbp
add    $0x1,%rbp
add    $0x328,%rax
mov    0x38(%rsp),%rcx
add    $0x328,%rcx
mov    0x30(%rsp),%rdx
add    $0x328,%rdx
add    $0x328,%r11
add    $0x328,%r10
add    $0x328,%rbx
addq   $0x65,0x8(%rsp)
cmp    $0x32,%rsi
movapd 0x984(%rip),%xmm7
jne    12d0 <solve_advection_diffusion+0x1b0>
add    $0xa218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <apply_thermal_boundary_conditions@plt>

LLVM IR (-O0):
define void @solve_advection_diffusion(double* %0, double* %1, double* %2, double %3, double %4, double* %5, double %6, double %7, double* %8, double %9) {
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca double
%15 = alloca double
%16 = alloca double*
%17 = alloca double
%18 = alloca double
%19 = alloca double*
%20 = alloca double
%21 = alloca i32
%22 = alloca i32
%23 = alloca [5151 x double]
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
store double* %0, double** %11
store double* %1, double** %12
store double* %2, double** %13
store double %3, double* %14
store double %4, double* %15
store double* %5, double** %16
store double %6, double* %17
store double %7, double* %18
store double* %8, double** %19
store double %9, double* %20
%35 = load double, double* %14
%36 = load double, double* %14
%37 = fmul double %35, %36
store double %37, double* %26
%38 = load double, double* %15
%39 = load double, double* %15
%40 = fmul double %38, %39
store double %40, double* %27
%41 = load double, double* %14
%42 = fmul double 2.000000e+00, %41
store double %42, double* %28
%43 = load double, double* %15
%44 = fmul double 2.000000e+00, %43
store double %44, double* %29
store i32 0, i32* %22
br label %45
45: ; preds = %71, %10
%46 = load i32, i32* %22
%47 = icmp slt i32 %46, 51
br i1 %47, label %48, label %74
48: ; preds = %45
store i32 0, i32* %21
br label %49
49: ; preds = %67, %48
%50 = load i32, i32* %21
%51 = icmp slt i32 %50, 101
br i1 %51, label %52, label %70
52: ; preds = %49
%53 = load double*, double** %11
%54 = load i32, i32* %22
%55 = mul nsw i32 101, %54
%56 = load i32, i32* %21
%57 = add nsw i32 %55, %56
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %53, i64 %58
%60 = load double, double* %59
%61 = load i32, i32* %22
%62 = mul nsw i32 101, %61
%63 = load i32, i32* %21
%64 = add nsw i32 %62, %63
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [5151 x double], [5151 x double]* %23, i64 0, i64 %65
store double %60, double* %66
br label %67
67: ; preds = %52
%68 = load i32, i32* %21
%69 = add nsw i32 %68, 1
store i32 %69, i32* %21
br label %49
70: ; preds = %49
br label %71
71: ; preds = %70
%72 = load i32, i32* %22
%73 = add nsw i32 %72, 1
store i32 %73, i32* %22
br label %45
74: ; preds = %45
store i32 0, i32* %30
store i32 0, i32* %31
store i32 0, i32* %32
store i32 0, i32* %33
store i32 0, i32* %34
store i32 1, i32* %22
br label %75
75: ; preds = %214, %74
%76 = load i32, i32* %22
%77 = icmp slt i32 %76, 50
br i1 %77, label %78, label %217
78: ; preds = %75
store i32 1, i32* %21
br label %79
79: ; preds = %210, %78
%80 = load i32, i32* %21
%81 = icmp slt i32 %80, 100
br i1 %81, label %82, label %213
82: ; preds = %79
%83 = load i32, i32* %22
%84 = mul nsw i32 101, %83
%85 = load i32, i32* %21
%86 = add nsw i32 %84, %85
store i32 %86, i32* %32
%87 = load i32, i32* %22
%88 = sub nsw i32 %87, 1
%89 = mul nsw i32 101, %88
%90 = load i32, i32* %21
%91 = add nsw i32 %89, %90
store i32 %91, i32* %30
%92 = load i32, i32* %22
%93 = add nsw i32 %92, 1
%94 = mul nsw i32 101, %93
%95 = load i32, i32* %21
%96 = add nsw i32 %94, %95
store i32 %96, i32* %31
%97 = load i32, i32* %22
%98 = mul nsw i32 101, %97
%99 = load i32, i32* %21
%100 = add nsw i32 %99, 1
%101 = add nsw i32 %98, %100
store i32 %101, i32* %33
%102 = load i32, i32* %22
%103 = mul nsw i32 101, %102
%104 = load i32, i32* %21
%105 = sub nsw i32 %104, 1
%106 = add nsw i32 %103, %105
store i32 %106, i32* %34
%107 = load double*, double** %19
%108 = load i32, i32* %32
%109 = zext i32 %108 to i64
%110 = getelementptr inbounds double, double* %107, i64 %109
%111 = load double, double* %110
%112 = load i32, i32* %33
%113 = zext i32 %112 to i64
%114 = getelementptr inbounds [5151 x double], [5151 x double]* %23, i64 0, i64 %113
%115 = load double, double* %114
%116 = load i32, i32* %32
%117 = zext i32 %116 to i64
%118 = getelementptr inbounds [5151 x double], [5151 x double]* %23, i64 0, i64 %117
%119 = load double, double* %118
%120 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %119, double %115)
%121 = load i32, i32* %34
%122 = zext i32 %121 to i64
%123 = getelementptr inbounds [5151 x double], [5151 x double]* %23, i64 0, i64 %122
%124 = load double, double* %123
%125 = fadd double %120, %124
%126 = fmul double %111, %125
%127 = load double, double* %26
%128 = fdiv double %126, %127
store double %128, double* %24
%129 = load double*, double** %19
%130 = load i32, i32* %32
%131 = zext i32 %130 to i64
%132 = getelementptr inbounds double, double* %129, i64 %131
%133 = load double, double* %132
%134 = load i32, i32* %31
%135 = zext i32 %134 to i64
%136 = getelementptr inbounds [5151 x double], [5151 x double]* %23, i64 0, i64 %135
%137 = load double, double* %136
%138 = load i32, i32* %32
%139 = zext i32 %138 to i64
%140 = getelementptr inbounds [5151 x double], [5151 x double]* %23, i64 0, i64 %139
%141 = load double, double* %140
%142 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %141, double %137)
%143 = load i32, i32* %30
%144 = zext i32 %143 to i64
%145 = getelementptr inbounds [5151 x double], [5151 x double]* %23, i64 0, i64 %144
%146 = load double, double* %145
%147 = fadd double %142, %146
%148 = fmul double %133, %147
%149 = load double, double* %27
%150 = fdiv double %148, %149
store double %150, double* %25
%151 = load i32, i32* %32
%152 = zext i32 %151 to i64
%153 = getelementptr inbounds [5151 x double], [5151 x double]* %23, i64 0, i64 %152
%154 = load double, double* %153
%155 = load double, double* %17
%156 = load double, double* %20
%157 = load double, double* %24
%158 = fadd double %156, %157
%159 = load double, double* %25
%160 = fadd double %158, %159
%161 = load double*, double** %16
%162 = load i32, i32* %32
%163 = zext i32 %162 to i64
%164 = getelementptr inbounds double, double* %161, i64 %163
%165 = load double, double* %164
%166 = load double, double* %18
%167 = fmul double %165, %166
%168 = fdiv double %160, %167
%169 = load double*, double** %12
%170 = load i32, i32* %32
%171 = zext i32 %170 to i64
%172 = getelementptr inbounds double, double* %169, i64 %171
%173 = load double, double* %172
%174 = load i32, i32* %33
%175 = zext i32 %174 to i64
%176 = getelementptr inbounds [5151 x double], [5151 x double]* %23, i64 0, i64 %175
%177 = load double, double* %176
%178 = load i32, i32* %34
%179 = zext i32 %178 to i64
%180 = getelementptr inbounds [5151 x double], [5151 x double]* %23, i64 0, i64 %179
%181 = load double, double* %180
%182 = fsub double %177, %181
%183 = load double, double* %28
%184 = fdiv double %182, %183
%185 = fneg double %173
%186 = call double @llvm.fmuladd.f64(double %185, double %184, double %168)
%187 = load double*, double** %13
%188 = load i32, i32* %32
%189 = zext i32 %188 to i64
%190 = getelementptr inbounds double, double* %187, i64 %189
%191 = load double, double* %190
%192 = load i32, i32* %31
%193 = zext i32 %192 to i64
%194 = getelementptr inbounds [5151 x double], [5151 x double]* %23, i64 0, i64 %193
%195 = load double, double* %194
%196 = load i32, i32* %30
%197 = zext i32 %196 to i64
%198 = getelementptr inbounds [5151 x double], [5151 x double]* %23, i64 0, i64 %197
%199 = load double, double* %198
%200 = fsub double %195, %199
%201 = load double, double* %29
%202 = fdiv double %200, %201
%203 = fneg double %191
%204 = call double @llvm.fmuladd.f64(double %203, double %202, double %186)
%205 = call double @llvm.fmuladd.f64(double %155, double %204, double %154)
%206 = load double*, double** %11
%207 = load i32, i32* %32
%208 = zext i32 %207 to i64
%209 = getelementptr inbounds double, double* %206, i64 %208
store double %205, double* %209
br label %210
210: ; preds = %82
%211 = load i32, i32* %21
%212 = add nsw i32 %211, 1
store i32 %212, i32* %21
br label %79
213: ; preds = %79
br label %214
214: ; preds = %213
%215 = load i32, i32* %22
%216 = add nsw i32 %215, 1
store i32 %216, i32* %22
br label %75
217: ; preds = %75
%218 = load double*, double** %11
%219 = call i32 @apply_thermal_boundary_conditions(double* %218)
ret void
}

LLVM IR (-O2):
define void @solve_advection_diffusion(double* %0, double* nocapture %1, double* nocapture %2, double %3, double %4, double* nocapture %5, double %6, double %7, double* nocapture %8, double %9) {
%11 = bitcast double* %0 to i8*
%12 = alloca [5151 x double]
%13 = bitcast [5151 x double]* %12 to i8*
%14 = fmul double %3, %3
%15 = fmul double %3, 2.000000e+00
%16 = fmul double %4, %4
%17 = fmul double %4, 2.000000e+00
%18 = insertelement <2 x double> poison, double %14, i64 0
%19 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> zeroinitializer
%20 = insertelement <2 x double> poison, double %16, i64 0
%21 = shufflevector <2 x double> %20, <2 x double> poison, <2 x i32> zeroinitializer
%22 = insertelement <2 x double> poison, double %9, i64 0
%23 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> zeroinitializer
%24 = insertelement <2 x double> poison, double %7, i64 0
%25 = shufflevector <2 x double> %24, <2 x double> poison, <2 x i32> zeroinitializer
%26 = insertelement <2 x double> poison, double %15, i64 0
%27 = shufflevector <2 x double> %26, <2 x double> poison, <2 x i32> zeroinitializer
%28 = insertelement <2 x double> poison, double %17, i64 0
%29 = shufflevector <2 x double> %28, <2 x double> poison, <2 x i32> zeroinitializer
%30 = insertelement <2 x double> poison, double %6, i64 0
%31 = shufflevector <2 x double> %30, <2 x double> poison, <2 x i32> zeroinitializer
br label %32
32: ; preds = %10, %176
%33 = phi i64 [ 0, %10 ], [ %179, %176 ]
%34 = phi i64 [ 1, %10 ], [ %177, %176 ]
%35 = mul nuw nsw i64 %33, 101
%36 = add i64 %35, 102
%37 = getelementptr double, double* %0, i64 %36
%38 = add i64 %35, 201
%39 = getelementptr double, double* %0, i64 %38
%40 = mul nuw nsw i64 %34, 101
%41 = getelementptr double, double* %2, i64 %38
%42 = getelementptr double, double* %2, i64 %36
%43 = getelementptr double, double* %1, i64 %38
%44 = getelementptr double, double* %1, i64 %36
%45 = getelementptr double, double* %5, i64 %38
%46 = getelementptr double, double* %5, i64 %36
%47 = getelementptr double, double* %8, i64 %38
%48 = getelementptr double, double* %8, i64 %36
%49 = icmp ult double* %37, %47
%50 = icmp ult double* %48, %39
%51 = and i1 %49, %50
%52 = icmp ult double* %37, %45
%53 = icmp ult double* %46, %39
%54 = and i1 %52, %53
%55 = or i1 %51, %54
%56 = icmp ult double* %37, %43
%57 = icmp ult double* %44, %39
%58 = and i1 %56, %57
%59 = or i1 %55, %58
%60 = icmp ult double* %37, %41
%61 = icmp ult double* %42, %39
%62 = and i1 %60, %61
%63 = or i1 %59, %62
br i1 %63, label %125, label %64
64: ; preds = %32, %64
%65 = phi i64 [ %123, %64 ], [ 0, %32 ]
%66 = or i64 %65, 1
%67 = add nuw nsw i64 %66, %40
%68 = add nsw i64 %67, -101
%69 = add nuw nsw i64 %67, 101
%70 = add i64 %65, 2
%71 = add nuw nsw i64 %70, %40
%72 = add nsw i64 %67, -1
%73 = getelementptr inbounds double, double* %8, i64 %67
%74 = bitcast double* %73 to <2 x double>*
%75 = load <2 x double>, <2 x double>* %74
%76 = getelementptr inbounds [5151 x double], [5151 x double]* %12, i64 0, i64 %71
%77 = bitcast double* %76 to <2 x double>*
%78 = load <2 x double>, <2 x double>* %77
%79 = getelementptr inbounds [5151 x double], [5151 x double]* %12, i64 0, i64 %67
%80 = bitcast double* %79 to <2 x double>*
%81 = load <2 x double>, <2 x double>* %80
%82 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %81, <2 x double> <double -2.000000e+00, double -2.000000e+00>, <2 x double> %78)
%83 = getelementptr inbounds [5151 x double], [5151 x double]* %12, i64 0, i64 %72
%84 = bitcast double* %83 to <2 x double>*
%85 = load <2 x double>, <2 x double>* %84
%86 = fadd <2 x double> %82, %85
%87 = fmul <2 x double> %75, %86
%88 = fdiv <2 x double> %87, %19
%89 = getelementptr inbounds [5151 x double], [5151 x double]* %12, i64 0, i64 %69
%90 = bitcast double* %89 to <2 x double>*
%91 = load <2 x double>, <2 x double>* %90
%92 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %81, <2 x double> <double -2.000000e+00, double -2.000000e+00>, <2 x double> %91)
%93 = getelementptr inbounds [5151 x double], [5151 x double]* %12, i64 0, i64 %68
%94 = bitcast double* %93 to <2 x double>*
%95 = load <2 x double>, <2 x double>* %94
%96 = fadd <2 x double> %92, %95
%97 = fmul <2 x double> %75, %96
%98 = fdiv <2 x double> %97, %21
%99 = fadd <2 x double> %88, %23
%100 = fadd <2 x double> %99, %98
%101 = getelementptr inbounds double, double* %5, i64 %67
%102 = bitcast double* %101 to <2 x double>*
%103 = load <2 x double>, <2 x double>* %102
%104 = fmul <2 x double> %103, %25
%105 = fdiv <2 x double> %100, %104
%106 = getelementptr inbounds double, double* %1, i64 %67
%107 = bitcast double* %106 to <2 x double>*
%108 = load <2 x double>, <2 x double>* %107
%109 = fsub <2 x double> %78, %85
%110 = fdiv <2 x double> %109, %27
%111 = fneg <2 x double> %108
%112 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %111, <2 x double> %110, <2 x double> %105)
%113 = getelementptr inbounds double, double* %2, i64 %67
%114 = bitcast double* %113 to <2 x double>*
%115 = load <2 x double>, <2 x double>* %114
%116 = fsub <2 x double> %91, %95
%117 = fdiv <2 x double> %116, %29
%118 = fneg <2 x double> %115
%119 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %118, <2 x double> %117, <2 x double> %112)
%120 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %31, <2 x double> %119, <2 x double> %81)
%121 = getelementptr inbounds double, double* %0, i64 %67
%122 = bitcast double* %121 to <2 x double>*
store <2 x double> %120, <2 x double>* %122
%123 = add nuw i64 %65, 2
%124 = icmp eq i64 %123, 98
br i1 %124, label %125, label %64
125: ; preds = %64, %32
%126 = phi i64 [ 1, %32 ], [ 99, %64 ]
br label %127
127: ; preds = %125, %127
%128 = phi i64 [ %132, %127 ], [ %126, %125 ]
%129 = add nuw nsw i64 %128, %40
%130 = add nsw i64 %129, -101
%131 = add nuw nsw i64 %129, 101
%132 = add nuw nsw i64 %128, 1
%133 = add nuw nsw i64 %132, %40
%134 = add nsw i64 %129, -1
%135 = getelementptr inbounds double, double* %8, i64 %129
%136 = load double, double* %135
%137 = getelementptr inbounds [5151 x double], [5151 x double]* %12, i64 0, i64 %133
%138 = load double, double* %137
%139 = getelementptr inbounds [5151 x double], [5151 x double]* %12, i64 0, i64 %129
%140 = load double, double* %139
%141 = tail call double @llvm.fmuladd.f64(double %140, double -2.000000e+00, double %138)
%142 = getelementptr inbounds [5151 x double], [5151 x double]* %12, i64 0, i64 %134
%143 = load double, double* %142
%144 = fadd double %141, %143
%145 = fmul double %136, %144
%146 = fdiv double %145, %14
%147 = getelementptr inbounds [5151 x double], [5151 x double]* %12, i64 0, i64 %131
%148 = load double, double* %147
%149 = tail call double @llvm.fmuladd.f64(double %140, double -2.000000e+00, double %148)
%150 = getelementptr inbounds [5151 x double], [5151 x double]* %12, i64 0, i64 %130
%151 = load double, double* %150
%152 = fadd double %149, %151
%153 = fmul double %136, %152
%154 = fdiv double %153, %16
%155 = fadd double %146, %9
%156 = fadd double %155, %154
%157 = getelementptr inbounds double, double* %5, i64 %129
%158 = load double, double* %157
%159 = fmul double %158, %7
%160 = fdiv double %156, %159
%161 = getelementptr inbounds double, double* %1, i64 %129
%162 = load double, double* %161
%163 = fsub double %138, %143
%164 = fdiv double %163, %15
%165 = fneg double %162
%166 = tail call double @llvm.fmuladd.f64(double %165, double %164, double %160)
%167 = getelementptr inbounds double, double* %2, i64 %129
%168 = load double, double* %167
%169 = fsub double %148, %151
%170 = fdiv double %169, %17
%171 = fneg double %168
%172 = tail call double @llvm.fmuladd.f64(double %171, double %170, double %166)
%173 = tail call double @llvm.fmuladd.f64(double %6, double %172, double %140)
%174 = getelementptr inbounds double, double* %0, i64 %129
store double %173, double* %174
%175 = icmp eq i64 %132, 100
br i1 %175, label %176, label %127
176: ; preds = %127
%177 = add nuw nsw i64 %34, 1
%178 = icmp eq i64 %177, 50
%179 = add i64 %33, 1
br i1 %178, label %180, label %32
180: ; preds = %176
%181 = tail call i32 @apply_thermal_boundary_conditions(double* %0)
ret void
}