#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 */
typedef scalar_t__ uint8_t;

/* Variables and functions */
double get(double *, int, int, int, int);
double Diffusion2D(double *M, double *K, int x, int y, int xSz, int ySz,
                   uint8_t bPeriodic, double gridsz) {
  int left = x - 1;
  int right = x + 1;
  int up = y + 1;
  int down = y - 1;
  double fl = 1.0;
  double fr = 1.0;
  double fu = 1.0;
  double fd = 1.0;
  if (bPeriodic) {
    if (right >= xSz)
      right -= xSz;
    if (left < 0)
      left += xSz;
    if (up >= ySz)
      up -= ySz;
    if (down < 0)
      down += ySz;
  } else {
    if (right >= xSz)
      right = left;
    if (left < 0)
      left = right;
    if (up >= ySz)
      up = down;
    if (down < 0)
      down = up;
  }
  double gridsz2 = gridsz * gridsz;
  double d2Tdxx =
      (fl * get(M, y, left, xSz, ySz) + fr * get(M, y, right, xSz, ySz) -
       2.0 * get(M, y, x, xSz, ySz)) /
      gridsz2;
  double d2Tdyy =
      (fu * get(M, up, x, xSz, ySz) + fd * get(M, down, x, xSz, ySz) -
       2.0 * get(M, y, x, xSz, ySz)) /
      gridsz2;
  double L = d2Tdxx + d2Tdyy;
  double dot = 0.0;
  double dKdx = (get(K, y, left, xSz, ySz) - get(K, y, x, xSz, ySz)) / gridsz;
  double dTdx = (get(M, y, left, xSz, ySz) - get(M, y, x, xSz, ySz)) / gridsz;
  double dKdy = (get(K, up, x, xSz, ySz) - get(K, y, x, xSz, ySz)) / gridsz;
  double dTdy = (get(M, up, x, xSz, ySz) - get(M, y, x, xSz, ySz)) / gridsz;
  dot = dKdx * dTdx + dKdy * dTdy;
  double du = get(K, y, x, xSz, ySz) * L + dot;
  return du;
}


