#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
double fabs(double);
int /*<<< orphan*/ fft(int, double **, double **);
int /*<<< orphan*/ free(double **);
int /*<<< orphan*/ log_fail();
int /*<<< orphan*/ log_pass();
double **malloc(int);
int /*<<< orphan*/ printf(char *);
int main() {
  int i;
  int N;
  double(*x)[2];
  double(*X)[2];
  double(*Xexp)[2];
  double epsilon;
  N = 2;
  if (N >= 2) {
    i = N;
    while (i == 2 * (i / 2))
      i = i / 2;
  }
  if (N < 2 || i != 1) {
    printf(", which does not equal 2^n for an integer n >= 1.");
    exit(EXIT_FAILURE);
  }
  x = malloc(2 * N * sizeof(double));
  X = malloc(2 * N * sizeof(double));
  Xexp = malloc(2 * N * sizeof(double));
  x[0][0] = 1.2;
  x[0][1] = 3.4;
  x[1][0] = 5.6;
  x[1][1] = 0.4;
  Xexp[0][0] = 6.8;
  Xexp[0][1] = 3.8;
  Xexp[1][0] = -4.4;
  Xexp[1][1] = 3.0;
  epsilon = 0.1;
  fft(N, x, X);
  for (i = 0; i < N; i++) {
    if (!(((fabs(X[i][0] - Xexp[i][0]) < epsilon) ? 1 : 0) &&
          ((fabs(X[i][1] - Xexp[i][1]) < epsilon) ? 1 : 0))) {
      log_fail();
      return -1;
    }
  }
  free(x);
  free(X);
  log_pass();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jl     11cf <main+0x5f>
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
shl    $0x1,%ecx
cmp    %ecx,%eax
jne    11ca <main+0x5a>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1196 <main+0x26>
jmp    11cf <main+0x5f>
cmpl   $0x2,-0xc(%rbp)
jl     11e3 <main+0x73>
cmpl   $0x1,-0x8(%rbp)
je     11fd <main+0x8d>
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
mov    0x2dea(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movsd  0xdf2(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movsd  0xdda(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
movsd  0xdc1(%rip),%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x18(%rbp),%rax
movsd  0xda8(%rip),%xmm0
movsd  %xmm0,0x18(%rax)
mov    -0x28(%rbp),%rax
movsd  0xd8f(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movsd  0xd77(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x28(%rbp),%rax
movsd  0xd5e(%rip),%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x28(%rbp),%rax
movsd  0xd45(%rip),%xmm0
movsd  %xmm0,0x18(%rax)
movsd  0xd30(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1090 <fft@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    13dc <main+0x26c>
mov    -0x20(%rbp),%rax
movslq -0x8(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm1
mov    -0x28(%rbp),%rax
movslq -0x8(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
subsd  (%rax),%xmm1
movaps 0xd2b(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1347 <main+0x1d7>
mov    $0x1,%al
test   $0x1,%al
jne    1356 <main+0x1e6>
jmp    13b6 <main+0x246>
xor    %eax,%eax
test   $0x1,%al
jne    1356 <main+0x1e6>
jmp    13b6 <main+0x246>
mov    -0x20(%rbp),%rax
movslq -0x8(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm1
mov    -0x28(%rbp),%rax
movslq -0x8(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
subsd  0x8(%rax),%xmm1
movaps 0xccb(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    13a7 <main+0x237>
mov    $0x1,%al
test   $0x1,%al
jne    13c9 <main+0x259>
jmp    13b6 <main+0x246>
xor    %eax,%eax
test   $0x1,%al
jne    13c9 <main+0x259>
jmp    13b6 <main+0x246>
mov    $0x0,%al
call   1060 <log_fail@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13f5 <main+0x285>
jmp    13ce <main+0x25e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    12ec <main+0x17c>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1050 <log_pass@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x20,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    $0x20,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    $0x20,%edi
call   1060 <malloc@plt>
movaps 0xe81(%rip),%xmm0
movups %xmm0,(%rbx)
movaps 0xe87(%rip),%xmm0
movups %xmm0,0x10(%rbx)
movaps 0xe8c(%rip),%xmm0
movups %xmm0,(%rax)
movaps 0xe92(%rip),%xmm0
movups %xmm0,0x10(%rax)
mov    $0x2,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1070 <fft@plt>
movsd  (%r14),%xmm1
addsd  0xe91(%rip),%xmm1
andpd  0xe79(%rip),%xmm1
movsd  0xe89(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1244 <main+0xf4>
movsd  0x8(%r14),%xmm1
addsd  0xe7d(%rip),%xmm1
andpd  0xe55(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1244 <main+0xf4>
movsd  0x10(%r14),%xmm1
addsd  0xe69(%rip),%xmm1
andpd  0xe39(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1244 <main+0xf4>
movsd  0x18(%r14),%xmm1
addsd  0xe55(%rip),%xmm1
andpd  0xe1d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1244 <main+0xf4>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <log_pass@plt>
jmp    1250 <main+0x100>
xor    %eax,%eax
call   1050 <log_fail@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [50 x i8] c", which does not equal 2^n for an integer n >= 1.\00"
@EXIT_FAILURE = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [2 x double]*
%5 = alloca [2 x double]*
%6 = alloca [2 x double]*
%7 = alloca double
store i32 0, i32* %1
store i32 2, i32* %3
%8 = load i32, i32* %3
%9 = icmp sge i32 %8, 2
br i1 %9, label %10, label %22
10: ; preds = %0
%11 = load i32, i32* %3
store i32 %11, i32* %2
br label %12
12: ; preds = %18, %10
%13 = load i32, i32* %2
%14 = load i32, i32* %2
%15 = sdiv i32 %14, 2
%16 = mul nsw i32 2, %15
%17 = icmp eq i32 %13, %16
br i1 %17, label %18, label %21
18: ; preds = %12
%19 = load i32, i32* %2
%20 = sdiv i32 %19, 2
store i32 %20, i32* %2
br label %12
21: ; preds = %12
br label %22
22: ; preds = %21, %0
%23 = load i32, i32* %3
%24 = icmp slt i32 %23, 2
br i1 %24, label %28, label %25
25: ; preds = %22
%26 = load i32, i32* %2
%27 = icmp ne i32 %26, 1
br i1 %27, label %28, label %32
28: ; preds = %25, %22
%29 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%30 = load i32, i32* @EXIT_FAILURE
%31 = call i32 @exit(i32 %30)
unreachable
32: ; preds = %25
%33 = load i32, i32* %3
%34 = mul nsw i32 2, %33
%35 = sext i32 %34 to i64
%36 = mul i64 %35, 8
%37 = trunc i64 %36 to i32
%38 = call double** @malloc(i32 %37)
%39 = bitcast double** %38 to [2 x double]*
store [2 x double]* %39, [2 x double]** %4
%40 = load i32, i32* %3
%41 = mul nsw i32 2, %40
%42 = sext i32 %41 to i64
%43 = mul i64 %42, 8
%44 = trunc i64 %43 to i32
%45 = call double** @malloc(i32 %44)
%46 = bitcast double** %45 to [2 x double]*
store [2 x double]* %46, [2 x double]** %5
%47 = load i32, i32* %3
%48 = mul nsw i32 2, %47
%49 = sext i32 %48 to i64
%50 = mul i64 %49, 8
%51 = trunc i64 %50 to i32
%52 = call double** @malloc(i32 %51)
%53 = bitcast double** %52 to [2 x double]*
store [2 x double]* %53, [2 x double]** %6
%54 = load [2 x double]*, [2 x double]** %4
%55 = getelementptr inbounds [2 x double], [2 x double]* %54, i64 0
%56 = getelementptr inbounds [2 x double], [2 x double]* %55, i64 0, i64 0
store double 1.200000e+00, double* %56
%57 = load [2 x double]*, [2 x double]** %4
%58 = getelementptr inbounds [2 x double], [2 x double]* %57, i64 0
%59 = getelementptr inbounds [2 x double], [2 x double]* %58, i64 0, i64 1
store double 3.400000e+00, double* %59
%60 = load [2 x double]*, [2 x double]** %4
%61 = getelementptr inbounds [2 x double], [2 x double]* %60, i64 1
%62 = getelementptr inbounds [2 x double], [2 x double]* %61, i64 0, i64 0
store double 5.600000e+00, double* %62
%63 = load [2 x double]*, [2 x double]** %4
%64 = getelementptr inbounds [2 x double], [2 x double]* %63, i64 1
%65 = getelementptr inbounds [2 x double], [2 x double]* %64, i64 0, i64 1
store double 4.000000e-01, double* %65
%66 = load [2 x double]*, [2 x double]** %6
%67 = getelementptr inbounds [2 x double], [2 x double]* %66, i64 0
%68 = getelementptr inbounds [2 x double], [2 x double]* %67, i64 0, i64 0
store double 6.800000e+00, double* %68
%69 = load [2 x double]*, [2 x double]** %6
%70 = getelementptr inbounds [2 x double], [2 x double]* %69, i64 0
%71 = getelementptr inbounds [2 x double], [2 x double]* %70, i64 0, i64 1
store double 3.800000e+00, double* %71
%72 = load [2 x double]*, [2 x double]** %6
%73 = getelementptr inbounds [2 x double], [2 x double]* %72, i64 1
%74 = getelementptr inbounds [2 x double], [2 x double]* %73, i64 0, i64 0
store double -4.400000e+00, double* %74
%75 = load [2 x double]*, [2 x double]** %6
%76 = getelementptr inbounds [2 x double], [2 x double]* %75, i64 1
%77 = getelementptr inbounds [2 x double], [2 x double]* %76, i64 0, i64 1
store double 3.000000e+00, double* %77
store double 1.000000e-01, double* %7
%78 = load i32, i32* %3
%79 = load [2 x double]*, [2 x double]** %4
%80 = bitcast [2 x double]* %79 to double**
%81 = load [2 x double]*, [2 x double]** %5
%82 = bitcast [2 x double]* %81 to double**
%83 = call i32 @fft(i32 %78, double** %80, double** %82)
store i32 0, i32* %2
br label %84
84: ; preds = %129, %32
%85 = load i32, i32* %2
%86 = load i32, i32* %3
%87 = icmp slt i32 %85, %86
br i1 %87, label %88, label %132
88: ; preds = %84
%89 = load [2 x double]*, [2 x double]** %5
%90 = load i32, i32* %2
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [2 x double], [2 x double]* %89, i64 %91
%93 = getelementptr inbounds [2 x double], [2 x double]* %92, i64 0, i64 0
%94 = load double, double* %93
%95 = load [2 x double]*, [2 x double]** %6
%96 = load i32, i32* %2
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds [2 x double], [2 x double]* %95, i64 %97
%99 = getelementptr inbounds [2 x double], [2 x double]* %98, i64 0, i64 0
%100 = load double, double* %99
%101 = fsub double %94, %100
%102 = call double @llvm.fabs.f64(double %101)
%103 = load double, double* %7
%104 = fcmp olt double %102, %103
br i1 %104, label %105, label %106
105: ; preds = %88
br i1 true, label %107, label %126
106: ; preds = %88
br i1 false, label %107, label %126
107: ; preds = %106, %105
%108 = load [2 x double]*, [2 x double]** %5
%109 = load i32, i32* %2
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds [2 x double], [2 x double]* %108, i64 %110
%112 = getelementptr inbounds [2 x double], [2 x double]* %111, i64 0, i64 1
%113 = load double, double* %112
%114 = load [2 x double]*, [2 x double]** %6
%115 = load i32, i32* %2
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds [2 x double], [2 x double]* %114, i64 %116
%118 = getelementptr inbounds [2 x double], [2 x double]* %117, i64 0, i64 1
%119 = load double, double* %118
%120 = fsub double %113, %119
%121 = call double @llvm.fabs.f64(double %120)
%122 = load double, double* %7
%123 = fcmp olt double %121, %122
br i1 %123, label %124, label %125
124: ; preds = %107
br i1 true, label %128, label %126
125: ; preds = %107
br i1 false, label %128, label %126
126: ; preds = %125, %124, %106, %105
%127 = call i32 (...) @log_fail()
store i32 -1, i32* %1
br label %140
128: ; preds = %125, %124
br label %129
129: ; preds = %128
%130 = load i32, i32* %2
%131 = add nsw i32 %130, 1
store i32 %131, i32* %2
br label %84
132: ; preds = %84
%133 = load [2 x double]*, [2 x double]** %4
%134 = bitcast [2 x double]* %133 to double**
%135 = call i32 @free(double** %134)
%136 = load [2 x double]*, [2 x double]** %5
%137 = bitcast [2 x double]* %136 to double**
%138 = call i32 @free(double** %137)
%139 = call i32 (...) @log_pass()
br label %140
140: ; preds = %132, %126
%141 = load i32, i32* %1
ret i32 %141
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define i32 @main() {
%1 = tail call double** @malloc(i32 32)
%2 = tail call double** @malloc(i32 32)
%3 = tail call double** @malloc(i32 32)
%4 = bitcast double** %1 to <2 x double>*
store <2 x double> <double 1.200000e+00, double 3.400000e+00>, <2 x double>* %4
%5 = getelementptr inbounds double*, double** %1, i64 2
%6 = bitcast double** %5 to <2 x double>*
store <2 x double> <double 5.600000e+00, double 4.000000e-01>, <2 x double>* %6
%7 = bitcast double** %3 to <2 x double>*
store <2 x double> <double 6.800000e+00, double 3.800000e+00>, <2 x double>* %7
%8 = getelementptr inbounds double*, double** %3, i64 2
%9 = bitcast double** %8 to <2 x double>*
store <2 x double> <double -4.400000e+00, double 3.000000e+00>, <2 x double>* %9
%10 = tail call i32 @fft(i32 2, double** %1, double** %2)
%11 = bitcast double** %2 to double*
%12 = load double, double* %11
%13 = fadd double %12, -6.800000e+00
%14 = tail call double @llvm.fabs.f64(double %13)
%15 = fcmp olt double %14, 1.000000e-01
br i1 %15, label %34, label %41
16: ; preds = %34
%17 = getelementptr inbounds double*, double** %2, i64 2
%18 = bitcast double** %17 to double*
%19 = load double, double* %18
%20 = fadd double %19, 4.400000e+00
%21 = tail call double @llvm.fabs.f64(double %20)
%22 = fcmp olt double %21, 1.000000e-01
br i1 %22, label %23, label %41
23: ; preds = %16
%24 = getelementptr inbounds double*, double** %2, i64 3
%25 = bitcast double** %24 to double*
%26 = load double, double* %25
%27 = fadd double %26, -3.000000e+00
%28 = tail call double @llvm.fabs.f64(double %27)
%29 = fcmp olt double %28, 1.000000e-01
br i1 %29, label %30, label %41
30: ; preds = %23
%31 = tail call i32 @free(double** %1)
%32 = tail call i32 @free(double** %2)
%33 = tail call i32 (...) @log_pass()
br label %43
34: ; preds = %0
%35 = getelementptr inbounds double*, double** %2, i64 1
%36 = bitcast double** %35 to double*
%37 = load double, double* %36
%38 = fadd double %37, -3.800000e+00
%39 = tail call double @llvm.fabs.f64(double %38)
%40 = fcmp olt double %39, 1.000000e-01
br i1 %40, label %16, label %41
41: ; preds = %23, %16, %34, %0
%42 = tail call i32 (...) @log_fail()
br label %43
43: ; preds = %30, %41
%44 = phi i32 [ -1, %41 ], [ 0, %30 ]
ret i32 %44
}