#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 /*<<< orphan*/ print_string(char *);
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 < 3; 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);
    print_string("done");
  }
  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   1090 <malloc@plt>
mov    %rax,-0x20(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x28(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
shr    $0x1,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x30(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
shr    $0x1,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x38(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x20(%rbp)
mov    %al,-0x39(%rbp)
je     123c <main+0xac>
xor    %eax,%eax
cmpq   $0x0,-0x28(%rbp)
mov    %al,-0x39(%rbp)
je     123c <main+0xac>
xor    %eax,%eax
cmpq   $0x0,-0x30(%rbp)
mov    %al,-0x39(%rbp)
je     123c <main+0xac>
cmpq   $0x0,-0x38(%rbp)
setne  %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    12bc <main+0x12c>
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   10b0 <fft@plt>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1050 <permute_bitrev@plt>
lea    0xd57(%rip),%rdi
call   1070 <print_string@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1250 <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   10a0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    $0x200,%edi
call   1090 <malloc@plt>
mov    %rax,%r14
mov    $0x200,%edi
call   1090 <malloc@plt>
mov    %rax,%rbx
mov    $0x100,%edi
call   1090 <malloc@plt>
mov    %rax,%r15
mov    $0x100,%edi
call   1090 <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   1080 <assert@plt>
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   10b0 <fft@plt>
mov    $0x40,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <permute_bitrev@plt>
lea    0xdc0(%rip),%r13
mov    %r13,%rdi
call   1070 <print_string@plt>
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   10b0 <fft@plt>
mov    $0x40,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <permute_bitrev@plt>
mov    %r13,%rdi
call   1070 <print_string@plt>
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   10b0 <fft@plt>
mov    $0x40,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <permute_bitrev@plt>
mov    %r13,%rdi
call   1070 <print_string@plt>
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   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"done\00"
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 = %76, %49
%54 = load i32, i32* %7
%55 = icmp slt i32 %54, 3
br i1 %55, label %56, label %79
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)
%75 = call i32 @print_string(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %76
76: ; preds = %56
%77 = load i32, i32* %7
%78 = add nsw i32 %77, 1
store i32 %78, i32* %7
br label %53
79: ; preds = %53
%80 = load double*, double** %8
%81 = call i32 @free(double* %80)
%82 = load double*, double** %9
%83 = call i32 @free(double* %82)
%84 = load double*, double** %10
%85 = call i32 @free(double* %84)
%86 = load double*, double** %11
%87 = call i32 @free(double* %86)
%88 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [5 x i8] c"done\00"
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)
%20 = tail call i32 @init_array(i32 64, double* %4, double* %6)
%21 = tail call i32 @compute_W(i32 64, double* %8, double* %10)
%22 = tail call i32 @fft(i32 64, double* %4, double* %6, double* %8, double* %10)
%23 = tail call i32 @permute_bitrev(i32 64, double* %4, double* %6)
%24 = tail call i32 @print_string(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%25 = tail call i32 @init_array(i32 64, double* %4, double* %6)
%26 = tail call i32 @compute_W(i32 64, double* %8, double* %10)
%27 = tail call i32 @fft(i32 64, double* %4, double* %6, double* %8, double* %10)
%28 = tail call i32 @permute_bitrev(i32 64, double* %4, double* %6)
%29 = tail call i32 @print_string(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%30 = tail call i32 @init_array(i32 64, double* %4, double* %6)
%31 = tail call i32 @compute_W(i32 64, double* %8, double* %10)
%32 = tail call i32 @fft(i32 64, double* %4, double* %6, double* %8, double* %10)
%33 = tail call i32 @permute_bitrev(i32 64, double* %4, double* %6)
%34 = tail call i32 @print_string(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%35 = tail call i32 @free(double* %4)
%36 = tail call i32 @free(double* %6)
%37 = tail call i32 @free(double* %8)
%38 = tail call i32 @free(double* %10)
%39 = tail call i32 @exit(i32 0)
unreachable
}