#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 SKP_Silk_LPC_inverse_pred_gain(int *, short *, int const);
int /*<<< orphan*/ SKP_Silk_NLSF2A(short *, int const *, int const);
int /*<<< orphan*/ SKP_Silk_bwexpander(short *, int const, int);
void SKP_Silk_NLSF2A_stable(short pAR_Q12[16], const int pNLSF[16],
                            const int LPC_order) {
  int i;
  int invGain_Q30;
  SKP_Silk_NLSF2A(pAR_Q12, pNLSF, LPC_order);
  for (i = 0; i < 20; i++) {
    if (SKP_Silk_LPC_inverse_pred_gain(&invGain_Q30, pAR_Q12, LPC_order) == 1) {
      SKP_Silk_bwexpander(pAR_Q12, LPC_order,
                          65536 - ((int)((short)(10 + i)) * (int)((short)(i))));
    } else {
      break;
    }
  }
  if (i == 20) {
    ;
    for (i = 0; i < LPC_order; i++) {
      pAR_Q12[i] = 0;
    }
  }
}


x86 assembly (clang, -O0):
<SKP_Silk_NLSF2A_stable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <SKP_Silk_NLSF2A@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x14,-0x18(%rbp)
jge    11bd <SKP_Silk_NLSF2A_stable+0x8d>
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    -0x1c(%rbp),%rdi
call   1030 <SKP_Silk_LPC_inverse_pred_gain@plt>
cmp    $0x1,%eax
jne    11a5 <SKP_Silk_NLSF2A_stable+0x75>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%eax
add    $0xa,%eax
cwtl
mov    -0x18(%rbp),%ecx
movswl %cx,%ecx
imul   %ecx,%eax
mov    $0x10000,%edx
sub    %eax,%edx
call   1050 <SKP_Silk_bwexpander@plt>
jmp    11aa <SKP_Silk_NLSF2A_stable+0x7a>
jmp    11bd <SKP_Silk_NLSF2A_stable+0x8d>
jmp    11af <SKP_Silk_NLSF2A_stable+0x7f>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115a <SKP_Silk_NLSF2A_stable+0x2a>
cmpl   $0x14,-0x18(%rbp)
jne    11fb <SKP_Silk_NLSF2A_stable+0xcb>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11f6 <SKP_Silk_NLSF2A_stable+0xc6>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movw   $0x0,(%rax,%rcx,2)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ce <SKP_Silk_NLSF2A_stable+0x9e>
jmp    11fb <SKP_Silk_NLSF2A_stable+0xcb>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SKP_Silk_NLSF2A_stable>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%r15
call   1040 <SKP_Silk_NLSF2A@plt>
mov    $0xa,%ebx
lea    0x4(%rsp),%r14
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
call   1030 <SKP_Silk_LPC_inverse_pred_gain@plt>
cmp    $0x1,%eax
jne    11a4 <SKP_Silk_NLSF2A_stable+0x64>
lea    -0xa(%rbx),%eax
imul   %ebx,%eax
mov    $0x10000,%edx
sub    %eax,%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1050 <SKP_Silk_bwexpander@plt>
add    $0x1,%ebx
cmp    $0x1e,%ebx
jne    1160 <SKP_Silk_NLSF2A_stable+0x20>
test   %ebp,%ebp
jle    11a4 <SKP_Silk_NLSF2A_stable+0x64>
mov    %ebp,%edx
add    %rdx,%rdx
mov    %r15,%rdi
xor    %esi,%esi
call   1060 <memset@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @SKP_Silk_NLSF2A_stable(i16* %0, i32* %1, i32 %2) {
%4 = alloca i16*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i16* %0, i16** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%9 = load i16*, i16** %4
%10 = load i32*, i32** %5
%11 = load i32, i32* %6
%12 = call i32 @SKP_Silk_NLSF2A(i16* %9, i32* %10, i32 %11)
store i32 0, i32* %7
br label %13
13: ; preds = %36, %3
%14 = load i32, i32* %7
%15 = icmp slt i32 %14, 20
br i1 %15, label %16, label %39
16: ; preds = %13
%17 = load i16*, i16** %4
%18 = load i32, i32* %6
%19 = call i32 @SKP_Silk_LPC_inverse_pred_gain(i32* %8, i16* %17, i32 %18)
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %34
21: ; preds = %16
%22 = load i16*, i16** %4
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = add nsw i32 10, %24
%26 = trunc i32 %25 to i16
%27 = sext i16 %26 to i32
%28 = load i32, i32* %7
%29 = trunc i32 %28 to i16
%30 = sext i16 %29 to i32
%31 = mul nsw i32 %27, %30
%32 = sub nsw i32 65536, %31
%33 = call i32 @SKP_Silk_bwexpander(i16* %22, i32 %23, i32 %32)
br label %35
34: ; preds = %16
br label %39
35: ; preds = %21
br label %36
36: ; preds = %35
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
br label %13
39: ; preds = %34, %13
%40 = load i32, i32* %7
%41 = icmp eq i32 %40, 20
br i1 %41, label %42, label %56
42: ; preds = %39
store i32 0, i32* %7
br label %43
43: ; preds = %52, %42
%44 = load i32, i32* %7
%45 = load i32, i32* %6
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %55
47: ; preds = %43
%48 = load i16*, i16** %4
%49 = load i32, i32* %7
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i16, i16* %48, i64 %50
store i16 0, i16* %51
br label %52
52: ; preds = %47
%53 = load i32, i32* %7
%54 = add nsw i32 %53, 1
store i32 %54, i32* %7
br label %43
55: ; preds = %43
br label %56
56: ; preds = %55, %39
ret void
}

LLVM IR (-O2):
define void @SKP_Silk_NLSF2A_stable(i16* %0, i32* %1, i32 %2) {
%4 = bitcast i16* %0 to i8*
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
%7 = tail call i32 @SKP_Silk_NLSF2A(i16* %0, i32* %1, i32 %2)
br label %8
8: ; preds = %3, %12
%9 = phi i32 [ 0, %3 ], [ %17, %12 ]
%10 = call i32 @SKP_Silk_LPC_inverse_pred_gain(i32* %5, i16* %0, i32 %2)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %24
12: ; preds = %8
%13 = add nuw nsw i32 %9, 10
%14 = mul nuw nsw i32 %13, %9
%15 = sub nuw nsw i32 65536, %14
%16 = call i32 @SKP_Silk_bwexpander(i16* %0, i32 %2, i32 %15)
%17 = add nuw nsw i32 %9, 1
%18 = icmp eq i32 %17, 20
br i1 %18, label %19, label %8
19: ; preds = %12
%20 = icmp sgt i32 %2, 0
br i1 %20, label %21, label %24
21: ; preds = %19
%22 = zext i32 %2 to i64
%23 = shl nuw nsw i64 %22, 1
br label %24
24: ; preds = %8, %21, %19
ret void
}