#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*/ silk_corrMatrix_FLP(float const *, int const, int, float *);
int /*<<< orphan*/ silk_corrVector_FLP(float const *, float const *, int const,
                                       int, float *);
scalar_t__ silk_energy_FLP(float const *, int const);
int /*<<< orphan*/ silk_scale_vector_FLP(float *, float, int);
void silk_find_LTP_FLP(float XX[4 * 5 * 5], float xX[4 * 5],
                       const float r_ptr[], const int lag[4],
                       const int subfr_length, const int nb_subfr) {
  int k;
  float *xX_ptr, *XX_ptr;
  const float *lag_ptr;
  float xx, temp;
  xX_ptr = xX;
  XX_ptr = XX;
  for (k = 0; k < nb_subfr; k++) {
    lag_ptr = r_ptr - (lag[k] + 5 / 2);
    silk_corrMatrix_FLP(lag_ptr, subfr_length, 5, XX_ptr);
    silk_corrVector_FLP(lag_ptr, r_ptr, subfr_length, 5, xX_ptr);
    xx = (float)silk_energy_FLP(r_ptr, subfr_length + 5);
    temp = 1.0f / (((xx) > (0.03f * 0.5f * (XX_ptr[0] + XX_ptr[24]) + 1.0f))
                       ? (xx)
                       : (0.03f * 0.5f * (XX_ptr[0] + XX_ptr[24]) + 1.0f));
    silk_scale_vector_FLP(XX_ptr, temp, 5 * 5);
    silk_scale_vector_FLP(xX_ptr, temp, 5);
    r_ptr += subfr_length;
    XX_ptr += 5 * 5;
    xX_ptr += 5;
  }
}


