#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 */
double *dgetmem(int const);
int /*<<< orphan*/ fftr(double *, double *, int const);
int /*<<< orphan*/ fillz(double *, int, int const);
int /*<<< orphan*/ free(double *);
void c2ndps(double *c, const int m, double *n, const int l) {
  int i;
  double *tmp;
  fillz(n, sizeof(*n), l);
  tmp = dgetmem(l);
  for (i = 1; i < m + 1; i++) {
    n[i] = c[i] * i / 2.0;
    n[l - i] = n[i];
  }
  fftr(n, tmp, l);
  free(tmp);
}


x86 assembly (clang, -O0):
<c2ndps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    $0x8,%esi
call   1050 <fillz@plt>
mov    -0x1c(%rbp),%edi
call   1060 <dgetmem@plt>
mov    %rax,-0x28(%rbp)
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    11e7 <c2ndps+0xa7>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
cvtsi2sdl -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe57(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    -0x20(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    117a <c2ndps+0x3a>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <fftr@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c2ndps>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r15d
mov    %rdx,%rbx
mov    %esi,%r12d
mov    %rdi,%rbp
mov    %rdx,%rdi
mov    $0x8,%esi
mov    %ecx,%edx
call   1050 <fillz@plt>
mov    %r15d,%edi
call   1060 <dgetmem@plt>
mov    %rax,%r14
test   %r12d,%r12d
jle    121f <c2ndps+0xdf>
movslq %r15d,%rax
mov    %r12d,%r8d
mov    $0x1,%ecx
cmp    $0x1,%r12d
je     11f7 <c2ndps+0xb7>
mov    %r8d,%esi
and    $0xfffffffe,%esi
lea    (%rbx,%rax,8),%rdi
add    $0xfffffffffffffff8,%rdi
mov    $0x1,%ecx
movsd  0xe5d(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xorps  %xmm1,%xmm1
cvtsi2sd %ecx,%xmm1
mulsd  0x0(%rbp,%rcx,8),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx,%rcx,8)
movsd  %xmm1,(%rdi)
lea    0x1(%rcx),%rdx
xorps  %xmm1,%xmm1
cvtsi2sd %edx,%xmm1
mulsd  0x8(%rbp,%rcx,8),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rbx,%rcx,8)
movsd  %xmm1,-0x8(%rdi)
add    $0x2,%rcx
add    $0xfffffffffffffff0,%rdi
cmp    %rsi,%rdx
jne    11b0 <c2ndps+0x70>
test   $0x1,%r8b
je     121f <c2ndps+0xdf>
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
mulsd  0x0(%rbp,%rcx,8),%xmm0
mulsd  0xdee(%rip),%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
sub    %rcx,%rax
movsd  %xmm0,(%rbx,%rax,8)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1040 <fftr@plt>
mov    %r14,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @c2ndps(double* %0, i32 %1, double* %2, i32 %3) {
%5 = alloca double*
%6 = alloca i32
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32
%10 = alloca double*
store double* %0, double** %5
store i32 %1, i32* %6
store double* %2, double** %7
store i32 %3, i32* %8
%11 = load double*, double** %7
%12 = load i32, i32* %8
%13 = call i32 @fillz(double* %11, i32 8, i32 %12)
%14 = load i32, i32* %8
%15 = call double* @dgetmem(i32 %14)
store double* %15, double** %10
store i32 1, i32* %9
br label %16
16: ; preds = %46, %4
%17 = load i32, i32* %9
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
%20 = icmp slt i32 %17, %19
br i1 %20, label %21, label %49
21: ; preds = %16
%22 = load double*, double** %5
%23 = load i32, i32* %9
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds double, double* %22, i64 %24
%26 = load double, double* %25
%27 = load i32, i32* %9
%28 = sitofp i32 %27 to double
%29 = fmul double %26, %28
%30 = fdiv double %29, 2.000000e+00
%31 = load double*, double** %7
%32 = load i32, i32* %9
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %31, i64 %33
store double %30, double* %34
%35 = load double*, double** %7
%36 = load i32, i32* %9
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %35, i64 %37
%39 = load double, double* %38
%40 = load double*, double** %7
%41 = load i32, i32* %8
%42 = load i32, i32* %9
%43 = sub nsw i32 %41, %42
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %40, i64 %44
store double %39, double* %45
br label %46
46: ; preds = %21
%47 = load i32, i32* %9
%48 = add nsw i32 %47, 1
store i32 %48, i32* %9
br label %16
49: ; preds = %16
%50 = load double*, double** %7
%51 = load double*, double** %10
%52 = load i32, i32* %8
%53 = call i32 @fftr(double* %50, double* %51, i32 %52)
%54 = load double*, double** %10
%55 = call i32 @free(double* %54)
ret void
}

LLVM IR (-O2):
define void @c2ndps(double* nocapture %0, i32 %1, double* %2, i32 %3) {
%5 = tail call i32 @fillz(double* %2, i32 8, i32 %3)
%6 = tail call double* @dgetmem(i32 %3)
%7 = icmp slt i32 %1, 1
br i1 %7, label %53, label %8
8: ; preds = %4
%9 = sext i32 %3 to i64
%10 = zext i32 %1 to i64
%11 = and i64 %10, 1
%12 = icmp eq i32 %1, 1
br i1 %12, label %40, label %13
13: ; preds = %8
%14 = and i64 %10, 4294967294
br label %15
15: ; preds = %15, %13
%16 = phi i64 [ 1, %13 ], [ %37, %15 ]
%17 = phi i64 [ 0, %13 ], [ %38, %15 ]
%18 = getelementptr inbounds double, double* %0, i64 %16
%19 = load double, double* %18
%20 = trunc i64 %16 to i32
%21 = sitofp i32 %20 to double
%22 = fmul double %19, %21
%23 = fmul double %22, 5.000000e-01
%24 = getelementptr inbounds double, double* %2, i64 %16
store double %23, double* %24
%25 = sub nsw i64 %9, %16
%26 = getelementptr inbounds double, double* %2, i64 %25
store double %23, double* %26
%27 = add nuw nsw i64 %16, 1
%28 = getelementptr inbounds double, double* %0, i64 %27
%29 = load double, double* %28
%30 = trunc i64 %27 to i32
%31 = sitofp i32 %30 to double
%32 = fmul double %29, %31
%33 = fmul double %32, 5.000000e-01
%34 = getelementptr inbounds double, double* %2, i64 %27
store double %33, double* %34
%35 = sub nsw i64 %9, %27
%36 = getelementptr inbounds double, double* %2, i64 %35
store double %33, double* %36
%37 = add nuw nsw i64 %16, 2
%38 = add i64 %17, 2
%39 = icmp eq i64 %38, %14
br i1 %39, label %40, label %15
40: ; preds = %15, %8
%41 = phi i64 [ 1, %8 ], [ %37, %15 ]
%42 = icmp eq i64 %11, 0
br i1 %42, label %53, label %43
43: ; preds = %40
%44 = getelementptr inbounds double, double* %0, i64 %41
%45 = load double, double* %44
%46 = trunc i64 %41 to i32
%47 = sitofp i32 %46 to double
%48 = fmul double %45, %47
%49 = fmul double %48, 5.000000e-01
%50 = getelementptr inbounds double, double* %2, i64 %41
store double %49, double* %50
%51 = sub nsw i64 %9, %41
%52 = getelementptr inbounds double, double* %2, i64 %51
store double %49, double* %52
br label %53
53: ; preds = %43, %40, %4
%54 = tail call i32 @fftr(double* %2, double* %6, i32 %3)
%55 = tail call i32 @free(double* %6)
ret void
}