#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*/ Inverse_SO3_Naive_sym(int, double *, double *, double *,
                                         double *, double *, double *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ perror(char *);
void Inverse_SO3_Naive_sym_W(int bw, double *rsignal, double *isignal,
                             double *rcoeffs, double *icoeffs, int flag) {
  int n, n3;
  double *workspace1, *workspace2;
  n = 2 * bw;
  n3 = n * n * n;
  workspace1 = (double *)malloc(sizeof(double) * 2 * n3);
  workspace2 = (double *)malloc(sizeof(double) * (24 * bw + 2 * bw * bw));
  if ((workspace1 == NULL) || (workspace2 == NULL)) {
    perror("Error in allocating memory");
    exit(1);
  }
  Inverse_SO3_Naive_sym(bw, rcoeffs, icoeffs, rsignal, isignal, workspace1,
                        workspace2, flag);
  free(workspace2);
  free(workspace1);
}


x86 assembly (clang, -O0):
<Inverse_SO3_Naive_sym_W>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
imul   -0x30(%rbp),%eax
imul   -0x30(%rbp),%eax
mov    %eax,-0x34(%rbp)
movslq -0x34(%rbp),%rax
shl    $0x4,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x40(%rbp)
imul   $0x18,-0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
imul   -0x4(%rbp),%ecx
add    %ecx,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x40(%rbp)
je     11d0 <Inverse_SO3_Naive_sym_W+0x80>
cmpq   $0x0,-0x48(%rbp)
jne    11e6 <Inverse_SO3_Naive_sym_W+0x96>
lea    0xe29(%rip),%rdi
call   1060 <perror@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x40(%rbp),%r9
mov    -0x48(%rbp),%r10
mov    -0x2c(%rbp),%eax
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
call   1050 <Inverse_SO3_Naive_sym@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Inverse_SO3_Naive_sym_W>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,0x10(%rsp)
mov    %r8,0x8(%rsp)
mov    %rcx,%r13
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %edi,%r14d
lea    (%r14,%r14,1),%eax
imul   %eax,%edi
imul   %eax,%edi
shl    $0x5,%edi
call   1040 <malloc@plt>
mov    %rax,%rbp
lea    (%r14,%r14,1),%edi
add    $0x18,%edi
imul   %r14d,%edi
shl    $0x3,%edi
call   1040 <malloc@plt>
test   %rbp,%rbp
je     11ea <Inverse_SO3_Naive_sym_W+0x9a>
mov    %rax,%r15
test   %rax,%rax
je     11ea <Inverse_SO3_Naive_sym_W+0x9a>
mov    %r14d,%edi
mov    %r13,%rsi
mov    0x8(%rsp),%rdx
mov    %rbx,%rcx
mov    %r12,%r8
mov    %rbp,%r9
push   0x10(%rsp)
push   %r15
call   1050 <Inverse_SO3_Naive_sym@plt>
add    $0x10,%rsp
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
lea    0xe0f(%rip),%rdi
call   1060 <perror@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Error in allocating memory\00"
define void @Inverse_SO3_Naive_sym_W(i32 %0, double* %1, double* %2, double* %3, double* %4, i32 %5) {
%7 = alloca i32
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca double*
%16 = alloca double*
store i32 %0, i32* %7
store double* %1, double** %8
store double* %2, double** %9
store double* %3, double** %10
store double* %4, double** %11
store i32 %5, i32* %12
%17 = load i32, i32* %7
%18 = mul nsw i32 2, %17
store i32 %18, i32* %13
%19 = load i32, i32* %13
%20 = load i32, i32* %13
%21 = mul nsw i32 %19, %20
%22 = load i32, i32* %13
%23 = mul nsw i32 %21, %22
store i32 %23, i32* %14
%24 = load i32, i32* %14
%25 = sext i32 %24 to i64
%26 = mul i64 16, %25
%27 = trunc i64 %26 to i32
%28 = call i64 @malloc(i32 %27)
%29 = inttoptr i64 %28 to double*
store double* %29, double** %15
%30 = load i32, i32* %7
%31 = mul nsw i32 24, %30
%32 = load i32, i32* %7
%33 = mul nsw i32 2, %32
%34 = load i32, i32* %7
%35 = mul nsw i32 %33, %34
%36 = add nsw i32 %31, %35
%37 = sext i32 %36 to i64
%38 = mul i64 8, %37
%39 = trunc i64 %38 to i32
%40 = call i64 @malloc(i32 %39)
%41 = inttoptr i64 %40 to double*
store double* %41, double** %16
%42 = load double*, double** %15
%43 = icmp eq double* %42, null
br i1 %43, label %47, label %44
44: ; preds = %6
%45 = load double*, double** %16
%46 = icmp eq double* %45, null
br i1 %46, label %47, label %50
47: ; preds = %44, %6
%48 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %44
%51 = load i32, i32* %7
%52 = load double*, double** %10
%53 = load double*, double** %11
%54 = load double*, double** %8
%55 = load double*, double** %9
%56 = load double*, double** %15
%57 = load double*, double** %16
%58 = load i32, i32* %12
%59 = call i32 @Inverse_SO3_Naive_sym(i32 %51, double* %52, double* %53, double* %54, double* %55, double* %56, double* %57, i32 %58)
%60 = load double*, double** %16
%61 = call i32 @free(double* %60)
%62 = load double*, double** %15
%63 = call i32 @free(double* %62)
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"Error in allocating memory\00"
define void @Inverse_SO3_Naive_sym_W(i32 %0, double* %1, double* %2, double* %3, double* %4, i32 %5) {
%7 = shl nsw i32 %0, 1
%8 = shl i32 %0, 5
%9 = mul i32 %8, %7
%10 = mul i32 %9, %7
%11 = tail call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to double*
%13 = add i32 %7, 24
%14 = shl i32 %0, 3
%15 = mul i32 %14, %13
%16 = tail call i64 @malloc(i32 %15)
%17 = inttoptr i64 %16 to double*
%18 = icmp eq i64 %11, 0
%19 = icmp eq i64 %16, 0
%20 = select i1 %18, i1 true, i1 %19
br i1 %20, label %21, label %24
21: ; preds = %6
%22 = tail call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%23 = tail call i32 @exit(i32 1)
unreachable
24: ; preds = %6
%25 = tail call i32 @Inverse_SO3_Naive_sym(i32 %0, double* %3, double* %4, double* %1, double* %2, double* %12, double* %17, i32 %5)
%26 = tail call i32 @free(double* %17)
%27 = tail call i32 @free(double* %12)
ret void
}