void dct(x, y, m, tab) double *x, *y, *tab;
int m;
{
  int n, n2, i;
  double *cp1, *cp2, *xp1, *xp2, *yp1, *yp2;
  double arg, delta_w;
  n = 1 << m;
  n2 = n >> 1;
  if ((int)(*tab) != n) {
    delta_w = 3.141592652598793 / (2 * n);
    cp1 = tab + n2;
    cp2 = cp1 + n2;
    arg = 0;
    for (i = 0; i < n2; i++) {
      *(cp1++) = (double)(cos(arg) - sin(arg)) * 0.707106781186547;
      *(cp2++) = (double)(cos(arg) + sin(arg)) * 0.707106781186547;
      arg += delta_w;
    }
  }
  xp1 = x;
  xp2 = x + (n - 1);
  yp1 = y;
  yp2 = y + n2;
  for (i = 0; i < n2; i++) {
    *(yp1++) = *xp1;
    *(yp2++) = *xp2;
    xp1 += 2;
    xp2 -= 2;
  }
  hartley(y, m, tab);
  *x = *y;
  *(x + n2) = *(y + n2);
  cp1 = tab + n2 + 1;
  cp2 = cp1 + n2;
  xp1 = x + 1;
  xp2 = x + (n - 1);
  yp1 = y + 1;
  yp2 = y + (n - 1);
  for (i = 1; i < n2; i++) {
    *(xp1++) = (*cp1) * (*yp1) + (*cp2) * (*yp2);
    *(xp2--) = (*cp2++) * (*yp1++) - (*cp1++) * (*yp2--);
  }
}


