void ddxt2d_sub(int n1, int n2, int ics, int isgn, double **a, double *t,
                int *ip, double *w) {
  void ddct(int n, int isgn, double *a, int *ip, double *w);
  void ddst(int n, int isgn, double *a, int *ip, double *w);
  int i, j;
  if (n2 > 2) {
    for (j = 0; j < n2; j += 4) {
      for (i = 0; i < n1; i++) {
        t[i] = a[i][j];
        t[n1 + i] = a[i][j + 1];
        t[2 * n1 + i] = a[i][j + 2];
        t[3 * n1 + i] = a[i][j + 3];
      }
      if (ics == 0) {
        ddct(n1, isgn, t, ip, w);
        ddct(n1, isgn, &t[n1], ip, w);
        ddct(n1, isgn, &t[2 * n1], ip, w);
        ddct(n1, isgn, &t[3 * n1], ip, w);
      } else {
        ddst(n1, isgn, t, ip, w);
        ddst(n1, isgn, &t[n1], ip, w);
        ddst(n1, isgn, &t[2 * n1], ip, w);
        ddst(n1, isgn, &t[3 * n1], ip, w);
      }
      for (i = 0; i < n1; i++) {
        a[i][j] = t[i];
        a[i][j + 1] = t[n1 + i];
        a[i][j + 2] = t[2 * n1 + i];
        a[i][j + 3] = t[3 * n1 + i];
      }
    }
  } else if (n2 == 2) {
    for (i = 0; i < n1; i++) {
      t[i] = a[i][0];
      t[n1 + i] = a[i][1];
    }
    if (ics == 0) {
      ddct(n1, isgn, t, ip, w);
      ddct(n1, isgn, &t[n1], ip, w);
    } else {
      ddst(n1, isgn, t, ip, w);
      ddst(n1, isgn, &t[n1], ip, w);
    }
    for (i = 0; i < n1; i++) {
      a[i][0] = t[i];
      a[i][1] = t[n1 + i];
    }
  }
}


