#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_1d(double *, int, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ perfPoll(int /*<<< orphan*/);
scalar_t__ rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
void main() {
  double *input;
  input = (double *)malloc(sizeof(double) * (1024 * 1024));
  srand(0);
  int i;
  for (i = 0; i < (1024 * 1024); i++) {
    input[i] = (double)rand();
  }
  perfPoll(0);
  for (i = 0; i < 200; i++) {
    fft_1d(input, (1024 * 1024) >> 1, 1);
  }
  perfPoll(0);
  for (;;) {
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x800000,%edi
call   1050 <malloc@plt>
mov    %rax,-0x8(%rbp)
xor    %edi,%edi
call   1030 <srand@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x100000,-0xc(%rbp)
jge    11a8 <main+0x58>
mov    $0x0,%al
call   1070 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1174 <main+0x24>
xor    %edi,%edi
call   1040 <perfPoll@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xc8,-0xc(%rbp)
jge    11e4 <main+0x94>
mov    -0x8(%rbp),%rdi
mov    $0x80000,%esi
mov    $0x1,%edx
call   1060 <fft_1d@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b6 <main+0x66>
xor    %edi,%edi
call   1040 <perfPoll@plt>
jmp    11eb <main+0x9b>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x800000,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
xor    %edi,%edi
call   1030 <srand@plt>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    $0x100000,%rbx
jne    1170 <main+0x20>
xor    %edi,%edi
call   1040 <perfPoll@plt>
mov    $0xc8,%ebx
xchg   %ax,%ax
mov    %r14,%rdi
mov    $0x80000,%esi
mov    $0x1,%edx
call   1060 <fft_1d@plt>
add    $0xffffffff,%ebx
jne    11a0 <main+0x50>
xor    %edi,%edi
call   1040 <perfPoll@plt>
xchg   %ax,%ax
jmp    11c0 <main+0x70>

LLVM IR (-O0):
define void @main() {
%1 = alloca double*
%2 = alloca i32
%3 = call i64 @malloc(i32 8388608)
%4 = inttoptr i64 %3 to double*
store double* %4, double** %1
%5 = call i32 @srand(i32 0)
store i32 0, i32* %2
br label %6
6: ; preds = %16, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 1048576
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = call i64 (...) @rand()
%11 = sitofp i64 %10 to double
%12 = load double*, double** %1
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds double, double* %12, i64 %14
store double %11, double* %15
br label %16
16: ; preds = %9
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %6
19: ; preds = %6
%20 = call i32 @perfPoll(i32 0)
store i32 0, i32* %2
br label %21
21: ; preds = %27, %19
%22 = load i32, i32* %2
%23 = icmp slt i32 %22, 200
br i1 %23, label %24, label %30
24: ; preds = %21
%25 = load double*, double** %1
%26 = call i32 @fft_1d(double* %25, i32 524288, i32 1)
br label %27
27: ; preds = %24
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 1
store i32 %29, i32* %2
br label %21
30: ; preds = %21
%31 = call i32 @perfPoll(i32 0)
br label %32
32: ; preds = %32, %30
br label %32
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i64 @malloc(i32 8388608)
%2 = inttoptr i64 %1 to double*
%3 = tail call i32 @srand(i32 0)
br label %4
4: ; preds = %0, %4
%5 = phi i64 [ 0, %0 ], [ %9, %4 ]
%6 = tail call i64 (...) @rand()
%7 = sitofp i64 %6 to double
%8 = getelementptr inbounds double, double* %2, i64 %5
store double %7, double* %8
%9 = add nuw nsw i64 %5, 1
%10 = icmp eq i64 %9, 1048576
br i1 %10, label %11, label %4
11: ; preds = %4
%12 = tail call i32 @perfPoll(i32 0)
br label %13
13: ; preds = %11, %13
%14 = phi i32 [ 0, %11 ], [ %16, %13 ]
%15 = tail call i32 @fft_1d(double* %2, i32 524288, i32 1)
%16 = add nuw nsw i32 %14, 1
%17 = icmp eq i32 %16, 200
br i1 %17, label %18, label %13
18: ; preds = %13
%19 = tail call i32 @perfPoll(i32 0)
br label %20
20: ; preds = %20, %18
br label %20
}