void matrix_ij_G(int n, double *mat, double ex, double ey, double ez, double xg,
                 double yg) {
  double g1, g2, g3;
  double g1x, g1y, g1z;
  double g2x, g2y, g2z;
  double g3xxx, g3xxy, g3xxz, g3xyy, g3xyz, g3yyy, g3yyz, g3yzz, g3xzz, g3zzz;
  double exx, eyy, ezz, exy, eyz, exz;
  double exxx, exxy, exxz, exyy, exyz, exzz, eyyy, eyyz, eyzz, ezzz;
  g1 = -1.0 / 3.0 * xg;
  g2 = yg;
  g3 = xg - 2.0 * yg;
  exx = ex * ex;
  eyy = ey * ey;
  ezz = ez * ez;
  exy = ex * ey;
  eyz = ey * ez;
  exz = ez * ex;
  exxx = exx * ex;
  exxy = exx * ey;
  exxz = exx * ez;
  exyy = exy * ey;
  exyz = exy * ez;
  exzz = exz * ez;
  eyyy = eyy * ey;
  eyyz = eyy * ez;
  eyzz = eyz * ez;
  ezzz = ezz * ez;
  g1x = g1 * ex;
  g1y = g1 * ey;
  g1z = g1 * ez;
  g2x = g2 * ex;
  g2y = g2 * ey;
  g2z = g2 * ez;
  g3xxx = g3 * exxx;
  g3xxy = g3 * exxy;
  g3xxz = g3 * exxz;
  g3xyy = g3 * exyy;
  g3xyz = g3 * exyz;
  g3xzz = g3 * exzz;
  g3yyy = g3 * eyyy;
  g3yyz = g3 * eyyz;
  g3yzz = g3 * eyzz;
  g3zzz = g3 * ezzz;
  mat[0 * n + 0] += g1x;
  mat[0 * n + 1] += g1y;
  mat[0 * n + 2] += g1z;
  mat[4 * n + 0] += g1x;
  mat[4 * n + 1] += g1y;
  mat[4 * n + 2] += g1z;
  mat[0 * n + 0] += 2.0 * g2x;
  mat[1 * n + 0] += g2y;
  mat[1 * n + 1] += g2x;
  mat[2 * n + 0] += g2z;
  mat[2 * n + 2] += g2x;
  mat[3 * n + 1] += g2z;
  mat[3 * n + 2] += g2y;
  mat[4 * n + 1] += 2.0 * g2y;
  mat[0 * n + 0] += g3xxx;
  mat[0 * n + 1] += g3xxy;
  mat[0 * n + 2] += g3xxz;
  mat[1 * n + 0] += g3xxy;
  mat[1 * n + 1] += g3xyy;
  mat[1 * n + 2] += g3xyz;
  mat[2 * n + 0] += g3xxz;
  mat[2 * n + 1] += g3xyz;
  mat[2 * n + 2] += g3xzz;
  mat[3 * n + 0] += g3xyz;
  mat[3 * n + 1] += g3yyz;
  mat[3 * n + 2] += g3yzz;
  mat[4 * n + 0] += g3xyy;
  mat[4 * n + 1] += g3yyy;
  mat[4 * n + 2] += g3yyz;
}