x86 assembly (clang, -O0):
<ddxt2d_sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    1424 <ddxt2d_sub+0x304>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    141f <ddxt2d_sub+0x2ff>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    122c <ddxt2d_sub+0x10c>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x28(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x4(%rbp),%ecx
add    -0x24(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x28(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
add    -0x24(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x28(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
imul   $0x3,-0x4(%rbp),%ecx
add    -0x24(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1168 <ddxt2d_sub+0x48>
cmpl   $0x0,-0xc(%rbp)
jne    12be <ddxt2d_sub+0x19e>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    0x10(%rbp),%rcx
mov    0x18(%rbp),%r8
call   1040 <ddct@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x20(%rbp),%rdx
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    0x10(%rbp),%rcx
mov    0x18(%rbp),%r8
call   1040 <ddct@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
mov    0x10(%rbp),%rcx
mov    0x18(%rbp),%r8
call   1040 <ddct@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x20(%rbp),%rdx
imul   $0x3,-0x4(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
mov    0x10(%rbp),%rcx
mov    0x18(%rbp),%r8
call   1040 <ddct@plt>
jmp    1341 <ddxt2d_sub+0x221>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    0x10(%rbp),%rcx
mov    0x18(%rbp),%r8
call   1030 <ddst@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x20(%rbp),%rdx
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    0x10(%rbp),%rcx
mov    0x18(%rbp),%r8
call   1030 <ddst@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
mov    0x10(%rbp),%rcx
mov    0x18(%rbp),%r8
call   1030 <ddst@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x20(%rbp),%rdx
imul   $0x3,-0x4(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
mov    0x10(%rbp),%rcx
mov    0x18(%rbp),%r8
call   1030 <ddst@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    140c <ddxt2d_sub+0x2ec>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
mov    -0x4(%rbp),%ecx
add    -0x24(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x28(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
add    -0x24(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x28(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
imul   $0x3,-0x4(%rbp),%ecx
add    -0x24(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x28(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1348 <ddxt2d_sub+0x228>
jmp    1411 <ddxt2d_sub+0x2f1>
mov    -0x28(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x28(%rbp)
jmp    1155 <ddxt2d_sub+0x35>
jmp    157b <ddxt2d_sub+0x45b>
cmpl   $0x2,-0x8(%rbp)
jne    1576 <ddxt2d_sub+0x456>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    148f <ddxt2d_sub+0x36f>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  0x8(%rax),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x4(%rbp),%ecx
add    -0x24(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1435 <ddxt2d_sub+0x315>
cmpl   $0x0,-0xc(%rbp)
jne    14d7 <ddxt2d_sub+0x3b7>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    0x10(%rbp),%rcx
mov    0x18(%rbp),%r8
call   1040 <ddct@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x20(%rbp),%rdx
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    0x10(%rbp),%rcx
mov    0x18(%rbp),%r8
call   1040 <ddct@plt>
jmp    1510 <ddxt2d_sub+0x3f0>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    0x10(%rbp),%rcx
mov    0x18(%rbp),%r8
call   1030 <ddst@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x20(%rbp),%rdx
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    0x10(%rbp),%rcx
mov    0x18(%rbp),%r8
call   1030 <ddst@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1571 <ddxt2d_sub+0x451>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
mov    -0x4(%rbp),%ecx
add    -0x24(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1517 <ddxt2d_sub+0x3f7>
jmp    1576 <ddxt2d_sub+0x456>
jmp    157b <ddxt2d_sub+0x45b>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ddxt2d_sub>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %ecx,0x4(%rsp)
mov    %edx,0x14(%rsp)
cmp    $0x3,%esi
mov    %r9,0x20(%rsp)
mov    %r8,0x18(%rsp)
jl     1340 <ddxt2d_sub+0x220>
lea    (%rdi,%rdi,1),%eax
lea    (%rdi,%rdi,2),%ecx
movslq %edi,%rdx
lea    (%r9,%rdx,8),%r12
cltq
lea    (%r9,%rax,8),%r13
movslq %ecx,%rax
lea    (%r9,%rax,8),%rbp
mov    %edi,%r15d
xor    %r14d,%r14d
mov    %rdi,0x8(%rsp)
mov    %esi,0x10(%rsp)
jmp    118d <ddxt2d_sub+0x6d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x4,%r14
cmp    %r10d,%r14d
jge    14ec <ddxt2d_sub+0x3cc>
test   %edi,%edi
jle    11eb <ddxt2d_sub+0xcb>
mov    %r14,%rax
or     $0x1,%rax
mov    %r14,%rcx
or     $0x2,%rcx
mov    %r14,%rdx
or     $0x3,%rdx
xor    %esi,%esi
nopl   0x0(%rax,%rax,1)
mov    (%r8,%rsi,8),%rbx
movsd  (%rbx,%r14,8),%xmm0
movsd  %xmm0,(%r9,%rsi,8)
movsd  (%rbx,%rax,8),%xmm0
movsd  %xmm0,(%r12,%rsi,8)
movsd  (%rbx,%rcx,8),%xmm0
movsd  %xmm0,0x0(%r13,%rsi,8)
movsd  (%rbx,%rdx,8),%xmm0
movsd  %xmm0,0x0(%rbp,%rsi,8)
add    $0x1,%rsi
cmp    %rsi,%r15
jne    11b0 <ddxt2d_sub+0x90>
cmpl   $0x0,0x14(%rsp)
je     1260 <ddxt2d_sub+0x140>
mov    0x4(%rsp),%esi
mov    %r9,%rdx
mov    0x60(%rsp),%rcx
mov    0x68(%rsp),%r8
call   1030 <ddst@plt>
mov    0x8(%rsp),%rdi
mov    0x4(%rsp),%ebx
mov    %ebx,%esi
mov    %r12,%rdx
mov    0x60(%rsp),%rcx
mov    0x68(%rsp),%r8
call   1030 <ddst@plt>
mov    0x8(%rsp),%rdi
mov    %ebx,%esi
mov    %r13,%rdx
mov    0x60(%rsp),%rcx
mov    0x68(%rsp),%r8
call   1030 <ddst@plt>
mov    0x8(%rsp),%rdi
mov    %ebx,%esi
mov    %rbp,%rdx
mov    0x60(%rsp),%rcx
mov    0x68(%rsp),%r8
call   1030 <ddst@plt>
jmp    12c5 <ddxt2d_sub+0x1a5>
nopl   0x0(%rax)
mov    0x4(%rsp),%esi
mov    %r9,%rdx
mov    0x60(%rsp),%rcx
mov    0x68(%rsp),%r8
call   1040 <ddct@plt>
mov    0x8(%rsp),%rdi
mov    0x4(%rsp),%ebx
mov    %ebx,%esi
mov    %r12,%rdx
mov    0x60(%rsp),%rcx
mov    0x68(%rsp),%r8
call   1040 <ddct@plt>
mov    0x8(%rsp),%rdi
mov    %ebx,%esi
mov    %r13,%rdx
mov    0x60(%rsp),%rcx
mov    0x68(%rsp),%r8
call   1040 <ddct@plt>
mov    0x8(%rsp),%rdi
mov    %ebx,%esi
mov    %rbp,%rdx
mov    0x60(%rsp),%rcx
mov    0x68(%rsp),%r8
call   1040 <ddct@plt>
mov    0x10(%rsp),%r10d
mov    0x18(%rsp),%r8
mov    0x8(%rsp),%rdi
mov    0x20(%rsp),%r9
test   %edi,%edi
jle    1180 <ddxt2d_sub+0x60>
mov    %r14,%rax
or     $0x1,%rax
mov    %r14,%rcx
or     $0x2,%rcx
mov    %r14,%rdx
or     $0x3,%rdx
xor    %esi,%esi
nopl   0x0(%rax,%rax,1)
movsd  (%r9,%rsi,8),%xmm0
mov    (%r8,%rsi,8),%rbx
movsd  %xmm0,(%rbx,%r14,8)
movsd  (%r12,%rsi,8),%xmm0
movsd  %xmm0,(%rbx,%rax,8)
movsd  0x0(%r13,%rsi,8),%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
movsd  0x0(%rbp,%rsi,8),%xmm0
movsd  %xmm0,(%rbx,%rdx,8)
add    $0x1,%rsi
cmp    %rsi,%r15
jne    1300 <ddxt2d_sub+0x1e0>
jmp    1180 <ddxt2d_sub+0x60>
cmp    $0x2,%esi
jne    14ec <ddxt2d_sub+0x3cc>
mov    %edi,%r14d
test   %edi,%edi
jle    13de <ddxt2d_sub+0x2be>
cmp    $0x1,%edi
jne    135d <ddxt2d_sub+0x23d>
xor    %eax,%eax
jmp    13bc <ddxt2d_sub+0x29c>
mov    %r14d,%ecx
and    $0xfffffffe,%ecx
lea    0x8(%r9),%rdx
lea    (%r9,%r14,8),%rsi
add    $0x8,%rsi
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r8,%rax,8),%rbp
movsd  0x0(%rbp),%xmm0
movsd  %xmm0,-0x8(%rdx,%rax,8)
movsd  0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rsi,%rax,8)
mov    0x8(%r8,%rax,8),%rbp
movsd  0x0(%rbp),%xmm0
movsd  %xmm0,(%rdx,%rax,8)
movsd  0x8(%rbp),%xmm0
movsd  %xmm0,(%rsi,%rax,8)
add    $0x2,%rax
cmp    %rax,%rcx
jne    1380 <ddxt2d_sub+0x260>
test   $0x1,%r14b
je     13de <ddxt2d_sub+0x2be>
mov    (%r8,%rax,8),%rcx
movsd  (%rcx),%xmm0
movsd  %xmm0,(%r9,%rax,8)
movsd  0x8(%rcx),%xmm0
add    %r14,%rax
movsd  %xmm0,(%r9,%rax,8)
cmpl   $0x0,0x14(%rsp)
je     1424 <ddxt2d_sub+0x304>
mov    0x4(%rsp),%r12d
mov    %r12d,%esi
mov    %r9,%rdx
mov    0x60(%rsp),%r13
mov    %r13,%rcx
mov    %rdi,%rbp
mov    0x68(%rsp),%rbx
mov    %rbx,%r8
mov    %r9,%r15
call   1030 <ddst@plt>
movslq %ebp,%rax
lea    (%r15,%rax,8),%rdx
mov    %ebp,%edi
mov    %r12d,%esi
mov    %r13,%rcx
mov    %rbx,%r8
call   1030 <ddst@plt>
jmp    1461 <ddxt2d_sub+0x341>
mov    0x4(%rsp),%r12d
mov    %r12d,%esi
mov    %r9,%rdx
mov    0x60(%rsp),%r13
mov    %r13,%rcx
mov    %rdi,%rbp
mov    0x68(%rsp),%rbx
mov    %rbx,%r8
mov    %r9,%r15
call   1040 <ddct@plt>
movslq %ebp,%rax
lea    (%r15,%rax,8),%rdx
mov    %ebp,%edi
mov    %r12d,%esi
mov    %r13,%rcx
mov    %rbx,%r8
call   1040 <ddct@plt>
test   %ebp,%ebp
mov    0x20(%rsp),%r8
mov    0x18(%rsp),%rbx
jle    14ec <ddxt2d_sub+0x3cc>
cmp    $0x1,%ebp
jne    1478 <ddxt2d_sub+0x358>
xor    %eax,%eax
jmp    14ca <ddxt2d_sub+0x3aa>
mov    %r14d,%ecx
and    $0xfffffffe,%ecx
lea    0x8(%r8),%rdx
lea    (%r8,%r14,8),%rsi
add    $0x8,%rsi
xor    %eax,%eax
nopl   0x0(%rax)
movsd  -0x8(%rdx,%rax,8),%xmm0
mov    (%rbx,%rax,8),%rdi
movsd  %xmm0,(%rdi)
movsd  -0x8(%rsi,%rax,8),%xmm0
movsd  %xmm0,0x8(%rdi)
movsd  (%rdx,%rax,8),%xmm0
mov    0x8(%rbx,%rax,8),%rdi
movsd  %xmm0,(%rdi)
movsd  (%rsi,%rax,8),%xmm0
movsd  %xmm0,0x8(%rdi)
add    $0x2,%rax
cmp    %rax,%rcx
jne    1490 <ddxt2d_sub+0x370>
test   $0x1,%r14b
je     14ec <ddxt2d_sub+0x3cc>
movsd  (%r8,%rax,8),%xmm0
mov    (%rbx,%rax,8),%rcx
movsd  %xmm0,(%rcx)
add    %rax,%r14
movsd  (%r8,%r14,8),%xmm0
movsd  %xmm0,0x8(%rcx)
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @ddxt2d_sub(i32 %0, i32 %1, i32 %2, i32 %3, double** %4, double* %5, i32* %6, double* %7) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca double**
%14 = alloca double*
%15 = alloca i32*
%16 = alloca double*
%17 = alloca i32
%18 = alloca i32
store i32 %0, i32* %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store double** %4, double*** %13
store double* %5, double** %14
store i32* %6, i32** %15
store double* %7, double** %16
%19 = load i32, i32* %10
%20 = icmp sgt i32 %19, 2
br i1 %20, label %21, label %242
21: ; preds = %8
store i32 0, i32* %18
br label %22
22: ; preds = %238, %21
%23 = load i32, i32* %18
%24 = load i32, i32* %10
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %241
26: ; preds = %22
store i32 0, i32* %17
br label %27
27: ; preds = %95, %26
%28 = load i32, i32* %17
%29 = load i32, i32* %9
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %98
31: ; preds = %27
%32 = load double**, double*** %13
%33 = load i32, i32* %17
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double*, double** %32, i64 %34
%36 = load double*, double** %35
%37 = load i32, i32* %18
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %36, i64 %38
%40 = load double, double* %39
%41 = load double*, double** %14
%42 = load i32, i32* %17
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double, double* %41, i64 %43
store double %40, double* %44
%45 = load double**, double*** %13
%46 = load i32, i32* %17
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds double*, double** %45, i64 %47
%49 = load double*, double** %48
%50 = load i32, i32* %18
%51 = add nsw i32 %50, 1
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds double, double* %49, i64 %52
%54 = load double, double* %53
%55 = load double*, double** %14
%56 = load i32, i32* %9
%57 = load i32, i32* %17
%58 = add nsw i32 %56, %57
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds double, double* %55, i64 %59
store double %54, double* %60
%61 = load double**, double*** %13
%62 = load i32, i32* %17
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double*, double** %61, i64 %63
%65 = load double*, double** %64
%66 = load i32, i32* %18
%67 = add nsw i32 %66, 2
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds double, double* %65, i64 %68
%70 = load double, double* %69
%71 = load double*, double** %14
%72 = load i32, i32* %9
%73 = mul nsw i32 2, %72
%74 = load i32, i32* %17
%75 = add nsw i32 %73, %74
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds double, double* %71, i64 %76
store double %70, double* %77
%78 = load double**, double*** %13
%79 = load i32, i32* %17
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds double*, double** %78, i64 %80
%82 = load double*, double** %81
%83 = load i32, i32* %18
%84 = add nsw i32 %83, 3
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds double, double* %82, i64 %85
%87 = load double, double* %86
%88 = load double*, double** %14
%89 = load i32, i32* %9
%90 = mul nsw i32 3, %89
%91 = load i32, i32* %17
%92 = add nsw i32 %90, %91
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds double, double* %88, i64 %93
store double %87, double* %94
br label %95
95: ; preds = %31
%96 = load i32, i32* %17
%97 = add nsw i32 %96, 1
store i32 %97, i32* %17
br label %27
98: ; preds = %27
%99 = load i32, i32* %11
%100 = icmp eq i32 %99, 0
br i1 %100, label %101, label %133
101: ; preds = %98
%102 = load i32, i32* %9
%103 = load i32, i32* %12
%104 = load double*, double** %14
%105 = load i32*, i32** %15
%106 = load double*, double** %16
%107 = load i32, i32* %9
%108 = load i32, i32* %12
%109 = load double*, double** %14
%110 = load i32, i32* %9
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds double, double* %109, i64 %111
%113 = load i32*, i32** %15
%114 = load double*, double** %16
%115 = load i32, i32* %9
%116 = load i32, i32* %12
%117 = load double*, double** %14
%118 = load i32, i32* %9
%119 = mul nsw i32 2, %118
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds double, double* %117, i64 %120
%122 = load i32*, i32** %15
%123 = load double*, double** %16
%124 = load i32, i32* %9
%125 = load i32, i32* %12
%126 = load double*, double** %14
%127 = load i32, i32* %9
%128 = mul nsw i32 3, %127
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds double, double* %126, i64 %129
%131 = load i32*, i32** %15
%132 = load double*, double** %16
br label %165
133: ; preds = %98
%134 = load i32, i32* %9
%135 = load i32, i32* %12
%136 = load double*, double** %14
%137 = load i32*, i32** %15
%138 = load double*, double** %16
%139 = load i32, i32* %9
%140 = load i32, i32* %12
%141 = load double*, double** %14
%142 = load i32, i32* %9
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds double, double* %141, i64 %143
%145 = load i32*, i32** %15
%146 = load double*, double** %16
%147 = load i32, i32* %9
%148 = load i32, i32* %12
%149 = load double*, double** %14
%150 = load i32, i32* %9
%151 = mul nsw i32 2, %150
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds double, double* %149, i64 %152
%154 = load i32*, i32** %15
%155 = load double*, double** %16
%156 = load i32, i32* %9
%157 = load i32, i32* %12
%158 = load double*, double** %14
%159 = load i32, i32* %9
%160 = mul nsw i32 3, %159
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds double, double* %158, i64 %161
%163 = load i32*, i32** %15
%164 = load double*, double** %16
br label %165
165: ; preds = %133, %101
store i32 0, i32* %17
br label %166
166: ; preds = %234, %165
%167 = load i32, i32* %17
%168 = load i32, i32* %9
%169 = icmp slt i32 %167, %168
br i1 %169, label %170, label %237
170: ; preds = %166
%171 = load double*, double** %14
%172 = load i32, i32* %17
%173 = sext i32 %172 to i64
%174 = getelementptr inbounds double, double* %171, i64 %173
%175 = load double, double* %174
%176 = load double**, double*** %13
%177 = load i32, i32* %17
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds double*, double** %176, i64 %178
%180 = load double*, double** %179
%181 = load i32, i32* %18
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds double, double* %180, i64 %182
store double %175, double* %183
%184 = load double*, double** %14
%185 = load i32, i32* %9
%186 = load i32, i32* %17
%187 = add nsw i32 %185, %186
%188 = sext i32 %187 to i64
%189 = getelementptr inbounds double, double* %184, i64 %188
%190 = load double, double* %189
%191 = load double**, double*** %13
%192 = load i32, i32* %17
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds double*, double** %191, i64 %193
%195 = load double*, double** %194
%196 = load i32, i32* %18
%197 = add nsw i32 %196, 1
%198 = sext i32 %197 to i64
%199 = getelementptr inbounds double, double* %195, i64 %198
store double %190, double* %199
%200 = load double*, double** %14
%201 = load i32, i32* %9
%202 = mul nsw i32 2, %201
%203 = load i32, i32* %17
%204 = add nsw i32 %202, %203
%205 = sext i32 %204 to i64
%206 = getelementptr inbounds double, double* %200, i64 %205
%207 = load double, double* %206
%208 = load double**, double*** %13
%209 = load i32, i32* %17
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds double*, double** %208, i64 %210
%212 = load double*, double** %211
%213 = load i32, i32* %18
%214 = add nsw i32 %213, 2
%215 = sext i32 %214 to i64
%216 = getelementptr inbounds double, double* %212, i64 %215
store double %207, double* %216
%217 = load double*, double** %14
%218 = load i32, i32* %9
%219 = mul nsw i32 3, %218
%220 = load i32, i32* %17
%221 = add nsw i32 %219, %220
%222 = sext i32 %221 to i64
%223 = getelementptr inbounds double, double* %217, i64 %222
%224 = load double, double* %223
%225 = load double**, double*** %13
%226 = load i32, i32* %17
%227 = sext i32 %226 to i64
%228 = getelementptr inbounds double*, double** %225, i64 %227
%229 = load double*, double** %228
%230 = load i32, i32* %18
%231 = add nsw i32 %230, 3
%232 = sext i32 %231 to i64
%233 = getelementptr inbounds double, double* %229, i64 %232
store double %224, double* %233
br label %234
234: ; preds = %170
%235 = load i32, i32* %17
%236 = add nsw i32 %235, 1
store i32 %236, i32* %17
br label %166
237: ; preds = %166
br label %238
238: ; preds = %237
%239 = load i32, i32* %18
%240 = add nsw i32 %239, 4
store i32 %240, i32* %18
br label %22
241: ; preds = %22
br label %344
242: ; preds = %8
%243 = load i32, i32* %10
%244 = icmp eq i32 %243, 2
br i1 %244, label %245, label %343
245: ; preds = %242
store i32 0, i32* %17
br label %246
246: ; preds = %275, %245
%247 = load i32, i32* %17
%248 = load i32, i32* %9
%249 = icmp slt i32 %247, %248
br i1 %249, label %250, label %278
250: ; preds = %246
%251 = load double**, double*** %13
%252 = load i32, i32* %17
%253 = sext i32 %252 to i64
%254 = getelementptr inbounds double*, double** %251, i64 %253
%255 = load double*, double** %254
%256 = getelementptr inbounds double, double* %255, i64 0
%257 = load double, double* %256
%258 = load double*, double** %14
%259 = load i32, i32* %17
%260 = sext i32 %259 to i64
%261 = getelementptr inbounds double, double* %258, i64 %260
store double %257, double* %261
%262 = load double**, double*** %13
%263 = load i32, i32* %17
%264 = sext i32 %263 to i64
%265 = getelementptr inbounds double*, double** %262, i64 %264
%266 = load double*, double** %265
%267 = getelementptr inbounds double, double* %266, i64 1
%268 = load double, double* %267
%269 = load double*, double** %14
%270 = load i32, i32* %9
%271 = load i32, i32* %17
%272 = add nsw i32 %270, %271
%273 = sext i32 %272 to i64
%274 = getelementptr inbounds double, double* %269, i64 %273
store double %268, double* %274
br label %275
275: ; preds = %250
%276 = load i32, i32* %17
%277 = add nsw i32 %276, 1
store i32 %277, i32* %17
br label %246
278: ; preds = %246
%279 = load i32, i32* %11
%280 = icmp eq i32 %279, 0
br i1 %280, label %281, label %295
281: ; preds = %278
%282 = load i32, i32* %9
%283 = load i32, i32* %12
%284 = load double*, double** %14
%285 = load i32*, i32** %15
%286 = load double*, double** %16
%287 = load i32, i32* %9
%288 = load i32, i32* %12
%289 = load double*, double** %14
%290 = load i32, i32* %9
%291 = sext i32 %290 to i64
%292 = getelementptr inbounds double, double* %289, i64 %291
%293 = load i32*, i32** %15
%294 = load double*, double** %16
br label %309
295: ; preds = %278
%296 = load i32, i32* %9
%297 = load i32, i32* %12
%298 = load double*, double** %14
%299 = load i32*, i32** %15
%300 = load double*, double** %16
%301 = load i32, i32* %9
%302 = load i32, i32* %12
%303 = load double*, double** %14
%304 = load i32, i32* %9
%305 = sext i32 %304 to i64
%306 = getelementptr inbounds double, double* %303, i64 %305
%307 = load i32*, i32** %15
%308 = load double*, double** %16
br label %309
309: ; preds = %295, %281
store i32 0, i32* %17
br label %310
310: ; preds = %339, %309
%311 = load i32, i32* %17
%312 = load i32, i32* %9
%313 = icmp slt i32 %311, %312
br i1 %313, label %314, label %342
314: ; preds = %310
%315 = load double*, double** %14
%316 = load i32, i32* %17
%317 = sext i32 %316 to i64
%318 = getelementptr inbounds double, double* %315, i64 %317
%319 = load double, double* %318
%320 = load double**, double*** %13
%321 = load i32, i32* %17
%322 = sext i32 %321 to i64
%323 = getelementptr inbounds double*, double** %320, i64 %322
%324 = load double*, double** %323
%325 = getelementptr inbounds double, double* %324, i64 0
store double %319, double* %325
%326 = load double*, double** %14
%327 = load i32, i32* %9
%328 = load i32, i32* %17
%329 = add nsw i32 %327, %328
%330 = sext i32 %329 to i64
%331 = getelementptr inbounds double, double* %326, i64 %330
%332 = load double, double* %331
%333 = load double**, double*** %13
%334 = load i32, i32* %17
%335 = sext i32 %334 to i64
%336 = getelementptr inbounds double*, double** %333, i64 %335
%337 = load double*, double** %336
%338 = getelementptr inbounds double, double* %337, i64 1
store double %332, double* %338
br label %339
339: ; preds = %314
%340 = load i32, i32* %17
%341 = add nsw i32 %340, 1
store i32 %341, i32* %17
br label %310
342: ; preds = %310
br label %343
343: ; preds = %342, %242
br label %344
344: ; preds = %343, %241
ret void
}

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