#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)(66)) * (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    11b4 <SKP_Silk_NLSF2A_stable+0x84>
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    119c <SKP_Silk_NLSF2A_stable+0x6c>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%eax
cwtl
imul   $0x42,%eax,%eax
mov    $0x10000,%edx
sub    %eax,%edx
call   1050 <SKP_Silk_bwexpander@plt>
jmp    11a1 <SKP_Silk_NLSF2A_stable+0x71>
jmp    11b4 <SKP_Silk_NLSF2A_stable+0x84>
jmp    11a6 <SKP_Silk_NLSF2A_stable+0x76>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115a <SKP_Silk_NLSF2A_stable+0x2a>
cmpl   $0x14,-0x18(%rbp)
jne    11f2 <SKP_Silk_NLSF2A_stable+0xc2>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11ed <SKP_Silk_NLSF2A_stable+0xbd>
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    11c5 <SKP_Silk_NLSF2A_stable+0x95>
jmp    11f2 <SKP_Silk_NLSF2A_stable+0xc2>
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,%r14
call   1040 <SKP_Silk_NLSF2A@plt>
mov    $0x10000,%ebx
lea    0x4(%rsp),%r15
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1030 <SKP_Silk_LPC_inverse_pred_gain@plt>
cmp    $0x1,%eax
jne    119c <SKP_Silk_NLSF2A_stable+0x5c>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1050 <SKP_Silk_bwexpander@plt>
add    $0xffffffbe,%ebx
cmp    $0xfad8,%ebx
jne    1160 <SKP_Silk_NLSF2A_stable+0x20>
test   %ebp,%ebp
jle    119c <SKP_Silk_NLSF2A_stable+0x5c>
mov    %ebp,%edx
add    %rdx,%rdx
mov    %r14,%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 = %32, %3
%14 = load i32, i32* %7
%15 = icmp slt i32 %14, 20
br i1 %15, label %16, label %35
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 %30
21: ; preds = %16
%22 = load i16*, i16** %4
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = trunc i32 %24 to i16
%26 = sext i16 %25 to i32
%27 = mul nsw i32 66, %26
%28 = sub nsw i32 65536, %27
%29 = call i32 @SKP_Silk_bwexpander(i16* %22, i32 %23, i32 %28)
br label %31
30: ; preds = %16
br label %35
31: ; preds = %21
br label %32
32: ; preds = %31
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
store i32 %34, i32* %7
br label %13
35: ; preds = %30, %13
%36 = load i32, i32* %7
%37 = icmp eq i32 %36, 20
br i1 %37, label %38, label %52
38: ; preds = %35
store i32 0, i32* %7
br label %39
39: ; preds = %48, %38
%40 = load i32, i32* %7
%41 = load i32, i32* %6
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %51
43: ; preds = %39
%44 = load i16*, i16** %4
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i16, i16* %44, i64 %46
store i16 0, i16* %47
br label %48
48: ; preds = %43
%49 = load i32, i32* %7
%50 = add nsw i32 %49, 1
store i32 %50, i32* %7
br label %39
51: ; preds = %39
br label %52
52: ; preds = %51, %35
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 ], [ %16, %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 %23
12: ; preds = %8
%13 = mul nsw i32 %9, -66
%14 = add nsw i32 %13, 65536
%15 = call i32 @SKP_Silk_bwexpander(i16* %0, i32 %2, i32 %14)
%16 = add nuw nsw i32 %9, 1
%17 = icmp eq i32 %16, 20
br i1 %17, label %18, label %8
18: ; preds = %12
%19 = icmp sgt i32 %2, 0
br i1 %19, label %20, label %23
20: ; preds = %18
%21 = zext i32 %2 to i64
%22 = shl nuw nsw i64 %21, 1
br label %23
23: ; preds = %8, %20, %18
ret void
}