x86 assembly (clang, -O0):
<dct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x14(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cvttsd2si (%rax),%eax
cmp    -0x24(%rbp),%eax
je     1277 <dct+0x147>
mov    -0x24(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe7d(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x28(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1272 <dct+0x142>
movsd  -0x68(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x68(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  0xe0e(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x38(%rbp)
movsd  %xmm0,(%rax)
movsd  -0x68(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x68(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xdca(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x40(%rbp)
movsd  %xmm0,(%rax)
movsd  -0x70(%rbp),%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11c1 <dct+0x91>
jmp    1277 <dct+0x147>
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1321 <dct+0x1f1>
mov    -0x48(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x58(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x58(%rbp)
movsd  %xmm0,(%rax)
mov    -0x50(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x60(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x60(%rbp)
movsd  %xmm0,(%rax)
mov    -0x48(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x48(%rbp)
mov    -0x50(%rbp),%rax
add    $0xfffffffffffffff0,%rax
mov    %rax,-0x50(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12b9 <dct+0x189>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1050 <hartley@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
add    $0x8,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x28(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    14a9 <dct+0x379>
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x58(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x60(%rbp),%rax
mulsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x48(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x48(%rbp)
movsd  %xmm0,(%rax)
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x40(%rbp)
movsd  (%rax),%xmm0
mov    -0x58(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x58(%rbp)
movsd  (%rax),%xmm2
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x38(%rbp)
movsd  (%rax),%xmm1
mov    -0x60(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffff8,%rcx
mov    %rcx,-0x60(%rbp)
mulsd  (%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x50(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffff8,%rcx
mov    %rcx,-0x50(%rbp)
movsd  %xmm0,(%rax)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    13d6 <dct+0x2a6>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dct>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rcx,%rbp
mov    %edx,%ecx
mov    %rsi,%r14
mov    $0x1,%r9d
shl    %cl,%r9d
mov    %r9d,%edx
sar    %edx
cvttsd2si 0x0(%rbp),%eax
cmp    %eax,%r9d
mov    %edx,0x1c(%rsp)
mov    %r9,0x30(%rsp)
mov    %rdi,0x48(%rsp)
movslq %edx,%r13
je     1393 <dct+0x263>
cmp    $0x1,%r9d
jle    14b5 <dct+0x385>
mov    %rbp,0x40(%rsp)
lea    0x0(%rbp,%r13,8),%rbp
lea    0x0(,%r13,8),%r15
add    %rbp,%r15
cmp    $0x2,%r13d
mov    $0x1,%esi
cmovge %edx,%esi
xorpd  %xmm0,%xmm0
cmp    $0x4,%r9d
jl     1311 <dct+0x1e1>
mov    %ecx,0x3c(%rsp)
mov    %r13,0x28(%rsp)
lea    (%r9,%r9,1),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0xe38(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
mov    %rsi,0x50(%rsp)
mov    %esi,%ebx
and    $0xfffffffe,%ebx
xorpd  %xmm0,%xmm0
xor    %r12d,%r12d
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0xde4(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x0(%rbp,%r12,8)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
addsd  0x10(%rsp),%xmm0
mulsd  0xdaf(%rip),%xmm0
movsd  %xmm0,(%r15,%r12,8)
movsd  0x8(%rsp),%xmm0
addsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xd69(%rip),%xmm1
movsd  %xmm1,0x8(%rbp,%r12,8)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
addsd  0x10(%rsp),%xmm0
mulsd  0xd38(%rip),%xmm0
movsd  %xmm0,0x8(%r15,%r12,8)
movsd  0x8(%rsp),%xmm0
addsd  0x20(%rsp),%xmm0
add    $0xfffffffffffffff0,%r13
add    $0x2,%r12
cmp    %r12d,%ebx
jne    11f0 <dct+0xc0>
sub    %r13,%r15
sub    %r13,%rbp
mov    0x1c(%rsp),%edx
mov    0x28(%rsp),%r13
mov    0x3c(%rsp),%ecx
mov    0x48(%rsp),%rdi
mov    0x50(%rsp),%rsi
test   $0x1,%sil
je     1389 <dct+0x259>
movsd  %xmm0,0x8(%rsp)
mov    %ecx,%r12d
mov    %rdi,%rbx
call   1040 <cos@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  0x20(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xcbd(%rip),%xmm1
movsd  %xmm1,0x0(%rbp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
mov    %rbx,%rdi
mov    %r12d,%ecx
mov    0x1c(%rsp),%edx
addsd  0x20(%rsp),%xmm0
mulsd  0xc84(%rip),%xmm0
movsd  %xmm0,(%r15)
mov    0x40(%rsp),%rbp
mov    0x30(%rsp),%r9
movslq %r9d,%r12
lea    (%rdi,%r12,8),%r15
add    $0xfffffffffffffff8,%r15
add    $0xffffffffffffffff,%r12
mov    %r13,0x28(%rsp)
lea    (%r14,%r13,8),%r13
cmp    $0x2,%r9d
jl     14cd <dct+0x39d>
mov    %rbp,%r8
cmp    $0x2,%edx
mov    $0x1,%r10d
cmovge %edx,%r10d
lea    -0x1(%r10),%ebp
mov    %r13,%rdx
mov    %r14,%rbx
mov    %r15,%rsi
mov    %rdi,%rax
cmp    $0x3,%ebp
jb     1477 <dct+0x347>
mov    %r10d,%edx
and    $0x7ffffffc,%edx
xor    %ebp,%ebp
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movsd  (%rdi,%rbx,2),%xmm0
movsd  %xmm0,(%r14,%rbx,1)
movsd  (%r15,%rbp,1),%xmm0
movsd  %xmm0,0x0(%r13,%rbx,1)
movsd  0x10(%rdi,%rbx,2),%xmm0
movsd  %xmm0,0x8(%r14,%rbx,1)
movsd  -0x10(%r15,%rbp,1),%xmm0
movsd  %xmm0,0x8(%r13,%rbx,1)
movsd  0x20(%rdi,%rbx,2),%xmm0
movsd  %xmm0,0x10(%r14,%rbx,1)
movsd  -0x20(%r15,%rbp,1),%xmm0
movsd  %xmm0,0x10(%r13,%rbx,1)
movsd  0x30(%rdi,%rbx,2),%xmm0
movsd  %xmm0,0x18(%r14,%rbx,1)
movsd  -0x30(%r15,%rbp,1),%xmm0
movsd  %xmm0,0x18(%r13,%rbx,1)
add    $0x20,%rbx
add    $0xffffffffffffffc0,%rbp
add    $0xfffffffc,%edx
jne    13f0 <dct+0x2c0>
lea    (%rbx,%r13,1),%rdx
add    %r14,%rbx
lea    (%r15,%rbp,1),%rsi
mov    %rdi,%rax
sub    %rbp,%rax
test   $0x3,%r10b
je     14b0 <dct+0x380>
and    $0x3,%r10d
shl    $0x3,%r10
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
movsd  (%rax,%rbp,2),%xmm0
movsd  %xmm0,(%rbx,%rbp,1)
movsd  (%rsi),%xmm0
movsd  %xmm0,(%rdx,%rbp,1)
add    $0xfffffffffffffff0,%rsi
add    $0x8,%rbp
cmp    %ebp,%r10d
jne    1490 <dct+0x360>
mov    %r8,%rbp
jmp    14cd <dct+0x39d>
movslq %r9d,%r12
lea    (%rdi,%r12,8),%r15
add    $0xfffffffffffffff8,%r15
add    $0xffffffffffffffff,%r12
mov    %r13,0x28(%rsp)
lea    (%r14,%r13,8),%r13
mov    %r14,%rdi
mov    %ecx,%esi
mov    %rbp,%rdx
xor    %eax,%eax
call   1050 <hartley@plt>
movsd  (%r14),%xmm0
mov    0x48(%rsp),%rbx
movsd  %xmm0,(%rbx)
movsd  0x0(%r13),%xmm0
mov    0x28(%rsp),%rdi
movsd  %xmm0,(%rbx,%rdi,8)
cmpl   $0x4,0x30(%rsp)
jl     157c <dct+0x44c>
lea    0x8(,%rdi,8),%rax
add    %rbp,%rax
lea    (%r14,%r12,8),%rcx
mov    0x1c(%rsp),%esi
cmp    $0x3,%esi
mov    $0x2,%edx
cmovge %esi,%edx
lea    (%rax,%rdi,8),%rsi
add    $0xffffffffffffffff,%rdx
xor    %edi,%edi
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movsd  (%rsi,%rbp,8),%xmm0
mulsd  (%rcx,%rdi,1),%xmm0
movsd  (%rax,%rbp,8),%xmm1
mulsd  0x8(%r14,%rbp,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rbx,%rbp,8)
movsd  (%rcx,%rdi,1),%xmm0
mulsd  (%rax,%rbp,8),%xmm0
movsd  (%rsi,%rbp,8),%xmm1
mulsd  0x8(%r14,%rbp,8),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%r15,%rdi,1)
add    $0x1,%rbp
add    $0xfffffffffffffff8,%rdi
cmp    %ebp,%edx
jne    1530 <dct+0x400>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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