#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 LPC_inverse_pred_gain_QA(int *, int **, int const);
int SKP_Silk_LPC_inverse_pred_gain(int *invGain_Q30, const short *A_Q12,
                                   const int order) {
  int k;
  int Atmp_QA[2][16];
  int *Anew_QA;
  Anew_QA = Atmp_QA[order & 1];
  for (k = 0; k < order; k++) {
    Anew_QA[k] = (((int)A_Q12[k]) << (16 - 12));
  }
  return LPC_inverse_pred_gain_QA(invGain_Q30, Atmp_QA, order);
}


x86 assembly (clang, -O0):
<SKP_Silk_LPC_inverse_pred_gain>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    $0x1,%eax
movslq %eax,%rcx
lea    -0xa0(%rbp),%rax
shl    $0x6,%rcx
add    %rcx,%rax
mov    %rax,-0xa8(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1182 <SKP_Silk_LPC_inverse_pred_gain+0x72>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movswl (%rax,%rcx,2),%edx
shl    $0x4,%edx
mov    -0xa8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114b <SKP_Silk_LPC_inverse_pred_gain+0x3b>
mov    -0x8(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <LPC_inverse_pred_gain_QA@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SKP_Silk_LPC_inverse_pred_gain>:
push   %rbx
sub    $0x80,%rsp
test   %edx,%edx
jle    1243 <SKP_Silk_LPC_inverse_pred_gain+0x133>
mov    %edx,%r8d
and    $0x1,%r8d
mov    %edx,%r9d
cmp    $0x8,%edx
jae    1136 <SKP_Silk_LPC_inverse_pred_gain+0x26>
xor    %ecx,%ecx
jmp    1227 <SKP_Silk_LPC_inverse_pred_gain+0x117>
mov    %r9d,%ecx
and    $0xfffffff8,%ecx
lea    -0x8(%rcx),%rax
mov    %rax,%r10
shr    $0x3,%r10
add    $0x1,%r10
test   %rax,%rax
je     1254 <SKP_Silk_LPC_inverse_pred_gain+0x144>
mov    %r10,%r11
and    $0xfffffffffffffffe,%r11
mov    %r8,%rax
shl    $0x6,%rax
lea    (%rsp,%rax,1),%rbx
add    $0x30,%rbx
xor    %eax,%eax
nopl   0x0(%rax)
movq   (%rsi,%rax,2),%xmm0
punpcklwd %xmm0,%xmm0
movq   0x8(%rsi,%rax,2),%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x10,%xmm0
psrad  $0x10,%xmm1
pslld  $0x4,%xmm0
pslld  $0x4,%xmm1
movdqa %xmm0,-0x30(%rbx,%rax,4)
movdqa %xmm1,-0x20(%rbx,%rax,4)
movq   0x10(%rsi,%rax,2),%xmm0
punpcklwd %xmm0,%xmm0
movq   0x18(%rsi,%rax,2),%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x10,%xmm0
psrad  $0x10,%xmm1
pslld  $0x4,%xmm0
pslld  $0x4,%xmm1
movdqa %xmm0,-0x10(%rbx,%rax,4)
movdqa %xmm1,(%rbx,%rax,4)
add    $0x10,%rax
add    $0xfffffffffffffffe,%r11
jne    1170 <SKP_Silk_LPC_inverse_pred_gain+0x60>
test   $0x1,%r10b
je     1222 <SKP_Silk_LPC_inverse_pred_gain+0x112>
movq   (%rsi,%rax,2),%xmm0
movq   0x8(%rsi,%rax,2),%xmm1
punpcklwd %xmm0,%xmm0
psrad  $0x10,%xmm0
punpcklwd %xmm1,%xmm1
psrad  $0x10,%xmm1
pslld  $0x4,%xmm0
pslld  $0x4,%xmm1
mov    %r8,%rbx
shl    $0x6,%rbx
add    %rsp,%rbx
movdqa %xmm0,(%rbx,%rax,4)
movdqa %xmm1,0x10(%rbx,%rax,4)
cmp    %r9,%rcx
je     1243 <SKP_Silk_LPC_inverse_pred_gain+0x133>
shl    $0x6,%r8
lea    (%rsp,%r8,1),%rax
nop
movswl (%rsi,%rcx,2),%ebx
shl    $0x4,%ebx
mov    %ebx,(%rax,%rcx,4)
add    $0x1,%rcx
cmp    %rcx,%r9
jne    1230 <SKP_Silk_LPC_inverse_pred_gain+0x120>
mov    %rsp,%rsi
call   1030 <LPC_inverse_pred_gain_QA@plt>
add    $0x80,%rsp
pop    %rbx
ret
xor    %eax,%eax
test   $0x1,%r10b
jne    11e6 <SKP_Silk_LPC_inverse_pred_gain+0xd6>
jmp    1222 <SKP_Silk_LPC_inverse_pred_gain+0x112>

LLVM IR (-O0):
define i32 @SKP_Silk_LPC_inverse_pred_gain(i32* %0, i16* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i16*
%6 = alloca i32
%7 = alloca i32
%8 = alloca [2 x [16 x i32]]
%9 = alloca i32*
store i32* %0, i32** %4
store i16* %1, i16** %5
store i32 %2, i32* %6
%10 = load i32, i32* %6
%11 = and i32 %10, 1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [2 x [16 x i32]], [2 x [16 x i32]]* %8, i64 0, i64 %12
%14 = getelementptr inbounds [16 x i32], [16 x i32]* %13, i64 0, i64 0
store i32* %14, i32** %9
store i32 0, i32* %7
br label %15
15: ; preds = %31, %3
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %34
19: ; preds = %15
%20 = load i16*, i16** %5
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i16, i16* %20, i64 %22
%24 = load i16, i16* %23
%25 = sext i16 %24 to i32
%26 = shl i32 %25, 4
%27 = load i32*, i32** %9
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
store i32 %26, i32* %30
br label %31
31: ; preds = %19
%32 = load i32, i32* %7
%33 = add nsw i32 %32, 1
store i32 %33, i32* %7
br label %15
34: ; preds = %15
%35 = load i32*, i32** %4
%36 = getelementptr inbounds [2 x [16 x i32]], [2 x [16 x i32]]* %8, i64 0, i64 0
%37 = bitcast [16 x i32]* %36 to i32**
%38 = load i32, i32* %6
%39 = call i32 @LPC_inverse_pred_gain_QA(i32* %35, i32** %37, i32 %38)
ret i32 %39
}

LLVM IR (-O2):
define i32 @SKP_Silk_LPC_inverse_pred_gain(i32* %0, i16* nocapture %1, i32 %2) {
%4 = alloca [2 x [16 x i32]]
%5 = bitcast [2 x [16 x i32]]* %4 to i8*
%6 = and i32 %2, 1
%7 = zext i32 %6 to i64
%8 = icmp sgt i32 %2, 0
br i1 %8, label %9, label %87
9: ; preds = %3
%10 = zext i32 %2 to i64
%11 = icmp ult i32 %2, 8
br i1 %11, label %76, label %12
12: ; preds = %9
%13 = and i64 %10, 4294967288
%14 = add nsw i64 %13, -8
%15 = lshr exact i64 %14, 3
%16 = add nuw nsw i64 %15, 1
%17 = and i64 %16, 1
%18 = icmp eq i64 %14, 0
br i1 %18, label %56, label %19
19: ; preds = %12
%20 = and i64 %16, 4611686018427387902
br label %21
21: ; preds = %21, %19
%22 = phi i64 [ 0, %19 ], [ %53, %21 ]
%23 = phi i64 [ 0, %19 ], [ %54, %21 ]
%24 = getelementptr inbounds i16, i16* %1, i64 %22
%25 = bitcast i16* %24 to <4 x i16>*
%26 = load <4 x i16>, <4 x i16>* %25
%27 = getelementptr inbounds i16, i16* %24, i64 4
%28 = bitcast i16* %27 to <4 x i16>*
%29 = load <4 x i16>, <4 x i16>* %28
%30 = sext <4 x i16> %26 to <4 x i32>
%31 = sext <4 x i16> %29 to <4 x i32>
%32 = shl nsw <4 x i32> %30, <i32 4, i32 4, i32 4, i32 4>
%33 = shl nsw <4 x i32> %31, <i32 4, i32 4, i32 4, i32 4>
%34 = getelementptr inbounds [2 x [16 x i32]], [2 x [16 x i32]]* %4, i64 0, i64 %7, i64 %22
%35 = bitcast i32* %34 to <4 x i32>*
store <4 x i32> %32, <4 x i32>* %35
%36 = getelementptr inbounds i32, i32* %34, i64 4
%37 = bitcast i32* %36 to <4 x i32>*
store <4 x i32> %33, <4 x i32>* %37
%38 = or i64 %22, 8
%39 = getelementptr inbounds i16, i16* %1, i64 %38
%40 = bitcast i16* %39 to <4 x i16>*
%41 = load <4 x i16>, <4 x i16>* %40
%42 = getelementptr inbounds i16, i16* %39, i64 4
%43 = bitcast i16* %42 to <4 x i16>*
%44 = load <4 x i16>, <4 x i16>* %43
%45 = sext <4 x i16> %41 to <4 x i32>
%46 = sext <4 x i16> %44 to <4 x i32>
%47 = shl nsw <4 x i32> %45, <i32 4, i32 4, i32 4, i32 4>
%48 = shl nsw <4 x i32> %46, <i32 4, i32 4, i32 4, i32 4>
%49 = getelementptr inbounds [2 x [16 x i32]], [2 x [16 x i32]]* %4, i64 0, i64 %7, i64 %38
%50 = bitcast i32* %49 to <4 x i32>*
store <4 x i32> %47, <4 x i32>* %50
%51 = getelementptr inbounds i32, i32* %49, i64 4
%52 = bitcast i32* %51 to <4 x i32>*
store <4 x i32> %48, <4 x i32>* %52
%53 = add nuw i64 %22, 16
%54 = add i64 %23, 2
%55 = icmp eq i64 %54, %20
br i1 %55, label %56, label %21
56: ; preds = %21, %12
%57 = phi i64 [ 0, %12 ], [ %53, %21 ]
%58 = icmp eq i64 %17, 0
br i1 %58, label %74, label %59
59: ; preds = %56
%60 = getelementptr inbounds i16, i16* %1, i64 %57
%61 = bitcast i16* %60 to <4 x i16>*
%62 = load <4 x i16>, <4 x i16>* %61
%63 = getelementptr inbounds i16, i16* %60, i64 4
%64 = bitcast i16* %63 to <4 x i16>*
%65 = load <4 x i16>, <4 x i16>* %64
%66 = sext <4 x i16> %62 to <4 x i32>
%67 = sext <4 x i16> %65 to <4 x i32>
%68 = shl nsw <4 x i32> %66, <i32 4, i32 4, i32 4, i32 4>
%69 = shl nsw <4 x i32> %67, <i32 4, i32 4, i32 4, i32 4>
%70 = getelementptr inbounds [2 x [16 x i32]], [2 x [16 x i32]]* %4, i64 0, i64 %7, i64 %57
%71 = bitcast i32* %70 to <4 x i32>*
store <4 x i32> %68, <4 x i32>* %71
%72 = getelementptr inbounds i32, i32* %70, i64 4
%73 = bitcast i32* %72 to <4 x i32>*
store <4 x i32> %69, <4 x i32>* %73
br label %74
74: ; preds = %56, %59
%75 = icmp eq i64 %13, %10
br i1 %75, label %87, label %76
76: ; preds = %9, %74
%77 = phi i64 [ 0, %9 ], [ %13, %74 ]
br label %78
78: ; preds = %76, %78
%79 = phi i64 [ %85, %78 ], [ %77, %76 ]
%80 = getelementptr inbounds i16, i16* %1, i64 %79
%81 = load i16, i16* %80
%82 = sext i16 %81 to i32
%83 = shl nsw i32 %82, 4
%84 = getelementptr inbounds [2 x [16 x i32]], [2 x [16 x i32]]* %4, i64 0, i64 %7, i64 %79
store i32 %83, i32* %84
%85 = add nuw nsw i64 %79, 1
%86 = icmp eq i64 %85, %10
br i1 %86, label %87, label %78
87: ; preds = %78, %74, %3
%88 = bitcast [2 x [16 x i32]]* %4 to i32**
%89 = call i32 @LPC_inverse_pred_gain_QA(i32* %0, i32** %88, i32 %2)
ret i32 %89
}