#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*/ c_lattice_worker(int, double *, double *, int, double,
                                    double);
int /*<<< orphan*/ posix_memalign(void **, int, int);
double *c_lattice(int lm, double sin_, double cos_, double *inArr, int arrLen) {
  double *outArr;
  posix_memalign((void **)&outArr, 16, arrLen * sizeof(double));
  if (arrLen != 0) {
    c_lattice_worker(lm, inArr, outArr, arrLen, sin_, cos_);
  }
  return outArr;
}


x86 assembly (clang, -O0):
<c_lattice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %edx,-0x24(%rbp)
lea    -0x30(%rbp),%rdi
movslq -0x24(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
mov    $0x10,%esi
call   1030 <posix_memalign@plt>
cmpl   $0x0,-0x24(%rbp)
je     117b <c_lattice+0x5b>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x24(%rbp),%ecx
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1040 <c_lattice_worker@plt>
mov    -0x30(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_lattice>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %edx,%ebx
mov    %rsi,%r14
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,0x10(%rsp)
mov    %edi,%ebp
lea    0x0(,%rbx,8),%edx
lea    0x8(%rsp),%rdi
mov    $0x10,%esi
call   1030 <posix_memalign@plt>
test   %ebx,%ebx
je     1172 <c_lattice+0x52>
mov    0x8(%rsp),%rdx
mov    %ebp,%edi
mov    %r14,%rsi
mov    %ebx,%ecx
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
call   1040 <c_lattice_worker@plt>
mov    0x8(%rsp),%rax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define double* @c_lattice(i32 %0, double %1, double %2, double* %3, i32 %4) {
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double*
%10 = alloca i32
%11 = alloca double*
store i32 %0, i32* %6
store double %1, double* %7
store double %2, double* %8
store double* %3, double** %9
store i32 %4, i32* %10
%12 = bitcast double** %11 to i8**
%13 = load i32, i32* %10
%14 = sext i32 %13 to i64
%15 = mul i64 %14, 8
%16 = trunc i64 %15 to i32
%17 = call i32 @posix_memalign(i8** %12, i32 16, i32 %16)
%18 = load i32, i32* %10
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %28
20: ; preds = %5
%21 = load i32, i32* %6
%22 = load double*, double** %9
%23 = load double*, double** %11
%24 = load i32, i32* %10
%25 = load double, double* %7
%26 = load double, double* %8
%27 = call i32 @c_lattice_worker(i32 %21, double* %22, double* %23, i32 %24, double %25, double %26)
br label %28
28: ; preds = %20, %5
%29 = load double*, double** %11
ret double* %29
}

LLVM IR (-O2):
define double* @c_lattice(i32 %0, double %1, double %2, double* %3, i32 %4) {
%6 = alloca double*
%7 = bitcast double** %6 to i8*
%8 = bitcast double** %6 to i8**
%9 = shl i32 %4, 3
%10 = call i32 @posix_memalign(i8** %8, i32 16, i32 %9)
%11 = icmp eq i32 %4, 0
br i1 %11, label %15, label %12
12: ; preds = %5
%13 = load double*, double** %6
%14 = call i32 @c_lattice_worker(i32 %0, double* %3, double* %13, i32 %4, double %1, double %2)
br label %15
15: ; preds = %12, %5
%16 = load double*, double** %6
ret double* %16
}