#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*/ fft1D_512(double *, double *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  double a_x[512];
  double a_y[512];
  int i;
  float max, min;
  max = 2147483646.0;
  min = -2147483646.0;
  for (i = 0; i < 512; i++) {
    a_x[i] = (double)(i);
    a_y[i] = (double)(i);
  }
  printf("ORIG!\n");
  for (i = 0; i < 512; i++) {
    printf("x = %f y = %f \n", a_x[i], a_y[i]);
  }
  fft1D_512(a_x, a_y);
  printf("OUTPUT\n");
  for (i = 0; i < 512; i++) {
    printf("x = %f y = %f \n", a_x[i], a_y[i]);
  }
  fft1D_512(a_x, a_y);
  printf("NORMAL\n");
  for (i = 0; i < 512; i++) {
    printf("x = %f y = %f \n", a_x[i] / 512, a_y[i] / 512);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2020,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xeca(%rip),%xmm0
movss  %xmm0,-0x2018(%rbp)
ff
movss  0xeb6(%rip),%xmm0
movss  %xmm0,-0x201c(%rbp)
ff
movl   $0x0,-0x2014(%rbp)
cmpl   $0x200,-0x2014(%rbp)
jge    11b0 <main+0x90>
cvtsi2sdl -0x2014(%rbp),%xmm0
ff
movslq -0x2014(%rbp),%rax
movsd  %xmm0,-0x1010(%rbp,%rax,8)
ff ff
cvtsi2sdl -0x2014(%rbp),%xmm0
ff
movslq -0x2014(%rbp),%rax
movsd  %xmm0,-0x2010(%rbp,%rax,8)
ff ff
mov    -0x2014(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2014(%rbp)
jmp    115c <main+0x3c>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2014(%rbp)
cmpl   $0x200,-0x2014(%rbp)
jge    121a <main+0xfa>
movslq -0x2014(%rbp),%rax
movsd  -0x1010(%rbp,%rax,8),%xmm0
ff ff
movslq -0x2014(%rbp),%rax
movsd  -0x2010(%rbp,%rax,8),%xmm1
ff ff
lea    0xe18(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x2014(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2014(%rbp)
jmp    11c8 <main+0xa8>
lea    -0x1010(%rbp),%rdi
lea    -0x2010(%rbp),%rsi
call   1040 <fft1D_512@plt>
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2014(%rbp)
cmpl   $0x200,-0x2014(%rbp)
jge    1297 <main+0x177>
movslq -0x2014(%rbp),%rax
movsd  -0x1010(%rbp,%rax,8),%xmm0
ff ff
movslq -0x2014(%rbp),%rax
movsd  -0x2010(%rbp,%rax,8),%xmm1
ff ff
lea    0xd9b(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x2014(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2014(%rbp)
jmp    1245 <main+0x125>
lea    -0x1010(%rbp),%rdi
lea    -0x2010(%rbp),%rsi
call   1040 <fft1D_512@plt>
lea    0xd7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2014(%rbp)
cmpl   $0x200,-0x2014(%rbp)
jge    132c <main+0x20c>
movslq -0x2014(%rbp),%rax
movsd  -0x1010(%rbp,%rax,8),%xmm0
ff ff
movsd  0xd1e(%rip),%xmm1
divsd  %xmm1,%xmm0
movslq -0x2014(%rbp),%rax
movsd  -0x2010(%rbp,%rax,8),%xmm1
ff ff
movsd  0xd02(%rip),%xmm2
divsd  %xmm2,%xmm1
lea    0xd06(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x2014(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2014(%rbp)
jmp    12c2 <main+0x1a2>
xor    %eax,%eax
add    $0x2020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x2008,%rsp
movdqa 0xebe(%rip),%xmm0
xor    %eax,%eax
movdqa 0xec4(%rip),%xmm1
movdqa 0xecc(%rip),%xmm2
movdqa 0xed4(%rip),%xmm3
movdqa 0xedc(%rip),%xmm4
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movdqa %xmm0,%xmm5
cvtdq2pd %xmm0,%xmm6
paddd  %xmm1,%xmm5
cvtdq2pd %xmm5,%xmm5
movaps %xmm6,0x1000(%rsp,%rax,8)
movaps %xmm5,0x1010(%rsp,%rax,8)
movaps %xmm6,(%rsp,%rax,8)
movdqa %xmm0,%xmm6
paddd  %xmm2,%xmm6
movdqa %xmm0,%xmm7
paddd  %xmm3,%xmm7
cvtdq2pd %xmm6,%xmm6
cvtdq2pd %xmm7,%xmm7
movaps %xmm5,0x10(%rsp,%rax,8)
movaps %xmm6,0x1020(%rsp,%rax,8)
movaps %xmm7,0x1030(%rsp,%rax,8)
movaps %xmm6,0x20(%rsp,%rax,8)
movaps %xmm7,0x30(%rsp,%rax,8)
add    $0x8,%rax
paddd  %xmm4,%xmm0
cmp    $0x200,%rax
jne    1170 <main+0x40>
lea    0xe86(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
lea    0xe68(%rip),%r14
movq   0x1000(%rsp,%rbx,8),%xmm0
movq   (%rsp,%rbx,8),%xmm1
mov    %r14,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x200,%rbx
jne    11f0 <main+0xc0>
lea    0x1000(%rsp),%rdi
mov    %rsp,%rsi
call   1050 <fft1D_512@plt>
lea    0xe42(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
lea    0xe1e(%rip),%r14
nopw   0x0(%rax,%rax,1)
movq   0x1000(%rsp,%rbx,8),%xmm0
movq   (%rsp,%rbx,8),%xmm1
mov    %r14,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x200,%rbx
jne    1240 <main+0x110>
lea    0x1000(%rsp),%rdi
mov    %rsp,%rsi
call   1050 <fft1D_512@plt>
lea    0xdf9(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
lea    0xdce(%rip),%r14
nopw   0x0(%rax,%rax,1)
movsd  0x1000(%rsp,%rbx,8),%xmm0
movsd  0xdaf(%rip),%xmm2
mulsd  %xmm2,%xmm0
movsd  (%rsp,%rbx,8),%xmm1
mulsd  %xmm2,%xmm1
mov    %r14,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x200,%rbx
jne    1290 <main+0x160>
xor    %eax,%eax
add    $0x2008,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"ORIG!\0A\00"
@.str.1 = [16 x i8] c"x = %f y = %f \0A\00"
@.str.2 = [8 x i8] c"OUTPUT\0A\00"
@.str.3 = [8 x i8] c"NORMAL\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [512 x double]
%3 = alloca [512 x double]
%4 = alloca i32
%5 = alloca float
%6 = alloca float
store i32 0, i32* %1
store float 0x41E0000000000000, float* %5
store float 0xC1E0000000000000, float* %6
store i32 0, i32* %4
br label %7
7: ; preds = %21, %0
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 512
br i1 %9, label %10, label %24
10: ; preds = %7
%11 = load i32, i32* %4
%12 = sitofp i32 %11 to double
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [512 x double], [512 x double]* %2, i64 0, i64 %14
store double %12, double* %15
%16 = load i32, i32* %4
%17 = sitofp i32 %16 to double
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [512 x double], [512 x double]* %3, i64 0, i64 %19
store double %17, double* %20
br label %21
21: ; preds = %10
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %7
24: ; preds = %7
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %26
26: ; preds = %39, %24
%27 = load i32, i32* %4
%28 = icmp slt i32 %27, 512
br i1 %28, label %29, label %42
29: ; preds = %26
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [512 x double], [512 x double]* %2, i64 0, i64 %31
%33 = load double, double* %32
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [512 x double], [512 x double]* %3, i64 0, i64 %35
%37 = load double, double* %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %33, double %37)
br label %39
39: ; preds = %29
%40 = load i32, i32* %4
%41 = add nsw i32 %40, 1
store i32 %41, i32* %4
br label %26
42: ; preds = %26
%43 = getelementptr inbounds [512 x double], [512 x double]* %2, i64 0, i64 0
%44 = getelementptr inbounds [512 x double], [512 x double]* %3, i64 0, i64 0
%45 = call i32 @fft1D_512(double* %43, double* %44)
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
br label %47
47: ; preds = %60, %42
%48 = load i32, i32* %4
%49 = icmp slt i32 %48, 512
br i1 %49, label %50, label %63
50: ; preds = %47
%51 = load i32, i32* %4
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [512 x double], [512 x double]* %2, i64 0, i64 %52
%54 = load double, double* %53
%55 = load i32, i32* %4
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [512 x double], [512 x double]* %3, i64 0, i64 %56
%58 = load double, double* %57
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %54, double %58)
br label %60
60: ; preds = %50
%61 = load i32, i32* %4
%62 = add nsw i32 %61, 1
store i32 %62, i32* %4
br label %47
63: ; preds = %47
%64 = getelementptr inbounds [512 x double], [512 x double]* %2, i64 0, i64 0
%65 = getelementptr inbounds [512 x double], [512 x double]* %3, i64 0, i64 0
%66 = call i32 @fft1D_512(double* %64, double* %65)
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %4
br label %68
68: ; preds = %83, %63
%69 = load i32, i32* %4
%70 = icmp slt i32 %69, 512
br i1 %70, label %71, label %86
71: ; preds = %68
%72 = load i32, i32* %4
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [512 x double], [512 x double]* %2, i64 0, i64 %73
%75 = load double, double* %74
%76 = fdiv double %75, 5.120000e+02
%77 = load i32, i32* %4
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [512 x double], [512 x double]* %3, i64 0, i64 %78
%80 = load double, double* %79
%81 = fdiv double %80, 5.120000e+02
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %76, double %81)
br label %83
83: ; preds = %71
%84 = load i32, i32* %4
%85 = add nsw i32 %84, 1
store i32 %85, i32* %4
br label %68
86: ; preds = %68
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [16 x i8] c"x = %f y = %f \0A\00"
@str = [6 x i8] c"ORIG!\00"
@str.4 = [7 x i8] c"OUTPUT\00"
@str.5 = [7 x i8] c"NORMAL\00"
define i32 @main() {
%1 = alloca [512 x double]
%2 = alloca [512 x double]
%3 = bitcast [512 x double]* %1 to i8*
%4 = bitcast [512 x double]* %2 to i8*
br label %5
5: ; preds = %5, %0
%6 = phi i64 [ 0, %0 ], [ %32, %5 ]
%7 = phi <2 x i32> [ <i32 0, i32 1>, %0 ], [ %33, %5 ]
%8 = add <2 x i32> %7, <i32 2, i32 2>
%9 = sitofp <2 x i32> %7 to <2 x double>
%10 = sitofp <2 x i32> %8 to <2 x double>
%11 = getelementptr inbounds [512 x double], [512 x double]* %1, i64 0, i64 %6
%12 = bitcast double* %11 to <2 x double>*
store <2 x double> %9, <2 x double>* %12
%13 = getelementptr inbounds double, double* %11, i64 2
%14 = bitcast double* %13 to <2 x double>*
store <2 x double> %10, <2 x double>* %14
%15 = getelementptr inbounds [512 x double], [512 x double]* %2, i64 0, i64 %6
%16 = bitcast double* %15 to <2 x double>*
store <2 x double> %9, <2 x double>* %16
%17 = getelementptr inbounds double, double* %15, i64 2
%18 = bitcast double* %17 to <2 x double>*
store <2 x double> %10, <2 x double>* %18
%19 = or i64 %6, 4
%20 = add <2 x i32> %7, <i32 4, i32 4>
%21 = add <2 x i32> %7, <i32 6, i32 6>
%22 = sitofp <2 x i32> %20 to <2 x double>
%23 = sitofp <2 x i32> %21 to <2 x double>
%24 = getelementptr inbounds [512 x double], [512 x double]* %1, i64 0, i64 %19
%25 = bitcast double* %24 to <2 x double>*
store <2 x double> %22, <2 x double>* %25
%26 = getelementptr inbounds double, double* %24, i64 2
%27 = bitcast double* %26 to <2 x double>*
store <2 x double> %23, <2 x double>* %27
%28 = getelementptr inbounds [512 x double], [512 x double]* %2, i64 0, i64 %19
%29 = bitcast double* %28 to <2 x double>*
store <2 x double> %22, <2 x double>* %29
%30 = getelementptr inbounds double, double* %28, i64 2
%31 = bitcast double* %30 to <2 x double>*
store <2 x double> %23, <2 x double>* %31
%32 = add nuw nsw i64 %6, 8
%33 = add <2 x i32> %7, <i32 8, i32 8>
%34 = icmp eq i64 %32, 512
br i1 %34, label %35, label %5
35: ; preds = %5
%36 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
br label %37
37: ; preds = %35, %37
%38 = phi i64 [ 0, %35 ], [ %44, %37 ]
%39 = getelementptr inbounds [512 x double], [512 x double]* %1, i64 0, i64 %38
%40 = load double, double* %39
%41 = getelementptr inbounds [512 x double], [512 x double]* %2, i64 0, i64 %38
%42 = load double, double* %41
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %40, double %42)
%44 = add nuw nsw i64 %38, 1
%45 = icmp eq i64 %44, 512
br i1 %45, label %46, label %37
46: ; preds = %37
%47 = getelementptr inbounds [512 x double], [512 x double]* %1, i64 0, i64 0
%48 = getelementptr inbounds [512 x double], [512 x double]* %2, i64 0, i64 0
%49 = call i32 @fft1D_512(double* %47, double* %48)
%50 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.4, i64 0, i64 0))
br label %51
51: ; preds = %46, %51
%52 = phi i64 [ 0, %46 ], [ %58, %51 ]
%53 = getelementptr inbounds [512 x double], [512 x double]* %1, i64 0, i64 %52
%54 = load double, double* %53
%55 = getelementptr inbounds [512 x double], [512 x double]* %2, i64 0, i64 %52
%56 = load double, double* %55
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %54, double %56)
%58 = add nuw nsw i64 %52, 1
%59 = icmp eq i64 %58, 512
br i1 %59, label %60, label %51
60: ; preds = %51
%61 = call i32 @fft1D_512(double* %47, double* %48)
%62 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.5, i64 0, i64 0))
br label %63
63: ; preds = %60, %63
%64 = phi i64 [ 0, %60 ], [ %72, %63 ]
%65 = getelementptr inbounds [512 x double], [512 x double]* %1, i64 0, i64 %64
%66 = load double, double* %65
%67 = fmul double %66, 0x3F60000000000000
%68 = getelementptr inbounds [512 x double], [512 x double]* %2, i64 0, i64 %64
%69 = load double, double* %68
%70 = fmul double %69, 0x3F60000000000000
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %67, double %70)
%72 = add nuw nsw i64 %64, 1
%73 = icmp eq i64 %72, 512
br i1 %73, label %74, label %63
74: ; preds = %63
ret i32 0
}