#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 abs(int);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ gint2_nai_dispatch(int, double *, double, int, double *,
                                      double, double *, double *);
double *malloc(int);
int gint2_nai_dmat(double *dmat, double *potentials, double *points,
                   double *centers, int *shell_types, int *shell_map,
                   int *num_primitives, double *ccoeffs, double *exponents,
                   int num_dmat, int num_points, int num_centers,
                   int num_shells, int num_ccoeffs, int num_exponents) {
  int result, size, i_point, k, k1, k2, primitive1, primitive2, dof1, dof2;
  int shell1, shell2, shell_type1, shell_type2, shell_dof1, shell_dof2,
      shell_offset1, shell_offset2;
  double *work, *work_sum, *out, *out_sum, *center1, *center2;
  double *shell_ccoeffs1, *shell_ccoeffs2, *ccoeff1, *ccoeff2, c1, c2;
  double *shell_exponents1, *shell_exponents2, *exponent1, *exponent2;
  double tmp;
  result = 0;
  size = 10 * 10;
  work = malloc(size * sizeof(double));
  if (work == NULL) {
    result = -1;
    goto EXIT;
  };
  work_sum = malloc(size * sizeof(double));
  if (work_sum == NULL) {
    result = -1;
    goto EXIT;
  };
  for (i_point = 0; i_point < num_points; i_point++) {
    *potentials = 0.0;
    shell_ccoeffs1 = ccoeffs;
    shell_exponents1 = exponents;
    shell_offset1 = 0;
    for (shell1 = 0; shell1 < num_shells; shell1++) {
      center1 = centers + (3 * shell_map[shell1]);
      shell_type1 = shell_types[shell1];
      if (abs(shell_type1) > 3) {
        result = -2;
        goto EXIT;
      };
      shell_dof1 =
          ((shell_type1 < -1)
               ? (-2 * shell_type1 + 1)
               : ((shell_type1 == -1)
                      ? (4)
                      : (((shell_type1 + 1) * (shell_type1 + 2)) / 2)));
      shell_ccoeffs2 = ccoeffs;
      shell_exponents2 = exponents;
      shell_offset2 = 0;
      for (shell2 = 0; shell2 <= shell1; shell2++) {
        center2 = centers + (3 * shell_map[shell2]);
        shell_type2 = shell_types[shell2];
        if (abs(shell_type2) > 3) {
          result = -2;
          goto EXIT;
        };
        shell_dof2 =
            ((shell_type2 < -1)
                 ? (-2 * shell_type2 + 1)
                 : ((shell_type2 == -1)
                        ? (4)
                        : (((shell_type2 + 1) * (shell_type2 + 2)) / 2)));
        out_sum = work_sum;
        for (k = 0; k < size; k++) {
          *out_sum = 0.0;
          out_sum++;
        }
        exponent1 = shell_exponents1;
        ccoeff1 = shell_ccoeffs1;
        for (primitive1 = 0; primitive1 < num_primitives[shell1];
             primitive1++) {
          exponent2 = shell_exponents2;
          ccoeff2 = shell_ccoeffs2;
          for (primitive2 = 0; primitive2 < num_primitives[shell2];
               primitive2++) {
            gint2_nai_dispatch(shell_type1, center1, *exponent1, shell_type2,
                               center2, *exponent2, points, work);
            out = work;
            out_sum = work_sum;
            for (dof1 = 0; dof1 < shell_dof1; dof1++) {
              c1 = ccoeff1[(shell_type1 == -1) && (dof1 > 0)];
              for (dof2 = 0; dof2 < shell_dof2; dof2++) {
                c2 = ccoeff2[(shell_type2 == -1) && (dof2 > 0)];
                *out_sum += c1 * c2 * (*out);
                out++;
                out_sum++;
              }
            }
            exponent2++;
            ccoeff2 += 1 + (shell_type2 == -1);
          }
          exponent1++;
          ccoeff1 += 1 + (shell_type1 == -1);
        }
        out_sum = work_sum;
        tmp = 0;
        for (dof1 = 0; dof1 < shell_dof1; dof1++) {
          for (dof2 = 0; dof2 < shell_dof2; dof2++) {
            k1 = dof1 + shell_offset1;
            k2 = dof2 + shell_offset2;
            if (k1 > k2) {
              k = (k1 * (k1 + 1)) / 2 + k2;
            } else {
              k = (k2 * (k2 + 1)) / 2 + k1;
            }
            tmp += (*out_sum) * dmat[k];
            out_sum++;
          }
        }
        if (shell1 != shell2)
          tmp *= 2;
        *potentials += tmp;
        shell_exponents2 += num_primitives[shell2];
        shell_ccoeffs2 += num_primitives[shell2] * (1 + (shell_type2 == -1));
        shell_offset2 += shell_dof2;
      }
      shell_exponents1 += num_primitives[shell1];
      shell_ccoeffs1 += num_primitives[shell1] * (1 + (shell_type1 == -1));
      shell_offset1 += shell_dof1;
    }
    points += 3;
    potentials++;
  }
EXIT:
  free(work);
  free(work_sum);
  return result;
}