x86 assembly (clang, -O0):
<matrix_ij_G>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  %xmm3,-0x30(%rbp)
movsd  %xmm4,-0x38(%rbp)
movsd  0xecd(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
movsd  -0xd8(%rbp),%xmm0
ff
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x108(%rbp)
ff
movsd  -0xd8(%rbp),%xmm0
ff
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x110(%rbp)
ff
movsd  -0xd8(%rbp),%xmm0
ff
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x118(%rbp)
ff
movsd  -0xf0(%rbp),%xmm0
ff
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x120(%rbp)
ff
movsd  -0xf0(%rbp),%xmm0
ff
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x128(%rbp)
ff
movsd  -0x100(%rbp),%xmm0
ff
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x130(%rbp)
ff
movsd  -0xe0(%rbp),%xmm0
ff
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x138(%rbp)
ff
movsd  -0xe0(%rbp),%xmm0
ff
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x140(%rbp)
ff
movsd  -0xf8(%rbp),%xmm0
ff
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x148(%rbp)
ff
movsd  -0xe8(%rbp),%xmm0
ff
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x150(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x50(%rbp),%xmm0
mulsd  -0x108(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
mulsd  -0x110(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
mulsd  -0x118(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
mulsd  -0x120(%rbp),%xmm0
ff
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
mulsd  -0x128(%rbp),%xmm0
ff
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
mulsd  -0x130(%rbp),%xmm0
ff
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
mulsd  -0x138(%rbp),%xmm0
ff
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
mulsd  -0x140(%rbp),%xmm0
ff
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
mulsd  -0x148(%rbp),%xmm0
ff
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
mulsd  -0x150(%rbp),%xmm0
ff
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
mov    -0x10(%rbp),%rax
imul   $0x0,-0x4(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
mov    -0x10(%rbp),%rax
imul   $0x0,-0x4(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x68(%rbp),%xmm0
mov    -0x10(%rbp),%rax
imul   $0x0,-0x4(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x58(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x68(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x70(%rbp),%xmm0
mov    -0x10(%rbp),%rax
imul   $0x0,-0x4(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x78(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x0,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x70(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x0,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x80(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x70(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x80(%rbp),%xmm0
mov    -0x10(%rbp),%rax
imul   $0x3,-0x4(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x78(%rbp),%xmm0
mov    -0x10(%rbp),%rax
imul   $0x3,-0x4(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x78(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x88(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
imul   $0x0,-0x4(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x90(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
imul   $0x0,-0x4(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x98(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
imul   $0x0,-0x4(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x90(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x0,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0xa0(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x0,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0xa8(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x0,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x98(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0xa8(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0xc8(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0xa8(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
imul   $0x3,-0x4(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0xb8(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
imul   $0x3,-0x4(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0xc0(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
imul   $0x3,-0x4(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0xa0(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0xb0(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0xb8(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matrix_ij_G>:
movsd  0xef8(%rip),%xmm5
mulsd  %xmm3,%xmm5
movapd %xmm0,%xmm7
mulsd  %xmm0,%xmm7
movapd %xmm1,%xmm12
unpcklpd %xmm1,%xmm12
movapd %xmm0,%xmm13
unpcklpd %xmm1,%xmm13
movapd %xmm12,%xmm11
mulpd  %xmm13,%xmm11
movapd %xmm1,%xmm8
mulsd  %xmm2,%xmm8
movapd %xmm0,%xmm9
mulsd  %xmm2,%xmm9
movapd %xmm7,%xmm14
unpcklpd %xmm11,%xmm7
movapd %xmm2,%xmm10
mulsd  %xmm2,%xmm9
mulpd  %xmm11,%xmm12
unpckhpd %xmm11,%xmm11
mulsd  %xmm2,%xmm11
mulsd  %xmm2,%xmm8
movapd %xmm5,%xmm6
mulsd  %xmm2,%xmm5
mulsd  %xmm4,%xmm0
mulsd  %xmm4,%xmm1
mulsd  %xmm4,%xmm2
addsd  %xmm4,%xmm4
subsd  %xmm4,%xmm3
unpcklpd %xmm14,%xmm14
mulpd  %xmm13,%xmm14
unpcklpd %xmm10,%xmm10
mulpd  %xmm7,%xmm10
unpcklpd %xmm6,%xmm6
mulpd  %xmm13,%xmm6
mulsd  %xmm3,%xmm9
mulsd  %xmm3,%xmm11
mulsd  %xmm3,%xmm8
unpcklpd %xmm3,%xmm3
mulpd  %xmm3,%xmm14
mulpd  %xmm3,%xmm10
mulpd  %xmm12,%xmm3
movupd (%rsi),%xmm4
addpd  %xmm6,%xmm4
movupd %xmm4,(%rsi)
movsd  0x10(%rsi),%xmm4
addsd  %xmm5,%xmm4
movsd  %xmm4,0x10(%rsi)
lea    0x0(,%rdi,4),%eax
movslq %eax,%r8
lea    0x1(,%rdi,4),%r9d
movupd (%rsi,%r8,8),%xmm4
addpd  %xmm6,%xmm4
movupd %xmm4,(%rsi,%r8,8)
lea    0x2(,%rdi,4),%eax
movslq %eax,%r10
addsd  (%rsi,%r10,8),%xmm5
movsd  %xmm5,(%rsi,%r10,8)
movapd %xmm0,%xmm4
addsd  %xmm0,%xmm4
addsd  (%rsi),%xmm4
movsd  %xmm4,(%rsi)
movslq %edi,%rdx
movsd  (%rsi,%rdx,8),%xmm4
addsd  %xmm1,%xmm4
movsd  %xmm4,(%rsi,%rdx,8)
movsd  0x8(%rsi,%rdx,8),%xmm4
addsd  %xmm0,%xmm4
movsd  %xmm4,0x8(%rsi,%rdx,8)
lea    (%rdx,%rdx,1),%eax
cltq
movsd  (%rsi,%rax,8),%xmm4
addsd  %xmm2,%xmm4
movsd  %xmm4,(%rsi,%rax,8)
addsd  0x10(%rsi,%rax,8),%xmm0
movsd  %xmm0,0x10(%rsi,%rax,8)
lea    (%rdi,%rdi,2),%edi
movslq %edi,%rdi
addsd  0x8(%rsi,%rdi,8),%xmm2
movslq %r9d,%rcx
movsd  %xmm2,0x8(%rsi,%rdi,8)
movsd  0x10(%rsi,%rdi,8),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsi,%rdi,8)
addsd  %xmm1,%xmm1
addsd  (%rsi,%rcx,8),%xmm1
movsd  %xmm1,(%rsi,%rcx,8)
movupd (%rsi),%xmm0
addpd  %xmm14,%xmm0
movupd %xmm0,(%rsi)
movsd  0x10(%rsi),%xmm0
addsd  %xmm10,%xmm0
movsd  %xmm0,0x10(%rsi)
unpckhpd %xmm14,%xmm14
addsd  (%rsi,%rdx,8),%xmm14
movsd  %xmm14,(%rsi,%rdx,8)
movsd  0x8(%rsi,%rdx,8),%xmm0
addsd  %xmm3,%xmm0
movsd  %xmm0,0x8(%rsi,%rdx,8)
movapd %xmm10,%xmm0
unpckhpd %xmm10,%xmm0
movsd  0x10(%rsi,%rdx,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsi,%rdx,8)
movupd (%rsi,%rax,8),%xmm1
addpd  %xmm10,%xmm1
movupd %xmm1,(%rsi,%rax,8)
addsd  0x10(%rsi,%rax,8),%xmm9
movsd  %xmm9,0x10(%rsi,%rax,8)
addsd  (%rsi,%rdi,8),%xmm0
movsd  %xmm0,(%rsi,%rdi,8)
movsd  0x8(%rsi,%rdi,8),%xmm0
addsd  %xmm11,%xmm0
movsd  %xmm0,0x8(%rsi,%rdi,8)
addsd  0x10(%rsi,%rdi,8),%xmm8
movsd  %xmm8,0x10(%rsi,%rdi,8)
movupd (%rsi,%r8,8),%xmm0
addpd  %xmm3,%xmm0
movupd %xmm0,(%rsi,%r8,8)
addsd  (%rsi,%r10,8),%xmm11
movsd  %xmm11,(%rsi,%r10,8)
ret

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

LLVM IR (-O2):
define void @matrix_ij_G(i32 %0, double* nocapture %1, double %2, double %3, double %4, double %5, double %6) {
%8 = fmul double %5, 0xBFD5555555555555
%9 = tail call double @llvm.fmuladd.f64(double %6, double -2.000000e+00, double %5)
%10 = fmul double %2, %2
%11 = insertelement <2 x double> poison, double %3, i64 0
%12 = shufflevector <2 x double> %11, <2 x double> poison, <2 x i32> zeroinitializer
%13 = insertelement <2 x double> poison, double %2, i64 0
%14 = insertelement <2 x double> %13, double %3, i64 1
%15 = fmul <2 x double> %12, %14
%16 = fmul double %3, %4
%17 = fmul double %2, %4
%18 = insertelement <2 x double> poison, double %10, i64 0
%19 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> zeroinitializer
%20 = fmul <2 x double> %19, %14
%21 = shufflevector <2 x double> %18, <2 x double> %15, <2 x i32> <i32 0, i32 2>
%22 = insertelement <2 x double> poison, double %4, i64 0
%23 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> zeroinitializer
%24 = fmul <2 x double> %21, %23
%25 = fmul double %17, %4
%26 = fmul <2 x double> %15, %12
%27 = extractelement <2 x double> %15, i64 1
%28 = fmul double %27, %4
%29 = fmul double %16, %4
%30 = insertelement <2 x double> poison, double %8, i64 0
%31 = shufflevector <2 x double> %30, <2 x double> poison, <2 x i32> zeroinitializer
%32 = fmul <2 x double> %31, %14
%33 = fmul double %8, %4
%34 = fmul double %2, %6
%35 = fmul double %3, %6
%36 = fmul double %4, %6
%37 = insertelement <2 x double> poison, double %9, i64 0
%38 = shufflevector <2 x double> %37, <2 x double> poison, <2 x i32> zeroinitializer
%39 = fmul <2 x double> %20, %38
%40 = fmul <2 x double> %24, %38
%41 = fmul double %25, %9
%42 = fmul <2 x double> %26, %38
%43 = fmul double %28, %9
%44 = fmul double %29, %9
%45 = bitcast double* %1 to <2 x double>*
%46 = load <2 x double>, <2 x double>* %45
%47 = fadd <2 x double> %32, %46
%48 = bitcast double* %1 to <2 x double>*
store <2 x double> %47, <2 x double>* %48
%49 = getelementptr inbounds double, double* %1, i64 2
%50 = load double, double* %49
%51 = fadd double %33, %50
store double %51, double* %49
%52 = shl nsw i32 %0, 2
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds double, double* %1, i64 %53
%55 = or i32 %52, 1
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds double, double* %1, i64 %56
%58 = bitcast double* %54 to <2 x double>*
%59 = load <2 x double>, <2 x double>* %58
%60 = fadd <2 x double> %32, %59
%61 = bitcast double* %54 to <2 x double>*
store <2 x double> %60, <2 x double>* %61
%62 = or i32 %52, 2
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double, double* %1, i64 %63
%65 = load double, double* %64
%66 = fadd double %33, %65
store double %66, double* %64
%67 = load double, double* %1
%68 = tail call double @llvm.fmuladd.f64(double %34, double 2.000000e+00, double %67)
store double %68, double* %1
%69 = sext i32 %0 to i64
%70 = getelementptr inbounds double, double* %1, i64 %69
%71 = load double, double* %70
%72 = fadd double %35, %71
store double %72, double* %70
%73 = add nsw i32 %0, 1
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds double, double* %1, i64 %74
%76 = load double, double* %75
%77 = fadd double %34, %76
store double %77, double* %75
%78 = shl nsw i32 %0, 1
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds double, double* %1, i64 %79
%81 = load double, double* %80
%82 = fadd double %36, %81
store double %82, double* %80
%83 = add nsw i32 %78, 2
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds double, double* %1, i64 %84
%86 = load double, double* %85
%87 = fadd double %34, %86
store double %87, double* %85
%88 = mul nsw i32 %0, 3
%89 = add nsw i32 %88, 1
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds double, double* %1, i64 %90
%92 = load double, double* %91
%93 = fadd double %36, %92
store double %93, double* %91
%94 = add nsw i32 %88, 2
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds double, double* %1, i64 %95
%97 = load double, double* %96
%98 = fadd double %35, %97
store double %98, double* %96
%99 = load double, double* %57
%100 = tail call double @llvm.fmuladd.f64(double %35, double 2.000000e+00, double %99)
store double %100, double* %57
%101 = bitcast double* %1 to <2 x double>*
%102 = load <2 x double>, <2 x double>* %101
%103 = fadd <2 x double> %39, %102
%104 = bitcast double* %1 to <2 x double>*
store <2 x double> %103, <2 x double>* %104
%105 = load double, double* %49
%106 = extractelement <2 x double> %40, i64 0
%107 = fadd double %106, %105
store double %107, double* %49
%108 = load double, double* %70
%109 = extractelement <2 x double> %39, i64 1
%110 = fadd double %109, %108
store double %110, double* %70
%111 = load double, double* %75
%112 = extractelement <2 x double> %42, i64 0
%113 = fadd double %112, %111
store double %113, double* %75
%114 = add nsw i32 %0, 2
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds double, double* %1, i64 %115
%117 = load double, double* %116
%118 = extractelement <2 x double> %40, i64 1
%119 = fadd double %118, %117
store double %119, double* %116
%120 = bitcast double* %80 to <2 x double>*
%121 = load <2 x double>, <2 x double>* %120
%122 = fadd <2 x double> %40, %121
%123 = bitcast double* %80 to <2 x double>*
store <2 x double> %122, <2 x double>* %123
%124 = load double, double* %85
%125 = fadd double %41, %124
store double %125, double* %85
%126 = sext i32 %88 to i64
%127 = getelementptr inbounds double, double* %1, i64 %126
%128 = load double, double* %127
%129 = fadd double %118, %128
store double %129, double* %127
%130 = load double, double* %91
%131 = fadd double %43, %130
store double %131, double* %91
%132 = load double, double* %96
%133 = fadd double %44, %132
store double %133, double* %96
%134 = bitcast double* %54 to <2 x double>*
%135 = load <2 x double>, <2 x double>* %134
%136 = fadd <2 x double> %42, %135
%137 = bitcast double* %54 to <2 x double>*
store <2 x double> %136, <2 x double>* %137
%138 = load double, double* %64
%139 = fadd double %43, %138
store double %139, double* %64
ret void
}