#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(double);
void psycho_3_powerdensityspectrum(double energy[1024], double 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    11ae <psycho_3_powerdensityspectrum+0x9e>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  0xebc(%rip),%xmm0
ucomisd (%rax,%rcx,8),%xmm0
jbe    1169 <psycho_3_powerdensityspectrum+0x59>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  0xeb1(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    119b <psycho_3_powerdensityspectrum+0x8b>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1030 <log10@plt>
imul   $0xa,%eax,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe7e(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    11a0 <psycho_3_powerdensityspectrum+0x90>
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
movsd  0xedb(%rip),%xmm2
movsd  0xedb(%rip),%xmm3
jmp    1144 <psycho_3_powerdensityspectrum+0x34>
nop
movsd  %xmm1,0x8(%r14,%rbx,8)
add    $0x1,%rbx
cmp    $0x200,%rbx
je     1180 <psycho_3_powerdensityspectrum+0x70>
movsd  0x8(%r15,%rbx,8),%xmm0
ucomisd %xmm0,%xmm3
movapd %xmm2,%xmm1
ja     1130 <psycho_3_powerdensityspectrum+0x20>
call   1030 <log10@plt>
movsd  0xea6(%rip),%xmm3
movsd  0xe96(%rip),%xmm2
add    %eax,%eax
lea    (%rax,%rax,4),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
addsd  0xe92(%rip),%xmm1
jmp    1130 <psycho_3_powerdensityspectrum+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

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