x86 assembly (clang, -O0):
<gint2_nai_dmat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    0x50(%rbp),%eax
mov    0x48(%rbp),%eax
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x64,-0x38(%rbp)
movslq -0x38(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x80(%rbp)
cmpq   $0x0,-0x80(%rbp)
jne    11b9 <gint2_nai_dmat+0x79>
movl   $0xffffffff,-0x34(%rbp)
jmp    18e7 <gint2_nai_dmat+0x7a7>
movslq -0x38(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x88(%rbp)
cmpq   $0x0,-0x88(%rbp)
jne    11e9 <gint2_nai_dmat+0xa9>
movl   $0xffffffff,-0x34(%rbp)
jmp    18e7 <gint2_nai_dmat+0x7a7>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    0x30(%rbp),%eax
jge    18e2 <gint2_nai_dmat+0x7a2>
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    0x18(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    0x20(%rbp),%rax
mov    %rax,-0xe0(%rbp)
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    0x40(%rbp),%eax
jge    18bc <gint2_nai_dmat+0x77c>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
movslq -0x5c(%rbp),%rdx
imul   $0x3,(%rcx,%rdx,4),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xa0(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%edi
call   1040 <abs@plt>
cmp    $0x3,%eax
jle    1283 <gint2_nai_dmat+0x143>
movl   $0xfffffffe,-0x34(%rbp)
jmp    18e7 <gint2_nai_dmat+0x7a7>
cmpl   $0xffffffff,-0x64(%rbp)
jge    12a2 <gint2_nai_dmat+0x162>
imul   $0xfffffffe,-0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x104(%rbp)
jmp    12e5 <gint2_nai_dmat+0x1a5>
cmpl   $0xffffffff,-0x64(%rbp)
jne    12bc <gint2_nai_dmat+0x17c>
mov    $0x4,%eax
mov    %eax,-0x108(%rbp)
jmp    12d9 <gint2_nai_dmat+0x199>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    -0x64(%rbp),%ecx
add    $0x2,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x108(%rbp)
mov    -0x108(%rbp),%eax
mov    %eax,-0x104(%rbp)
mov    -0x104(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    0x18(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    0x20(%rbp),%rax
mov    %rax,-0xe8(%rbp)
movl   $0x0,-0x78(%rbp)
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x5c(%rbp),%eax
jg     184d <gint2_nai_dmat+0x70d>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
movslq -0x60(%rbp),%rdx
imul   $0x3,(%rcx,%rdx,4),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xa8(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x68(%rbp)
mov    -0x68(%rbp),%edi
call   1040 <abs@plt>
cmp    $0x3,%eax
jle    136a <gint2_nai_dmat+0x22a>
movl   $0xfffffffe,-0x34(%rbp)
jmp    18e7 <gint2_nai_dmat+0x7a7>
cmpl   $0xffffffff,-0x68(%rbp)
jge    1389 <gint2_nai_dmat+0x249>
imul   $0xfffffffe,-0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10c(%rbp)
jmp    13cc <gint2_nai_dmat+0x28c>
cmpl   $0xffffffff,-0x68(%rbp)
jne    13a3 <gint2_nai_dmat+0x263>
mov    $0x4,%eax
mov    %eax,-0x110(%rbp)
jmp    13c0 <gint2_nai_dmat+0x280>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    -0x68(%rbp),%ecx
add    $0x2,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x110(%rbp)
mov    -0x110(%rbp),%eax
mov    %eax,-0x10c(%rbp)
mov    -0x10c(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    -0x88(%rbp),%rax
mov    %rax,-0x98(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    1424 <gint2_nai_dmat+0x2e4>
mov    -0x98(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x98(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x98(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    13ea <gint2_nai_dmat+0x2aa>
mov    -0xe0(%rbp),%rax
mov    %rax,-0xf0(%rbp)
mov    -0xb0(%rbp),%rax
mov    %rax,-0xc0(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    0x10(%rbp),%rcx
movslq -0x5c(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    16ad <gint2_nai_dmat+0x56d>
mov    -0xe8(%rbp),%rax
mov    %rax,-0xf8(%rbp)
mov    -0xb8(%rbp),%rax
mov    %rax,-0xc8(%rbp)
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
mov    0x10(%rbp),%rcx
movslq -0x60(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    1666 <gint2_nai_dmat+0x526>
mov    -0x64(%rbp),%edi
mov    -0xa0(%rbp),%rsi
mov    -0xf0(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x68(%rbp),%edx
mov    -0xa8(%rbp),%rcx
mov    -0xf8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%r8
mov    -0x80(%rbp),%r9
call   1060 <gint2_nai_dispatch@plt>
mov    -0x80(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x88(%rbp),%rax
mov    %rax,-0x98(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x6c(%rbp),%eax
jge    161f <gint2_nai_dmat+0x4df>
mov    -0xc0(%rbp),%rax
mov    %rax,-0x120(%rbp)
xor    %eax,%eax
cmpl   $0xffffffff,-0x64(%rbp)
mov    %al,-0x111(%rbp)
jne    1522 <gint2_nai_dmat+0x3e2>
cmpl   $0x0,-0x54(%rbp)
setg   %al
mov    %al,-0x111(%rbp)
mov    -0x120(%rbp),%rax
mov    -0x111(%rbp),%cl
and    $0x1,%cl
movzbl %cl,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x70(%rbp),%eax
jge    160c <gint2_nai_dmat+0x4cc>
mov    -0xc8(%rbp),%rax
mov    %rax,-0x130(%rbp)
xor    %eax,%eax
cmpl   $0xffffffff,-0x68(%rbp)
mov    %al,-0x121(%rbp)
jne    1585 <gint2_nai_dmat+0x445>
cmpl   $0x0,-0x58(%rbp)
setg   %al
mov    %al,-0x121(%rbp)
mov    -0x130(%rbp),%rax
mov    -0x121(%rbp),%cl
and    $0x1,%cl
movzbl %cl,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0xd0(%rbp),%xmm0
ff
mulsd  -0xd8(%rbp),%xmm0
ff
mov    -0x90(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x98(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0x90(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x90(%rbp)
mov    -0x98(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x98(%rbp)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    154c <gint2_nai_dmat+0x40c>
jmp    1611 <gint2_nai_dmat+0x4d1>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    14e9 <gint2_nai_dmat+0x3a9>
mov    -0xf8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0xf8(%rbp)
cmpl   $0xffffffff,-0x68(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%ecx
add    $0x1,%ecx
mov    -0xc8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xc8(%rbp)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    147e <gint2_nai_dmat+0x33e>
mov    -0xf0(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0xf0(%rbp)
cmpl   $0xffffffff,-0x64(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%ecx
add    $0x1,%ecx
mov    -0xc0(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xc0(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1447 <gint2_nai_dmat+0x307>
mov    -0x88(%rbp),%rax
mov    %rax,-0x98(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x6c(%rbp),%eax
jge    17a6 <gint2_nai_dmat+0x666>
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x70(%rbp),%eax
jge    1793 <gint2_nai_dmat+0x653>
mov    -0x54(%rbp),%eax
add    -0x74(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x58(%rbp),%eax
add    -0x78(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x48(%rbp),%eax
jle    1729 <gint2_nai_dmat+0x5e9>
mov    -0x44(%rbp),%eax
mov    -0x44(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    -0x48(%rbp),%eax
mov    %eax,-0x40(%rbp)
jmp    1743 <gint2_nai_dmat+0x603>
mov    -0x48(%rbp),%eax
mov    -0x48(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    -0x44(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x98(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x100(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
mov    -0x98(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x98(%rbp)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    16e0 <gint2_nai_dmat+0x5a0>
jmp    1798 <gint2_nai_dmat+0x658>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    16cd <gint2_nai_dmat+0x58d>
mov    -0x5c(%rbp),%eax
cmp    -0x60(%rbp),%eax
je     17ca <gint2_nai_dmat+0x68a>
movsd  0x846(%rip),%xmm0
mulsd  -0x100(%rbp),%xmm0
ff
movsd  %xmm0,-0x100(%rbp)
ff
movsd  -0x100(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    0x10(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
mov    -0xe8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xe8(%rbp)
mov    0x10(%rbp),%rax
movslq -0x60(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
cmpl   $0xffffffff,-0x68(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x1,%eax
imul   %eax,%ecx
mov    -0xb8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xb8(%rbp)
mov    -0x70(%rbp),%eax
add    -0x78(%rbp),%eax
mov    %eax,-0x78(%rbp)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    1312 <gint2_nai_dmat+0x1d2>
mov    0x10(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
mov    -0xe0(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xe0(%rbp)
mov    0x10(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
cmpl   $0xffffffff,-0x64(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x1,%eax
imul   %eax,%ecx
mov    -0xb0(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xb0(%rbp)
mov    -0x6c(%rbp),%eax
add    -0x74(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    122b <gint2_nai_dmat+0xeb>
mov    -0x18(%rbp),%rax
add    $0x18,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11f0 <gint2_nai_dmat+0xb0>
jmp    18e7 <gint2_nai_dmat+0x7a7>
mov    -0x80(%rbp),%rdi
call   1030 <free@plt>
mov    -0x88(%rbp),%rdi
call   1030 <free@plt>
mov    -0x34(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gint2_nai_dmat>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf8,%rsp
mov    %r9,0x90(%rsp)
mov    %r8,0x98(%rsp)
mov    %rcx,0x70(%rsp)
mov    %rdx,0xa0(%rsp)
mov    %rsi,%r15
mov    %rdi,%rbx
mov    $0x320,%edi
call   1050 <malloc@plt>
mov    %rax,0x58(%rsp)
mov    $0x320,%edi
call   1050 <malloc@plt>
mov    %rax,0x20(%rsp)
test   %rax,%rax
je     17a2 <gint2_nai_dmat+0x662>
cmpl   $0x0,0x150(%rsp)
jle    17b0 <gint2_nai_dmat+0x670>
mov    0x160(%rsp),%eax
mov    0x140(%rsp),%rdx
mov    0x138(%rsp),%rsi
mov    %eax,%ecx
mov    %rcx,0xb8(%rsp)
xor    %ecx,%ecx
mov    %rcx,0x68(%rsp)
mov    %rbx,0xc0(%rsp)
movq   $0x0,(%r15)
test   %eax,%eax
jle    1770 <gint2_nai_dmat+0x630>
xor    %r12d,%r12d
mov    $0x1,%eax
mov    %rax,0x88(%rsp)
mov    %rdx,0x38(%rsp)
mov    %rsi,0x30(%rsp)
xor    %edi,%edi
mov    %r15,0x78(%rsp)
mov    0x98(%rsp),%rax
mov    (%rax,%r12,4),%ebp
mov    %ebp,%eax
neg    %eax
cmovs  %ebp,%eax
mov    $0xfffffffe,%ebx
cmp    $0x3,%eax
ja     17b2 <gint2_nai_dmat+0x672>
cmp    $0xfffffffe,%ebp
jg     1240 <gint2_nai_dmat+0x100>
mov    $0x1,%ecx
sub    %ebp,%ecx
sub    %ebp,%ecx
jmp    1260 <gint2_nai_dmat+0x120>
nopw   0x0(%rax,%rax,1)
cmp    $0xffffffff,%ebp
je     1259 <gint2_nai_dmat+0x119>
lea    0x1(%rbp),%eax
lea    0x2(%rbp),%ebx
imul   %eax,%ebx
mov    %ebx,%ecx
shr    $0x1f,%ecx
add    %ebx,%ecx
sar    %ecx
jmp    1260 <gint2_nai_dmat+0x120>
mov    $0x4,%ecx
xchg   %ax,%ax
mov    %ecx,0xc(%rsp)
mov    0x90(%rsp),%rax
movslq (%rax,%r12,4),%rax
lea    (%rax,%rax,2),%rax
mov    0x70(%rsp),%rcx
lea    (%rcx,%rax,8),%rax
mov    %rax,0xd0(%rsp)
xor    %eax,%eax
cmp    $0xffffffff,%ebp
sete   %al
add    $0x1,%rax
mov    %rax,0xc8(%rsp)
mov    %rdx,0x50(%rsp)
mov    %rsi,0x48(%rsp)
movl   $0x0,0x1c(%rsp)
mov    %r12,0x40(%rsp)
mov    %rdi,0x80(%rsp)
xor    %esi,%esi
mov    %rbp,0x28(%rsp)
jmp    132a <gint2_nai_dmat+0x1ea>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x28(%rsp),%rdx
mov    0x10(%rsp),%rdi
addsd  (%r15),%xmm0
movsd  %xmm0,(%r15)
movslq (%r11,%rsi,4),%rax
mov    0x50(%rsp),%rcx
lea    (%rcx,%rax,8),%rcx
mov    %rcx,0x50(%rsp)
xor    %ecx,%ecx
cmp    $0xffffffff,%r14d
sete   %cl
add    $0x1,%ecx
imul   %rax,%rcx
mov    0x48(%rsp),%rax
lea    (%rax,%rcx,8),%rax
mov    %rax,0x48(%rsp)
add    %edi,0x1c(%rsp)
add    $0x1,%rsi
cmp    0x88(%rsp),%rsi
je     1700 <gint2_nai_dmat+0x5c0>
mov    0x98(%rsp),%rax
mov    (%rax,%rsi,4),%r14d
mov    %r14d,%eax
neg    %eax
cmovs  %r14d,%eax
cmp    $0x3,%eax
ja     17a9 <gint2_nai_dmat+0x669>
cmp    $0xfffffffe,%r14d
jg     1360 <gint2_nai_dmat+0x220>
mov    $0x1,%ecx
sub    %r14d,%ecx
sub    %r14d,%ecx
mov    %rcx,0x10(%rsp)
jmp    1386 <gint2_nai_dmat+0x246>
cmp    $0xffffffff,%r14d
je     137c <gint2_nai_dmat+0x23c>
lea    0x1(%r14),%eax
lea    0x2(%r14),%ecx
imul   %eax,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
sar    %eax
jmp    1381 <gint2_nai_dmat+0x241>
mov    $0x4,%eax
mov    %rax,0x10(%rsp)
mov    0x90(%rsp),%rax
movslq (%rax,%rsi,4),%rbx
mov    $0x320,%edx
mov    %rsi,%rbp
mov    0x20(%rsp),%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    0x130(%rsp),%r11
mov    (%r11,%r12,4),%r8d
test   %r8d,%r8d
mov    %rbp,0xa8(%rsp)
jle    1610 <gint2_nai_dmat+0x4d0>
lea    (%rbx,%rbx,2),%rax
mov    0x70(%rsp),%rcx
lea    (%rcx,%rax,8),%rax
mov    %rax,0xe0(%rsp)
xor    %r12d,%r12d
cmp    $0xffffffff,%r14d
sete   %r12b
lea    0x1(%r12),%rax
mov    %rax,0xd8(%rsp)
mov    (%r11,%rbp,4),%ecx
mov    0x10(%rsp),%r13
cmp    $0x1,%r13d
setne  %al
mov    %r12d,%edx
and    %al,%dl
movzbl %dl,%eax
mov    %rax,0xf0(%rsp)
and    $0xfffffffe,%r13d
xor    %edx,%edx
mov    0x38(%rsp),%rax
mov    %rax,0xb0(%rsp)
mov    0x30(%rsp),%rbp
mov    0x28(%rsp),%rdi
mov    0xc(%rsp),%r10d
jmp    146f <gint2_nai_dmat+0x32f>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x40(%rsp),%rax
mov    (%r11,%rax,4),%r8d
mov    0x60(%rsp),%edx
addq   $0x8,0xb0(%rsp)
mov    0xc8(%rsp),%rax
lea    0x0(%rbp,%rax,8),%rbp
add    $0x1,%edx
cmp    %r8d,%edx
jge    1615 <gint2_nai_dmat+0x4d5>
test   %ecx,%ecx
jle    144d <gint2_nai_dmat+0x30d>
mov    %edx,0x60(%rsp)
xor    %edx,%edx
mov    0x50(%rsp),%rsi
mov    0x48(%rsp),%r15
jmp    14cb <gint2_nai_dmat+0x38b>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0xe8(%rsp),%rsi
add    $0x8,%rsi
mov    0xd8(%rsp),%rax
lea    (%r15,%rax,8),%r15
mov    0x64(%rsp),%edx
add    $0x1,%edx
mov    0xa8(%rsp),%rax
mov    0x130(%rsp),%r11
mov    (%r11,%rax,4),%ecx
cmp    %ecx,%edx
jge    1440 <gint2_nai_dmat+0x300>
mov    %edx,0x64(%rsp)
mov    0xb0(%rsp),%rax
movsd  (%rax),%xmm0
mov    %rsi,0xe8(%rsp)
movsd  (%rsi),%xmm1
mov    0xd0(%rsp),%rsi
mov    %r14d,%edx
mov    0xe0(%rsp),%rcx
mov    0xa0(%rsp),%r8
mov    0x58(%rsp),%r9
call   1060 <gint2_nai_dispatch@plt>
mov    0x10(%rsp),%r9
mov    0xc(%rsp),%r10d
mov    0x28(%rsp),%rdi
test   %r10d,%r10d
jle    1490 <gint2_nai_dmat+0x350>
xor    %r8d,%r8d
mov    0x20(%rsp),%rcx
mov    0x58(%rsp),%rdx
jmp    154d <gint2_nai_dmat+0x40d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r8d
cmp    %r10d,%r8d
je     1490 <gint2_nai_dmat+0x350>
cmp    $0xffffffff,%edi
sete   %bl
test   %r8d,%r8d
setne  %sil
test   %r9d,%r9d
jle    1540 <gint2_nai_dmat+0x400>
and    %sil,%bl
movzbl %bl,%esi
movsd  0x0(%rbp,%rsi,8),%xmm0
cmp    $0x1,%r9d
je     15dc <gint2_nai_dmat+0x49c>
mov    %rbp,%r11
xor    %ebp,%ebp
xor    %esi,%esi
nopl   0x0(%rax,%rax,1)
cmp    $0xffffffff,%r14d
sete   %bl
test   %ebp,%ebp
setne  %al
and    %bl,%al
movzbl %al,%eax
movsd  (%r15,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
mulsd  (%rdx,%rbp,8),%xmm1
addsd  (%rcx,%rbp,8),%xmm1
movsd  %xmm1,(%rcx,%rbp,8)
movsd  (%r15,%r12,8),%xmm1
mulsd  %xmm0,%xmm1
mulsd  0x8(%rdx,%rbp,8),%xmm1
addsd  0x8(%rcx,%rbp,8),%xmm1
movsd  %xmm1,0x8(%rcx,%rbp,8)
add    $0xfffffffffffffff0,%rsi
add    $0x2,%rbp
cmp    %ebp,%r13d
jne    1580 <gint2_nai_dmat+0x440>
sub    %rsi,%rcx
sub    %rsi,%rdx
mov    %r11,%rbp
test   $0x1,%r9b
je     1540 <gint2_nai_dmat+0x400>
mov    0xf0(%rsp),%rax
mulsd  (%r15,%rax,8),%xmm0
mulsd  (%rdx),%xmm0
addsd  (%rcx),%xmm0
movsd  %xmm0,(%rcx)
add    $0x8,%rdx
add    $0x8,%rcx
jmp    1540 <gint2_nai_dmat+0x400>
nopl   (%rax)
mov    0xc(%rsp),%r10d
test   %r10d,%r10d
jle    16d0 <gint2_nai_dmat+0x590>
xor    %r9d,%r9d
xorpd  %xmm0,%xmm0
mov    0x20(%rsp),%rdx
mov    0x78(%rsp),%r15
mov    0xc0(%rsp),%rdi
mov    0x40(%rsp),%r12
mov    0x80(%rsp),%r13
jmp    1662 <gint2_nai_dmat+0x522>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r9d
mov    0xc(%rsp),%r10d
cmp    %r10d,%r9d
je     16e6 <gint2_nai_dmat+0x5a6>
mov    0x10(%rsp),%rcx
test   %ecx,%ecx
jle    1650 <gint2_nai_dmat+0x510>
lea    (%r9,%r13,1),%esi
lea    (%r9,%r13,1),%eax
add    $0x1,%eax
imul   %esi,%eax
mov    %eax,%r10d
shr    $0x1f,%r10d
add    %eax,%r10d
sar    %r10d
mov    0x1c(%rsp),%eax
mov    %eax,%ebx
mov    %ecx,%eax
jmp    16bd <gint2_nai_dmat+0x57d>
lea    0x1(%rbx),%ebp
imul   %ebx,%ebp
mov    %ebp,%ecx
shr    $0x1f,%ecx
add    %ebp,%ecx
sar    %ecx
add    %esi,%ecx
movsd  (%rdx),%xmm1
movslq %ecx,%rcx
mulsd  (%rdi,%rcx,8),%xmm1
addsd  %xmm1,%xmm0
add    $0x8,%rdx
add    $0x1,%ebx
add    $0xffffffff,%eax
je     1650 <gint2_nai_dmat+0x510>
cmp    %ebx,%esi
jle    1690 <gint2_nai_dmat+0x550>
lea    (%r10,%rbx,1),%ecx
jmp    16a1 <gint2_nai_dmat+0x561>
nopw   0x0(%rax,%rax,1)
xorpd  %xmm0,%xmm0
mov    0x78(%rsp),%r15
mov    0x40(%rsp),%r12
mov    0x80(%rsp),%r13
mov    0xa8(%rsp),%rsi
cmp    %rsi,%r12
je     12d0 <gint2_nai_dmat+0x190>
addsd  %xmm0,%xmm0
jmp    12d0 <gint2_nai_dmat+0x190>
xor    %eax,%eax
cmp    $0xffffffff,%edx
sete   %al
movslq %r8d,%rcx
mov    0x38(%rsp),%rdx
lea    (%rdx,%rcx,8),%rdx
mov    %rdx,0x38(%rsp)
add    $0x1,%eax
imul   %eax,%ecx
movslq %ecx,%rax
mov    0x30(%rsp),%rcx
lea    (%rcx,%rax,8),%rcx
mov    %rcx,0x30(%rsp)
add    %r13d,%r10d
add    $0x1,%r12
addq   $0x1,0x88(%rsp)
mov    %r10d,%edi
cmp    0xb8(%rsp),%r12
mov    0x140(%rsp),%rdx
mov    0x138(%rsp),%rsi
jne    1209 <gint2_nai_dmat+0xc9>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
addq   $0x18,0xa0(%rsp)
add    $0x8,%r15
mov    0x68(%rsp),%rax
add    $0x1,%eax
xor    %ebx,%ebx
mov    %rax,0x68(%rsp)
cmp    0x150(%rsp),%eax
mov    0x160(%rsp),%eax
jne    11d9 <gint2_nai_dmat+0x99>
jmp    17b2 <gint2_nai_dmat+0x672>
mov    $0xffffffff,%ebx
jmp    17b2 <gint2_nai_dmat+0x672>
mov    $0xfffffffe,%ebx
jmp    17b2 <gint2_nai_dmat+0x672>
xor    %ebx,%ebx
mov    0x58(%rsp),%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rdi
call   1030 <free@plt>
mov    %ebx,%eax
add    $0xf8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @gint2_nai_dmat(double* %0, double* %1, double* %2, double* %3, i32* %4, i32* %5, i32* %6, double* %7, double* %8, i32 %9, i32 %10, i32 %11, i32 %12, i32 %13, i32 %14) {
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
%19 = alloca double*
%20 = alloca i32*
%21 = alloca i32*
%22 = alloca i32*
%23 = alloca double*
%24 = alloca double*
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32
%36 = alloca i32
%37 = alloca i32
%38 = alloca i32
%39 = alloca i32
%40 = alloca i32
%41 = alloca i32
%42 = alloca i32
%43 = alloca i32
%44 = alloca i32
%45 = alloca i32
%46 = alloca i32
%47 = alloca i32
%48 = alloca i32
%49 = alloca double*
%50 = alloca double*
%51 = alloca double*
%52 = alloca double*
%53 = alloca double*
%54 = alloca double*
%55 = alloca double*
%56 = alloca double*
%57 = alloca double*
%58 = alloca double*
%59 = alloca double
%60 = alloca double
%61 = alloca double*
%62 = alloca double*
%63 = alloca double*
%64 = alloca double*
%65 = alloca double
store double* %0, double** %16
store double* %1, double** %17
store double* %2, double** %18
store double* %3, double** %19
store i32* %4, i32** %20
store i32* %5, i32** %21
store i32* %6, i32** %22
store double* %7, double** %23
store double* %8, double** %24
store i32 %9, i32* %25
store i32 %10, i32* %26
store i32 %11, i32* %27
store i32 %12, i32* %28
store i32 %13, i32* %29
store i32 %14, i32* %30
store i32 0, i32* %31
store i32 100, i32* %32
%66 = load i32, i32* %32
%67 = sext i32 %66 to i64
%68 = mul i64 %67, 8
%69 = trunc i64 %68 to i32
%70 = call double* @malloc(i32 %69)
store double* %70, double** %49
%71 = load double*, double** %49
%72 = icmp eq double* %71, null
br i1 %72, label %73, label %74
73: ; preds = %15
store i32 -1, i32* %31
br label %443
74: ; preds = %15
%75 = load i32, i32* %32
%76 = sext i32 %75 to i64
%77 = mul i64 %76, 8
%78 = trunc i64 %77 to i32
%79 = call double* @malloc(i32 %78)
store double* %79, double** %50
%80 = load double*, double** %50
%81 = icmp eq double* %80, null
br i1 %81, label %82, label %83
82: ; preds = %74
store i32 -1, i32* %31
br label %443
83: ; preds = %74
store i32 0, i32* %33
br label %84
84: ; preds = %439, %83
%85 = load i32, i32* %33
%86 = load i32, i32* %26
%87 = icmp slt i32 %85, %86
br i1 %87, label %88, label %442
88: ; preds = %84
%89 = load double*, double** %17
store double 0.000000e+00, double* %89
%90 = load double*, double** %23
store double* %90, double** %55
%91 = load double*, double** %24
store double* %91, double** %61
store i32 0, i32* %47
store i32 0, i32* %41
br label %92
92: ; preds = %431, %88
%93 = load i32, i32* %41
%94 = load i32, i32* %28
%95 = icmp slt i32 %93, %94
br i1 %95, label %96, label %434
96: ; preds = %92
%97 = load double*, double** %19
%98 = load i32*, i32** %21
%99 = load i32, i32* %41
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds i32, i32* %98, i64 %100
%102 = load i32, i32* %101
%103 = mul nsw i32 3, %102
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds double, double* %97, i64 %104
store double* %105, double** %53
%106 = load i32*, i32** %20
%107 = load i32, i32* %41
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds i32, i32* %106, i64 %108
%110 = load i32, i32* %109
store i32 %110, i32* %43
%111 = load i32, i32* %43
%112 = call i32 @abs(i32 %111)
%113 = icmp sgt i32 %112, 3
br i1 %113, label %114, label %115
114: ; preds = %96
store i32 -2, i32* %31
br label %443
115: ; preds = %96
%116 = load i32, i32* %43
%117 = icmp slt i32 %116, -1
br i1 %117, label %118, label %122
118: ; preds = %115
%119 = load i32, i32* %43
%120 = mul nsw i32 -2, %119
%121 = add nsw i32 %120, 1
br label %135
122: ; preds = %115
%123 = load i32, i32* %43
%124 = icmp eq i32 %123, -1
br i1 %124, label %125, label %126
125: ; preds = %122
br label %133
126: ; preds = %122
%127 = load i32, i32* %43
%128 = add nsw i32 %127, 1
%129 = load i32, i32* %43
%130 = add nsw i32 %129, 2
%131 = mul nsw i32 %128, %130
%132 = sdiv i32 %131, 2
br label %133
133: ; preds = %126, %125
%134 = phi i32 [ 4, %125 ], [ %132, %126 ]
br label %135
135: ; preds = %133, %118
%136 = phi i32 [ %121, %118 ], [ %134, %133 ]
store i32 %136, i32* %45
%137 = load double*, double** %23
store double* %137, double** %56
%138 = load double*, double** %24
store double* %138, double** %62
store i32 0, i32* %48
store i32 0, i32* %42
br label %139
139: ; preds = %403, %135
%140 = load i32, i32* %42
%141 = load i32, i32* %41
%142 = icmp sle i32 %140, %141
br i1 %142, label %143, label %406
143: ; preds = %139
%144 = load double*, double** %19
%145 = load i32*, i32** %21
%146 = load i32, i32* %42
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds i32, i32* %145, i64 %147
%149 = load i32, i32* %148
%150 = mul nsw i32 3, %149
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds double, double* %144, i64 %151
store double* %152, double** %54
%153 = load i32*, i32** %20
%154 = load i32, i32* %42
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds i32, i32* %153, i64 %155
%157 = load i32, i32* %156
store i32 %157, i32* %44
%158 = load i32, i32* %44
%159 = call i32 @abs(i32 %158)
%160 = icmp sgt i32 %159, 3
br i1 %160, label %161, label %162
161: ; preds = %143
store i32 -2, i32* %31
br label %443
162: ; preds = %143
%163 = load i32, i32* %44
%164 = icmp slt i32 %163, -1
br i1 %164, label %165, label %169
165: ; preds = %162
%166 = load i32, i32* %44
%167 = mul nsw i32 -2, %166
%168 = add nsw i32 %167, 1
br label %182
169: ; preds = %162
%170 = load i32, i32* %44
%171 = icmp eq i32 %170, -1
br i1 %171, label %172, label %173
172: ; preds = %169
br label %180
173: ; preds = %169
%174 = load i32, i32* %44
%175 = add nsw i32 %174, 1
%176 = load i32, i32* %44
%177 = add nsw i32 %176, 2
%178 = mul nsw i32 %175, %177
%179 = sdiv i32 %178, 2
br label %180
180: ; preds = %173, %172
%181 = phi i32 [ 4, %172 ], [ %179, %173 ]
br label %182
182: ; preds = %180, %165
%183 = phi i32 [ %168, %165 ], [ %181, %180 ]
store i32 %183, i32* %46
%184 = load double*, double** %50
store double* %184, double** %52
store i32 0, i32* %34
br label %185
185: ; preds = %193, %182
%186 = load i32, i32* %34
%187 = load i32, i32* %32
%188 = icmp slt i32 %186, %187
br i1 %188, label %189, label %196
189: ; preds = %185
%190 = load double*, double** %52
store double 0.000000e+00, double* %190
%191 = load double*, double** %52
%192 = getelementptr inbounds double, double* %191, i32 1
store double* %192, double** %52
br label %193
193: ; preds = %189
%194 = load i32, i32* %34
%195 = add nsw i32 %194, 1
store i32 %195, i32* %34
br label %185
196: ; preds = %185
%197 = load double*, double** %61
store double* %197, double** %63
%198 = load double*, double** %55
store double* %198, double** %57
store i32 0, i32* %37
br label %199
199: ; preds = %308, %196
%200 = load i32, i32* %37
%201 = load i32*, i32** %22
%202 = load i32, i32* %41
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds i32, i32* %201, i64 %203
%205 = load i32, i32* %204
%206 = icmp slt i32 %200, %205
br i1 %206, label %207, label %311
207: ; preds = %199
%208 = load double*, double** %62
store double* %208, double** %64
%209 = load double*, double** %56
store double* %209, double** %58
store i32 0, i32* %38
br label %210
210: ; preds = %295, %207
%211 = load i32, i32* %38
%212 = load i32*, i32** %22
%213 = load i32, i32* %42
%214 = sext i32 %213 to i64
%215 = getelementptr inbounds i32, i32* %212, i64 %214
%216 = load i32, i32* %215
%217 = icmp slt i32 %211, %216
br i1 %217, label %218, label %298
218: ; preds = %210
%219 = load i32, i32* %43
%220 = load double*, double** %53
%221 = load double*, double** %63
%222 = load double, double* %221
%223 = load i32, i32* %44
%224 = load double*, double** %54
%225 = load double*, double** %64
%226 = load double, double* %225
%227 = load double*, double** %18
%228 = load double*, double** %49
%229 = call i32 @gint2_nai_dispatch(i32 %219, double* %220, double %222, i32 %223, double* %224, double %226, double* %227, double* %228)
%230 = load double*, double** %49
store double* %230, double** %51
%231 = load double*, double** %50
store double* %231, double** %52
store i32 0, i32* %39
br label %232
232: ; preds = %282, %218
%233 = load i32, i32* %39
%234 = load i32, i32* %45
%235 = icmp slt i32 %233, %234
br i1 %235, label %236, label %285
236: ; preds = %232
%237 = load double*, double** %57
%238 = load i32, i32* %43
%239 = icmp eq i32 %238, -1
br i1 %239, label %240, label %243
240: ; preds = %236
%241 = load i32, i32* %39
%242 = icmp sgt i32 %241, 0
br label %243
243: ; preds = %240, %236
%244 = phi i1 [ false, %236 ], [ %242, %240 ]
%245 = zext i1 %244 to i32
%246 = sext i32 %245 to i64
%247 = getelementptr inbounds double, double* %237, i64 %246
%248 = load double, double* %247
store double %248, double* %59
store i32 0, i32* %40
br label %249
249: ; preds = %278, %243
%250 = load i32, i32* %40
%251 = load i32, i32* %46
%252 = icmp slt i32 %250, %251
br i1 %252, label %253, label %281
253: ; preds = %249
%254 = load double*, double** %58
%255 = load i32, i32* %44
%256 = icmp eq i32 %255, -1
br i1 %256, label %257, label %260
257: ; preds = %253
%258 = load i32, i32* %40
%259 = icmp sgt i32 %258, 0
br label %260
260: ; preds = %257, %253
%261 = phi i1 [ false, %253 ], [ %259, %257 ]
%262 = zext i1 %261 to i32
%263 = sext i32 %262 to i64
%264 = getelementptr inbounds double, double* %254, i64 %263
%265 = load double, double* %264
store double %265, double* %60
%266 = load double, double* %59
%267 = load double, double* %60
%268 = fmul double %266, %267
%269 = load double*, double** %51
%270 = load double, double* %269
%271 = load double*, double** %52
%272 = load double, double* %271
%273 = call double @llvm.fmuladd.f64(double %268, double %270, double %272)
store double %273, double* %271
%274 = load double*, double** %51
%275 = getelementptr inbounds double, double* %274, i32 1
store double* %275, double** %51
%276 = load double*, double** %52
%277 = getelementptr inbounds double, double* %276, i32 1
store double* %277, double** %52
br label %278
278: ; preds = %260
%279 = load i32, i32* %40
%280 = add nsw i32 %279, 1
store i32 %280, i32* %40
br label %249
281: ; preds = %249
br label %282
282: ; preds = %281
%283 = load i32, i32* %39
%284 = add nsw i32 %283, 1
store i32 %284, i32* %39
br label %232
285: ; preds = %232
%286 = load double*, double** %64
%287 = getelementptr inbounds double, double* %286, i32 1
store double* %287, double** %64
%288 = load i32, i32* %44
%289 = icmp eq i32 %288, -1
%290 = zext i1 %289 to i32
%291 = add nsw i32 1, %290
%292 = load double*, double** %58
%293 = sext i32 %291 to i64
%294 = getelementptr inbounds double, double* %292, i64 %293
store double* %294, double** %58
br label %295
295: ; preds = %285
%296 = load i32, i32* %38
%297 = add nsw i32 %296, 1
store i32 %297, i32* %38
br label %210
298: ; preds = %210
%299 = load double*, double** %63
%300 = getelementptr inbounds double, double* %299, i32 1
store double* %300, double** %63
%301 = load i32, i32* %43
%302 = icmp eq i32 %301, -1
%303 = zext i1 %302 to i32
%304 = add nsw i32 1, %303
%305 = load double*, double** %57
%306 = sext i32 %304 to i64
%307 = getelementptr inbounds double, double* %305, i64 %306
store double* %307, double** %57
br label %308
308: ; preds = %298
%309 = load i32, i32* %37
%310 = add nsw i32 %309, 1
store i32 %310, i32* %37
br label %199
311: ; preds = %199
%312 = load double*, double** %50
store double* %312, double** %52
store double 0.000000e+00, double* %65
store i32 0, i32* %39
br label %313
313: ; preds = %364, %311
%314 = load i32, i32* %39
%315 = load i32, i32* %45
%316 = icmp slt i32 %314, %315
br i1 %316, label %317, label %367
317: ; preds = %313
store i32 0, i32* %40
br label %318
318: ; preds = %360, %317
%319 = load i32, i32* %40
%320 = load i32, i32* %46
%321 = icmp slt i32 %319, %320
br i1 %321, label %322, label %363
322: ; preds = %318
%323 = load i32, i32* %39
%324 = load i32, i32* %47
%325 = add nsw i32 %323, %324
store i32 %325, i32* %35
%326 = load i32, i32* %40
%327 = load i32, i32* %48
%328 = add nsw i32 %326, %327
store i32 %328, i32* %36
%329 = load i32, i32* %35
%330 = load i32, i32* %36
%331 = icmp sgt i32 %329, %330
br i1 %331, label %332, label %340
332: ; preds = %322
%333 = load i32, i32* %35
%334 = load i32, i32* %35
%335 = add nsw i32 %334, 1
%336 = mul nsw i32 %333, %335
%337 = sdiv i32 %336, 2
%338 = load i32, i32* %36
%339 = add nsw i32 %337, %338
store i32 %339, i32* %34
br label %348
340: ; preds = %322
%341 = load i32, i32* %36
%342 = load i32, i32* %36
%343 = add nsw i32 %342, 1
%344 = mul nsw i32 %341, %343
%345 = sdiv i32 %344, 2
%346 = load i32, i32* %35
%347 = add nsw i32 %345, %346
store i32 %347, i32* %34
br label %348
348: ; preds = %340, %332
%349 = load double*, double** %52
%350 = load double, double* %349
%351 = load double*, double** %16
%352 = load i32, i32* %34
%353 = sext i32 %352 to i64
%354 = getelementptr inbounds double, double* %351, i64 %353
%355 = load double, double* %354
%356 = load double, double* %65
%357 = call double @llvm.fmuladd.f64(double %350, double %355, double %356)
store double %357, double* %65
%358 = load double*, double** %52
%359 = getelementptr inbounds double, double* %358, i32 1
store double* %359, double** %52
br label %360
360: ; preds = %348
%361 = load i32, i32* %40
%362 = add nsw i32 %361, 1
store i32 %362, i32* %40
br label %318
363: ; preds = %318
br label %364
364: ; preds = %363
%365 = load i32, i32* %39
%366 = add nsw i32 %365, 1
store i32 %366, i32* %39
br label %313
367: ; preds = %313
%368 = load i32, i32* %41
%369 = load i32, i32* %42
%370 = icmp ne i32 %368, %369
br i1 %370, label %371, label %374
371: ; preds = %367
%372 = load double, double* %65
%373 = fmul double %372, 2.000000e+00
store double %373, double* %65
br label %374
374: ; preds = %371, %367
%375 = load double, double* %65
%376 = load double*, double** %17
%377 = load double, double* %376
%378 = fadd double %377, %375
store double %378, double* %376
%379 = load i32*, i32** %22
%380 = load i32, i32* %42
%381 = sext i32 %380 to i64
%382 = getelementptr inbounds i32, i32* %379, i64 %381
%383 = load i32, i32* %382
%384 = load double*, double** %62
%385 = sext i32 %383 to i64
%386 = getelementptr inbounds double, double* %384, i64 %385
store double* %386, double** %62
%387 = load i32*, i32** %22
%388 = load i32, i32* %42
%389 = sext i32 %388 to i64
%390 = getelementptr inbounds i32, i32* %387, i64 %389
%391 = load i32, i32* %390
%392 = load i32, i32* %44
%393 = icmp eq i32 %392, -1
%394 = zext i1 %393 to i32
%395 = add nsw i32 1, %394
%396 = mul nsw i32 %391, %395
%397 = load double*, double** %56
%398 = sext i32 %396 to i64
%399 = getelementptr inbounds double, double* %397, i64 %398
store double* %399, double** %56
%400 = load i32, i32* %46
%401 = load i32, i32* %48
%402 = add nsw i32 %401, %400
store i32 %402, i32* %48
br label %403
403: ; preds = %374
%404 = load i32, i32* %42
%405 = add nsw i32 %404, 1
store i32 %405, i32* %42
br label %139
406: ; preds = %139
%407 = load i32*, i32** %22
%408 = load i32, i32* %41
%409 = sext i32 %408 to i64
%410 = getelementptr inbounds i32, i32* %407, i64 %409
%411 = load i32, i32* %410
%412 = load double*, double** %61
%413 = sext i32 %411 to i64
%414 = getelementptr inbounds double, double* %412, i64 %413
store double* %414, double** %61
%415 = load i32*, i32** %22
%416 = load i32, i32* %41
%417 = sext i32 %416 to i64
%418 = getelementptr inbounds i32, i32* %415, i64 %417
%419 = load i32, i32* %418
%420 = load i32, i32* %43
%421 = icmp eq i32 %420, -1
%422 = zext i1 %421 to i32
%423 = add nsw i32 1, %422
%424 = mul nsw i32 %419, %423
%425 = load double*, double** %55
%426 = sext i32 %424 to i64
%427 = getelementptr inbounds double, double* %425, i64 %426
store double* %427, double** %55
%428 = load i32, i32* %45
%429 = load i32, i32* %47
%430 = add nsw i32 %429, %428
store i32 %430, i32* %47
br label %431
431: ; preds = %406
%432 = load i32, i32* %41
%433 = add nsw i32 %432, 1
store i32 %433, i32* %41
br label %92
434: ; preds = %92
%435 = load double*, double** %18
%436 = getelementptr inbounds double, double* %435, i64 3
store double* %436, double** %18
%437 = load double*, double** %17
%438 = getelementptr inbounds double, double* %437, i32 1
store double* %438, double** %17
br label %439
439: ; preds = %434
%440 = load i32, i32* %33
%441 = add nsw i32 %440, 1
store i32 %441, i32* %33
br label %84
442: ; preds = %84
br label %443
443: ; preds = %442, %161, %114, %82, %73
%444 = load double*, double** %49
%445 = call i32 @free(double* %444)
%446 = load double*, double** %50
%447 = call i32 @free(double* %446)
%448 = load i32, i32* %31
ret i32 %448
}

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