void ddct(int n, int isgn, double *a, int *ip, double *w) {
  void makewt(int nw, int *ip, double *w);
  void makect(int nc, int *ip, double *c);
  void cftfsub(int n, double *a, int *ip, int nw, double *w);
  void cftbsub(int n, double *a, int *ip, int nw, double *w);
  void rftfsub(int n, double *a, int nc, double *c);
  void rftbsub(int n, double *a, int nc, double *c);
  void dctsub(int n, double *a, int nc, double *c);
  int j, nw, nc;
  double xr;
  nw = ip[0];
  if (n > (nw << 2)) {
    nw = n >> 2;
    makewt(nw, ip, w);
  }
  nc = ip[1];
  if (n > nc) {
    nc = n;
    makect(nc, ip, w + nw);
  }
  if (isgn < 0) {
    xr = a[n - 1];
    for (j = n - 2; j >= 2; j -= 2) {
      a[j + 1] = a[j] - a[j - 1];
      a[j] += a[j - 1];
    }
    a[1] = a[0] - xr;
    a[0] += xr;
    if (n > 4) {
      rftbsub(n, a, nc, w + nw);
      cftbsub(n, a, ip + 2, nw, w);
    } else if (n == 4) {
      cftbsub(n, a, ip + 2, nw, w);
    }
  }
  dctsub(n, a, nc, w + nw);
  if (isgn >= 0) {
    if (n > 4) {
      cftfsub(n, a, ip + 2, nw, w);
      rftfsub(n, a, nc, w + nw);
    } else if (n == 4) {
      cftfsub(n, a, ip + 2, nw, w);
    }
    xr = a[0] - a[1];
    a[0] += a[1];
    for (j = 2; j < n; j += 2) {
      a[j - 1] = a[j] - a[j + 1];
      a[j] += a[j + 1];
    }
    a[n - 1] = xr;
  }
}