x86 assembly (clang, -O0):
<Diffusion2D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x38(%rbp)
movsd  0xe9a(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe8d(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe80(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe73(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
cmpq   $0x0,0x10(%rbp)
je     11f6 <Diffusion2D+0xe6>
mov    -0x30(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jl     11b4 <Diffusion2D+0xa4>
mov    -0x1c(%rbp),%ecx
mov    -0x30(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    11c7 <Diffusion2D+0xb7>
mov    -0x1c(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x20(%rbp),%eax
jl     11de <Diffusion2D+0xce>
mov    -0x20(%rbp),%ecx
mov    -0x34(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x38(%rbp)
jge    11f1 <Diffusion2D+0xe1>
mov    -0x20(%rbp),%eax
add    -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
jmp    123f <Diffusion2D+0x12f>
mov    -0x30(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jl     1208 <Diffusion2D+0xf8>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    1218 <Diffusion2D+0x108>
mov    -0x30(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x20(%rbp),%eax
jl     122a <Diffusion2D+0x11a>
mov    -0x38(%rbp),%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x38(%rbp)
jge    123a <Diffusion2D+0x12a>
mov    -0x34(%rbp),%eax
mov    %eax,-0x38(%rbp)
jmp    123f <Diffusion2D+0x12f>
movsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <get@plt>
movsd  %xmm0,-0x100(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x108(%rbp)
ff
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x30(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <get@plt>
movsd  -0x108(%rbp),%xmm1
ff
movsd  -0x100(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0xf8(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <get@plt>
movaps %xmm0,%xmm1
movsd  -0xf0(%rbp),%xmm0
ff
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
divsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
mov    -0x8(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <get@plt>
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
mov    -0x8(%rbp),%rdi
mov    -0x38(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <get@plt>
movsd  -0xe8(%rbp),%xmm1
ff
movsd  -0xe0(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0xd8(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <get@plt>
movaps %xmm0,%xmm1
movsd  -0xd0(%rbp),%xmm0
ff
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
divsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x68(%rbp),%xmm0
addsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <get@plt>
movsd  %xmm0,-0xc8(%rbp)
ff
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <get@plt>
movaps %xmm0,%xmm1
movsd  -0xc8(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <get@plt>
movsd  %xmm0,-0xc0(%rbp)
ff
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <get@plt>
movaps %xmm0,%xmm1
movsd  -0xc0(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x10(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <get@plt>
movsd  %xmm0,-0xb8(%rbp)
ff
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <get@plt>
movaps %xmm0,%xmm1
movsd  -0xb8(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x8(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <get@plt>
movsd  %xmm0,-0xb0(%rbp)
ff
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <get@plt>
movaps %xmm0,%xmm1
movsd  -0xb0(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x90(%rbp),%xmm2
ff
movsd  -0x98(%rbp),%xmm1
ff
mulsd  -0xa0(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <get@plt>
movsd  -0x78(%rbp),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Diffusion2D>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %r9d,%r14d
mov    %r8d,%r15d
mov    %ecx,%eax
mov    %rsi,0x28(%rsp)
mov    %rdi,%r13
lea    -0x1(%rdx),%ecx
mov    %rdx,%r12
lea    0x1(%rdx),%ebx
lea    0x1(%rax),%esi
lea    -0x1(%rax),%r8d
cmpq   $0x0,0xe0(%rsp)
je     1181 <Diffusion2D+0x71>
xor    %ebp,%ebp
cmp    %r15d,%ebx
mov    %r15d,%edx
cmovl  %ebp,%edx
sub    %edx,%ebx
mov    %ebx,(%rsp)
test   %r12d,%r12d
mov    %r15d,%edx
cmovg  %ebp,%edx
add    %ecx,%edx
cmp    %r14d,%esi
mov    %r14d,%ecx
cmovl  %ebp,%ecx
sub    %ecx,%esi
mov    %esi,0x30(%rsp)
test   %eax,%eax
cmovle %r14d,%ebp
add    %r8d,%ebp
jmp    11a6 <Diffusion2D+0x96>
cmp    %r15d,%ebx
cmovge %ecx,%ebx
test   %r12d,%r12d
mov    %ebx,(%rsp)
cmovle %ebx,%ecx
cmp    %r14d,%esi
cmovge %r8d,%esi
test   %eax,%eax
mov    %esi,0x30(%rsp)
cmovle %esi,%r8d
mov    %r8d,%ebp
mov    %ecx,%edx
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
mov    %r13,%rdi
mov    %eax,%esi
mov    %edx,0x50(%rsp)
mov    %r15d,%ecx
mov    %rax,%rbx
mov    %r14d,%r8d
movapd %xmm0,0x40(%rsp)
call   1030 <get@plt>
movapd %xmm0,0x60(%rsp)
mov    %r13,%rdi
mov    %ebx,%esi
mov    (%rsp),%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <get@plt>
movapd %xmm0,(%rsp)
mov    %r13,%rdi
mov    %ebx,%esi
mov    %r12,0x70(%rsp)
mov    %r12d,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <get@plt>
movapd %xmm0,0x90(%rsp)
mov    %r13,%rdi
mov    0x30(%rsp),%esi
mov    %r12d,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <get@plt>
movapd %xmm0,0x80(%rsp)
mov    %r13,%rdi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <get@plt>
movapd 0x60(%rsp),%xmm2
unpcklpd 0x80(%rsp),%xmm2
movapd (%rsp),%xmm1
unpcklpd %xmm0,%xmm1
addpd  %xmm2,%xmm1
movapd %xmm1,(%rsp)
mov    %r13,%rdi
mov    %rbx,%rbp
mov    %ebp,%esi
mov    %r12d,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <get@plt>
movapd 0x90(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
addpd  %xmm1,%xmm1
movapd %xmm1,%xmm0
movapd (%rsp),%xmm1
subpd  %xmm0,%xmm1
movapd 0x10(%rsp),%xmm0
unpcklpd %xmm0,%xmm0
divpd  %xmm0,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
movapd %xmm0,0x60(%rsp)
mov    0x28(%rsp),%rbx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    0x50(%rsp),%r12d
mov    %r12d,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <get@plt>
movsd  %xmm0,0x10(%rsp)
mov    %rbx,%rdi
mov    %rbp,%rbx
mov    %rbp,0x78(%rsp)
mov    %ebx,%esi
mov    0x70(%rsp),%rbp
mov    %ebp,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <get@plt>
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
divsd  0x40(%rsp),%xmm1
movsd  %xmm1,0x10(%rsp)
mov    %r13,%rdi
mov    %ebx,%esi
mov    %r12d,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <get@plt>
movsd  %xmm0,(%rsp)
mov    %r13,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <get@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
divsd  0x40(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm1
movsd  %xmm1,(%rsp)
mov    0x28(%rsp),%rbx
mov    %rbx,%rdi
mov    0x30(%rsp),%r12d
mov    %r12d,%esi
mov    %ebp,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <get@plt>
movapd %xmm0,0x10(%rsp)
mov    %rbx,%rdi
mov    0x78(%rsp),%rbx
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <get@plt>
movapd %xmm0,0x50(%rsp)
mov    %r13,%rdi
mov    %r12d,%esi
mov    %ebp,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <get@plt>
movapd %xmm0,0x30(%rsp)
mov    %r13,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <get@plt>
movapd 0x10(%rsp),%xmm1
unpcklpd 0x30(%rsp),%xmm1
movapd 0x50(%rsp),%xmm2
unpcklpd %xmm0,%xmm2
subpd  %xmm2,%xmm1
movapd 0x40(%rsp),%xmm0
unpcklpd %xmm0,%xmm0
divpd  %xmm0,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
addsd  (%rsp),%xmm0
movapd %xmm0,0x40(%rsp)
mov    0x28(%rsp),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <get@plt>
mulsd  0x60(%rsp),%xmm0
addsd  0x40(%rsp),%xmm0
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define double @Diffusion2D(double* %0, double* %1, i32 %2, i32 %3, i32 %4, i32 %5, i64 %6, double %7) {
%9 = add nsw i32 %2, -1
%10 = add nsw i32 %2, 1
%11 = add nsw i32 %3, 1
%12 = add nsw i32 %3, -1
%13 = icmp eq i64 %6, 0
%14 = icmp slt i32 %10, %4
br i1 %13, label %27, label %15
15: ; preds = %8
%16 = select i1 %14, i32 0, i32 %4
%17 = sub nsw i32 %10, %16
%18 = icmp sgt i32 %2, 0
%19 = select i1 %18, i32 0, i32 %4
%20 = add nsw i32 %19, %9
%21 = icmp slt i32 %11, %5
%22 = select i1 %21, i32 0, i32 %5
%23 = sub nsw i32 %11, %22
%24 = icmp sgt i32 %3, 0
%25 = select i1 %24, i32 0, i32 %5
%26 = add nsw i32 %25, %12
br label %35
27: ; preds = %8
%28 = select i1 %14, i32 %10, i32 %9
%29 = icmp slt i32 %2, 1
%30 = select i1 %29, i32 %28, i32 %9
%31 = icmp slt i32 %11, %5
%32 = select i1 %31, i32 %11, i32 %12
%33 = icmp slt i32 %3, 1
%34 = select i1 %33, i32 %32, i32 %12
br label %35
35: ; preds = %27, %15
%36 = phi i32 [ %26, %15 ], [ %34, %27 ]
%37 = phi i32 [ %23, %15 ], [ %32, %27 ]
%38 = phi i32 [ %17, %15 ], [ %28, %27 ]
%39 = phi i32 [ %20, %15 ], [ %30, %27 ]
%40 = fmul double %7, %7
%41 = tail call double @get(double* %0, i32 %3, i32 %39, i32 %4, i32 %5)
%42 = tail call double @get(double* %0, i32 %3, i32 %38, i32 %4, i32 %5)
%43 = tail call double @get(double* %0, i32 %3, i32 %2, i32 %4, i32 %5)
%44 = tail call double @get(double* %0, i32 %37, i32 %2, i32 %4, i32 %5)
%45 = tail call double @get(double* %0, i32 %36, i32 %2, i32 %4, i32 %5)
%46 = insertelement <2 x double> poison, double %41, i64 0
%47 = insertelement <2 x double> %46, double %44, i64 1
%48 = insertelement <2 x double> poison, double %42, i64 0
%49 = insertelement <2 x double> %48, double %45, i64 1
%50 = fadd <2 x double> %47, %49
%51 = tail call double @get(double* %0, i32 %3, i32 %2, i32 %4, i32 %5)
%52 = insertelement <2 x double> poison, double %43, i64 0
%53 = insertelement <2 x double> %52, double %51, i64 1
%54 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %53, <2 x double> <double -2.000000e+00, double -2.000000e+00>, <2 x double> %50)
%55 = insertelement <2 x double> poison, double %40, i64 0
%56 = shufflevector <2 x double> %55, <2 x double> poison, <2 x i32> zeroinitializer
%57 = fdiv <2 x double> %54, %56
%58 = shufflevector <2 x double> %57, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%59 = fadd <2 x double> %57, %58
%60 = extractelement <2 x double> %59, i64 0
%61 = tail call double @get(double* %1, i32 %3, i32 %39, i32 %4, i32 %5)
%62 = tail call double @get(double* %1, i32 %3, i32 %2, i32 %4, i32 %5)
%63 = fsub double %61, %62
%64 = fdiv double %63, %7
%65 = tail call double @get(double* %0, i32 %3, i32 %39, i32 %4, i32 %5)
%66 = tail call double @get(double* %0, i32 %3, i32 %2, i32 %4, i32 %5)
%67 = fsub double %65, %66
%68 = fdiv double %67, %7
%69 = tail call double @get(double* %1, i32 %37, i32 %2, i32 %4, i32 %5)
%70 = tail call double @get(double* %1, i32 %3, i32 %2, i32 %4, i32 %5)
%71 = tail call double @get(double* %0, i32 %37, i32 %2, i32 %4, i32 %5)
%72 = tail call double @get(double* %0, i32 %3, i32 %2, i32 %4, i32 %5)
%73 = insertelement <2 x double> poison, double %69, i64 0
%74 = insertelement <2 x double> %73, double %71, i64 1
%75 = insertelement <2 x double> poison, double %70, i64 0
%76 = insertelement <2 x double> %75, double %72, i64 1
%77 = fsub <2 x double> %74, %76
%78 = insertelement <2 x double> poison, double %7, i64 0
%79 = shufflevector <2 x double> %78, <2 x double> poison, <2 x i32> zeroinitializer
%80 = fdiv <2 x double> %77, %79
%81 = shufflevector <2 x double> %80, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%82 = fmul <2 x double> %80, %81
%83 = extractelement <2 x double> %82, i64 0
%84 = tail call double @llvm.fmuladd.f64(double %64, double %68, double %83)
%85 = tail call double @get(double* %1, i32 %3, i32 %2, i32 %4, i32 %5)
%86 = tail call double @llvm.fmuladd.f64(double %85, double %60, double %84)
ret double %86
}