#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 */
scalar_t__ discreteHartley(int, float *, float *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int testing() {
  int sampleWidth = 4;
  float testingSample[] = {1.0f, 0.0f, 0.0f, 0.0f};
  float *outputSample = (float *)malloc(sizeof(float) * sampleWidth);
  if (discreteHartley(sampleWidth, testingSample, outputSample) == 0) {
    int i;
    for (i = 0; sampleWidth - 1 >= i; i++) {
      printf("%f\n", outputSample[i]);
    }
    discreteHartley(sampleWidth, outputSample, testingSample);
    for (i = 0; sampleWidth - 1 >= i; i++) {
      printf("%f\n", testingSample[i]);
    }
  } else {
    printf("DHT failed\n");
  }
}


x86 assembly (clang, -O0):
<testing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x4,-0x8(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1050 <discreteHartley@plt>
cmp    $0x0,%rax
jne    121a <testing+0xea>
movl   $0x0,-0x2c(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cmp    -0x2c(%rbp),%eax
jl     11c5 <testing+0x95>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe60(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1189 <testing+0x59>
mov    -0x8(%rbp),%edi
mov    -0x28(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1050 <discreteHartley@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cmp    -0x2c(%rbp),%eax
jl     1215 <testing+0xe5>
movslq -0x2c(%rbp),%rax
movss  -0x20(%rbp,%rax,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe10(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11dc <testing+0xac>
jmp    1228 <testing+0xf8>
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testing>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movaps 0xeb2(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rsp,%rsi
mov    $0x4,%edi
mov    %rax,%rdx
call   1060 <discreteHartley@plt>
test   %rax,%rax
je     1185 <testing+0x45>
lea    0xe99(%rip),%rdi
call   1030 <puts@plt>
jmp    1236 <testing+0xf6>
movss  (%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe7c(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x4(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x8(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xc(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %rsp,%rdx
mov    $0x4,%edi
mov    %rbx,%rsi
call   1060 <discreteHartley@plt>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.testing.testingSample = [4 x float] [float 1.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00]
@.str = [4 x i8] c"%f\0A\00"
@.str.1 = [12 x i8] c"DHT failed\0A\00"
define i32 @testing() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [4 x float]
%4 = alloca float*
%5 = alloca i32
store i32 4, i32* %2
%6 = bitcast [4 x float]* %3 to i8*
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = mul i64 4, %8
%10 = trunc i64 %9 to i32
%11 = call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to float*
store float* %12, float** %4
%13 = load i32, i32* %2
%14 = getelementptr inbounds [4 x float], [4 x float]* %3, i64 0, i64 0
%15 = load float*, float** %4
%16 = call i64 @discreteHartley(i32 %13, float* %14, float* %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %56
18: ; preds = %0
store i32 0, i32* %5
br label %19
19: ; preds = %32, %18
%20 = load i32, i32* %2
%21 = sub nsw i32 %20, 1
%22 = load i32, i32* %5
%23 = icmp sge i32 %21, %22
br i1 %23, label %24, label %35
24: ; preds = %19
%25 = load float*, float** %4
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds float, float* %25, i64 %27
%29 = load float, float* %28
%30 = fpext float %29 to double
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %30)
br label %32
32: ; preds = %24
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
br label %19
35: ; preds = %19
%36 = load i32, i32* %2
%37 = load float*, float** %4
%38 = getelementptr inbounds [4 x float], [4 x float]* %3, i64 0, i64 0
%39 = call i64 @discreteHartley(i32 %36, float* %37, float* %38)
store i32 0, i32* %5
br label %40
40: ; preds = %52, %35
%41 = load i32, i32* %2
%42 = sub nsw i32 %41, 1
%43 = load i32, i32* %5
%44 = icmp sge i32 %42, %43
br i1 %44, label %45, label %55
45: ; preds = %40
%46 = load i32, i32* %5
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [4 x float], [4 x float]* %3, i64 0, i64 %47
%49 = load float, float* %48
%50 = fpext float %49 to double
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %50)
br label %52
52: ; preds = %45
%53 = load i32, i32* %5
%54 = add nsw i32 %53, 1
store i32 %54, i32* %5
br label %40
55: ; preds = %40
br label %58
56: ; preds = %0
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %58
58: ; preds = %56, %55
%59 = load i32, i32* %1
ret i32 %59
}

LLVM IR (-O2):
@__const.testing.testingSample = [4 x float] [float 1.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00]
@.str = [4 x i8] c"%f\0A\00"
@str = [11 x i8] c"DHT failed\00"
define i32 @testing() {
%1 = alloca [4 x float]
%2 = bitcast [4 x float]* %1 to i8*
%3 = tail call i64 @malloc(i32 16)
%4 = inttoptr i64 %3 to float*
%5 = getelementptr inbounds [4 x float], [4 x float]* %1, i64 0, i64 0
%6 = call i64 @discreteHartley(i32 4, float* %5, float* %4)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %40
8: ; preds = %0
%9 = load float, float* %4
%10 = fpext float %9 to double
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %10)
%12 = getelementptr inbounds float, float* %4, i64 1
%13 = load float, float* %12
%14 = fpext float %13 to double
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %14)
%16 = getelementptr inbounds float, float* %4, i64 2
%17 = load float, float* %16
%18 = fpext float %17 to double
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %18)
%20 = getelementptr inbounds float, float* %4, i64 3
%21 = load float, float* %20
%22 = fpext float %21 to double
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %22)
%24 = call i64 @discreteHartley(i32 4, float* %4, float* %5)
%25 = load float, float* %5
%26 = fpext float %25 to double
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %26)
%28 = getelementptr inbounds [4 x float], [4 x float]* %1, i64 0, i64 1
%29 = load float, float* %28
%30 = fpext float %29 to double
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %30)
%32 = getelementptr inbounds [4 x float], [4 x float]* %1, i64 0, i64 2
%33 = load float, float* %32
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %34)
%36 = getelementptr inbounds [4 x float], [4 x float]* %1, i64 0, i64 3
%37 = load float, float* %36
%38 = fpext float %37 to double
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %38)
br label %42
40: ; preds = %0
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
br label %42
42: ; preds = %8, %40
ret i32 undef
}