#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;
  if (n > 262144)
    return;
  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)
cmpl   $0x40000,-0x4(%rbp)
jle    11ac <lsx_ddct+0x2c>
jmp    1499 <lsx_ddct+0x319>
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    11df <lsx_ddct+0x5f>
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    1216 <lsx_ddct+0x96>
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    1349 <lsx_ddct+0x1c9>
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     12ad <lsx_ddct+0x12d>
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    1240 <lsx_ddct+0xc0>
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    1325 <lsx_ddct+0x1a5>
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    1344 <lsx_ddct+0x1c4>
cmpl   $0x4,-0x4(%rbp)
jne    133f <lsx_ddct+0x1bf>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   10a0 <cftfsub@plt>
jmp    1344 <lsx_ddct+0x1c4>
jmp    1349 <lsx_ddct+0x1c9>
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     1499 <lsx_ddct+0x319>
cmpl   $0x4,-0x4(%rbp)
jle    13c2 <lsx_ddct+0x242>
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    13e1 <lsx_ddct+0x261>
cmpl   $0x4,-0x4(%rbp)
jne    13dc <lsx_ddct+0x25c>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   10a0 <cftfsub@plt>
jmp    13e1 <lsx_ddct+0x261>
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    1482 <lsx_ddct+0x302>
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    1413 <lsx_ddct+0x293>
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
cmp    $0x40000,%edi
jg     14cd <lsx_ddct+0x34d>
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%rbx
mov    %esi,%r9d
mov    %edi,%r14d
mov    (%rcx),%ebp
lea    0x0(,%rbp,4),%eax
cmp    %edi,%eax
jge    11cf <lsx_ddct+0x4f>
mov    %r14d,%ebp
sar    $0x2,%ebp
mov    %ebp,%edi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r9d,%r13d
call   1040 <makewt@plt>
mov    %r13d,%r9d
mov    0x4(%r12),%r8d
movslq %ebp,%r13
cmp    %r14d,%r8d
jge    11f4 <lsx_ddct+0x74>
lea    (%r15,%r13,8),%rdx
mov    %r14d,%edi
mov    %r12,%rsi
mov    %r9d,%ebp
call   1090 <makect@plt>
mov    %ebp,%r9d
mov    %r14d,%r8d
movslq %r14d,%rax
test   %r9d,%r9d
js     1258 <lsx_ddct+0xd8>
mov    %rax,0x8(%rsp)
lea    (%r15,%r13,8),%r13
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %r8d,%ebp
mov    %r8d,%edx
mov    %r13,%rcx
call   1030 <dctsub@plt>
cmp    $0x5,%r14d
jl     131c <lsx_ddct+0x19c>
add    $0x8,%r12
mov    %r14d,%edi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1060 <bitrv2@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   10a0 <cftfsub@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %r13,%rcx
call   1050 <rftfsub@plt>
jmp    1336 <lsx_ddct+0x1b6>
movsd  -0x8(%rbx,%rax,8),%xmm0
cmp    $0x4,%r14d
jl     14dc <lsx_ddct+0x35c>
mov    %rax,0x8(%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
nopl   0x0(%rax,%rax,1)
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,0x14(%rsp)
jl     1553 <lsx_ddct+0x3d3>
lea    (%r15,%r13,8),%rcx
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %r8d,%edx
mov    %r8d,%ebp
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    %r15,%rdx
call   1070 <cftbsub@plt>
jmp    156c <lsx_ddct+0x3ec>
cmp    $0x4,%r14d
jne    1515 <lsx_ddct+0x395>
mov    $0x4,%edi
mov    %rbx,%rsi
mov    %r15,%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    0x8(%rsp),%r8
mov    %r14d,%eax
cmp    $0x5,%rax
mov    $0x4,%ecx
cmovae %rax,%rcx
add    $0xfffffffffffffffd,%rcx
mov    $0x2,%edx
cmp    $0x2,%rcx
jb     1490 <lsx_ddct+0x310>
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     153f <lsx_ddct+0x3bf>
mov    %rbp,%rdi
and    $0xfffffffffffffffe,%rdi
mov    $0x6,%esi
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    13b0 <lsx_ddct+0x230>
add    $0xfffffffffffffffc,%rsi
test   $0x1,%bpl
je     147a <lsx_ddct+0x2fa>
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
je     14c6 <lsx_ddct+0x346>
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 <lsx_ddct+0x310>
movsd  %xmm0,-0x8(%rbx,%r8,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    (%r15,%r13,8),%rcx
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %r8d,%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
mov    0x8(%rsp),%r8
jge    1354 <lsx_ddct+0x1d4>
jmp    14c6 <lsx_ddct+0x346>
mov    $0x2,%esi
test   $0x1,%bpl
jne    143f <lsx_ddct+0x2bf>
jmp    147a <lsx_ddct+0x2fa>
cmp    $0x4,%r14d
jne    156f <lsx_ddct+0x3ef>
mov    $0x4,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r8d,%ebp
call   10a0 <cftfsub@plt>
mov    %ebp,%r8d
lea    (%r15,%r13,8),%r13
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %r8d,%ebp
mov    %r8d,%edx
mov    %r13,%rcx
call   1030 <dctsub@plt>
cmpl   $0x0,0x14(%rsp)
jns    1219 <lsx_ddct+0x99>
jmp    14cd <lsx_ddct+0x34d>

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

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