#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ bitrv2(int, int *, double *);
int /*<<< orphan*/ cftbsub(int, double *, double *);
int /*<<< orphan*/ cftfsub(int, double *, double *);
int /*<<< orphan*/ dctsub(int, double *, int, double *);
int /*<<< orphan*/ makect(int, int *, double *);
int /*<<< orphan*/ makewt(int, int *, double *);
int /*<<< orphan*/ rftbsub(int, double *, int, double *);
int /*<<< orphan*/ rftfsub(int, double *, int, double *);
void lsx_ddct(int n, int isgn, double *a, int *ip, double *w) {
  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);
      bitrv2(n, ip + 2, a);
      cftbsub(n, a, w);
    } else if (n == 4) {
      cftfsub(n, a, w);
    }
  }
  dctsub(n, a, nc, w + nw);
  if (isgn >= 0) {
    if (n > 4) {
      bitrv2(n, ip + 2, a);
      cftfsub(n, a, w);
      rftfsub(n, a, nc, w + nw);
    } else if (n == 4) {
      cftfsub(n, a, 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):
<lsx_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    11cd <lsx_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    1204 <lsx_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   1090 <makect@plt>
cmpl   $0x0,-0x8(%rbp)
jge    1337 <lsx_ddct+0x1b7>
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     129b <lsx_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    122e <lsx_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    1313 <lsx_ddct+0x193>
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   1080 <rftbsub@plt>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
add    $0x8,%rsi
mov    -0x10(%rbp),%rdx
call   1060 <bitrv2@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1070 <cftbsub@plt>
jmp    1332 <lsx_ddct+0x1b2>
cmpl   $0x4,-0x4(%rbp)
jne    132d <lsx_ddct+0x1ad>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   10a0 <cftfsub@plt>
jmp    1332 <lsx_ddct+0x1b2>
jmp    1337 <lsx_ddct+0x1b7>
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     1487 <lsx_ddct+0x307>
cmpl   $0x4,-0x4(%rbp)
jle    13b0 <lsx_ddct+0x230>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
add    $0x8,%rsi
mov    -0x10(%rbp),%rdx
call   1060 <bitrv2@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   10a0 <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    13cf <lsx_ddct+0x24f>
cmpl   $0x4,-0x4(%rbp)
jne    13ca <lsx_ddct+0x24a>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   10a0 <cftfsub@plt>
jmp    13cf <lsx_ddct+0x24f>
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    1470 <lsx_ddct+0x2f0>
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    1401 <lsx_ddct+0x281>
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):
<lsx_ddct>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r12
mov    %rdx,%rbx
mov    %esi,%r9d
mov    %edi,%r14d
mov    (%rcx),%ebp
lea    0x0(,%rbp,4),%eax
cmp    %edi,%eax
mov    %r8,(%rsp)
jge    11c8 <lsx_ddct+0x48>
mov    %r14d,%ebp
sar    $0x2,%ebp
mov    %ebp,%edi
mov    %r12,%rsi
mov    %r8,%rdx
mov    %r9d,%r15d
call   1040 <makewt@plt>
mov    %r15d,%r9d
mov    (%rsp),%r8
mov    0x4(%r12),%r15d
movslq %ebp,%r13
cmp    %r14d,%r15d
jge    11f1 <lsx_ddct+0x71>
lea    (%r8,%r13,8),%rdx
mov    %r14d,%edi
mov    %r12,%rsi
mov    %r9d,%ebp
call   1090 <makect@plt>
mov    %ebp,%r9d
mov    (%rsp),%r8
mov    %r14d,%r15d
movslq %r14d,%rbp
test   %r9d,%r9d
js     124f <lsx_ddct+0xcf>
lea    (%r8,%r13,8),%r13
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %r15d,%edx
mov    %r13,%rcx
call   1030 <dctsub@plt>
cmp    $0x5,%r14d
jl     1323 <lsx_ddct+0x1a3>
add    $0x8,%r12
mov    %r14d,%edi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1060 <bitrv2@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    (%rsp),%rdx
call   10a0 <cftfsub@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %r15d,%edx
mov    %r13,%rcx
call   1050 <rftfsub@plt>
jmp    133e <lsx_ddct+0x1be>
movsd  -0x8(%rbx,%rbp,8),%xmm0
cmp    $0x4,%r14d
jl     14eb <lsx_ddct+0x36b>
mov    %rbp,0x10(%rsp)
lea    0x2(%r14),%eax
lea    -0x2(%r14),%ecx
lea    (%rbx,%rcx,8),%rcx
lea    -0x3(%r14),%edx
lea    (%rbx,%rdx,8),%rdx
lea    -0x1(%r14),%esi
lea    (%rbx,%rsi,8),%rsi
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%rcx,%rdi,8),%xmm1
movsd  (%rdx,%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    (%rax,%rdi,1),%ebp
cmp    $0x5,%ebp
ja     1290 <lsx_ddct+0x110>
movsd  (%rbx),%xmm1
movapd %xmm1,%xmm2
subsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rbx)
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx)
cmp    $0x5,%r14d
mov    %r9d,0xc(%rsp)
jl     155d <lsx_ddct+0x3dd>
lea    (%r8,%r13,8),%rcx
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %r15d,%edx
call   1080 <rftbsub@plt>
lea    0x8(%r12),%rsi
mov    %r14d,%edi
mov    %rbx,%rdx
call   1060 <bitrv2@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    (%rsp),%rdx
call   1070 <cftbsub@plt>
mov    (%rsp),%r8
mov    0x10(%rsp),%rbp
jmp    157c <lsx_ddct+0x3fc>
cmp    $0x4,%r14d
jne    1524 <lsx_ddct+0x3a4>
mov    $0x4,%edi
mov    %rbx,%rsi
mov    (%rsp),%rdx
call   10a0 <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     14a0 <lsx_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     1549 <lsx_ddct+0x3c9>
mov    %rbp,%rdi
and    $0xfffffffffffffffe,%rdi
mov    $0x6,%esi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
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    13c0 <lsx_ddct+0x240>
add    $0xfffffffffffffffc,%rsi
test   $0x1,%bpl
je     148a <lsx_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     14d6 <lsx_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     14a0 <lsx_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)
lea    (%r8,%r13,8),%rcx
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %r15d,%edx
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    1357 <lsx_ddct+0x1d7>
jmp    14d6 <lsx_ddct+0x356>
mov    $0x2,%esi
test   $0x1,%bpl
jne    144f <lsx_ddct+0x2cf>
jmp    148a <lsx_ddct+0x30a>
cmp    $0x4,%r14d
mov    0x10(%rsp),%rbp
jne    157c <lsx_ddct+0x3fc>
mov    $0x4,%edi
mov    %rbx,%rsi
mov    %r8,%rdx
call   10a0 <cftfsub@plt>
mov    (%rsp),%r8
lea    (%r8,%r13,8),%r13
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %r15d,%edx
mov    %r13,%rcx
call   1030 <dctsub@plt>
cmpl   $0x0,0xc(%rsp)
jns    120e <lsx_ddct+0x8e>
jmp    14dc <lsx_ddct+0x35c>

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

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