x86 assembly (clang, -O0):
<ddct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x28(%rbp),%ecx
shl    $0x2,%ecx
cmp    %ecx,%eax
jle    11bd <ddct+0x4d>
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <makewt@plt>
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jle    11f4 <ddct+0x84>
mov    -0x4(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
movslq -0x28(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
call   1080 <makect@plt>
cmpl   $0x0,-0x8(%rbp)
jge    1329 <ddct+0x1b9>
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jl     128b <ddct+0x11b>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x24(%rbp)
jmp    121e <ddct+0xae>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
subsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
cmpl   $0x4,-0x4(%rbp)
jle    12fa <ddct+0x18a>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x2c(%rbp),%edx
mov    -0x20(%rbp),%rcx
movslq -0x28(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rcx
call   1070 <rftbsub@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
mov    -0x28(%rbp),%ecx
mov    -0x20(%rbp),%r8
call   1060 <cftbsub@plt>
jmp    1324 <ddct+0x1b4>
cmpl   $0x4,-0x4(%rbp)
jne    131f <ddct+0x1af>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
mov    -0x28(%rbp),%ecx
mov    -0x20(%rbp),%r8
call   1060 <cftbsub@plt>
jmp    1324 <ddct+0x1b4>
jmp    1329 <ddct+0x1b9>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x2c(%rbp),%edx
mov    -0x20(%rbp),%rcx
movslq -0x28(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rcx
call   1030 <dctsub@plt>
cmpl   $0x0,-0x8(%rbp)
jl     147b <ddct+0x30b>
cmpl   $0x4,-0x4(%rbp)
jle    1399 <ddct+0x229>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
mov    -0x28(%rbp),%ecx
mov    -0x20(%rbp),%r8
call   1090 <cftfsub@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x2c(%rbp),%edx
mov    -0x20(%rbp),%rcx
movslq -0x28(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rcx
call   1050 <rftfsub@plt>
jmp    13c3 <ddct+0x253>
cmpl   $0x4,-0x4(%rbp)
jne    13be <ddct+0x24e>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
mov    -0x28(%rbp),%ecx
mov    -0x20(%rbp),%r8
call   1090 <cftfsub@plt>
jmp    13c3 <ddct+0x253>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movl   $0x2,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1464 <ddct+0x2f4>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x24(%rbp)
jmp    13f5 <ddct+0x285>
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ddct>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,%rbp
mov    %rcx,%r12
mov    %rdx,%rbx
mov    %edi,%r14d
mov    (%rcx),%r13d
lea    0x0(,%r13,4),%eax
cmp    %edi,%eax
jge    11b4 <ddct+0x44>
mov    %r14d,%r13d
sar    $0x2,%r13d
mov    %r13d,%edi
mov    %esi,%r15d
mov    %r12,%rsi
mov    %rbp,%rdx
call   1040 <makewt@plt>
mov    %r15d,%esi
mov    0x4(%r12),%edx
movslq %r13d,%r15
cmp    %r14d,%edx
jge    11ee <ddct+0x7e>
lea    0x0(,%r15,8),%rdx
add    %rbp,%rdx
mov    %r14d,%edi
mov    %r13,(%rsp)
mov    %r15,%r13
mov    %esi,%r15d
mov    %r12,%rsi
call   1080 <makect@plt>
mov    %r15d,%esi
mov    %r13,%r15
mov    (%rsp),%r13
mov    %r14d,%edx
mov    %rbp,(%rsp)
movslq %r14d,%rbp
test   %esi,%esi
js     124d <ddct+0xdd>
mov    (%rsp),%rax
lea    (%rax,%r15,8),%r15
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %edx,0x8(%rsp)
mov    %r15,%rcx
call   1030 <dctsub@plt>
cmp    $0x5,%r14d
jl     1306 <ddct+0x196>
add    $0x8,%r12
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r13d,%ecx
mov    (%rsp),%r8
call   1090 <cftfsub@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    0x8(%rsp),%edx
mov    %r15,%rcx
call   1050 <rftfsub@plt>
jmp    132b <ddct+0x1bb>
movsd  -0x8(%rbx,%rbp,8),%xmm0
cmp    $0x4,%r14d
jl     14db <ddct+0x36b>
mov    %esi,0xc(%rsp)
mov    %rbp,0x10(%rsp)
lea    0x2(%r14),%r8d
lea    -0x2(%r14),%ecx
lea    (%rbx,%rcx,8),%rcx
lea    -0x3(%r14),%eax
lea    (%rbx,%rax,8),%rax
lea    -0x1(%r14),%esi
lea    (%rbx,%rsi,8),%rsi
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  (%rcx,%rdi,8),%xmm1
movsd  (%rax,%rdi,8),%xmm2
movapd %xmm1,%xmm3
subsd  %xmm2,%xmm3
movsd  %xmm3,(%rsi,%rdi,8)
addsd  %xmm2,%xmm1
movsd  %xmm1,(%rcx,%rdi,8)
add    $0xfffffffffffffffe,%rdi
lea    (%r8,%rdi,1),%ebp
cmp    $0x5,%ebp
ja     1290 <ddct+0x120>
movsd  (%rbx),%xmm1
movapd %xmm1,%xmm2
subsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rbx)
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx)
cmp    $0x5,%r14d
mov    (%rsp),%rbp
mov    %edx,0x8(%rsp)
jl     154e <ddct+0x3de>
lea    0x0(,%r15,8),%rcx
add    %rbp,%rcx
mov    %r14d,%edi
mov    %rbx,%rsi
call   1070 <rftbsub@plt>
mov    %r14d,%edi
jmp    1559 <ddct+0x3e9>
cmp    $0x4,%r14d
jne    1515 <ddct+0x3a5>
add    $0x8,%r12
mov    $0x4,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r13d,%ecx
mov    (%rsp),%r8
call   1090 <cftfsub@plt>
movsd  (%rbx),%xmm1
movsd  0x8(%rbx),%xmm2
movapd %xmm1,%xmm0
subsd  %xmm2,%xmm0
addsd  %xmm2,%xmm1
movsd  %xmm1,(%rbx)
mov    %r14d,%eax
cmp    $0x5,%rax
mov    $0x4,%ecx
cmovae %rax,%rcx
add    $0xfffffffffffffffd,%rcx
mov    $0x2,%edx
cmp    $0x2,%rcx
jb     1490 <ddct+0x320>
mov    %rbp,%r8
shr    %rcx
add    $0x1,%rcx
movabs $0x7ffffffffffffffe,%rdx
ff ff 7f
and    %rcx,%rdx
lea    -0x2(%rdx),%rsi
mov    %rsi,%rbp
shr    %rbp
add    $0x1,%rbp
test   %rsi,%rsi
je     153a <ddct+0x3ca>
mov    %rbp,%rdi
and    $0xfffffffffffffffe,%rdi
mov    $0x6,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movupd -0x20(%rbx,%rsi,8),%xmm1
movupd -0x10(%rbx,%rsi,8),%xmm2
movupd (%rbx,%rsi,8),%xmm3
movupd 0x10(%rbx,%rsi,8),%xmm4
movapd %xmm1,%xmm5
unpcklpd %xmm2,%xmm5
unpckhpd %xmm2,%xmm1
movapd %xmm5,%xmm2
subpd  %xmm1,%xmm2
addpd  %xmm5,%xmm1
movapd %xmm2,%xmm5
unpckhpd %xmm1,%xmm5
unpcklpd %xmm1,%xmm2
movupd %xmm2,-0x28(%rbx,%rsi,8)
movupd %xmm5,-0x18(%rbx,%rsi,8)
movapd %xmm3,%xmm1
unpcklpd %xmm4,%xmm1
unpckhpd %xmm4,%xmm3
movapd %xmm1,%xmm2
subpd  %xmm3,%xmm2
addpd  %xmm1,%xmm3
movapd %xmm2,%xmm1
unpckhpd %xmm3,%xmm1
unpcklpd %xmm3,%xmm2
movupd %xmm2,-0x8(%rbx,%rsi,8)
movupd %xmm1,0x8(%rbx,%rsi,8)
add    $0x8,%rsi
add    $0xfffffffffffffffe,%rdi
jne    13b0 <ddct+0x240>
add    $0xfffffffffffffffc,%rsi
test   $0x1,%bpl
je     147a <ddct+0x30a>
movupd (%rbx,%rsi,8),%xmm1
movupd 0x10(%rbx,%rsi,8),%xmm2
movapd %xmm1,%xmm3
unpcklpd %xmm2,%xmm3
unpckhpd %xmm2,%xmm1
movapd %xmm3,%xmm2
subpd  %xmm1,%xmm2
addpd  %xmm3,%xmm1
movapd %xmm2,%xmm3
unpckhpd %xmm1,%xmm3
unpcklpd %xmm1,%xmm2
movupd %xmm2,-0x8(%rbx,%rsi,8)
movupd %xmm3,0x8(%rbx,%rsi,8)
cmp    %rdx,%rcx
mov    %r8,%rbp
je     14c6 <ddct+0x356>
add    %rcx,%rcx
or     $0x2,%rcx
mov    %rcx,%rdx
nopl   0x0(%rax)
lea    0x0(,%rdx,8),%rcx
movsd  (%rbx,%rdx,8),%xmm1
or     $0x8,%rcx
movsd  (%rbx,%rcx,1),%xmm2
movapd %xmm1,%xmm3
subsd  %xmm2,%xmm3
movsd  %xmm3,-0x8(%rbx,%rdx,8)
addsd  %xmm1,%xmm2
movsd  %xmm2,(%rbx,%rdx,8)
add    $0x2,%rdx
cmp    %rax,%rdx
jb     1490 <ddct+0x320>
movsd  %xmm0,-0x8(%rbx,%rbp,8)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movsd  (%rbx),%xmm1
movapd %xmm1,%xmm2
subsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rbx)
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx)
mov    (%rsp),%rax
lea    (%rax,%r15,8),%rcx
mov    %r14d,%edi
mov    %rbx,%rsi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <dctsub@plt>
movsd  (%rbx),%xmm1
movsd  0x8(%rbx),%xmm2
movapd %xmm1,%xmm0
subsd  %xmm2,%xmm0
addsd  %xmm2,%xmm1
movsd  %xmm1,(%rbx)
cmp    $0x3,%r14d
jge    1344 <ddct+0x1d4>
jmp    14c6 <ddct+0x356>
mov    $0x2,%esi
test   $0x1,%bpl
jne    143f <ddct+0x2cf>
jmp    147a <ddct+0x30a>
mov    $0x4,%edi
cmp    $0x4,%r14d
jne    156c <ddct+0x3fc>
lea    0x8(%r12),%rdx
mov    %rbx,%rsi
mov    %r13d,%ecx
mov    %rbp,%r8
call   1060 <cftbsub@plt>
lea    0x0(,%r15,8),%r15
add    %rbp,%r15
mov    %r14d,%edi
mov    %rbx,%rsi
mov    0x8(%rsp),%edx
mov    %r15,%rcx
call   1030 <dctsub@plt>
cmpl   $0x0,0xc(%rsp)
mov    0x10(%rsp),%rbp
jns    1213 <ddct+0xa3>
jmp    14cc <ddct+0x35c>

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

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