#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*/ assert(int);
int /*<<< orphan*/ compute_W(int, double *, double *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fft(int, double *, double *, double *, double *);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ init_array(int, double *, double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ permute_bitrev(int, double *, double *);
int main(int argc, char *argv[]) {
  int n;
  int i;
  double *A_re, *A_im, *W_re, *W_im;
  n = 64;
  A_re = (double *)malloc(sizeof(double) * n);
  A_im = (double *)malloc(sizeof(double) * n);
  W_re = (double *)malloc(sizeof(double) * n / 2);
  W_im = (double *)malloc(sizeof(double) * n / 2);
  assert(A_re != NULL && A_im != NULL && W_re != NULL && W_im != NULL);
  for (i = 0; i < 10000000; i++) {
    init_array(n, A_re, A_im);
    compute_W(n, W_re, W_im);
    fft(n, A_re, A_im, W_re, W_im);
    permute_bitrev(n, A_re, A_im);
  }
  free(A_re);
  free(A_im);
  free(W_re);
  free(W_im);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x40,-0x14(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x20(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x28(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
shr    $0x1,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x30(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
shr    $0x1,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x38(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x20(%rbp)
mov    %al,-0x39(%rbp)
je     122c <main+0xac>
xor    %eax,%eax
cmpq   $0x0,-0x28(%rbp)
mov    %al,-0x39(%rbp)
je     122c <main+0xac>
xor    %eax,%eax
cmpq   $0x0,-0x30(%rbp)
mov    %al,-0x39(%rbp)
je     122c <main+0xac>
cmpq   $0x0,-0x38(%rbp)
setne  %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x989680,-0x18(%rbp)
jge    12a3 <main+0x123>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1060 <init_array@plt>
mov    -0x14(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
call   1040 <compute_W@plt>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%r8
call   10a0 <fft@plt>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1050 <permute_bitrev@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1240 <main+0xc0>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
xor    %edi,%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0x200,%edi
call   1080 <malloc@plt>
mov    %rax,%r14
mov    $0x200,%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
mov    $0x100,%edi
call   1080 <malloc@plt>
mov    %rax,%r15
mov    $0x100,%edi
call   1080 <malloc@plt>
mov    %rax,%r12
test   %r14,%r14
setne  %al
test   %rbx,%rbx
setne  %cl
and    %al,%cl
test   %r15,%r15
setne  %al
test   %r12,%r12
setne  %dl
and    %al,%dl
and    %cl,%dl
movzbl %dl,%edi
call   1070 <assert@plt>
mov    $0x989680,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x40,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1060 <init_array@plt>
mov    $0x40,%edi
mov    %r15,%rsi
mov    %r12,%rdx
call   1040 <compute_W@plt>
mov    $0x40,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %r15,%rcx
mov    %r12,%r8
call   10a0 <fft@plt>
mov    $0x40,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <permute_bitrev@plt>
add    $0xffffffff,%ebp
jne    11f0 <main+0x70>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 64, i32* %6
%12 = load i32, i32* %6
%13 = sext i32 %12 to i64
%14 = mul i64 8, %13
%15 = trunc i64 %14 to i32
%16 = call i64 @malloc(i32 %15)
%17 = inttoptr i64 %16 to double*
store double* %17, double** %8
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = mul i64 8, %19
%21 = trunc i64 %20 to i32
%22 = call i64 @malloc(i32 %21)
%23 = inttoptr i64 %22 to double*
store double* %23, double** %9
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = mul i64 8, %25
%27 = udiv i64 %26, 2
%28 = trunc i64 %27 to i32
%29 = call i64 @malloc(i32 %28)
%30 = inttoptr i64 %29 to double*
store double* %30, double** %10
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = mul i64 8, %32
%34 = udiv i64 %33, 2
%35 = trunc i64 %34 to i32
%36 = call i64 @malloc(i32 %35)
%37 = inttoptr i64 %36 to double*
store double* %37, double** %11
%38 = load double*, double** %8
%39 = icmp ne double* %38, null
br i1 %39, label %40, label %49
40: ; preds = %2
%41 = load double*, double** %9
%42 = icmp ne double* %41, null
br i1 %42, label %43, label %49
43: ; preds = %40
%44 = load double*, double** %10
%45 = icmp ne double* %44, null
br i1 %45, label %46, label %49
46: ; preds = %43
%47 = load double*, double** %11
%48 = icmp ne double* %47, null
br label %49
49: ; preds = %46, %43, %40, %2
%50 = phi i1 [ false, %43 ], [ false, %40 ], [ false, %2 ], [ %48, %46 ]
%51 = zext i1 %50 to i32
%52 = call i32 @assert(i32 %51)
store i32 0, i32* %7
br label %53
53: ; preds = %75, %49
%54 = load i32, i32* %7
%55 = icmp slt i32 %54, 10000000
br i1 %55, label %56, label %78
56: ; preds = %53
%57 = load i32, i32* %6
%58 = load double*, double** %8
%59 = load double*, double** %9
%60 = call i32 @init_array(i32 %57, double* %58, double* %59)
%61 = load i32, i32* %6
%62 = load double*, double** %10
%63 = load double*, double** %11
%64 = call i32 @compute_W(i32 %61, double* %62, double* %63)
%65 = load i32, i32* %6
%66 = load double*, double** %8
%67 = load double*, double** %9
%68 = load double*, double** %10
%69 = load double*, double** %11
%70 = call i32 @fft(i32 %65, double* %66, double* %67, double* %68, double* %69)
%71 = load i32, i32* %6
%72 = load double*, double** %8
%73 = load double*, double** %9
%74 = call i32 @permute_bitrev(i32 %71, double* %72, double* %73)
br label %75
75: ; preds = %56
%76 = load i32, i32* %7
%77 = add nsw i32 %76, 1
store i32 %77, i32* %7
br label %53
78: ; preds = %53
%79 = load double*, double** %8
%80 = call i32 @free(double* %79)
%81 = load double*, double** %9
%82 = call i32 @free(double* %81)
%83 = load double*, double** %10
%84 = call i32 @free(double* %83)
%85 = load double*, double** %11
%86 = call i32 @free(double* %85)
%87 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @malloc(i32 512)
%4 = inttoptr i64 %3 to double*
%5 = tail call i64 @malloc(i32 512)
%6 = inttoptr i64 %5 to double*
%7 = tail call i64 @malloc(i32 256)
%8 = inttoptr i64 %7 to double*
%9 = tail call i64 @malloc(i32 256)
%10 = inttoptr i64 %9 to double*
%11 = icmp ne i64 %3, 0
%12 = icmp ne i64 %5, 0
%13 = select i1 %11, i1 %12, i1 false
%14 = icmp ne i64 %7, 0
%15 = select i1 %13, i1 %14, i1 false
%16 = icmp ne i64 %9, 0
%17 = select i1 %15, i1 %16, i1 false
%18 = zext i1 %17 to i32
%19 = tail call i32 @assert(i32 %18)
br label %20
20: ; preds = %2, %20
%21 = phi i32 [ 0, %2 ], [ %26, %20 ]
%22 = tail call i32 @init_array(i32 64, double* %4, double* %6)
%23 = tail call i32 @compute_W(i32 64, double* %8, double* %10)
%24 = tail call i32 @fft(i32 64, double* %4, double* %6, double* %8, double* %10)
%25 = tail call i32 @permute_bitrev(i32 64, double* %4, double* %6)
%26 = add nuw nsw i32 %21, 1
%27 = icmp eq i32 %26, 10000000
br i1 %27, label %28, label %20
28: ; preds = %20
%29 = tail call i32 @free(double* %4)
%30 = tail call i32 @free(double* %6)
%31 = tail call i32 @free(double* %8)
%32 = tail call i32 @free(double* %10)
%33 = tail call i32 @exit(i32 0)
unreachable
}