#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 */
unsigned int atoi(char *);
float cos(float);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fft_float(unsigned int, int, float *, float *, float *,
                             float *);
int /*<<< orphan*/ free(float *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int rand();
float sin(float);
int /*<<< orphan*/ srand(int);
int /*<<< orphan*/ strncmp(char *, char *, int);
int startup(int argc, char *argv[]) {
  unsigned MAXSIZE;
  unsigned MAXWAVES;
  unsigned i, j;
  float *RealIn;
  float *ImagIn;
  float *RealOut;
  float *ImagOut;
  float *coeff;
  float *amp;
  int invfft = 0;
  if (argc < 3) {
    printf("Usage: fft <waves> <length> -i\n");
    printf("-i performs an inverse fft\n");
    printf("make <waves> random sinusoids");
    printf("<length> is the number of samples\n");
    exit(-1);
  } else if (argc == 4)
    invfft = !strncmp(argv[3], "-i", 2);
  MAXSIZE = atoi(argv[2]);
  MAXWAVES = atoi(argv[1]);
  srand(1);
  RealIn = (float *)malloc(sizeof(float) * MAXSIZE);
  ImagIn = (float *)malloc(sizeof(float) * MAXSIZE);
  RealOut = (float *)malloc(sizeof(float) * MAXSIZE);
  ImagOut = (float *)malloc(sizeof(float) * MAXSIZE);
  coeff = (float *)malloc(sizeof(float) * MAXWAVES);
  amp = (float *)malloc(sizeof(float) * MAXWAVES);
  for (i = 0; i < MAXWAVES; i++) {
    coeff[i] = rand() % 1000;
    amp[i] = rand() % 1000;
  }
  for (i = 0; i < MAXSIZE; i++) {
    RealIn[i] = 0;
    for (j = 0; j < MAXWAVES; j++) {
      if (rand() % 2) {
        RealIn[i] += coeff[j] * cos(amp[j] * i);
      } else {
        RealIn[i] += coeff[j] * sin(amp[j] * i);
      }
      ImagIn[i] = 0;
    }
  }
  fft_float(MAXSIZE, invfft, RealIn, ImagIn, RealOut, ImagOut);
  printf("RealOut:\n");
  for (i = 0; i < MAXSIZE; i++)
    printf("%f \t", RealOut[i]);
  printf("\n");
  printf("ImagOut:\n");
  for (i = 0; i < MAXSIZE; i++)
    printf("%f \t", ImagOut[i]);
  printf("\n");
  free(RealIn);
  free(ImagIn);
  free(RealOut);
  free(ImagOut);
  free(coeff);
  free(amp);
  exit(0);
}


x86 assembly (clang, -O0):
<startup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x54(%rbp)
cmpl   $0x3,-0x4(%rbp)
jge    1212 <startup+0x62>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
cmpl   $0x4,-0x4(%rbp)
jne    1245 <startup+0x95>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xe52(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x54(%rbp)
jmp    124a <startup+0x9a>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    $0x1,%edi
call   1060 <srand@plt>
mov    -0x14(%rbp),%eax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x2,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jae    133f <startup+0x18f>
mov    $0x0,%al
call   10d0 <rand@plt>
mov    $0x3e8,%ecx
cltd
idiv   %ecx
cvtsi2ss %edx,%xmm0
mov    -0x48(%rbp),%rax
mov    -0x1c(%rbp),%ecx
movss  %xmm0,(%rax,%rcx,4)
mov    $0x0,%al
call   10d0 <rand@plt>
mov    $0x3e8,%ecx
cltd
idiv   %ecx
cvtsi2ss %edx,%xmm0
mov    -0x50(%rbp),%rax
mov    -0x1c(%rbp),%ecx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12e7 <startup+0x137>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    1459 <startup+0x2a9>
mov    -0x28(%rbp),%rax
mov    -0x1c(%rbp),%ecx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jae    1446 <startup+0x296>
mov    $0x0,%al
call   10d0 <rand@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     13dd <startup+0x22d>
mov    -0x48(%rbp),%rax
mov    -0x20(%rbp),%ecx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x58(%rbp)
mov    -0x50(%rbp),%rax
movss  (%rax,%rcx,4),%xmm0
mov    -0x1c(%rbp),%eax
cvtsi2ss %rax,%xmm1
mulss  %xmm1,%xmm0
call   10a0 <cos@plt>
movaps %xmm0,%xmm2
movss  -0x58(%rbp),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x1c(%rbp),%ecx
movss  (%rax,%rcx,4),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,(%rax,%rcx,4)
jmp    1429 <startup+0x279>
mov    -0x48(%rbp),%rax
mov    -0x20(%rbp),%ecx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x5c(%rbp)
mov    -0x50(%rbp),%rax
movss  (%rax,%rcx,4),%xmm0
mov    -0x1c(%rbp),%eax
cvtsi2ss %rax,%xmm1
mulss  %xmm1,%xmm0
call   1070 <sin@plt>
movaps %xmm0,%xmm2
movss  -0x5c(%rbp),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x1c(%rbp),%ecx
movss  (%rax,%rcx,4),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x30(%rbp),%rax
mov    -0x1c(%rbp),%ecx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1368 <startup+0x1b8>
jmp    144b <startup+0x29b>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1346 <startup+0x196>
mov    -0x14(%rbp),%edi
mov    -0x54(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%r8
mov    -0x40(%rbp),%r9
call   1080 <fft_float@plt>
lea    0xc05(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    14c1 <startup+0x311>
mov    -0x38(%rbp),%rax
mov    -0x1c(%rbp),%ecx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xbde(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1489 <startup+0x2d9>
lea    0xbcf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xbb9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    151c <startup+0x36c>
mov    -0x40(%rbp),%rax
mov    -0x1c(%rbp),%ecx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xb83(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    14e4 <startup+0x334>
lea    0xb74(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@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>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

x86 assembly (clang, -O2):
<startup>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
cmp    $0x2,%edi
jg     121f <startup+0x4f>
lea    0xe4b(%rip),%rdi
call   1060 <puts@plt>
lea    0xe5e(%rip),%rdi
call   1060 <puts@plt>
lea    0xdfe(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe5f(%rip),%rdi
call   1060 <puts@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
mov    %rsi,%rbx
xor    %ecx,%ecx
cmp    $0x4,%edi
jne    1245 <startup+0x75>
mov    0x18(%rbx),%rdi
lea    0xe1d(%rip),%rsi
mov    $0x2,%edx
call   1050 <strncmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,0x10(%rsp)
mov    0x10(%rbx),%rdi
call   10d0 <atoi@plt>
mov    %eax,%ebp
mov    0x8(%rbx),%rdi
call   10d0 <atoi@plt>
mov    %eax,%r15d
mov    $0x1,%edi
call   1080 <srand@plt>
mov    %rbp,0x20(%rsp)
lea    0x0(,%rbp,4),%ebp
mov    %ebp,%edi
call   10b0 <malloc@plt>
mov    %rax,%rbx
mov    %ebp,%edi
call   10b0 <malloc@plt>
mov    %rax,0x18(%rsp)
mov    %ebp,%edi
call   10b0 <malloc@plt>
mov    %rax,%r13
mov    %ebp,%edi
call   10b0 <malloc@plt>
mov    %rax,0x8(%rsp)
lea    0x0(,%r15,4),%ebp
mov    %ebp,%edi
call   10b0 <malloc@plt>
mov    %rax,%r14
mov    %ebp,%edi
call   10b0 <malloc@plt>
mov    %rax,0x28(%rsp)
mov    %r15d,%r12d
mov    %r15,0x40(%rsp)
test   %r15d,%r15d
je     1341 <startup+0x171>
xor    %ebp,%ebp
nop
xor    %eax,%eax
call   10f0 <rand@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,(%r14,%rbp,4)
xor    %eax,%eax
call   10f0 <rand@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mov    0x28(%rsp),%rax
movss  %xmm0,(%rax,%rbp,4)
add    $0x1,%rbp
cmp    %rbp,%r12
jne    12d0 <startup+0x100>
mov    0x20(%rsp),%rdi
test   %edi,%edi
mov    %r13,0x38(%rsp)
jne    1379 <startup+0x1a9>
mov    0x10(%rsp),%esi
mov    %rbx,%rdx
mov    0x18(%rsp),%rcx
mov    %r13,%r8
mov    0x8(%rsp),%r9
call   10a0 <fft_float@plt>
lea    0xcb4(%rip),%rdi
call   1060 <puts@plt>
jmp    14ad <startup+0x2dd>
mov    %edi,%ecx
xor    %r15d,%r15d
mov    0x8(%rsp),%r9
mov    %rcx,%r13
jmp    139d <startup+0x1cd>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15
cmp    %rcx,%r15
je     143a <startup+0x26a>
movl   $0x0,(%rbx,%r15,4)
cmpl   $0x0,0x40(%rsp)
je     1390 <startup+0x1c0>
mov    %r15d,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  %xmm0,0x34(%rsp)
xor    %ebp,%ebp
jmp    1409 <startup+0x239>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
call   1090 <sin@plt>
movss  0x14(%rsp),%xmm1
mov    0x8(%rsp),%r9
mov    %r13,%rcx
mulss  %xmm0,%xmm1
addss  (%rbx,%r15,4),%xmm1
movss  %xmm1,(%rbx,%r15,4)
mov    0x18(%rsp),%rax
movl   $0x0,(%rax,%r15,4)
add    $0x1,%rbp
cmp    %rbp,%r12
je     1390 <startup+0x1c0>
xor    %eax,%eax
call   10f0 <rand@plt>
mov    %r14,%rcx
movss  (%r14,%rbp,4),%xmm1
mov    0x28(%rsp),%rcx
movss  (%rcx,%rbp,4),%xmm0
mulss  0x34(%rsp),%xmm0
test   $0x1,%al
movss  %xmm1,0x14(%rsp)
je     13d0 <startup+0x200>
call   10c0 <cos@plt>
jmp    13d5 <startup+0x205>
mov    0x20(%rsp),%rbp
mov    %ebp,%edi
mov    0x10(%rsp),%esi
mov    %rbx,%rdx
mov    0x18(%rsp),%rcx
mov    0x38(%rsp),%r15
mov    %r15,%r8
call   10a0 <fft_float@plt>
lea    0xbc2(%rip),%rdi
call   1060 <puts@plt>
test   %ebp,%ebp
jne    1487 <startup+0x2b7>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xbb1(%rip),%rdi
call   1060 <puts@plt>
mov    0x8(%rsp),%r13
jmp    14fe <startup+0x32e>
xor    %ebp,%ebp
lea    0xb8e(%rip),%r12
movss  (%r15,%rbp,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1070 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1490 <startup+0x2c0>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xb6e(%rip),%rdi
call   1060 <puts@plt>
mov    0x20(%rsp),%rax
test   %eax,%eax
mov    0x8(%rsp),%r13
je     14fe <startup+0x32e>
mov    %eax,%r12d
xor    %ebp,%ebp
lea    0xb41(%rip),%r15
nopl   (%rax)
movss  0x0(%r13,%rbp,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1070 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    14e0 <startup+0x310>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    0x38(%rsp),%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x28(%rsp),%rdi
call   1030 <free@plt>
xor    %edi,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Usage: fft <waves> <length> -i\0A\00"
@.str.1 = [28 x i8] c"-i performs an inverse fft\0A\00"
@.str.2 = [30 x i8] c"make <waves> random sinusoids\00"
@.str.3 = [35 x i8] c"<length> is the number of samples\0A\00"
@.str.4 = [3 x i8] c"-i\00"
@.str.5 = [10 x i8] c"RealOut:\0A\00"
@.str.6 = [5 x i8] c"%f \09\00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [10 x i8] c"ImagOut:\0A\00"
define i32 @startup(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca float*
%10 = alloca float*
%11 = alloca float*
%12 = alloca float*
%13 = alloca float*
%14 = alloca float*
%15 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 0, i32* %15
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 3
br i1 %17, label %18, label %24
18: ; preds = %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%23 = call i32 @exit(i32 -1)
unreachable
24: ; preds = %2
%25 = load i32, i32* %3
%26 = icmp eq i32 %25, 4
br i1 %26, label %27, label %35
27: ; preds = %24
%28 = load i8**, i8*** %4
%29 = getelementptr inbounds i8*, i8** %28, i64 3
%30 = load i8*, i8** %29
%31 = call i32 @strncmp(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 2)
%32 = icmp ne i32 %31, 0
%33 = xor i1 %32, true
%34 = zext i1 %33 to i32
store i32 %34, i32* %15
br label %35
35: ; preds = %27, %24
br label %36
36: ; preds = %35
%37 = load i8**, i8*** %4
%38 = getelementptr inbounds i8*, i8** %37, i64 2
%39 = load i8*, i8** %38
%40 = call i32 @atoi(i8* %39)
store i32 %40, i32* %5
%41 = load i8**, i8*** %4
%42 = getelementptr inbounds i8*, i8** %41, i64 1
%43 = load i8*, i8** %42
%44 = call i32 @atoi(i8* %43)
store i32 %44, i32* %6
%45 = call i32 @srand(i32 1)
%46 = load i32, i32* %5
%47 = zext i32 %46 to i64
%48 = mul i64 4, %47
%49 = trunc i64 %48 to i32
%50 = call i64 @malloc(i32 %49)
%51 = inttoptr i64 %50 to float*
store float* %51, float** %9
%52 = load i32, i32* %5
%53 = zext i32 %52 to i64
%54 = mul i64 4, %53
%55 = trunc i64 %54 to i32
%56 = call i64 @malloc(i32 %55)
%57 = inttoptr i64 %56 to float*
store float* %57, float** %10
%58 = load i32, i32* %5
%59 = zext i32 %58 to i64
%60 = mul i64 4, %59
%61 = trunc i64 %60 to i32
%62 = call i64 @malloc(i32 %61)
%63 = inttoptr i64 %62 to float*
store float* %63, float** %11
%64 = load i32, i32* %5
%65 = zext i32 %64 to i64
%66 = mul i64 4, %65
%67 = trunc i64 %66 to i32
%68 = call i64 @malloc(i32 %67)
%69 = inttoptr i64 %68 to float*
store float* %69, float** %12
%70 = load i32, i32* %6
%71 = zext i32 %70 to i64
%72 = mul i64 4, %71
%73 = trunc i64 %72 to i32
%74 = call i64 @malloc(i32 %73)
%75 = inttoptr i64 %74 to float*
store float* %75, float** %13
%76 = load i32, i32* %6
%77 = zext i32 %76 to i64
%78 = mul i64 4, %77
%79 = trunc i64 %78 to i32
%80 = call i64 @malloc(i32 %79)
%81 = inttoptr i64 %80 to float*
store float* %81, float** %14
store i32 0, i32* %7
br label %82
82: ; preds = %101, %36
%83 = load i32, i32* %7
%84 = load i32, i32* %6
%85 = icmp ult i32 %83, %84
br i1 %85, label %86, label %104
86: ; preds = %82
%87 = call i32 (...) @rand()
%88 = srem i32 %87, 1000
%89 = sitofp i32 %88 to float
%90 = load float*, float** %13
%91 = load i32, i32* %7
%92 = zext i32 %91 to i64
%93 = getelementptr inbounds float, float* %90, i64 %92
store float %89, float* %93
%94 = call i32 (...) @rand()
%95 = srem i32 %94, 1000
%96 = sitofp i32 %95 to float
%97 = load float*, float** %14
%98 = load i32, i32* %7
%99 = zext i32 %98 to i64
%100 = getelementptr inbounds float, float* %97, i64 %99
store float %96, float* %100
br label %101
101: ; preds = %86
%102 = load i32, i32* %7
%103 = add i32 %102, 1
store i32 %103, i32* %7
br label %82
104: ; preds = %82
store i32 0, i32* %7
br label %105
105: ; preds = %173, %104
%106 = load i32, i32* %7
%107 = load i32, i32* %5
%108 = icmp ult i32 %106, %107
br i1 %108, label %109, label %176
109: ; preds = %105
%110 = load float*, float** %9
%111 = load i32, i32* %7
%112 = zext i32 %111 to i64
%113 = getelementptr inbounds float, float* %110, i64 %112
store float 0.000000e+00, float* %113
store i32 0, i32* %8
br label %114
114: ; preds = %169, %109
%115 = load i32, i32* %8
%116 = load i32, i32* %6
%117 = icmp ult i32 %115, %116
br i1 %117, label %118, label %172
118: ; preds = %114
%119 = call i32 (...) @rand()
%120 = srem i32 %119, 2
%121 = icmp ne i32 %120, 0
br i1 %121, label %122, label %143
122: ; preds = %118
%123 = load float*, float** %13
%124 = load i32, i32* %8
%125 = zext i32 %124 to i64
%126 = getelementptr inbounds float, float* %123, i64 %125
%127 = load float, float* %126
%128 = load float*, float** %14
%129 = load i32, i32* %8
%130 = zext i32 %129 to i64
%131 = getelementptr inbounds float, float* %128, i64 %130
%132 = load float, float* %131
%133 = load i32, i32* %7
%134 = uitofp i32 %133 to float
%135 = fmul float %132, %134
%136 = call float @cos(float %135)
%137 = load float*, float** %9
%138 = load i32, i32* %7
%139 = zext i32 %138 to i64
%140 = getelementptr inbounds float, float* %137, i64 %139
%141 = load float, float* %140
%142 = call float @llvm.fmuladd.f32(float %127, float %136, float %141)
store float %142, float* %140
br label %164
143: ; preds = %118
%144 = load float*, float** %13
%145 = load i32, i32* %8
%146 = zext i32 %145 to i64
%147 = getelementptr inbounds float, float* %144, i64 %146
%148 = load float, float* %147
%149 = load float*, float** %14
%150 = load i32, i32* %8
%151 = zext i32 %150 to i64
%152 = getelementptr inbounds float, float* %149, i64 %151
%153 = load float, float* %152
%154 = load i32, i32* %7
%155 = uitofp i32 %154 to float
%156 = fmul float %153, %155
%157 = call float @sin(float %156)
%158 = load float*, float** %9
%159 = load i32, i32* %7
%160 = zext i32 %159 to i64
%161 = getelementptr inbounds float, float* %158, i64 %160
%162 = load float, float* %161
%163 = call float @llvm.fmuladd.f32(float %148, float %157, float %162)
store float %163, float* %161
br label %164
164: ; preds = %143, %122
%165 = load float*, float** %10
%166 = load i32, i32* %7
%167 = zext i32 %166 to i64
%168 = getelementptr inbounds float, float* %165, i64 %167
store float 0.000000e+00, float* %168
br label %169
169: ; preds = %164
%170 = load i32, i32* %8
%171 = add i32 %170, 1
store i32 %171, i32* %8
br label %114
172: ; preds = %114
br label %173
173: ; preds = %172
%174 = load i32, i32* %7
%175 = add i32 %174, 1
store i32 %175, i32* %7
br label %105
176: ; preds = %105
%177 = load i32, i32* %5
%178 = load i32, i32* %15
%179 = load float*, float** %9
%180 = load float*, float** %10
%181 = load float*, float** %11
%182 = load float*, float** %12
%183 = call i32 @fft_float(i32 %177, i32 %178, float* %179, float* %180, float* %181, float* %182)
%184 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %7
br label %185
185: ; preds = %197, %176
%186 = load i32, i32* %7
%187 = load i32, i32* %5
%188 = icmp ult i32 %186, %187
br i1 %188, label %189, label %200
189: ; preds = %185
%190 = load float*, float** %11
%191 = load i32, i32* %7
%192 = zext i32 %191 to i64
%193 = getelementptr inbounds float, float* %190, i64 %192
%194 = load float, float* %193
%195 = fpext float %194 to double
%196 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), double %195)
br label %197
197: ; preds = %189
%198 = load i32, i32* %7
%199 = add i32 %198, 1
store i32 %199, i32* %7
br label %185
200: ; preds = %185
%201 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%202 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %7
br label %203
203: ; preds = %215, %200
%204 = load i32, i32* %7
%205 = load i32, i32* %5
%206 = icmp ult i32 %204, %205
br i1 %206, label %207, label %218
207: ; preds = %203
%208 = load float*, float** %12
%209 = load i32, i32* %7
%210 = zext i32 %209 to i64
%211 = getelementptr inbounds float, float* %208, i64 %210
%212 = load float, float* %211
%213 = fpext float %212 to double
%214 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), double %213)
br label %215
215: ; preds = %207
%216 = load i32, i32* %7
%217 = add i32 %216, 1
store i32 %217, i32* %7
br label %203
218: ; preds = %203
%219 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%220 = load float*, float** %9
%221 = call i32 @free(float* %220)
%222 = load float*, float** %10
%223 = call i32 @free(float* %222)
%224 = load float*, float** %11
%225 = call i32 @free(float* %224)
%226 = load float*, float** %12
%227 = call i32 @free(float* %226)
%228 = load float*, float** %13
%229 = call i32 @free(float* %228)
%230 = load float*, float** %14
%231 = call i32 @free(float* %230)
%232 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str.2 = [30 x i8] c"make <waves> random sinusoids\00"
@.str.4 = [3 x i8] c"-i\00"
@.str.6 = [5 x i8] c"%f \09\00"
@str = [9 x i8] c"RealOut:\00"
@str.9 = [9 x i8] c"ImagOut:\00"
@str.10 = [31 x i8] c"Usage: fft <waves> <length> -i\00"
@str.11 = [27 x i8] c"-i performs an inverse fft\00"
@str.12 = [34 x i8] c"<length> is the number of samples\00"
define i32 @startup(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %10
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.10, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.11, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.12, i64 0, i64 0))
%9 = tail call i32 @exit(i32 -1)
unreachable
10: ; preds = %2
%11 = icmp eq i32 %0, 4
br i1 %11, label %12, label %18
12: ; preds = %10
%13 = getelementptr inbounds i8*, i8** %1, i64 3
%14 = load i8*, i8** %13
%15 = tail call i32 @strncmp(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 2)
%16 = icmp eq i32 %15, 0
%17 = zext i1 %16 to i32
br label %18
18: ; preds = %10, %12
%19 = phi i32 [ %17, %12 ], [ 0, %10 ]
%20 = getelementptr inbounds i8*, i8** %1, i64 2
%21 = load i8*, i8** %20
%22 = tail call i32 @atoi(i8* %21)
%23 = getelementptr inbounds i8*, i8** %1, i64 1
%24 = load i8*, i8** %23
%25 = tail call i32 @atoi(i8* %24)
%26 = tail call i32 @srand(i32 1)
%27 = shl i32 %22, 2
%28 = tail call i64 @malloc(i32 %27)
%29 = inttoptr i64 %28 to float*
%30 = tail call i64 @malloc(i32 %27)
%31 = inttoptr i64 %30 to float*
%32 = tail call i64 @malloc(i32 %27)
%33 = inttoptr i64 %32 to float*
%34 = tail call i64 @malloc(i32 %27)
%35 = inttoptr i64 %34 to float*
%36 = shl i32 %25, 2
%37 = tail call i64 @malloc(i32 %36)
%38 = inttoptr i64 %37 to float*
%39 = tail call i64 @malloc(i32 %36)
%40 = inttoptr i64 %39 to float*
%41 = icmp eq i32 %25, 0
br i1 %41, label %44, label %42
42: ; preds = %18
%43 = zext i32 %25 to i64
br label %49
44: ; preds = %49, %18
%45 = icmp eq i32 %22, 0
br i1 %45, label %104, label %46
46: ; preds = %44
%47 = zext i32 %22 to i64
%48 = zext i32 %25 to i64
br label %61
49: ; preds = %42, %49
%50 = phi i64 [ 0, %42 ], [ %59, %49 ]
%51 = tail call i32 (...) @rand()
%52 = srem i32 %51, 1000
%53 = sitofp i32 %52 to float
%54 = getelementptr inbounds float, float* %38, i64 %50
store float %53, float* %54
%55 = tail call i32 (...) @rand()
%56 = srem i32 %55, 1000
%57 = sitofp i32 %56 to float
%58 = getelementptr inbounds float, float* %40, i64 %50
store float %57, float* %58
%59 = add nuw nsw i64 %50, 1
%60 = icmp eq i64 %59, %43
br i1 %60, label %44, label %49
61: ; preds = %46, %88
%62 = phi i64 [ 0, %46 ], [ %89, %88 ]
%63 = getelementptr inbounds float, float* %29, i64 %62
store float 0.000000e+00, float* %63
br i1 %41, label %88, label %64
64: ; preds = %61
%65 = trunc i64 %62 to i32
%66 = uitofp i32 %65 to float
%67 = getelementptr inbounds float, float* %31, i64 %62
br label %68
68: ; preds = %64, %82
%69 = phi i64 [ 0, %64 ], [ %86, %82 ]
%70 = tail call i32 (...) @rand()
%71 = and i32 %70, 1
%72 = icmp eq i32 %71, 0
%73 = getelementptr inbounds float, float* %38, i64 %69
%74 = load float, float* %73
%75 = getelementptr inbounds float, float* %40, i64 %69
%76 = load float, float* %75
%77 = fmul float %76, %66
br i1 %72, label %80, label %78
78: ; preds = %68
%79 = tail call float @cos(float %77)
br label %82
80: ; preds = %68
%81 = tail call float @sin(float %77)
br label %82
82: ; preds = %80, %78
%83 = phi float [ %81, %80 ], [ %79, %78 ]
%84 = load float, float* %63
%85 = tail call float @llvm.fmuladd.f32(float %74, float %83, float %84)
store float %85, float* %63
store float 0.000000e+00, float* %67
%86 = add nuw nsw i64 %69, 1
%87 = icmp eq i64 %86, %48
br i1 %87, label %88, label %68
88: ; preds = %82, %61
%89 = add nuw nsw i64 %62, 1
%90 = icmp eq i64 %89, %47
br i1 %90, label %91, label %61
91: ; preds = %88
%92 = tail call i32 @fft_float(i32 %22, i32 %19, float* %29, float* %31, float* %33, float* %35)
%93 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
br i1 %45, label %120, label %94
94: ; preds = %91
%95 = zext i32 %22 to i64
br label %96
96: ; preds = %94, %96
%97 = phi i64 [ 0, %94 ], [ %102, %96 ]
%98 = getelementptr inbounds float, float* %33, i64 %97
%99 = load float, float* %98
%100 = fpext float %99 to double
%101 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), double %100)
%102 = add nuw nsw i64 %97, 1
%103 = icmp eq i64 %102, %95
br i1 %103, label %107, label %96
104: ; preds = %44
%105 = tail call i32 @fft_float(i32 %22, i32 %19, float* %29, float* %31, float* %33, float* %35)
%106 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
br label %107
107: ; preds = %96, %104
%108 = tail call i32 @putchar(i32 10)
%109 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.9, i64 0, i64 0))
br i1 %45, label %123, label %110
110: ; preds = %107
%111 = zext i32 %22 to i64
br label %112
112: ; preds = %110, %112
%113 = phi i64 [ 0, %110 ], [ %118, %112 ]
%114 = getelementptr inbounds float, float* %35, i64 %113
%115 = load float, float* %114
%116 = fpext float %115 to double
%117 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), double %116)
%118 = add nuw nsw i64 %113, 1
%119 = icmp eq i64 %118, %111
br i1 %119, label %123, label %112
120: ; preds = %91
%121 = tail call i32 @putchar(i32 10)
%122 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.9, i64 0, i64 0))
br label %123
123: ; preds = %112, %120, %107
%124 = tail call i32 @putchar(i32 10)
%125 = tail call i32 @free(float* %29)
%126 = tail call i32 @free(float* %31)
%127 = tail call i32 @free(float* %33)
%128 = tail call i32 @free(float* %35)
%129 = tail call i32 @free(float* %38)
%130 = tail call i32 @free(float* %40)
%131 = tail call i32 @exit(i32 0)
unreachable
}