x86 assembly (clang, -O0):
<silk_find_LTP_FLP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    12da <silk_find_LTP_FLP+0x19a>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
movslq -0x2c(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
add    $0x2,%ecx
movslq %ecx,%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x40(%rbp),%rcx
mov    $0x5,%edx
call   1060 <silk_corrMatrix_FLP@plt>
mov    -0x48(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0x38(%rbp),%r8
mov    $0x5,%ecx
call   1040 <silk_corrVector_FLP@plt>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
add    $0x5,%esi
call   1050 <silk_energy_FLP@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x4c(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x40(%rbp),%rax
addss  0x60(%rax),%xmm1
movss  0xdf3(%rip),%xmm2
mulss  %xmm2,%xmm1
movss  0xdeb(%rip),%xmm2
addss  %xmm2,%xmm1
ucomiss %xmm1,%xmm0
jbe    1235 <silk_find_LTP_FLP+0xf5>
movss  -0x4c(%rbp),%xmm0
movss  %xmm0,-0x54(%rbp)
jmp    1263 <silk_find_LTP_FLP+0x123>
mov    -0x40(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x40(%rbp),%rax
addss  0x60(%rax),%xmm0
movss  0xdb2(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xdaa(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x54(%rbp)
movss  -0x54(%rbp),%xmm1
movss  0xd94(%rip),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x50(%rbp)
mov    -0x40(%rbp),%rdi
movss  -0x50(%rbp),%xmm0
mov    $0x19,%esi
call   1030 <silk_scale_vector_FLP@plt>
mov    -0x38(%rbp),%rdi
movss  -0x50(%rbp),%xmm0
mov    $0x5,%esi
call   1030 <silk_scale_vector_FLP@plt>
mov    -0x24(%rbp),%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x40(%rbp),%rax
add    $0x64,%rax
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rax
add    $0x14,%rax
mov    %rax,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1177 <silk_find_LTP_FLP+0x37>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<silk_find_LTP_FLP>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,0x8(%rsp)
test   %r9d,%r9d
jle    1250 <silk_find_LTP_FLP+0x110>
mov    %rdx,%r13
mov    %rsi,%r12
mov    %rdi,%rbx
mov    0x8(%rsp),%rax
lea    0x5(%rax),%edx
mov    %edx,(%rsp)
cltq
mov    %r9d,%edx
mov    %rdx,0x10(%rsp)
shl    $0x2,%rax
mov    %rax,0x18(%rsp)
xor    %ebp,%ebp
mov    %rcx,0x20(%rsp)
mov    0x8(%rsp),%r15
nop
mov    $0xfffffffe,%eax
sub    (%rcx,%rbp,4),%eax
cltq
lea    0x0(,%rax,4),%r14
add    %r13,%r14
mov    %r14,%rdi
mov    %r15d,%esi
mov    $0x5,%edx
mov    %rbx,%rcx
call   1060 <silk_corrMatrix_FLP@plt>
mov    %r14,%rdi
mov    %r13,%rsi
mov    %r15d,%edx
mov    $0x5,%ecx
mov    %r12,%r8
call   1040 <silk_corrVector_FLP@plt>
mov    %r13,%rdi
mov    (%rsp),%esi
call   1050 <silk_energy_FLP@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  (%rbx),%xmm1
addss  0x60(%rbx),%xmm1
mulss  0xe0e(%rip),%xmm1
movss  0xe0a(%rip),%xmm2
addss  %xmm2,%xmm1
maxss  %xmm1,%xmm0
divss  %xmm0,%xmm2
movss  %xmm2,0x4(%rsp)
mov    %rbx,%rdi
movaps %xmm2,%xmm0
mov    $0x19,%esi
call   1030 <silk_scale_vector_FLP@plt>
mov    %r12,%rdi
movss  0x4(%rsp),%xmm0
mov    $0x5,%esi
call   1030 <silk_scale_vector_FLP@plt>
mov    0x20(%rsp),%rcx
add    $0x14,%r12
add    $0x1,%rbp
add    0x18(%rsp),%r13
add    $0x64,%rbx
cmp    %rbp,0x10(%rsp)
jne    1190 <silk_find_LTP_FLP+0x50>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @silk_find_LTP_FLP(float* %0, float* %1, float* %2, i32* nocapture %3, i32 %4, i32 %5) {
%7 = icmp sgt i32 %5, 0
br i1 %7, label %8, label %41
8: ; preds = %6
%9 = add nsw i32 %4, 5
%10 = sext i32 %4 to i64
%11 = zext i32 %5 to i64
br label %12
12: ; preds = %8, %12
%13 = phi i64 [ 0, %8 ], [ %39, %12 ]
%14 = phi float* [ %2, %8 ], [ %36, %12 ]
%15 = phi float* [ %1, %8 ], [ %38, %12 ]
%16 = phi float* [ %0, %8 ], [ %37, %12 ]
%17 = getelementptr inbounds i32, i32* %3, i64 %13
%18 = load i32, i32* %17
%19 = sub i32 -2, %18
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds float, float* %14, i64 %20
%22 = tail call i32 @silk_corrMatrix_FLP(float* %21, i32 %4, i32 5, float* %16)
%23 = tail call i32 @silk_corrVector_FLP(float* %21, float* %14, i32 %4, i32 5, float* %15)
%24 = tail call i64 @silk_energy_FLP(float* %14, i32 %9)
%25 = sitofp i64 %24 to float
%26 = load float, float* %16
%27 = getelementptr inbounds float, float* %16, i64 24
%28 = load float, float* %27
%29 = fadd float %26, %28
%30 = tail call float @llvm.fmuladd.f32(float %29, float 0x3F8EB851E0000000, float 1.000000e+00)
%31 = fcmp olt float %30, %25
%32 = select i1 %31, float %25, float %30
%33 = fdiv float 1.000000e+00, %32
%34 = tail call i32 @silk_scale_vector_FLP(float* %16, float %33, i32 25)
%35 = tail call i32 @silk_scale_vector_FLP(float* %15, float %33, i32 5)
%36 = getelementptr inbounds float, float* %14, i64 %10
%37 = getelementptr inbounds float, float* %16, i64 25
%38 = getelementptr inbounds float, float* %15, i64 5
%39 = add nuw nsw i64 %13, 1
%40 = icmp eq i64 %39, %11
br i1 %40, label %41, label %12
41: ; preds = %12, %6
ret void
}