int SKP_Silk_LPC_inverse_pred_gain_Q24(int *invGain_Q30, const int *A_Q24,
                                       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] = ((24 - 16) == 1 ? ((A_Q24[k]) >> 1) + ((A_Q24[k]) & 1)
                                 : (((A_Q24[k]) >> ((24 - 16) - 1)) + 1) >> 1);
  }
  return LPC_inverse_pred_gain_QA(invGain_Q30, Atmp_QA, order);
}


x86 assembly (clang, -O0):
<SKP_Silk_LPC_inverse_pred_gain_Q24>:
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    1187 <SKP_Silk_LPC_inverse_pred_gain_Q24+0x77>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
sar    $0x7,%edx
add    $0x1,%edx
sar    $0x1,%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_Q24+0x3b>
mov    -0x8(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    $0x0,%al
call   1030 <LPC_inverse_pred_gain_QA@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SKP_Silk_LPC_inverse_pred_gain_Q24>:
push   %rbx
sub    $0x80,%rsp
test   %edx,%edx
jle    1257 <SKP_Silk_LPC_inverse_pred_gain_Q24+0x147>
mov    %edx,%r8d
and    $0x1,%r8d
mov    %edx,%r9d
cmp    $0x8,%edx
jae    1136 <SKP_Silk_LPC_inverse_pred_gain_Q24+0x26>
xor    %ecx,%ecx
jmp    122b <SKP_Silk_LPC_inverse_pred_gain_Q24+0x11b>
mov    %r9d,%ecx
and    $0xfffffff8,%ecx
lea    -0x8(%rcx),%rax
mov    %rax,%r10
shr    $0x3,%r10
add    $0x1,%r10
test   %rax,%rax
je     126a <SKP_Silk_LPC_inverse_pred_gain_Q24+0x15a>
mov    %r10,%r11
and    $0xfffffffffffffffe,%r11
mov    %r8,%rax
shl    $0x6,%rax
lea    (%rsp,%rax,1),%rbx
add    $0x30,%rbx
xor    %eax,%eax
pcmpeqd %xmm0,%xmm0
movdqu (%rsi,%rax,4),%xmm1
movdqu 0x10(%rsi,%rax,4),%xmm2
psrad  $0x7,%xmm1
psrad  $0x7,%xmm2
psubd  %xmm0,%xmm1
psubd  %xmm0,%xmm2
psrad  $0x1,%xmm1
psrad  $0x1,%xmm2
movdqa %xmm1,-0x30(%rbx,%rax,4)
movdqa %xmm2,-0x20(%rbx,%rax,4)
movdqu 0x20(%rsi,%rax,4),%xmm1
movdqu 0x30(%rsi,%rax,4),%xmm2
psrad  $0x7,%xmm1
psrad  $0x7,%xmm2
psubd  %xmm0,%xmm1
psubd  %xmm0,%xmm2
psrad  $0x1,%xmm1
psrad  $0x1,%xmm2
movdqa %xmm1,-0x10(%rbx,%rax,4)
movdqa %xmm2,(%rbx,%rax,4)
add    $0x10,%rax
add    $0xfffffffffffffffe,%r11
jne    1170 <SKP_Silk_LPC_inverse_pred_gain_Q24+0x60>
test   $0x1,%r10b
je     1226 <SKP_Silk_LPC_inverse_pred_gain_Q24+0x116>
movdqu (%rsi,%rax,4),%xmm0
movdqu 0x10(%rsi,%rax,4),%xmm1
psrad  $0x7,%xmm0
psrad  $0x7,%xmm1
pcmpeqd %xmm2,%xmm2
psubd  %xmm2,%xmm0
psubd  %xmm2,%xmm1
psrad  $0x1,%xmm0
psrad  $0x1,%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     1257 <SKP_Silk_LPC_inverse_pred_gain_Q24+0x147>
shl    $0x6,%r8
lea    (%rsp,%r8,1),%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rsi,%rcx,4),%ebx
sar    $0x7,%ebx
add    $0x1,%ebx
sar    %ebx
mov    %ebx,(%rax,%rcx,4)
add    $0x1,%rcx
cmp    %rcx,%r9
jne    1240 <SKP_Silk_LPC_inverse_pred_gain_Q24+0x130>
mov    %rsp,%rsi
xor    %eax,%eax
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_Q24+0xd6>
jmp    1226 <SKP_Silk_LPC_inverse_pred_gain_Q24+0x116>

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

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