#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*/ FFT_transform_internal(int, double *, int);
void FFT_inverse(int N, double *data) {
  int n = N / 2;
  double norm = 0.0;
  int i = 0;
  FFT_transform_internal(N, data, +1);
  norm = 1 / ((double)n);
  for (i = 0; i < N; i++)
    data[i] *= norm;
}


x86 assembly (clang, -O0):
<FFT_inverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1030 <FFT_transform_internal@plt>
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xea6(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    119b <FFT_inverse+0x8b>
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    116a <FFT_inverse+0x5a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FFT_inverse>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0x1,%edx
call   1030 <FFT_transform_internal@plt>
test   %ebp,%ebp
jle    1217 <FFT_inverse+0x107>
mov    %ebp,%eax
shr    $0x1f,%eax
add    %ebp,%eax
sar    %eax
cvtsi2sd %eax,%xmm1
movsd  0xec1(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    %ebp,%eax
cmp    $0x4,%ebp
jae    1151 <FFT_inverse+0x41>
xor    %ecx,%ecx
jmp    1200 <FFT_inverse+0xf0>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
lea    -0x4(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     121e <FFT_inverse+0x10e>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
nop
movupd (%rbx,%rdx,8),%xmm2
movupd 0x10(%rbx,%rdx,8),%xmm3
movupd 0x20(%rbx,%rdx,8),%xmm4
movupd 0x30(%rbx,%rdx,8),%xmm5
mulpd  %xmm1,%xmm2
mulpd  %xmm1,%xmm3
movupd %xmm2,(%rbx,%rdx,8)
movupd %xmm3,0x10(%rbx,%rdx,8)
mulpd  %xmm1,%xmm4
mulpd  %xmm1,%xmm5
movupd %xmm4,0x20(%rbx,%rdx,8)
movupd %xmm5,0x30(%rbx,%rdx,8)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rdi
jne    1180 <FFT_inverse+0x70>
test   $0x1,%sil
je     11ec <FFT_inverse+0xdc>
movupd (%rbx,%rdx,8),%xmm2
movupd 0x10(%rbx,%rdx,8),%xmm3
mulpd  %xmm1,%xmm2
mulpd  %xmm1,%xmm3
movupd %xmm2,(%rbx,%rdx,8)
movupd %xmm3,0x10(%rbx,%rdx,8)
cmp    %rax,%rcx
je     1217 <FFT_inverse+0x107>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%rbx,%rcx,8),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1200 <FFT_inverse+0xf0>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %edx,%edx
test   $0x1,%sil
jne    11ce <FFT_inverse+0xbe>
jmp    11ec <FFT_inverse+0xdc>

LLVM IR (-O0):
define void @FFT_inverse(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca i32
%6 = alloca double
%7 = alloca i32
store i32 %0, i32* %3
store double* %1, double** %4
%8 = load i32, i32* %3
%9 = sdiv i32 %8, 2
store i32 %9, i32* %5
store double 0.000000e+00, double* %6
store i32 0, i32* %7
%10 = load i32, i32* %3
%11 = load double*, double** %4
%12 = call i32 @FFT_transform_internal(i32 %10, double* %11, i32 1)
%13 = load i32, i32* %5
%14 = sitofp i32 %13 to double
%15 = fdiv double 1.000000e+00, %14
store double %15, double* %6
store i32 0, i32* %7
br label %16
16: ; preds = %28, %2
%17 = load i32, i32* %7
%18 = load i32, i32* %3
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %31
20: ; preds = %16
%21 = load double, double* %6
%22 = load double*, double** %4
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds double, double* %22, i64 %24
%26 = load double, double* %25
%27 = fmul double %26, %21
store double %27, double* %25
br label %28
28: ; preds = %20
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
store i32 %30, i32* %7
br label %16
31: ; preds = %16
ret void
}

LLVM IR (-O2):
define void @FFT_inverse(i32 %0, double* %1) {
%3 = sdiv i32 %0, 2
%4 = tail call i32 @FFT_transform_internal(i32 %0, double* %1, i32 1)
%5 = sitofp i32 %3 to double
%6 = fdiv double 1.000000e+00, %5
%7 = icmp sgt i32 %0, 0
br i1 %7, label %8, label %76
8: ; preds = %2
%9 = zext i32 %0 to i64
%10 = icmp ult i32 %0, 4
br i1 %10, label %67, label %11
11: ; preds = %8
%12 = and i64 %9, 4294967292
%13 = insertelement <2 x double> poison, double %6, i64 0
%14 = shufflevector <2 x double> %13, <2 x double> poison, <2 x i32> zeroinitializer
%15 = insertelement <2 x double> poison, double %6, i64 0
%16 = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> zeroinitializer
%17 = add nsw i64 %12, -4
%18 = lshr exact i64 %17, 2
%19 = add nuw nsw i64 %18, 1
%20 = and i64 %19, 1
%21 = icmp eq i64 %17, 0
br i1 %21, label %51, label %22
22: ; preds = %11
%23 = and i64 %19, 9223372036854775806
br label %24
24: ; preds = %24, %22
%25 = phi i64 [ 0, %22 ], [ %48, %24 ]
%26 = phi i64 [ 0, %22 ], [ %49, %24 ]
%27 = getelementptr inbounds double, double* %1, i64 %25
%28 = bitcast double* %27 to <2 x double>*
%29 = load <2 x double>, <2 x double>* %28
%30 = getelementptr inbounds double, double* %27, i64 2
%31 = bitcast double* %30 to <2 x double>*
%32 = load <2 x double>, <2 x double>* %31
%33 = fmul <2 x double> %14, %29
%34 = fmul <2 x double> %16, %32
%35 = bitcast double* %27 to <2 x double>*
store <2 x double> %33, <2 x double>* %35
%36 = bitcast double* %30 to <2 x double>*
store <2 x double> %34, <2 x double>* %36
%37 = or i64 %25, 4
%38 = getelementptr inbounds double, double* %1, i64 %37
%39 = bitcast double* %38 to <2 x double>*
%40 = load <2 x double>, <2 x double>* %39
%41 = getelementptr inbounds double, double* %38, i64 2
%42 = bitcast double* %41 to <2 x double>*
%43 = load <2 x double>, <2 x double>* %42
%44 = fmul <2 x double> %14, %40
%45 = fmul <2 x double> %16, %43
%46 = bitcast double* %38 to <2 x double>*
store <2 x double> %44, <2 x double>* %46
%47 = bitcast double* %41 to <2 x double>*
store <2 x double> %45, <2 x double>* %47
%48 = add nuw i64 %25, 8
%49 = add i64 %26, 2
%50 = icmp eq i64 %49, %23
br i1 %50, label %51, label %24
51: ; preds = %24, %11
%52 = phi i64 [ 0, %11 ], [ %48, %24 ]
%53 = icmp eq i64 %20, 0
br i1 %53, label %65, label %54
54: ; preds = %51
%55 = getelementptr inbounds double, double* %1, i64 %52
%56 = bitcast double* %55 to <2 x double>*
%57 = load <2 x double>, <2 x double>* %56
%58 = getelementptr inbounds double, double* %55, i64 2
%59 = bitcast double* %58 to <2 x double>*
%60 = load <2 x double>, <2 x double>* %59
%61 = fmul <2 x double> %14, %57
%62 = fmul <2 x double> %16, %60
%63 = bitcast double* %55 to <2 x double>*
store <2 x double> %61, <2 x double>* %63
%64 = bitcast double* %58 to <2 x double>*
store <2 x double> %62, <2 x double>* %64
br label %65
65: ; preds = %51, %54
%66 = icmp eq i64 %12, %9
br i1 %66, label %76, label %67
67: ; preds = %8, %65
%68 = phi i64 [ 0, %8 ], [ %12, %65 ]
br label %69
69: ; preds = %67, %69
%70 = phi i64 [ %74, %69 ], [ %68, %67 ]
%71 = getelementptr inbounds double, double* %1, i64 %70
%72 = load double, double* %71
%73 = fmul double %6, %72
store double %73, double* %71
%74 = add nuw nsw i64 %70, 1
%75 = icmp eq i64 %74, %9
br i1 %75, label %76, label %69
76: ; preds = %69, %65, %2
ret void
}