#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*/ dstsub(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_ddst(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);
    }
  }
  dstsub(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_ddst>:
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_ddst+0x2c>
jmp    14ea <lsx_ddst+0x36a>
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_ddst+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   1030 <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_ddst+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    1368 <lsx_ddst+0x1e8>
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     12c8 <lsx_ddst+0x148>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%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),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x24(%rbp)
jmp    1240 <lsx_ddst+0xc0>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
addsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x38(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
cmpl   $0x4,-0x4(%rbp)
jle    1344 <lsx_ddst+0x1c4>
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    -0x18(%rbp),%rsi
add    $0x8,%rsi
mov    -0x10(%rbp),%rdx
call   1050 <bitrv2@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1060 <cftbsub@plt>
jmp    1363 <lsx_ddst+0x1e3>
cmpl   $0x4,-0x4(%rbp)
jne    135e <lsx_ddst+0x1de>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   10a0 <cftfsub@plt>
jmp    1363 <lsx_ddst+0x1e3>
jmp    1368 <lsx_ddst+0x1e8>
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 <dstsub@plt>
cmpl   $0x0,-0x8(%rbp)
jl     14ea <lsx_ddst+0x36a>
cmpl   $0x4,-0x4(%rbp)
jle    13e1 <lsx_ddst+0x261>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
add    $0x8,%rsi
mov    -0x10(%rbp),%rdx
call   1050 <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   1040 <rftfsub@plt>
jmp    1400 <lsx_ddst+0x280>
cmpl   $0x4,-0x4(%rbp)
jne    13fb <lsx_ddst+0x27b>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   10a0 <cftfsub@plt>
jmp    1400 <lsx_ddst+0x280>
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    14bc <lsx_ddst+0x33c>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%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),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x24(%rbp)
jmp    1432 <lsx_ddst+0x2b2>
movsd  -0x38(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%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_ddst>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x40000,%edi
jg     1518 <lsx_ddst+0x398>
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_ddst+0x4f>
mov    %r14d,%ebp
sar    $0x2,%ebp
mov    %ebp,%edi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r9d,%r13d
call   1030 <makewt@plt>
mov    %r13d,%r9d
mov    0x4(%r12),%r8d
movslq %ebp,%r13
cmp    %r14d,%r8d
jge    11f4 <lsx_ddst+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_ddst+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   1080 <dstsub@plt>
cmp    $0x5,%r14d
jl     1330 <lsx_ddst+0x1b0>
add    $0x8,%r12
mov    %r14d,%edi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1050 <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   1040 <rftfsub@plt>
jmp    134a <lsx_ddst+0x1ca>
movsd  -0x8(%rbx,%rax,8),%xmm0
cmp    $0x4,%r14d
jl     1527 <lsx_ddst+0x3a7>
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
movapd 0xd6d(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%rcx,%rdi,8),%xmm2
movapd %xmm2,%xmm3
xorpd  %xmm1,%xmm3
movsd  (%rdx,%rdi,8),%xmm4
subsd  %xmm4,%xmm3
movsd  %xmm3,(%rsi,%rdi,8)
subsd  %xmm4,%xmm2
movsd  %xmm2,(%rcx,%rdi,8)
add    $0xfffffffffffffffe,%rdi
lea    (%rax,%rdi,1),%ebp
cmp    $0x5,%ebp
ja     12a0 <lsx_ddst+0x120>
movsd  (%rbx),%xmm1
movapd %xmm0,%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rbx)
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx)
cmp    $0x5,%r14d
mov    %r9d,0x14(%rsp)
jl     15a1 <lsx_ddst+0x421>
lea    (%r15,%r13,8),%rcx
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %r8d,%edx
mov    %r8d,%ebp
call   1070 <rftbsub@plt>
lea    0x8(%r12),%rsi
mov    %r14d,%edi
mov    %rbx,%rdx
call   1050 <bitrv2@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1060 <cftbsub@plt>
jmp    15ba <lsx_ddst+0x43a>
cmp    $0x4,%r14d
jne    1560 <lsx_ddst+0x3e0>
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     14b9 <lsx_ddst+0x339>
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     158d <lsx_ddst+0x40d>
mov    %rbp,%rdi
and    $0xfffffffffffffffe,%rdi
mov    $0x6,%esi
movapd 0xc36(%rip),%xmm1
nopw   0x0(%rax,%rax,1)
movupd -0x20(%rbx,%rsi,8),%xmm2
movupd -0x10(%rbx,%rsi,8),%xmm3
movupd (%rbx,%rsi,8),%xmm4
movupd 0x10(%rbx,%rsi,8),%xmm5
movapd %xmm2,%xmm6
unpcklpd %xmm3,%xmm6
unpckhpd %xmm3,%xmm2
movapd %xmm6,%xmm3
xorpd  %xmm1,%xmm3
subpd  %xmm2,%xmm3
subpd  %xmm2,%xmm6
movapd %xmm3,%xmm2
unpckhpd %xmm6,%xmm2
unpcklpd %xmm6,%xmm3
movupd %xmm3,-0x28(%rbx,%rsi,8)
movupd %xmm2,-0x18(%rbx,%rsi,8)
movapd %xmm4,%xmm2
unpcklpd %xmm5,%xmm2
unpckhpd %xmm5,%xmm4
movapd %xmm2,%xmm3
xorpd  %xmm1,%xmm3
subpd  %xmm4,%xmm3
subpd  %xmm4,%xmm2
movapd %xmm3,%xmm4
unpckhpd %xmm2,%xmm4
unpcklpd %xmm2,%xmm3
movupd %xmm3,-0x8(%rbx,%rsi,8)
movupd %xmm4,0x8(%rbx,%rsi,8)
add    $0x8,%rsi
add    $0xfffffffffffffffe,%rdi
jne    13d0 <lsx_ddst+0x250>
add    $0xfffffffffffffffc,%rsi
test   $0x1,%bpl
je     14aa <lsx_ddst+0x32a>
movupd (%rbx,%rsi,8),%xmm1
movupd 0x10(%rbx,%rsi,8),%xmm2
movapd %xmm1,%xmm3
unpcklpd %xmm2,%xmm3
unpckhpd %xmm2,%xmm1
movapd 0xb7a(%rip),%xmm2
xorpd  %xmm3,%xmm2
subpd  %xmm1,%xmm2
subpd  %xmm1,%xmm3
movapd %xmm2,%xmm1
unpckhpd %xmm3,%xmm1
unpcklpd %xmm3,%xmm2
movupd %xmm2,-0x8(%rbx,%rsi,8)
movupd %xmm1,0x8(%rbx,%rsi,8)
cmp    %rdx,%rcx
je     1509 <lsx_ddst+0x389>
add    %rcx,%rcx
or     $0x2,%rcx
mov    %rcx,%rdx
movapd 0xb3f(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0x0(,%rdx,8),%rcx
movsd  (%rbx,%rdx,8),%xmm2
movapd %xmm2,%xmm3
xorpd  %xmm1,%xmm3
or     $0x8,%rcx
unpcklpd %xmm2,%xmm3
movsd  (%rbx,%rcx,1),%xmm2
unpcklpd %xmm2,%xmm2
subpd  %xmm2,%xmm3
movupd %xmm3,-0x8(%rbx,%rdx,8)
add    $0x2,%rdx
cmp    %rax,%rdx
jb     14d0 <lsx_ddst+0x350>
xorpd  0xaef(%rip),%xmm0
movlpd %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 %xmm0,%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rbx)
subsd  %xmm0,%xmm1
movsd  %xmm1,(%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    1080 <dstsub@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    1368 <lsx_ddst+0x1e8>
jmp    1509 <lsx_ddst+0x389>
mov    $0x2,%esi
test   $0x1,%bpl
jne    1467 <lsx_ddst+0x2e7>
jmp    14aa <lsx_ddst+0x32a>
cmp    $0x4,%r14d
jne    15bd <lsx_ddst+0x43d>
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   1080 <dstsub@plt>
cmpl   $0x0,0x14(%rsp)
jns    1219 <lsx_ddst+0x99>
jmp    1518 <lsx_ddst+0x398>

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

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