#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*/ d2SdiagTriangle(double *, double *, double *, double const,
                                   double *, double *, double *, double *,
                                   double const);
void d2Sdiag2D(double *prod, const double *yc, const double *VRef,
               const double *alpha, const double *h, const double *m,
               const int n) {
  int idn, i1, i2, r, comp;
  double yA[2], yB[2], yC[2], yD[2], yM[2];
  double rA[2], rB[2], rC[2], rD[2];
  const int m1 = m[0], m2 = m[1];
  const int nn = (m1 + 1) * (m2 + 1);
  const double hd = h[0] * h[1];
  const double alphaVolume = alpha[2] * hd;
  const int inc_x = 1;
  const int inc_y = m1 + 1;
  const double *ptr;
  double *wptr;
#pragma omp parallel private(wptr, ptr, idn, i1, i2, r, comp, yA, yB, yC, yD,  \
                             yM, rA, rB, rC, rD)
  {
#pragma omp for
    for (i1 = 0; i1 < m1; i1++) {
      for (i2 = 0; i2 < m2; i2++) {
        idn = i1 + i2 * (m1 + 1);
        comp = 0;
        for (r = 0; r < 2; r++) {
          ptr = yc + idn + comp;
          yA[r] = *ptr;
          ptr = ptr + inc_x;
          yB[r] = *ptr;
          ptr = ptr + inc_y;
          yD[r] = *ptr;
          ptr = ptr - inc_x;
          yC[r] = *ptr;
          yM[r] = 0.25 * (yA[r] + yB[r] + yC[r] + yD[r]);
          rA[r] = 0.0;
          rB[r] = 0.0;
          rC[r] = 0.0;
          rD[r] = 0.0;
          comp += nn;
        }
        d2SdiagTriangle(yA, yB, yM, VRef[0], rA, rB, rD, rC, alphaVolume);
        d2SdiagTriangle(yB, yD, yM, VRef[1], rB, rD, rC, rA, alphaVolume);
        d2SdiagTriangle(yD, yC, yM, VRef[2], rD, rC, rA, rB, alphaVolume);
        d2SdiagTriangle(yC, yA, yM, VRef[3], rC, rA, rB, rD, alphaVolume);
        comp = 0;
        for (r = 0; r < 2; r++) {
          wptr = prod + idn + comp;
#pragma omp atomic
          *wptr += rA[r];
          wptr += inc_x;
#pragma omp atomic
          *wptr += rB[r];
          wptr += inc_y;
#pragma omp atomic
          *wptr += rD[r];
          wptr -= inc_x;
#pragma omp atomic
          *wptr += rC[r];
          comp += nn;
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<d2Sdiag2D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cvttsd2si (%rax),%eax
mov    %eax,-0xe4(%rbp)
mov    -0x30(%rbp),%rax
cvttsd2si 0x8(%rax),%eax
mov    %eax,-0xe8(%rbp)
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    -0xe8(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    %eax,-0xec(%rbp)
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
mulsd  0x8(%rax),%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
mulsd  -0xf8(%rbp),%xmm0
ff
movsd  %xmm0,-0x100(%rbp)
ff
movl   $0x1,-0x104(%rbp)
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x108(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0xe4(%rbp),%eax
jge    15ae <d2Sdiag2D+0x49e>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0xe8(%rbp),%eax
jge    159b <d2Sdiag2D+0x48b>
mov    -0x38(%rbp),%eax
mov    -0x3c(%rbp),%ecx
mov    -0xe4(%rbp),%edx
add    $0x1,%edx
imul   %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x34(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x40(%rbp)
cmpl   $0x2,-0x40(%rbp)
jge    136a <d2Sdiag2D+0x25a>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x44(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x110(%rbp)
mov    -0x110(%rbp),%rax
movsd  (%rax),%xmm0
movslq -0x40(%rbp),%rax
movsd  %xmm0,-0x60(%rbp,%rax,8)
mov    -0x110(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x110(%rbp)
mov    -0x110(%rbp),%rax
movsd  (%rax),%xmm0
movslq -0x40(%rbp),%rax
movsd  %xmm0,-0x70(%rbp,%rax,8)
mov    -0x110(%rbp),%rax
movslq -0x108(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x110(%rbp)
mov    -0x110(%rbp),%rax
movsd  (%rax),%xmm0
movslq -0x40(%rbp),%rax
movsd  %xmm0,-0x90(%rbp,%rax,8)
ff ff
mov    -0x110(%rbp),%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,-0x110(%rbp)
mov    -0x110(%rbp),%rax
movsd  (%rax),%xmm0
movslq -0x40(%rbp),%rax
movsd  %xmm0,-0x80(%rbp,%rax,8)
movslq -0x40(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm1
movslq -0x40(%rbp),%rax
addsd  -0x70(%rbp,%rax,8),%xmm1
movslq -0x40(%rbp),%rax
addsd  -0x80(%rbp,%rax,8),%xmm1
movslq -0x40(%rbp),%rax
addsd  -0x90(%rbp,%rax,8),%xmm1
ff ff
movsd  0xd01(%rip),%xmm0
mulsd  %xmm1,%xmm0
movslq -0x40(%rbp),%rax
movsd  %xmm0,-0xa0(%rbp,%rax,8)
ff ff
movslq -0x40(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xb0(%rbp,%rax,8)
ff ff
movslq -0x40(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xc0(%rbp,%rax,8)
ff ff
movslq -0x40(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xd0(%rbp,%rax,8)
ff ff
movslq -0x40(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xe0(%rbp,%rax,8)
ff ff
mov    -0xec(%rbp),%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    120a <d2Sdiag2D+0xfa>
lea    -0x60(%rbp),%rdi
lea    -0x70(%rbp),%rsi
lea    -0xa0(%rbp),%rdx
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
lea    -0xb0(%rbp),%rcx
lea    -0xc0(%rbp),%r8
lea    -0xe0(%rbp),%r9
lea    -0xd0(%rbp),%rax
movsd  -0x100(%rbp),%xmm1
ff
mov    %rax,(%rsp)
call   1030 <d2SdiagTriangle@plt>
lea    -0x70(%rbp),%rdi
lea    -0x90(%rbp),%rsi
lea    -0xa0(%rbp),%rdx
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
lea    -0xc0(%rbp),%rcx
lea    -0xe0(%rbp),%r8
lea    -0xd0(%rbp),%r9
lea    -0xb0(%rbp),%rax
movsd  -0x100(%rbp),%xmm1
ff
mov    %rax,(%rsp)
call   1030 <d2SdiagTriangle@plt>
lea    -0x90(%rbp),%rdi
lea    -0x80(%rbp),%rsi
lea    -0xa0(%rbp),%rdx
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
lea    -0xe0(%rbp),%rcx
lea    -0xd0(%rbp),%r8
lea    -0xb0(%rbp),%r9
lea    -0xc0(%rbp),%rax
movsd  -0x100(%rbp),%xmm1
ff
mov    %rax,(%rsp)
call   1030 <d2SdiagTriangle@plt>
lea    -0x80(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0xa0(%rbp),%rdx
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm0
lea    -0xd0(%rbp),%rcx
lea    -0xb0(%rbp),%r8
lea    -0xc0(%rbp),%r9
lea    -0xe0(%rbp),%rax
movsd  -0x100(%rbp),%xmm1
ff
mov    %rax,(%rsp)
call   1030 <d2SdiagTriangle@plt>
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x40(%rbp)
cmpl   $0x2,-0x40(%rbp)
jge    1588 <d2Sdiag2D+0x478>
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x44(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x118(%rbp)
movslq -0x40(%rbp),%rax
movsd  -0xb0(%rbp,%rax,8),%xmm0
ff ff
mov    -0x118(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x118(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x118(%rbp)
movslq -0x40(%rbp),%rax
movsd  -0xc0(%rbp,%rax,8),%xmm0
ff ff
mov    -0x118(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x108(%rbp),%ecx
mov    -0x118(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x118(%rbp)
movslq -0x40(%rbp),%rax
movsd  -0xe0(%rbp,%rax,8),%xmm0
ff ff
mov    -0x118(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x118(%rbp),%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,-0x118(%rbp)
movslq -0x40(%rbp),%rax
movsd  -0xd0(%rbp,%rax,8),%xmm0
ff ff
mov    -0x118(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0xec(%rbp),%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1491 <d2Sdiag2D+0x381>
jmp    158d <d2Sdiag2D+0x47d>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11d6 <d2Sdiag2D+0xc6>
jmp    15a0 <d2Sdiag2D+0x490>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11c0 <d2Sdiag2D+0xb0>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d2Sdiag2D>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x138,%rsp
mov    %rdx,0x100(%rsp)
mov    %rsi,0x40(%rsp)
mov    %rdi,0x48(%rsp)
cvttsd2si (%r9),%eax
test   %eax,%eax
jle    14ed <d2Sdiag2D+0x3dd>
cvttsd2si 0x8(%r9),%ebx
movsd  (%r8),%xmm1
mulsd  0x8(%r8),%xmm1
mulsd  0x10(%rcx),%xmm1
lea    0x1(%rax),%ecx
lea    0x1(%rbx),%edx
imul   %ecx,%edx
mov    %ecx,%ecx
movslq %edx,%rdx
mov    %eax,%eax
mov    %rax,0xb0(%rsp)
mov    %rbx,0xb8(%rsp)
mov    %ebx,%eax
mov    %rax,0xa8(%rsp)
lea    0x0(,%rcx,8),%r8
mov    0x40(%rsp),%rax
lea    0x8(%rax,%rcx,8),%r15
lea    (%rdx,%rcx,1),%rbp
lea    0x8(%rax,%rbp,8),%r11
lea    0x8(%rax,%rdx,8),%rdi
mov    0x48(%rsp),%rsi
lea    (%rsi,%rcx,8),%rax
lea    (%rsi,%rdx,8),%r10
lea    (%rsi,%rbp,8),%rbx
xor    %ebp,%ebp
mov    %rbp,0x38(%rsp)
xorpd  %xmm0,%xmm0
movapd 0xe3b(%rip),%xmm9
lea    0x60(%rsp),%r14
xor    %ecx,%ecx
movsd  %xmm1,0x8(%rsp)
mov    %r15,0xf8(%rsp)
mov    %rax,0xf0(%rsp)
mov    %r10,0xe8(%rsp)
mov    %r8,0xe0(%rsp)
mov    %r11,0xd8(%rsp)
mov    %rdi,0xd0(%rsp)
mov    %rbx,0xc8(%rsp)
jmp    1230 <d2Sdiag2D+0x120>
nopl   0x0(%rax)
mov    0xc0(%rsp),%rcx
add    $0x1,%rcx
addq   $0x8,0x38(%rsp)
cmp    0xb0(%rsp),%rcx
je     14ed <d2Sdiag2D+0x3dd>
mov    %rcx,0xc0(%rsp)
cmpl   $0x0,0xb8(%rsp)
jle    1210 <d2Sdiag2D+0x100>
mov    0xa8(%rsp),%rsi
lea    0x50(%rsp),%r12
lea    0x10(%rsp),%rcx
lea    0x20(%rsp),%rdx
mov    0x38(%rsp),%r13
xchg   %ax,%ax
mov    %rsi,0x108(%rsp)
mov    0x40(%rsp),%rsi
movapd %xmm0,0x10(%rsp)
movapd %xmm0,0x50(%rsp)
movapd %xmm0,0x70(%rsp)
movapd %xmm0,0x60(%rsp)
movsd  (%rsi,%r13,1),%xmm0
movsd  %xmm0,0x120(%rsp)
movsd  0x8(%rsi,%r13,1),%xmm6
movsd  %xmm6,0x110(%rsp)
movsd  (%r15,%r13,1),%xmm2
movsd  %xmm2,0x80(%rsp)
movsd  -0x8(%r15,%r13,1),%xmm3
movsd  %xmm3,0x90(%rsp)
movsd  -0x8(%rdi,%r13,1),%xmm4
movsd  %xmm4,0x128(%rsp)
movsd  (%rdi,%r13,1),%xmm5
movsd  %xmm5,0x118(%rsp)
movsd  (%r11,%r13,1),%xmm8
movsd  %xmm8,0x88(%rsp)
movsd  -0x8(%r11,%r13,1),%xmm7
movsd  %xmm7,0x98(%rsp)
unpcklpd %xmm4,%xmm0
unpcklpd %xmm5,%xmm6
addpd  %xmm0,%xmm6
unpcklpd %xmm7,%xmm3
addpd  %xmm6,%xmm3
unpcklpd %xmm8,%xmm2
addpd  %xmm3,%xmm2
mulpd  %xmm9,%xmm2
movapd %xmm2,0x20(%rsp)
mov    0x100(%rsp),%rax
movsd  (%rax),%xmm0
lea    0x70(%rsp),%r15
mov    %r15,(%rsp)
lea    0x120(%rsp),%rdi
lea    0x110(%rsp),%rsi
mov    %rdi,%rbx
mov    %r12,%r8
mov    %r14,%r9
mov    %rsi,%r12
mov    %rax,%rbp
call   1030 <d2SdiagTriangle@plt>
movsd  0x8(%rbp),%xmm0
lea    0x10(%rsp),%rax
mov    %rax,(%rsp)
mov    %r12,%rdi
lea    0x50(%rsp),%r12
lea    0x80(%rsp),%rsi
lea    0x20(%rsp),%rdx
mov    %r12,%rcx
mov    %r14,%r8
mov    %r15,%r9
movsd  0x8(%rsp),%xmm1
call   1030 <d2SdiagTriangle@plt>
movsd  0x10(%rbp),%xmm0
mov    %r12,(%rsp)
lea    0x80(%rsp),%rdi
lea    0x90(%rsp),%rsi
lea    0x20(%rsp),%rdx
mov    %r14,%rcx
mov    %r15,%r8
lea    0x10(%rsp),%r9
movsd  0x8(%rsp),%xmm1
call   1030 <d2SdiagTriangle@plt>
movsd  0x18(%rbp),%xmm0
mov    %r14,(%rsp)
lea    0x90(%rsp),%rdi
mov    %rbx,%rsi
lea    0x20(%rsp),%rdx
mov    %r15,%rcx
lea    0x10(%rsp),%r8
mov    %r12,%r9
movsd  0x8(%rsp),%xmm1
call   1030 <d2SdiagTriangle@plt>
movapd 0xbfa(%rip),%xmm9
mov    0xc8(%rsp),%rbx
mov    0xe8(%rsp),%r10
mov    0xf0(%rsp),%rax
mov    0xd0(%rsp),%rdi
mov    0xd8(%rsp),%r11
lea    0x10(%rsp),%rcx
lea    0x20(%rsp),%rdx
mov    0xf8(%rsp),%r15
mov    0xe0(%rsp),%rsi
movsd  0x8(%rsp),%xmm1
mov    0x48(%rsp),%rbp
movapd 0x10(%rsp),%xmm0
movupd 0x0(%rbp,%r13,1),%xmm2
movhpd 0x50(%rsp),%xmm0
addpd  %xmm2,%xmm0
movupd %xmm0,0x0(%rbp,%r13,1)
movapd 0x70(%rsp),%xmm0
movupd (%rax,%r13,1),%xmm2
movhpd 0x60(%rsp),%xmm0
addpd  %xmm2,%xmm0
movupd %xmm0,(%rax,%r13,1)
movapd 0x10(%rsp),%xmm0
movupd (%r10,%r13,1),%xmm3
movsd  0x58(%rsp),%xmm2
shufpd $0x1,%xmm2,%xmm0
addpd  %xmm3,%xmm0
movupd %xmm0,(%r10,%r13,1)
movapd 0x70(%rsp),%xmm0
movupd (%rbx,%r13,1),%xmm3
movsd  0x68(%rsp),%xmm2
shufpd $0x1,%xmm2,%xmm0
addpd  %xmm3,%xmm0
movupd %xmm0,(%rbx,%r13,1)
xorpd  %xmm0,%xmm0
add    %rsi,%r13
mov    0x108(%rsp),%rsi
add    $0xffffffffffffffff,%rsi
jne    1260 <d2Sdiag2D+0x150>
jmp    1210 <d2Sdiag2D+0x100>
add    $0x138,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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