#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*/ psycho_3_tonal_label_range(float *, int *, int *, float *,
                                              int, int, int);
void psycho_3_tonal_label(float power[513], int *tonelabel, float Xtm[513]) {
  int i;
  int maxima[513];
  maxima[0] = maxima[513 - 1] = 0;
  tonelabel[0] = tonelabel[513 - 1] = 0;
  Xtm[0] = Xtm[513 - 1] = -200.0;
  for (i = 1; i < 513 - 1; i++) {
    tonelabel[i] = 0;
    Xtm[i] = -200.0;
    if (power[i] > power[i - 1] && power[i] > power[i + 1])
      maxima[i] = 1;
    else
      maxima[i] = 0;
  }
  {
    psycho_3_tonal_label_range(power, tonelabel, maxima, Xtm, 2, 63, 2);
    psycho_3_tonal_label_range(power, tonelabel, maxima, Xtm, 63, 127, 3);
    psycho_3_tonal_label_range(power, tonelabel, maxima, Xtm, 127, 255, 6);
    psycho_3_tonal_label_range(power, tonelabel, maxima, Xtm, 255, 500, 12);
  }
}


x86 assembly (clang, -O0):
<psycho_3_tonal_label>:
push   %rbp
mov    %rsp,%rbp
sub    $0x830,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x820(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x0,0x800(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movss  0xea4(%rip),%xmm0
movss  %xmm0,0x800(%rax)
mov    -0x18(%rbp),%rax
movss  0xe90(%rip),%xmm0
movss  %xmm0,(%rax)
movl   $0x1,-0x1c(%rbp)
cmpl   $0x200,-0x1c(%rbp)
jge    122a <psycho_3_tonal_label+0x11a>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  0xe59(%rip),%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
ucomiss (%rax,%rcx,4),%xmm0
jbe    1208 <psycho_3_tonal_label+0xf8>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
ucomiss (%rax,%rcx,4),%xmm0
jbe    1208 <psycho_3_tonal_label+0xf8>
movslq -0x1c(%rbp),%rax
movl   $0x1,-0x820(%rbp,%rax,4)
jmp    1217 <psycho_3_tonal_label+0x107>
movslq -0x1c(%rbp),%rax
movl   $0x0,-0x820(%rbp,%rax,4)
jmp    121c <psycho_3_tonal_label+0x10c>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    117b <psycho_3_tonal_label+0x6b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x820(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x2,%r8d
mov    $0x3f,%r9d
movl   $0x2,(%rsp)
call   1030 <psycho_3_tonal_label_range@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x820(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x3f,%r8d
mov    $0x7f,%r9d
movl   $0x3,(%rsp)
call   1030 <psycho_3_tonal_label_range@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x820(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x7f,%r8d
mov    $0xff,%r9d
movl   $0x6,(%rsp)
call   1030 <psycho_3_tonal_label_range@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x820(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0xff,%r8d
mov    $0x1f4,%r9d
movl   $0xc,(%rsp)
call   1030 <psycho_3_tonal_label_range@plt>
add    $0x830,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psycho_3_tonal_label>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x818,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
movl   $0x0,0x810(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0x800(%rsi)
movl   $0x0,(%rsi)
movl   $0xc3480000,0x800(%rdx)
movl   $0xc3480000,(%rdx)
lea    0x8(%rdi),%rax
lea    0x4(%rdx),%rcx
lea    0x4(%rsi),%rdx
xor    %esi,%esi
jmp    1183 <psycho_3_tonal_label+0x73>
nopw   0x0(%rax,%rax,1)
xor    %edi,%edi
mov    %edi,0x14(%rsp,%rsi,1)
add    $0x4,%rsi
cmp    $0x7fc,%rsi
je     11ab <psycho_3_tonal_label+0x9b>
movl   $0x0,(%rdx,%rsi,1)
movl   $0xc3480000,(%rcx,%rsi,1)
movss  -0x4(%rax,%rsi,1),%xmm0
ucomiss -0x8(%rax,%rsi,1),%xmm0
jbe    1170 <psycho_3_tonal_label+0x60>
mov    $0x1,%edi
ucomiss (%rax,%rsi,1),%xmm0
jbe    1170 <psycho_3_tonal_label+0x60>
jmp    1172 <psycho_3_tonal_label+0x62>
movl   $0x2,(%rsp)
lea    0x10(%rsp),%r12
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r14,%rcx
mov    $0x2,%r8d
mov    $0x3f,%r9d
call   1030 <psycho_3_tonal_label_range@plt>
movl   $0x3,(%rsp)
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r14,%rcx
mov    $0x3f,%r8d
mov    $0x7f,%r9d
call   1030 <psycho_3_tonal_label_range@plt>
movl   $0x6,(%rsp)
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r14,%rcx
mov    $0x7f,%r8d
mov    $0xff,%r9d
call   1030 <psycho_3_tonal_label_range@plt>
movl   $0xc,(%rsp)
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r14,%rcx
mov    $0xff,%r8d
mov    $0x1f4,%r9d
call   1030 <psycho_3_tonal_label_range@plt>
add    $0x818,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @psycho_3_tonal_label(float* %0, i32* %1, float* %2) {
%4 = alloca float*
%5 = alloca i32*
%6 = alloca float*
%7 = alloca i32
%8 = alloca [513 x i32]
store float* %0, float** %4
store i32* %1, i32** %5
store float* %2, float** %6
%9 = getelementptr inbounds [513 x i32], [513 x i32]* %8, i64 0, i64 512
store i32 0, i32* %9
%10 = getelementptr inbounds [513 x i32], [513 x i32]* %8, i64 0, i64 0
store i32 0, i32* %10
%11 = load i32*, i32** %5
%12 = getelementptr inbounds i32, i32* %11, i64 512
store i32 0, i32* %12
%13 = load i32*, i32** %5
%14 = getelementptr inbounds i32, i32* %13, i64 0
store i32 0, i32* %14
%15 = load float*, float** %6
%16 = getelementptr inbounds float, float* %15, i64 512
store float -2.000000e+02, float* %16
%17 = load float*, float** %6
%18 = getelementptr inbounds float, float* %17, i64 0
store float -2.000000e+02, float* %18
store i32 1, i32* %7
br label %19
19: ; preds = %65, %3
%20 = load i32, i32* %7
%21 = icmp slt i32 %20, 512
br i1 %21, label %22, label %68
22: ; preds = %19
%23 = load i32*, i32** %5
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 0, i32* %26
%27 = load float*, float** %6
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds float, float* %27, i64 %29
store float -2.000000e+02, float* %30
%31 = load float*, float** %4
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds float, float* %31, i64 %33
%35 = load float, float* %34
%36 = load float*, float** %4
%37 = load i32, i32* %7
%38 = sub nsw i32 %37, 1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds float, float* %36, i64 %39
%41 = load float, float* %40
%42 = fcmp ogt float %35, %41
br i1 %42, label %43, label %60
43: ; preds = %22
%44 = load float*, float** %4
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds float, float* %44, i64 %46
%48 = load float, float* %47
%49 = load float*, float** %4
%50 = load i32, i32* %7
%51 = add nsw i32 %50, 1
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds float, float* %49, i64 %52
%54 = load float, float* %53
%55 = fcmp ogt float %48, %54
br i1 %55, label %56, label %60
56: ; preds = %43
%57 = load i32, i32* %7
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [513 x i32], [513 x i32]* %8, i64 0, i64 %58
store i32 1, i32* %59
br label %64
60: ; preds = %43, %22
%61 = load i32, i32* %7
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [513 x i32], [513 x i32]* %8, i64 0, i64 %62
store i32 0, i32* %63
br label %64
64: ; preds = %60, %56
br label %65
65: ; preds = %64
%66 = load i32, i32* %7
%67 = add nsw i32 %66, 1
store i32 %67, i32* %7
br label %19
68: ; preds = %19
%69 = load float*, float** %4
%70 = load i32*, i32** %5
%71 = getelementptr inbounds [513 x i32], [513 x i32]* %8, i64 0, i64 0
%72 = load float*, float** %6
%73 = call i32 @psycho_3_tonal_label_range(float* %69, i32* %70, i32* %71, float* %72, i32 2, i32 63, i32 2)
%74 = load float*, float** %4
%75 = load i32*, i32** %5
%76 = getelementptr inbounds [513 x i32], [513 x i32]* %8, i64 0, i64 0
%77 = load float*, float** %6
%78 = call i32 @psycho_3_tonal_label_range(float* %74, i32* %75, i32* %76, float* %77, i32 63, i32 127, i32 3)
%79 = load float*, float** %4
%80 = load i32*, i32** %5
%81 = getelementptr inbounds [513 x i32], [513 x i32]* %8, i64 0, i64 0
%82 = load float*, float** %6
%83 = call i32 @psycho_3_tonal_label_range(float* %79, i32* %80, i32* %81, float* %82, i32 127, i32 255, i32 6)
%84 = load float*, float** %4
%85 = load i32*, i32** %5
%86 = getelementptr inbounds [513 x i32], [513 x i32]* %8, i64 0, i64 0
%87 = load float*, float** %6
%88 = call i32 @psycho_3_tonal_label_range(float* %84, i32* %85, i32* %86, float* %87, i32 255, i32 500, i32 12)
ret void
}

LLVM IR (-O2):
define void @psycho_3_tonal_label(float* %0, i32* %1, float* %2) {
%4 = alloca [513 x i32]
%5 = bitcast [513 x i32]* %4 to i8*
%6 = getelementptr inbounds [513 x i32], [513 x i32]* %4, i64 0, i64 512
store i32 0, i32* %6
%7 = getelementptr inbounds [513 x i32], [513 x i32]* %4, i64 0, i64 0
store i32 0, i32* %7
%8 = getelementptr inbounds i32, i32* %1, i64 512
store i32 0, i32* %8
store i32 0, i32* %1
%9 = getelementptr inbounds float, float* %2, i64 512
store float -2.000000e+02, float* %9
store float -2.000000e+02, float* %2
br label %10
10: ; preds = %3, %26
%11 = phi i64 [ 1, %3 ], [ %20, %26 ]
%12 = getelementptr inbounds i32, i32* %1, i64 %11
store i32 0, i32* %12
%13 = getelementptr inbounds float, float* %2, i64 %11
store float -2.000000e+02, float* %13
%14 = getelementptr inbounds float, float* %0, i64 %11
%15 = load float, float* %14
%16 = add nsw i64 %11, -1
%17 = getelementptr inbounds float, float* %0, i64 %16
%18 = load float, float* %17
%19 = fcmp ogt float %15, %18
%20 = add nuw nsw i64 %11, 1
br i1 %19, label %21, label %25
21: ; preds = %10
%22 = getelementptr inbounds float, float* %0, i64 %20
%23 = load float, float* %22
%24 = fcmp ogt float %15, %23
br i1 %24, label %26, label %25
25: ; preds = %10, %21
br label %26
26: ; preds = %21, %25
%27 = phi i32 [ 0, %25 ], [ 1, %21 ]
%28 = getelementptr inbounds [513 x i32], [513 x i32]* %4, i64 0, i64 %11
store i32 %27, i32* %28
%29 = icmp eq i64 %20, 512
br i1 %29, label %30, label %10
30: ; preds = %26
%31 = call i32 @psycho_3_tonal_label_range(float* %0, i32* %1, i32* %7, float* %2, i32 2, i32 63, i32 2)
%32 = call i32 @psycho_3_tonal_label_range(float* %0, i32* %1, i32* %7, float* %2, i32 63, i32 127, i32 3)
%33 = call i32 @psycho_3_tonal_label_range(float* %0, i32* %1, i32* %7, float* %2, i32 127, i32 255, i32 6)
%34 = call i32 @psycho_3_tonal_label_range(float* %0, i32* %1, i32* %7, float* %2, i32 255, i32 500, i32 12)
ret void
}