#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*/ FST_semi_memo(double *, double *, double *, double *, int,
                                 double **, double *, int /*<<< orphan*/, int);
int /*<<< orphan*/ InvFST_semi_memo(double *, double *, double *, double *, int,
                                    double **, double *, int /*<<< orphan*/,
                                    int);
int /*<<< orphan*/ rotateCoefAll_mem(int, int, double, double, double, double *,
                                     double *, double *);
void rotateFct_mem(int bw, int degOut, double *sigR, double *sigI, double alpha,
                   double beta, double gamma, double *scratch,
                   double **spharmonic_pml_table,
                   double **transpose_spharmonic_pml_table) {
  double *rcoeffs, *icoeffs, *workspace;
  rcoeffs = scratch;
  icoeffs = rcoeffs + (bw * bw);
  workspace = icoeffs + (bw * bw);
  FST_semi_memo(sigR, sigI, rcoeffs, icoeffs, 2 * bw, spharmonic_pml_table,
                workspace, 0, bw);
  rotateCoefAll_mem(bw, degOut, alpha, beta, gamma, rcoeffs, icoeffs,
                    workspace);
  InvFST_semi_memo(rcoeffs, icoeffs, sigR, sigI, 2 * bw,
                   transpose_spharmonic_pml_table, workspace, 0, bw);
}


x86 assembly (clang, -O0):
<rotateFct_mem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
movsd  %xmm2,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x4(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x4(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x48(%rbp),%rdx
mov    -0x50(%rbp),%rcx
mov    -0x4(%rbp),%r8d
shl    $0x1,%r8d
mov    -0x40(%rbp),%r9
mov    -0x58(%rbp),%r10
mov    -0x4(%rbp),%eax
xor    %r11d,%r11d
mov    %r10,(%rsp)
movl   $0x0,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1050 <FST_semi_memo@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
mov    -0x48(%rbp),%rdx
mov    -0x50(%rbp),%rcx
mov    -0x58(%rbp),%r8
call   1040 <rotateCoefAll_mem@plt>
mov    -0x48(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x4(%rbp),%r8d
shl    $0x1,%r8d
mov    0x10(%rbp),%r9
mov    -0x58(%rbp),%r10
mov    -0x4(%rbp),%eax
xor    %r11d,%r11d
mov    %r10,(%rsp)
movl   $0x0,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1030 <InvFST_semi_memo@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotateFct_mem>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,%r14
movsd  %xmm2,0x20(%rsp)
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,0x10(%rsp)
mov    %rcx,0x8(%rsp)
mov    %rdx,%r13
mov    %esi,0x4(%rsp)
mov    %edi,%ebx
mov    %edi,%eax
imul   %eax,%eax
lea    (%r8,%rax,8),%rbp
lea    0x0(,%rax,8),%r12
add    %rbp,%r12
lea    (%rbx,%rbx,1),%r15d
sub    $0x8,%rsp
mov    %rdx,%rdi
mov    %rcx,%rsi
mov    %r8,%rdx
mov    %rbp,%rcx
mov    %r15d,%r8d
push   %rbx
push   $0x0
push   %r12
call   1050 <FST_semi_memo@plt>
add    $0x20,%rsp
mov    %ebx,%edi
mov    0x4(%rsp),%esi
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
mov    %r14,%rdx
mov    %rbp,%rcx
mov    %r12,%r8
call   1040 <rotateCoefAll_mem@plt>
sub    $0x8,%rsp
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %r13,%rdx
mov    0x10(%rsp),%rcx
mov    %r15d,%r8d
mov    0x68(%rsp),%r9
push   %rbx
push   $0x0
push   %r12
call   1030 <InvFST_semi_memo@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @rotateFct_mem(i32 %0, i32 %1, double* %2, double* %3, double %4, double %5, double %6, double* %7, double** %8, double** %9) {
%11 = alloca i32
%12 = alloca i32
%13 = alloca double*
%14 = alloca double*
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double*
%19 = alloca double**
%20 = alloca double**
%21 = alloca double*
%22 = alloca double*
%23 = alloca double*
store i32 %0, i32* %11
store i32 %1, i32* %12
store double* %2, double** %13
store double* %3, double** %14
store double %4, double* %15
store double %5, double* %16
store double %6, double* %17
store double* %7, double** %18
store double** %8, double*** %19
store double** %9, double*** %20
%24 = load double*, double** %18
store double* %24, double** %21
%25 = load double*, double** %21
%26 = load i32, i32* %11
%27 = load i32, i32* %11
%28 = mul nsw i32 %26, %27
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %25, i64 %29
store double* %30, double** %22
%31 = load double*, double** %22
%32 = load i32, i32* %11
%33 = load i32, i32* %11
%34 = mul nsw i32 %32, %33
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %31, i64 %35
store double* %36, double** %23
%37 = load double*, double** %13
%38 = load double*, double** %14
%39 = load double*, double** %21
%40 = load double*, double** %22
%41 = load i32, i32* %11
%42 = mul nsw i32 2, %41
%43 = load double**, double*** %19
%44 = load double*, double** %23
%45 = load i32, i32* %11
%46 = call i32 @FST_semi_memo(double* %37, double* %38, double* %39, double* %40, i32 %42, double** %43, double* %44, i32 0, i32 %45)
%47 = load i32, i32* %11
%48 = load i32, i32* %12
%49 = load double, double* %15
%50 = load double, double* %16
%51 = load double, double* %17
%52 = load double*, double** %21
%53 = load double*, double** %22
%54 = load double*, double** %23
%55 = call i32 @rotateCoefAll_mem(i32 %47, i32 %48, double %49, double %50, double %51, double* %52, double* %53, double* %54)
%56 = load double*, double** %21
%57 = load double*, double** %22
%58 = load double*, double** %13
%59 = load double*, double** %14
%60 = load i32, i32* %11
%61 = mul nsw i32 2, %60
%62 = load double**, double*** %20
%63 = load double*, double** %23
%64 = load i32, i32* %11
%65 = call i32 @InvFST_semi_memo(double* %56, double* %57, double* %58, double* %59, i32 %61, double** %62, double* %63, i32 0, i32 %64)
ret void
}

LLVM IR (-O2):
define void @rotateFct_mem(i32 %0, i32 %1, double* %2, double* %3, double %4, double %5, double %6, double* %7, double** %8, double** %9) {
%11 = mul nsw i32 %0, %0
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds double, double* %7, i64 %12
%14 = getelementptr inbounds double, double* %13, i64 %12
%15 = shl nsw i32 %0, 1
%16 = tail call i32 @FST_semi_memo(double* %2, double* %3, double* %7, double* %13, i32 %15, double** %8, double* %14, i32 0, i32 %0)
%17 = tail call i32 @rotateCoefAll_mem(i32 %0, i32 %1, double %4, double %5, double %6, double* %7, double* %13, double* %14)
%18 = tail call i32 @InvFST_semi_memo(double* %7, double* %13, double* %2, double* %3, i32 %15, double** %9, double* %14, i32 0, i32 %0)
ret void
}