#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 log10(float);
void psycho_3_powerdensityspectrum(float energy[1024], float power[513]) {
  int i;
  for (i = 1; i < 513; i++) {
    if (energy[i] < 1E-20)
      power[i] = -200.0 + 90.3090;
    else
      power[i] = 10 * log10(energy[i]) + 90.3090;
  }
}


x86 assembly (clang, -O0):
<psycho_3_powerdensityspectrum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x201,-0x14(%rbp)
jge    11ba <psycho_3_powerdensityspectrum+0xaa>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xeb3(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1171 <psycho_3_powerdensityspectrum+0x61>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  0xea9(%rip),%xmm0
movss  %xmm0,(%rax,%rcx,4)
jmp    11a7 <psycho_3_powerdensityspectrum+0x97>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1030 <log10@plt>
imul   $0xa,%eax,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe76(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
jmp    11ac <psycho_3_powerdensityspectrum+0x9c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <psycho_3_powerdensityspectrum+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psycho_3_powerdensityspectrum>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
movss  0xedb(%rip),%xmm2
movsd  0xedb(%rip),%xmm3
jmp    1144 <psycho_3_powerdensityspectrum+0x34>
nop
movss  %xmm1,0x4(%r14,%rbx,4)
add    $0x1,%rbx
cmp    $0x200,%rbx
je     118d <psycho_3_powerdensityspectrum+0x7d>
movss  0x4(%r15,%rbx,4),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
ucomisd %xmm1,%xmm3
movaps %xmm2,%xmm1
ja     1130 <psycho_3_powerdensityspectrum+0x20>
call   1030 <log10@plt>
movsd  0xea0(%rip),%xmm3
movss  0xe90(%rip),%xmm2
add    %eax,%eax
lea    (%rax,%rax,4),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0xe8c(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
jmp    1130 <psycho_3_powerdensityspectrum+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @psycho_3_powerdensityspectrum(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca i32
store float* %0, float** %3
store float* %1, float** %4
store i32 1, i32* %5
br label %6
6: ; preds = %38, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 513
br i1 %8, label %9, label %41
9: ; preds = %6
%10 = load float*, float** %3
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds float, float* %10, i64 %12
%14 = load float, float* %13
%15 = fpext float %14 to double
%16 = fcmp olt double %15, 0x3BC79CA10C924223
br i1 %16, label %17, label %22
17: ; preds = %9
%18 = load float*, float** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds float, float* %18, i64 %20
store float 0xC05B6C3960000000, float* %21
br label %37
22: ; preds = %9
%23 = load float*, float** %3
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds float, float* %23, i64 %25
%27 = load float, float* %26
%28 = call i32 @log10(float %27)
%29 = mul nsw i32 10, %28
%30 = sitofp i32 %29 to double
%31 = fadd double %30, 9.030900e+01
%32 = fptrunc double %31 to float
%33 = load float*, float** %4
%34 = load i32, i32* %5
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds float, float* %33, i64 %35
store float %32, float* %36
br label %37
37: ; preds = %22, %17
br label %38
38: ; preds = %37
%39 = load i32, i32* %5
%40 = add nsw i32 %39, 1
store i32 %40, i32* %5
br label %6
41: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @psycho_3_powerdensityspectrum(float* nocapture %0, float* nocapture writeonly %1) {
br label %3
3: ; preds = %2, %15
%4 = phi i64 [ 1, %2 ], [ %18, %15 ]
%5 = getelementptr inbounds float, float* %0, i64 %4
%6 = load float, float* %5
%7 = fpext float %6 to double
%8 = fcmp olt double %7, 0x3BC79CA10C924223
br i1 %8, label %15, label %9
9: ; preds = %3
%10 = tail call i32 @log10(float %6)
%11 = mul nsw i32 %10, 10
%12 = sitofp i32 %11 to double
%13 = fadd double %12, 9.030900e+01
%14 = fptrunc double %13 to float
br label %15
15: ; preds = %3, %9
%16 = phi float [ %14, %9 ], [ 0xC05B6C3960000000, %3 ]
%17 = getelementptr inbounds float, float* %1, i64 %4
store float %16, float* %17
%18 = add nuw nsw i64 %4, 1
%19 = icmp eq i64 %18, 513
br i1 %19, label %20, label %3
20: ; preds = %15
ret void
}