#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(int, double **, double **);
void ifft(int N, double (*x)[2], double (*X)[2]) {
  int N2 = N / 2;
  int i;
  double tmp0, tmp1;
  fft(N, X, x);
  x[0][0] = x[0][0] / N;
  x[0][1] = x[0][1] / N;
  x[N2][0] = x[N2][0] / N;
  x[N2][1] = x[N2][1] / N;
  for (i = 1; i < N2; i++) {
    tmp0 = x[i][0] / N;
    tmp1 = x[i][1] / N;
    x[i][0] = x[N - i][0] / N;
    x[i][1] = x[N - i][1] / N;
    x[N - i][0] = tmp0;
    x[N - i][1] = tmp1;
  }
}


x86 assembly (clang, -O0):
<ifft>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <fft@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  %xmm0,0x8(%rax)
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12de <ifft+0x1ce>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    -0x20(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    -0x20(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    -0x20(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    -0x20(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  %xmm0,0x8(%rax)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11dc <ifft+0xcc>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ifft>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%r14d
mov    %edi,%ebp
shr    $0x1f,%ebp
add    %edi,%ebp
sar    %ebp
mov    %rdx,%rsi
mov    %rbx,%rdx
call   1030 <fft@plt>
cvtsi2sd %r14d,%xmm0
movupd (%rbx),%xmm1
unpcklpd %xmm0,%xmm0
divpd  %xmm0,%xmm1
movupd %xmm1,(%rbx)
movslq %ebp,%rax
shl    $0x4,%rax
movupd (%rbx,%rax,1),%xmm1
divpd  %xmm0,%xmm1
movupd %xmm1,(%rbx,%rax,1)
cmp    $0x4,%r14d
jl     11a7 <ifft+0x97>
mov    %r14d,%ecx
cmp    $0x3,%ebp
mov    $0x2,%eax
cmovge %ebp,%eax
shl    $0x4,%rcx
add    %rbx,%rcx
add    $0xfffffffffffffff0,%rcx
shl    $0x4,%rax
mov    $0x10,%edx
movupd (%rbx,%rdx,1),%xmm1
divpd  %xmm0,%xmm1
movupd (%rcx),%xmm2
divpd  %xmm0,%xmm2
movupd %xmm2,(%rbx,%rdx,1)
movupd %xmm1,(%rcx)
add    $0xfffffffffffffff0,%rcx
add    $0x10,%rdx
cmp    %rdx,%rax
jne    1180 <ifft+0x70>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @ifft(i32 %0, [2 x double]* %1, [2 x double]* %2) {
%4 = alloca i32
%5 = alloca [2 x double]*
%6 = alloca [2 x double]*
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double
store i32 %0, i32* %4
store [2 x double]* %1, [2 x double]** %5
store [2 x double]* %2, [2 x double]** %6
%11 = load i32, i32* %4
%12 = sdiv i32 %11, 2
store i32 %12, i32* %7
%13 = load i32, i32* %4
%14 = load [2 x double]*, [2 x double]** %6
%15 = bitcast [2 x double]* %14 to double**
%16 = load [2 x double]*, [2 x double]** %5
%17 = bitcast [2 x double]* %16 to double**
%18 = call i32 @fft(i32 %13, double** %15, double** %17)
%19 = load [2 x double]*, [2 x double]** %5
%20 = getelementptr inbounds [2 x double], [2 x double]* %19, i64 0
%21 = getelementptr inbounds [2 x double], [2 x double]* %20, i64 0, i64 0
%22 = load double, double* %21
%23 = load i32, i32* %4
%24 = sitofp i32 %23 to double
%25 = fdiv double %22, %24
%26 = load [2 x double]*, [2 x double]** %5
%27 = getelementptr inbounds [2 x double], [2 x double]* %26, i64 0
%28 = getelementptr inbounds [2 x double], [2 x double]* %27, i64 0, i64 0
store double %25, double* %28
%29 = load [2 x double]*, [2 x double]** %5
%30 = getelementptr inbounds [2 x double], [2 x double]* %29, i64 0
%31 = getelementptr inbounds [2 x double], [2 x double]* %30, i64 0, i64 1
%32 = load double, double* %31
%33 = load i32, i32* %4
%34 = sitofp i32 %33 to double
%35 = fdiv double %32, %34
%36 = load [2 x double]*, [2 x double]** %5
%37 = getelementptr inbounds [2 x double], [2 x double]* %36, i64 0
%38 = getelementptr inbounds [2 x double], [2 x double]* %37, i64 0, i64 1
store double %35, double* %38
%39 = load [2 x double]*, [2 x double]** %5
%40 = load i32, i32* %7
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [2 x double], [2 x double]* %39, i64 %41
%43 = getelementptr inbounds [2 x double], [2 x double]* %42, i64 0, i64 0
%44 = load double, double* %43
%45 = load i32, i32* %4
%46 = sitofp i32 %45 to double
%47 = fdiv double %44, %46
%48 = load [2 x double]*, [2 x double]** %5
%49 = load i32, i32* %7
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [2 x double], [2 x double]* %48, i64 %50
%52 = getelementptr inbounds [2 x double], [2 x double]* %51, i64 0, i64 0
store double %47, double* %52
%53 = load [2 x double]*, [2 x double]** %5
%54 = load i32, i32* %7
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [2 x double], [2 x double]* %53, i64 %55
%57 = getelementptr inbounds [2 x double], [2 x double]* %56, i64 0, i64 1
%58 = load double, double* %57
%59 = load i32, i32* %4
%60 = sitofp i32 %59 to double
%61 = fdiv double %58, %60
%62 = load [2 x double]*, [2 x double]** %5
%63 = load i32, i32* %7
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [2 x double], [2 x double]* %62, i64 %64
%66 = getelementptr inbounds [2 x double], [2 x double]* %65, i64 0, i64 1
store double %61, double* %66
store i32 1, i32* %8
br label %67
67: ; preds = %138, %3
%68 = load i32, i32* %8
%69 = load i32, i32* %7
%70 = icmp slt i32 %68, %69
br i1 %70, label %71, label %141
71: ; preds = %67
%72 = load [2 x double]*, [2 x double]** %5
%73 = load i32, i32* %8
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [2 x double], [2 x double]* %72, i64 %74
%76 = getelementptr inbounds [2 x double], [2 x double]* %75, i64 0, i64 0
%77 = load double, double* %76
%78 = load i32, i32* %4
%79 = sitofp i32 %78 to double
%80 = fdiv double %77, %79
store double %80, double* %9
%81 = load [2 x double]*, [2 x double]** %5
%82 = load i32, i32* %8
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [2 x double], [2 x double]* %81, i64 %83
%85 = getelementptr inbounds [2 x double], [2 x double]* %84, i64 0, i64 1
%86 = load double, double* %85
%87 = load i32, i32* %4
%88 = sitofp i32 %87 to double
%89 = fdiv double %86, %88
store double %89, double* %10
%90 = load [2 x double]*, [2 x double]** %5
%91 = load i32, i32* %4
%92 = load i32, i32* %8
%93 = sub nsw i32 %91, %92
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [2 x double], [2 x double]* %90, i64 %94
%96 = getelementptr inbounds [2 x double], [2 x double]* %95, i64 0, i64 0
%97 = load double, double* %96
%98 = load i32, i32* %4
%99 = sitofp i32 %98 to double
%100 = fdiv double %97, %99
%101 = load [2 x double]*, [2 x double]** %5
%102 = load i32, i32* %8
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [2 x double], [2 x double]* %101, i64 %103
%105 = getelementptr inbounds [2 x double], [2 x double]* %104, i64 0, i64 0
store double %100, double* %105
%106 = load [2 x double]*, [2 x double]** %5
%107 = load i32, i32* %4
%108 = load i32, i32* %8
%109 = sub nsw i32 %107, %108
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds [2 x double], [2 x double]* %106, i64 %110
%112 = getelementptr inbounds [2 x double], [2 x double]* %111, i64 0, i64 1
%113 = load double, double* %112
%114 = load i32, i32* %4
%115 = sitofp i32 %114 to double
%116 = fdiv double %113, %115
%117 = load [2 x double]*, [2 x double]** %5
%118 = load i32, i32* %8
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds [2 x double], [2 x double]* %117, i64 %119
%121 = getelementptr inbounds [2 x double], [2 x double]* %120, i64 0, i64 1
store double %116, double* %121
%122 = load double, double* %9
%123 = load [2 x double]*, [2 x double]** %5
%124 = load i32, i32* %4
%125 = load i32, i32* %8
%126 = sub nsw i32 %124, %125
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds [2 x double], [2 x double]* %123, i64 %127
%129 = getelementptr inbounds [2 x double], [2 x double]* %128, i64 0, i64 0
store double %122, double* %129
%130 = load double, double* %10
%131 = load [2 x double]*, [2 x double]** %5
%132 = load i32, i32* %4
%133 = load i32, i32* %8
%134 = sub nsw i32 %132, %133
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds [2 x double], [2 x double]* %131, i64 %135
%137 = getelementptr inbounds [2 x double], [2 x double]* %136, i64 0, i64 1
store double %130, double* %137
br label %138
138: ; preds = %71
%139 = load i32, i32* %8
%140 = add nsw i32 %139, 1
store i32 %140, i32* %8
br label %67
141: ; preds = %67
ret void
}

LLVM IR (-O2):
define void @ifft(i32 %0, [2 x double]* %1, [2 x double]* %2) {
%4 = sdiv i32 %0, 2
%5 = bitcast [2 x double]* %2 to double**
%6 = bitcast [2 x double]* %1 to double**
%7 = tail call i32 @fft(i32 %0, double** %5, double** %6)
%8 = sitofp i32 %0 to double
%9 = bitcast [2 x double]* %1 to <2 x double>*
%10 = load <2 x double>, <2 x double>* %9
%11 = insertelement <2 x double> poison, double %8, i64 0
%12 = shufflevector <2 x double> %11, <2 x double> poison, <2 x i32> zeroinitializer
%13 = fdiv <2 x double> %10, %12
%14 = bitcast [2 x double]* %1 to <2 x double>*
store <2 x double> %13, <2 x double>* %14
%15 = sext i32 %4 to i64
%16 = getelementptr inbounds [2 x double], [2 x double]* %1, i64 %15, i64 0
%17 = bitcast double* %16 to <2 x double>*
%18 = load <2 x double>, <2 x double>* %17
%19 = fdiv <2 x double> %18, %12
%20 = bitcast double* %16 to <2 x double>*
store <2 x double> %19, <2 x double>* %20
%21 = icmp sgt i32 %0, 3
br i1 %21, label %22, label %45
22: ; preds = %3
%23 = zext i32 %0 to i64
%24 = call i32 @llvm.smax.i32(i32 %4, i32 2)
%25 = zext i32 %24 to i64
%26 = insertelement <2 x double> poison, double %8, i64 0
%27 = shufflevector <2 x double> %26, <2 x double> poison, <2 x i32> zeroinitializer
%28 = insertelement <2 x double> poison, double %8, i64 0
%29 = shufflevector <2 x double> %28, <2 x double> poison, <2 x i32> zeroinitializer
br label %30
30: ; preds = %22, %30
%31 = phi i64 [ 1, %22 ], [ %43, %30 ]
%32 = getelementptr inbounds [2 x double], [2 x double]* %1, i64 %31, i64 0
%33 = bitcast double* %32 to <2 x double>*
%34 = load <2 x double>, <2 x double>* %33
%35 = fdiv <2 x double> %34, %27
%36 = sub nsw i64 %23, %31
%37 = getelementptr inbounds [2 x double], [2 x double]* %1, i64 %36, i64 0
%38 = bitcast double* %37 to <2 x double>*
%39 = load <2 x double>, <2 x double>* %38
%40 = fdiv <2 x double> %39, %29
%41 = bitcast double* %32 to <2 x double>*
store <2 x double> %40, <2 x double>* %41
%42 = bitcast double* %37 to <2 x double>*
store <2 x double> %35, <2 x double>* %42
%43 = add nuw nsw i64 %31, 1
%44 = icmp eq i64 %43, %25
br i1 %44, label %45, label %30
45: ; preds = %30, %3
ret void
}