#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 M_PI;
int cordic_vector(int, int);
int /*<<< orphan*/ create_lookup_table();
int /*<<< orphan*/ fft_Npt(int *, int *, int *, int);
int /*<<< orphan*/ interpolate(int, int, int *, int *);
int /*<<< orphan*/ interpolate_ZOH(int, int, int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int sin(int);
int main() {
  int Input[128];
  int Output[(128 * 8)];
  int Output_ZOH[(128 * 8)];
  int Input_fft[2][128];
  int Output_fft[2][(128 * 8)];
  int Output_ZOH_fft[2][(128 * 8)];
  int i;
  printf("Input Samples are\n");
  for (i = 0; i < 128; i++) {
    Input[i] = 0xFFFF * sin(2 * M_PI * i * 300.0 / 8000.0);
    printf("%d\n", Input[i]);
  }
  interpolate(128, 8, Input, Output);
  printf("Output Samples are\n");
  for (i = 0; i < (128 * 8); i++) {
    printf("%d\n", Output[i]);
  }
  interpolate_ZOH(128, 8, Input, Output_ZOH);
  printf("Output Samples with ZOH are\n");
  for (i = 0; i < (128 * 8); i++) {
    printf("%d\n", Output_ZOH[i]);
  }
  create_lookup_table();
  fft_Npt(Input, Input_fft[0], Input_fft[1], 128);
  printf("Input Signal FFT\n");
  for (i = 0; i < 128; i++) {
    printf("%d\n", cordic_vector(Input_fft[0][i], Input_fft[1][i]));
  }
  printf("Output Signal FFT\n");
  fft_Npt(Output, Output_fft[0], Output_fft[1], 128 * 8);
  for (i = 0; i < 128 * 8; i++) {
    printf("%d\n", cordic_vector(Output_fft[0][i], Output_fft[1][i]));
  }
  printf("Output Signal with ZOH FFT\n");
  fft_Npt(Output_ZOH, Output_ZOH_fft[0], Output_ZOH_fft[1], 128 * 8);
  for (i = 0; i < 128 * 8; i++) {
    printf("%d\n", cordic_vector(Output_ZOH_fft[0][i], Output_ZOH_fft[1][i]));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x6620,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x6614(%rbp)
cmpl   $0x80,-0x6614(%rbp)
jge    1226 <main+0xb6>
mov    0x2e37(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
imul   -0x6614(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xe3f(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe2b(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <sin@plt>
imul   $0xffff,%eax,%ecx
movslq -0x6614(%rbp),%rax
mov    %ecx,-0x210(%rbp,%rax,4)
movslq -0x6614(%rbp),%rax
mov    -0x210(%rbp,%rax,4),%esi
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x6614(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6614(%rbp)
jmp    119a <main+0x2a>
lea    -0x210(%rbp),%rdx
lea    -0x1210(%rbp),%rcx
mov    $0x80,%edi
mov    $0x8,%esi
call   1070 <interpolate@plt>
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x6614(%rbp)
cmpl   $0x400,-0x6614(%rbp)
jge    129b <main+0x12b>
movslq -0x6614(%rbp),%rax
mov    -0x1210(%rbp,%rax,4),%esi
lea    0xda3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x6614(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6614(%rbp)
jmp    125b <main+0xeb>
lea    -0x210(%rbp),%rdx
lea    -0x2210(%rbp),%rcx
mov    $0x80,%edi
mov    $0x8,%esi
call   1030 <interpolate_ZOH@plt>
lea    0xd7c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x6614(%rbp)
cmpl   $0x400,-0x6614(%rbp)
jge    1310 <main+0x1a0>
movslq -0x6614(%rbp),%rax
mov    -0x2210(%rbp,%rax,4),%esi
lea    0xd2e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x6614(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6614(%rbp)
jmp    12d0 <main+0x160>
mov    $0x0,%al
call   1050 <create_lookup_table@plt>
lea    -0x210(%rbp),%rdi
lea    -0x2610(%rbp),%rsi
lea    -0x2610(%rbp),%rdx
add    $0x200,%rdx
mov    $0x80,%ecx
call   1080 <fft_Npt@plt>
lea    0xd14(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x6614(%rbp)
cmpl   $0x80,-0x6614(%rbp)
jge    13aa <main+0x23a>
movslq -0x6614(%rbp),%rax
mov    -0x2610(%rbp,%rax,4),%edi
movslq -0x6614(%rbp),%rax
mov    -0x2410(%rbp,%rax,4),%esi
call   1090 <cordic_vector@plt>
mov    %eax,%esi
lea    0xc94(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x6614(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6614(%rbp)
jmp    1355 <main+0x1e5>
lea    0xcb9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x1210(%rbp),%rdi
lea    -0x4610(%rbp),%rsi
lea    -0x4610(%rbp),%rdx
add    $0x1000,%rdx
mov    $0x400,%ecx
call   1080 <fft_Npt@plt>
movl   $0x0,-0x6614(%rbp)
cmpl   $0x400,-0x6614(%rbp)
jge    143d <main+0x2cd>
movslq -0x6614(%rbp),%rax
mov    -0x4610(%rbp,%rax,4),%edi
movslq -0x6614(%rbp),%rax
mov    -0x3610(%rbp,%rax,4),%esi
call   1090 <cordic_vector@plt>
mov    %eax,%esi
lea    0xc01(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x6614(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6614(%rbp)
jmp    13e8 <main+0x278>
lea    0xc39(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x2210(%rbp),%rdi
lea    -0x6610(%rbp),%rsi
lea    -0x6610(%rbp),%rdx
add    $0x1000,%rdx
mov    $0x400,%ecx
call   1080 <fft_Npt@plt>
movl   $0x0,-0x6614(%rbp)
cmpl   $0x400,-0x6614(%rbp)
jge    14d0 <main+0x360>
movslq -0x6614(%rbp),%rax
mov    -0x6610(%rbp,%rax,4),%edi
movslq -0x6614(%rbp),%rax
mov    -0x5610(%rbp,%rax,4),%esi
call   1090 <cordic_vector@plt>
mov    %eax,%esi
lea    0xb6e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x6614(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6614(%rbp)
jmp    147b <main+0x30b>
xor    %eax,%eax
add    $0x6620,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x6600,%rsp
lea    0xe81(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e49(%rip),%r14
lea    0xe6a(%rip),%r15
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r14),%eax
imul   %ebx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xe3b(%rip),%xmm0
divsd  0xe3b(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1070 <sin@plt>
mov    %eax,%esi
shl    $0x10,%esi
sub    %eax,%esi
mov    %esi,(%rsp,%rbx,2)
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x2,%rbx
cmp    $0x100,%rbx
jne    11b0 <main+0x30>
mov    %rsp,%rdx
lea    0x1600(%rsp),%rcx
mov    $0x80,%edi
mov    $0x8,%esi
call   1080 <interpolate@plt>
lea    0xe0e(%rip),%rdi
call   1030 <puts@plt>
lea    0xdec(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    0x1600(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    $0x400,%rbx
jne    1230 <main+0xb0>
mov    %rsp,%rdx
lea    0x600(%rsp),%rcx
mov    $0x80,%edi
mov    $0x8,%esi
call   1040 <interpolate_ZOH@plt>
lea    0xdca(%rip),%rdi
call   1030 <puts@plt>
lea    0xd95(%rip),%r14
xor    %ebx,%ebx
nopl   (%rax)
mov    0x600(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    $0x400,%rbx
jne    1280 <main+0x100>
xor    %eax,%eax
call   1060 <create_lookup_table@plt>
lea    0x400(%rsp),%rdx
mov    %rsp,%rdi
lea    0x200(%rsp),%rsi
mov    $0x80,%ecx
call   1090 <fft_Npt@plt>
lea    0xd8c(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffffffffff80,%rbx
lea    0xd34(%rip),%r14
nopl   0x0(%rax)
mov    0x400(%rsp,%rbx,4),%edi
mov    0x600(%rsp,%rbx,4),%esi
call   10a0 <cordic_vector@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
inc    %rbx
jne    12e0 <main+0x160>
lea    0xd5b(%rip),%rdi
call   1030 <puts@plt>
lea    0x5600(%rsp),%rdx
lea    0x1600(%rsp),%rdi
lea    0x4600(%rsp),%rsi
mov    $0x400,%ecx
call   1090 <fft_Npt@plt>
mov    $0xfffffffffffffc00,%rbx
lea    0xcd0(%rip),%r14
mov    0x5600(%rsp,%rbx,4),%edi
mov    0x6600(%rsp,%rbx,4),%esi
call   10a0 <cordic_vector@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
inc    %rbx
jne    1340 <main+0x1c0>
lea    0xd0d(%rip),%rdi
call   1030 <puts@plt>
lea    0x3600(%rsp),%rdx
lea    0x600(%rsp),%rdi
lea    0x2600(%rsp),%rsi
mov    $0x400,%ecx
call   1090 <fft_Npt@plt>
mov    $0xfffffffffffffc00,%rbx
lea    0xc70(%rip),%r14
mov    0x3600(%rsp,%rbx,4),%edi
mov    0x4600(%rsp,%rbx,4),%esi
call   10a0 <cordic_vector@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
inc    %rbx
jne    13a0 <main+0x220>
xor    %eax,%eax
add    $0x6600,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Input Samples are\0A\00"
@M_PI = global i32 0
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [20 x i8] c"Output Samples are\0A\00"
@.str.3 = [29 x i8] c"Output Samples with ZOH are\0A\00"
@.str.4 = [18 x i8] c"Input Signal FFT\0A\00"
@.str.5 = [19 x i8] c"Output Signal FFT\0A\00"
@.str.6 = [28 x i8] c"Output Signal with ZOH FFT\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [128 x i32]
%3 = alloca [1024 x i32]
%4 = alloca [1024 x i32]
%5 = alloca [2 x [128 x i32]]
%6 = alloca [2 x [1024 x i32]]
%7 = alloca [2 x [1024 x i32]]
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %8
br label %10
10: ; preds = %32, %0
%11 = load i32, i32* %8
%12 = icmp slt i32 %11, 128
br i1 %12, label %13, label %35
13: ; preds = %10
%14 = load i32, i32* @M_PI
%15 = mul nsw i32 2, %14
%16 = load i32, i32* %8
%17 = mul nsw i32 %15, %16
%18 = sitofp i32 %17 to double
%19 = fmul double %18, 3.000000e+02
%20 = fdiv double %19, 8.000000e+03
%21 = fptosi double %20 to i32
%22 = call i32 @sin(i32 %21)
%23 = mul nsw i32 65535, %22
%24 = load i32, i32* %8
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [128 x i32], [128 x i32]* %2, i64 0, i64 %25
store i32 %23, i32* %26
%27 = load i32, i32* %8
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [128 x i32], [128 x i32]* %2, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %13
%33 = load i32, i32* %8
%34 = add nsw i32 %33, 1
store i32 %34, i32* %8
br label %10
35: ; preds = %10
%36 = getelementptr inbounds [128 x i32], [128 x i32]* %2, i64 0, i64 0
%37 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 0
%38 = call i32 @interpolate(i32 128, i32 8, i32* %36, i32* %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %8
br label %40
40: ; preds = %49, %35
%41 = load i32, i32* %8
%42 = icmp slt i32 %41, 1024
br i1 %42, label %43, label %52
43: ; preds = %40
%44 = load i32, i32* %8
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %43
%50 = load i32, i32* %8
%51 = add nsw i32 %50, 1
store i32 %51, i32* %8
br label %40
52: ; preds = %40
%53 = getelementptr inbounds [128 x i32], [128 x i32]* %2, i64 0, i64 0
%54 = getelementptr inbounds [1024 x i32], [1024 x i32]* %4, i64 0, i64 0
%55 = call i32 @interpolate_ZOH(i32 128, i32 8, i32* %53, i32* %54)
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %8
br label %57
57: ; preds = %66, %52
%58 = load i32, i32* %8
%59 = icmp slt i32 %58, 1024
br i1 %59, label %60, label %69
60: ; preds = %57
%61 = load i32, i32* %8
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [1024 x i32], [1024 x i32]* %4, i64 0, i64 %62
%64 = load i32, i32* %63
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %64)
br label %66
66: ; preds = %60
%67 = load i32, i32* %8
%68 = add nsw i32 %67, 1
store i32 %68, i32* %8
br label %57
69: ; preds = %57
%70 = call i32 (...) @create_lookup_table()
%71 = getelementptr inbounds [128 x i32], [128 x i32]* %2, i64 0, i64 0
%72 = getelementptr inbounds [2 x [128 x i32]], [2 x [128 x i32]]* %5, i64 0, i64 0
%73 = getelementptr inbounds [128 x i32], [128 x i32]* %72, i64 0, i64 0
%74 = getelementptr inbounds [2 x [128 x i32]], [2 x [128 x i32]]* %5, i64 0, i64 1
%75 = getelementptr inbounds [128 x i32], [128 x i32]* %74, i64 0, i64 0
%76 = call i32 @fft_Npt(i32* %71, i32* %73, i32* %75, i32 128)
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %8
br label %78
78: ; preds = %94, %69
%79 = load i32, i32* %8
%80 = icmp slt i32 %79, 128
br i1 %80, label %81, label %97
81: ; preds = %78
%82 = getelementptr inbounds [2 x [128 x i32]], [2 x [128 x i32]]* %5, i64 0, i64 0
%83 = load i32, i32* %8
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [128 x i32], [128 x i32]* %82, i64 0, i64 %84
%86 = load i32, i32* %85
%87 = getelementptr inbounds [2 x [128 x i32]], [2 x [128 x i32]]* %5, i64 0, i64 1
%88 = load i32, i32* %8
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [128 x i32], [128 x i32]* %87, i64 0, i64 %89
%91 = load i32, i32* %90
%92 = call i32 @cordic_vector(i32 %86, i32 %91)
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %92)
br label %94
94: ; preds = %81
%95 = load i32, i32* %8
%96 = add nsw i32 %95, 1
store i32 %96, i32* %8
br label %78
97: ; preds = %78
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%99 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 0
%100 = getelementptr inbounds [2 x [1024 x i32]], [2 x [1024 x i32]]* %6, i64 0, i64 0
%101 = getelementptr inbounds [1024 x i32], [1024 x i32]* %100, i64 0, i64 0
%102 = getelementptr inbounds [2 x [1024 x i32]], [2 x [1024 x i32]]* %6, i64 0, i64 1
%103 = getelementptr inbounds [1024 x i32], [1024 x i32]* %102, i64 0, i64 0
%104 = call i32 @fft_Npt(i32* %99, i32* %101, i32* %103, i32 1024)
store i32 0, i32* %8
br label %105
105: ; preds = %121, %97
%106 = load i32, i32* %8
%107 = icmp slt i32 %106, 1024
br i1 %107, label %108, label %124
108: ; preds = %105
%109 = getelementptr inbounds [2 x [1024 x i32]], [2 x [1024 x i32]]* %6, i64 0, i64 0
%110 = load i32, i32* %8
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds [1024 x i32], [1024 x i32]* %109, i64 0, i64 %111
%113 = load i32, i32* %112
%114 = getelementptr inbounds [2 x [1024 x i32]], [2 x [1024 x i32]]* %6, i64 0, i64 1
%115 = load i32, i32* %8
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds [1024 x i32], [1024 x i32]* %114, i64 0, i64 %116
%118 = load i32, i32* %117
%119 = call i32 @cordic_vector(i32 %113, i32 %118)
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %119)
br label %121
121: ; preds = %108
%122 = load i32, i32* %8
%123 = add nsw i32 %122, 1
store i32 %123, i32* %8
br label %105
124: ; preds = %105
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
%126 = getelementptr inbounds [1024 x i32], [1024 x i32]* %4, i64 0, i64 0
%127 = getelementptr inbounds [2 x [1024 x i32]], [2 x [1024 x i32]]* %7, i64 0, i64 0
%128 = getelementptr inbounds [1024 x i32], [1024 x i32]* %127, i64 0, i64 0
%129 = getelementptr inbounds [2 x [1024 x i32]], [2 x [1024 x i32]]* %7, i64 0, i64 1
%130 = getelementptr inbounds [1024 x i32], [1024 x i32]* %129, i64 0, i64 0
%131 = call i32 @fft_Npt(i32* %126, i32* %128, i32* %130, i32 1024)
store i32 0, i32* %8
br label %132
132: ; preds = %148, %124
%133 = load i32, i32* %8
%134 = icmp slt i32 %133, 1024
br i1 %134, label %135, label %151
135: ; preds = %132
%136 = getelementptr inbounds [2 x [1024 x i32]], [2 x [1024 x i32]]* %7, i64 0, i64 0
%137 = load i32, i32* %8
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds [1024 x i32], [1024 x i32]* %136, i64 0, i64 %138
%140 = load i32, i32* %139
%141 = getelementptr inbounds [2 x [1024 x i32]], [2 x [1024 x i32]]* %7, i64 0, i64 1
%142 = load i32, i32* %8
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds [1024 x i32], [1024 x i32]* %141, i64 0, i64 %143
%145 = load i32, i32* %144
%146 = call i32 @cordic_vector(i32 %140, i32 %145)
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %146)
br label %148
148: ; preds = %135
%149 = load i32, i32* %8
%150 = add nsw i32 %149, 1
store i32 %150, i32* %8
br label %132
151: ; preds = %132
ret i32 0
}

LLVM IR (-O2):
@M_PI = global i32 0
@.str.1 = [4 x i8] c"%d\0A\00"
@str = [18 x i8] c"Input Samples are\00"
@str.7 = [19 x i8] c"Output Samples are\00"
@str.8 = [28 x i8] c"Output Samples with ZOH are\00"
@str.9 = [17 x i8] c"Input Signal FFT\00"
@str.10 = [18 x i8] c"Output Signal FFT\00"
@str.11 = [27 x i8] c"Output Signal with ZOH FFT\00"
define i32 @main() {
%1 = alloca [128 x i32]
%2 = alloca [1024 x i32]
%3 = alloca [1024 x i32]
%4 = alloca [2 x [128 x i32]]
%5 = alloca [2 x [1024 x i32]]
%6 = alloca [2 x [1024 x i32]]
%7 = bitcast [128 x i32]* %1 to i8*
%8 = bitcast [1024 x i32]* %2 to i8*
%9 = bitcast [1024 x i32]* %3 to i8*
%10 = bitcast [2 x [128 x i32]]* %4 to i8*
%11 = bitcast [2 x [1024 x i32]]* %5 to i8*
%12 = bitcast [2 x [1024 x i32]]* %6 to i8*
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %14
14: ; preds = %0, %14
%15 = phi i64 [ 0, %0 ], [ %28, %14 ]
%16 = load i32, i32* @M_PI
%17 = trunc i64 %15 to i32
%18 = shl i32 %17, 1
%19 = mul i32 %18, %16
%20 = sitofp i32 %19 to double
%21 = fmul double %20, 3.000000e+02
%22 = fdiv double %21, 8.000000e+03
%23 = fptosi double %22 to i32
%24 = tail call i32 @sin(i32 %23)
%25 = mul nsw i32 %24, 65535
%26 = getelementptr inbounds [128 x i32], [128 x i32]* %1, i64 0, i64 %15
store i32 %25, i32* %26
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%28 = add nuw nsw i64 %15, 1
%29 = icmp eq i64 %28, 128
br i1 %29, label %30, label %14
30: ; preds = %14
%31 = getelementptr inbounds [128 x i32], [128 x i32]* %1, i64 0, i64 0
%32 = getelementptr inbounds [1024 x i32], [1024 x i32]* %2, i64 0, i64 0
%33 = call i32 @interpolate(i32 128, i32 8, i32* %31, i32* %32)
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.7, i64 0, i64 0))
br label %35
35: ; preds = %30, %35
%36 = phi i64 [ 0, %30 ], [ %40, %35 ]
%37 = getelementptr inbounds [1024 x i32], [1024 x i32]* %2, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %38)
%40 = add nuw nsw i64 %36, 1
%41 = icmp eq i64 %40, 1024
br i1 %41, label %42, label %35
42: ; preds = %35
%43 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 0
%44 = call i32 @interpolate_ZOH(i32 128, i32 8, i32* %31, i32* %43)
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.8, i64 0, i64 0))
br label %46
46: ; preds = %42, %46
%47 = phi i64 [ 0, %42 ], [ %51, %46 ]
%48 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 %47
%49 = load i32, i32* %48
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %49)
%51 = add nuw nsw i64 %47, 1
%52 = icmp eq i64 %51, 1024
br i1 %52, label %53, label %46
53: ; preds = %46
%54 = call i32 (...) @create_lookup_table()
%55 = getelementptr inbounds [2 x [128 x i32]], [2 x [128 x i32]]* %4, i64 0, i64 0, i64 0
%56 = getelementptr inbounds [2 x [128 x i32]], [2 x [128 x i32]]* %4, i64 0, i64 1, i64 0
%57 = call i32 @fft_Npt(i32* %31, i32* %55, i32* %56, i32 128)
%58 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.9, i64 0, i64 0))
br label %59
59: ; preds = %53, %59
%60 = phi i64 [ 0, %53 ], [ %67, %59 ]
%61 = getelementptr inbounds [2 x [128 x i32]], [2 x [128 x i32]]* %4, i64 0, i64 0, i64 %60
%62 = load i32, i32* %61
%63 = getelementptr inbounds [2 x [128 x i32]], [2 x [128 x i32]]* %4, i64 0, i64 1, i64 %60
%64 = load i32, i32* %63
%65 = call i32 @cordic_vector(i32 %62, i32 %64)
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %65)
%67 = add nuw nsw i64 %60, 1
%68 = icmp eq i64 %67, 128
br i1 %68, label %69, label %59
69: ; preds = %59
%70 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.10, i64 0, i64 0))
%71 = getelementptr inbounds [2 x [1024 x i32]], [2 x [1024 x i32]]* %5, i64 0, i64 0, i64 0
%72 = getelementptr inbounds [2 x [1024 x i32]], [2 x [1024 x i32]]* %5, i64 0, i64 1, i64 0
%73 = call i32 @fft_Npt(i32* %32, i32* %71, i32* %72, i32 1024)
br label %74
74: ; preds = %69, %74
%75 = phi i64 [ 0, %69 ], [ %82, %74 ]
%76 = getelementptr inbounds [2 x [1024 x i32]], [2 x [1024 x i32]]* %5, i64 0, i64 0, i64 %75
%77 = load i32, i32* %76
%78 = getelementptr inbounds [2 x [1024 x i32]], [2 x [1024 x i32]]* %5, i64 0, i64 1, i64 %75
%79 = load i32, i32* %78
%80 = call i32 @cordic_vector(i32 %77, i32 %79)
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %80)
%82 = add nuw nsw i64 %75, 1
%83 = icmp eq i64 %82, 1024
br i1 %83, label %84, label %74
84: ; preds = %74
%85 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.11, i64 0, i64 0))
%86 = getelementptr inbounds [2 x [1024 x i32]], [2 x [1024 x i32]]* %6, i64 0, i64 0, i64 0
%87 = getelementptr inbounds [2 x [1024 x i32]], [2 x [1024 x i32]]* %6, i64 0, i64 1, i64 0
%88 = call i32 @fft_Npt(i32* %43, i32* %86, i32* %87, i32 1024)
br label %89
89: ; preds = %84, %89
%90 = phi i64 [ 0, %84 ], [ %97, %89 ]
%91 = getelementptr inbounds [2 x [1024 x i32]], [2 x [1024 x i32]]* %6, i64 0, i64 0, i64 %90
%92 = load i32, i32* %91
%93 = getelementptr inbounds [2 x [1024 x i32]], [2 x [1024 x i32]]* %6, i64 0, i64 1, i64 %90
%94 = load i32, i32* %93
%95 = call i32 @cordic_vector(i32 %92, i32 %94)
%96 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %95)
%97 = add nuw nsw i64 %90, 1
%98 = icmp eq i64 %97, 1024
br i1 %98, label %99, label %89
99: ; preds = %89
ret i32 0
}