#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 */
typedef int int16_t;

/* Variables and functions */
int /*<<< orphan*/ apcm_quantization_xmaxc_to_exp_mant(int, int *, int *);
int /*<<< orphan*/ assert(int);
int saturated_abs16(int);
int saturated_add16(int, int);
int saturated_mul16(int, int);
void apcm_quantization(int16_t xM[13], int16_t xMc[13], int16_t *mant_out,
                       int16_t *exp_out, int16_t *xmaxc_out) {
  static const int16_t gsm_NRFAC[8] = {29128, 26215, 23832, 21846,
                                       20165, 18725, 17476, 16384};
  int i;
  int itest;
  int16_t xmax;
  int16_t xmaxc;
  int16_t temp;
  int16_t temp1;
  int16_t temp2;
  int16_t exp;
  int16_t mant;
  xmax = 0;
  for (i = 0; i < 13; i++) {
    temp = xM[i];
    temp = saturated_abs16(temp);
    if (temp > xmax)
      xmax = temp;
  }
  exp = 0;
  temp = xmax >> 9;
  itest = 0;
  for (i = 0; i <= 5; i++) {
    itest |= (temp <= 0);
    temp >>= 1;
    assert(exp <= 5);
    if (itest == 0)
      exp++;
  }
  assert(exp <= 6 && exp >= 0);
  temp = (int16_t)(exp + 5);
  assert(temp <= 11 && temp >= 0);
  xmaxc = saturated_add16((xmax >> temp), exp << 3);
  apcm_quantization_xmaxc_to_exp_mant(xmaxc, &exp, &mant);
  assert(exp <= 4096 && exp >= -4096);
  assert(mant >= 0 && mant <= 7);
  temp1 = (int16_t)(6 - exp);
  temp2 = gsm_NRFAC[mant];
  for (i = 0; i < 13; i++) {
    assert(temp1 >= 0 && temp1 < 16);
    temp = xM[i] << temp1;
    temp = saturated_mul16(temp, temp2);
    temp >>= 12;
    xMc[i] = (int16_t)(temp + 4);
  }
  *mant_out = mant;
  *exp_out = exp;
  *xmaxc_out = xmaxc;
}


x86 assembly (clang, -O0):
<apcm_quantization>:
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    %r8,-0x28(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0xd,-0x2c(%rbp)
jge    11c2 <apcm_quantization+0x72>
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%edi
call   1070 <saturated_abs16@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jle    11af <apcm_quantization+0x5f>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x34(%rbp)
jmp    11b4 <apcm_quantization+0x64>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    117a <apcm_quantization+0x2a>
movl   $0x0,-0x48(%rbp)
mov    -0x34(%rbp),%eax
sar    $0x9,%eax
mov    %eax,-0x3c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x5,-0x2c(%rbp)
jg     123c <apcm_quantization+0xec>
cmpl   $0x0,-0x3c(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%eax
or     -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x3c(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0x5,-0x48(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpl   $0x0,-0x30(%rbp)
jne    1229 <apcm_quantization+0xd9>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    122e <apcm_quantization+0xde>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11e0 <apcm_quantization+0x90>
xor    %eax,%eax
cmpl   $0x6,-0x48(%rbp)
mov    %al,-0x4d(%rbp)
jg     1255 <apcm_quantization+0x105>
cmpl   $0x0,-0x48(%rbp)
setge  %al
mov    %al,-0x4d(%rbp)
mov    -0x4d(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x48(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x3c(%rbp)
xor    %eax,%eax
cmpl   $0xb,-0x3c(%rbp)
mov    %al,-0x4e(%rbp)
jg     1284 <apcm_quantization+0x134>
cmpl   $0x0,-0x3c(%rbp)
setge  %al
mov    %al,-0x4e(%rbp)
mov    -0x4e(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x34(%rbp),%edi
mov    -0x3c(%rbp),%ecx
sar    %cl,%edi
mov    -0x48(%rbp),%esi
shl    $0x3,%esi
call   1040 <saturated_add16@plt>
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%edi
lea    -0x48(%rbp),%rsi
lea    -0x4c(%rbp),%rdx
call   1030 <apcm_quantization_xmaxc_to_exp_mant@plt>
xor    %eax,%eax
cmpl   $0x1000,-0x48(%rbp)
mov    %al,-0x4f(%rbp)
jg     12d6 <apcm_quantization+0x186>
cmpl   $0xfffff000,-0x48(%rbp)
setge  %al
mov    %al,-0x4f(%rbp)
mov    -0x4f(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
xor    %eax,%eax
cmpl   $0x0,-0x4c(%rbp)
mov    %al,-0x50(%rbp)
jl     12fc <apcm_quantization+0x1ac>
cmpl   $0x7,-0x4c(%rbp)
setle  %al
mov    %al,-0x50(%rbp)
mov    -0x50(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x6,%eax
sub    -0x48(%rbp),%eax
mov    %eax,-0x40(%rbp)
movslq -0x4c(%rbp),%rcx
lea    0xce1(%rip),%rax
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x44(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0xd,-0x2c(%rbp)
jge    13a5 <apcm_quantization+0x255>
xor    %eax,%eax
cmpl   $0x0,-0x40(%rbp)
mov    %al,-0x51(%rbp)
jl     134f <apcm_quantization+0x1ff>
cmpl   $0x10,-0x40(%rbp)
setl   %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x40(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%edi
mov    -0x44(%rbp),%esi
call   1060 <saturated_mul16@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
sar    $0xc,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%edx
add    $0x4,%edx
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    132c <apcm_quantization+0x1dc>
mov    -0x4c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x48(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x38(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<apcm_quantization>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r8,0x20(%rsp)
mov    %rcx,0x18(%rsp)
mov    %rdx,0x10(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%edi
call   1070 <saturated_abs16@plt>
mov    %eax,%ebp
xor    %r13d,%r13d
test   %eax,%eax
cmovs  %r13d,%ebp
mov    0x4(%rbx),%edi
call   1070 <saturated_abs16@plt>
cmp    %ebp,%eax
cmovg  %eax,%ebp
mov    0x8(%rbx),%edi
call   1070 <saturated_abs16@plt>
cmp    %ebp,%eax
cmovg  %eax,%ebp
mov    0xc(%rbx),%edi
call   1070 <saturated_abs16@plt>
cmp    %ebp,%eax
cmovg  %eax,%ebp
mov    0x10(%rbx),%edi
call   1070 <saturated_abs16@plt>
cmp    %ebp,%eax
cmovg  %eax,%ebp
mov    0x14(%rbx),%edi
call   1070 <saturated_abs16@plt>
cmp    %ebp,%eax
cmovg  %eax,%ebp
mov    0x18(%rbx),%edi
call   1070 <saturated_abs16@plt>
cmp    %ebp,%eax
cmovg  %eax,%ebp
mov    0x1c(%rbx),%edi
call   1070 <saturated_abs16@plt>
cmp    %ebp,%eax
cmovg  %eax,%ebp
mov    0x20(%rbx),%edi
call   1070 <saturated_abs16@plt>
cmp    %ebp,%eax
cmovg  %eax,%ebp
mov    0x24(%rbx),%edi
call   1070 <saturated_abs16@plt>
cmp    %ebp,%eax
cmovg  %eax,%ebp
mov    0x28(%rbx),%edi
call   1070 <saturated_abs16@plt>
cmp    %ebp,%eax
cmovg  %eax,%ebp
mov    0x2c(%rbx),%edi
call   1070 <saturated_abs16@plt>
cmp    %ebp,%eax
cmovg  %eax,%ebp
mov    %rbx,0x28(%rsp)
mov    0x30(%rbx),%edi
call   1070 <saturated_abs16@plt>
cmp    %ebp,%eax
cmovg  %eax,%ebp
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
movd   %ebp,%xmm0
pshufd $0x0,%xmm0,%xmm0
movdqa %xmm0,0x30(%rsp)
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
movdqa 0x30(%rsp),%xmm0
pxor   0xd81(%rip),%xmm0
pcmpgtd 0xd89(%rip),%xmm0
movmskps %xmm0,%eax
mov    %eax,%ecx
shr    %cl
and    $0x5,%cl
sub    %cl,%al
mov    %eax,%ecx
and    $0x33,%cl
shr    $0x2,%al
and    $0x33,%al
add    %cl,%al
mov    %eax,%ecx
shr    $0x4,%cl
add    %al,%cl
and    $0xf,%cl
cmp    $0x2000,%ebp
movzbl %cl,%ebx
sbb    $0xffffffff,%ebx
cmp    $0x4000,%ebp
sbb    $0xffffffff,%ebx
mov    %ebx,0x8(%rsp)
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
lea    0x5(%rbx),%ecx
shr    %cl,%ebp
shl    $0x3,%ebx
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r14,%rbx
call   1040 <saturated_add16@plt>
mov    %eax,%ebp
lea    0x8(%rsp),%rsi
lea    0xc(%rsp),%rdx
mov    %eax,%edi
call   1030 <apcm_quantization_xmaxc_to_exp_mant@plt>
mov    $0x1000,%eax
add    0x8(%rsp),%eax
xor    %edi,%edi
cmp    $0x2001,%eax
setb   %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmpl   $0x8,0xc(%rsp)
setb   %dil
call   1050 <assert@plt>
mov    0x8(%rsp),%eax
mov    $0x6,%r14d
sub    %eax,%r14d
movslq 0xc(%rsp),%rcx
lea    0xce1(%rip),%rdx
mov    (%rdx,%rcx,4),%r15d
add    $0x9,%eax
xor    %r12d,%r12d
cmp    $0x10,%eax
setb   %r12b
mov    %r12d,%edi
call   1050 <assert@plt>
mov    0x28(%rsp),%rax
mov    (%rax,%r13,4),%edi
mov    %r14d,%ecx
shl    %cl,%edi
mov    %r15d,%esi
call   1060 <saturated_mul16@plt>
sar    $0xc,%eax
add    $0x4,%eax
mov    %eax,(%rbx,%r13,4)
add    $0x1,%r13
cmp    $0xd,%r13
jne    1350 <apcm_quantization+0x200>
mov    0xc(%rsp),%eax
mov    0x10(%rsp),%rcx
mov    %eax,(%rcx)
mov    0x8(%rsp),%eax
mov    0x18(%rsp),%rcx
mov    %eax,(%rcx)
mov    0x20(%rsp),%rax
mov    %ebp,(%rax)
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@apcm_quantization.gsm_NRFAC = internal constant [8 x i32] [i32 29128, i32 26215, i32 23832, i32 21846, i32 20165, i32 18725, i32 17476, i32 16384]
define void @apcm_quantization(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4) {
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32* %4, i32** %10
store i32 0, i32* %13
store i32 0, i32* %11
br label %20
20: ; preds = %37, %5
%21 = load i32, i32* %11
%22 = icmp slt i32 %21, 13
br i1 %22, label %23, label %40
23: ; preds = %20
%24 = load i32*, i32** %6
%25 = load i32, i32* %11
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %24, i64 %26
%28 = load i32, i32* %27
store i32 %28, i32* %15
%29 = load i32, i32* %15
%30 = call i32 @saturated_abs16(i32 %29)
store i32 %30, i32* %15
%31 = load i32, i32* %15
%32 = load i32, i32* %13
%33 = icmp sgt i32 %31, %32
br i1 %33, label %34, label %36
34: ; preds = %23
%35 = load i32, i32* %15
store i32 %35, i32* %13
br label %36
36: ; preds = %34, %23
br label %37
37: ; preds = %36
%38 = load i32, i32* %11
%39 = add nsw i32 %38, 1
store i32 %39, i32* %11
br label %20
40: ; preds = %20
store i32 0, i32* %18
%41 = load i32, i32* %13
%42 = ashr i32 %41, 9
store i32 %42, i32* %15
store i32 0, i32* %12
store i32 0, i32* %11
br label %43
43: ; preds = %64, %40
%44 = load i32, i32* %11
%45 = icmp sle i32 %44, 5
br i1 %45, label %46, label %67
46: ; preds = %43
%47 = load i32, i32* %15
%48 = icmp sle i32 %47, 0
%49 = zext i1 %48 to i32
%50 = load i32, i32* %12
%51 = or i32 %50, %49
store i32 %51, i32* %12
%52 = load i32, i32* %15
%53 = ashr i32 %52, 1
store i32 %53, i32* %15
%54 = load i32, i32* %18
%55 = icmp sle i32 %54, 5
%56 = zext i1 %55 to i32
%57 = call i32 @assert(i32 %56)
%58 = load i32, i32* %12
%59 = icmp eq i32 %58, 0
br i1 %59, label %60, label %63
60: ; preds = %46
%61 = load i32, i32* %18
%62 = add nsw i32 %61, 1
store i32 %62, i32* %18
br label %63
63: ; preds = %60, %46
br label %64
64: ; preds = %63
%65 = load i32, i32* %11
%66 = add nsw i32 %65, 1
store i32 %66, i32* %11
br label %43
67: ; preds = %43
%68 = load i32, i32* %18
%69 = icmp sle i32 %68, 6
br i1 %69, label %70, label %73
70: ; preds = %67
%71 = load i32, i32* %18
%72 = icmp sge i32 %71, 0
br label %73
73: ; preds = %70, %67
%74 = phi i1 [ false, %67 ], [ %72, %70 ]
%75 = zext i1 %74 to i32
%76 = call i32 @assert(i32 %75)
%77 = load i32, i32* %18
%78 = add nsw i32 %77, 5
store i32 %78, i32* %15
%79 = load i32, i32* %15
%80 = icmp sle i32 %79, 11
br i1 %80, label %81, label %84
81: ; preds = %73
%82 = load i32, i32* %15
%83 = icmp sge i32 %82, 0
br label %84
84: ; preds = %81, %73
%85 = phi i1 [ false, %73 ], [ %83, %81 ]
%86 = zext i1 %85 to i32
%87 = call i32 @assert(i32 %86)
%88 = load i32, i32* %13
%89 = load i32, i32* %15
%90 = ashr i32 %88, %89
%91 = load i32, i32* %18
%92 = shl i32 %91, 3
%93 = call i32 @saturated_add16(i32 %90, i32 %92)
store i32 %93, i32* %14
%94 = load i32, i32* %14
%95 = call i32 @apcm_quantization_xmaxc_to_exp_mant(i32 %94, i32* %18, i32* %19)
%96 = load i32, i32* %18
%97 = icmp sle i32 %96, 4096
br i1 %97, label %98, label %101
98: ; preds = %84
%99 = load i32, i32* %18
%100 = icmp sge i32 %99, -4096
br label %101
101: ; preds = %98, %84
%102 = phi i1 [ false, %84 ], [ %100, %98 ]
%103 = zext i1 %102 to i32
%104 = call i32 @assert(i32 %103)
%105 = load i32, i32* %19
%106 = icmp sge i32 %105, 0
br i1 %106, label %107, label %110
107: ; preds = %101
%108 = load i32, i32* %19
%109 = icmp sle i32 %108, 7
br label %110
110: ; preds = %107, %101
%111 = phi i1 [ false, %101 ], [ %109, %107 ]
%112 = zext i1 %111 to i32
%113 = call i32 @assert(i32 %112)
%114 = load i32, i32* %18
%115 = sub nsw i32 6, %114
store i32 %115, i32* %16
%116 = load i32, i32* %19
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds [8 x i32], [8 x i32]* @apcm_quantization.gsm_NRFAC, i64 0, i64 %117
%119 = load i32, i32* %118
store i32 %119, i32* %17
store i32 0, i32* %11
br label %120
120: ; preds = %151, %110
%121 = load i32, i32* %11
%122 = icmp slt i32 %121, 13
br i1 %122, label %123, label %154
123: ; preds = %120
%124 = load i32, i32* %16
%125 = icmp sge i32 %124, 0
br i1 %125, label %126, label %129
126: ; preds = %123
%127 = load i32, i32* %16
%128 = icmp slt i32 %127, 16
br label %129
129: ; preds = %126, %123
%130 = phi i1 [ false, %123 ], [ %128, %126 ]
%131 = zext i1 %130 to i32
%132 = call i32 @assert(i32 %131)
%133 = load i32*, i32** %6
%134 = load i32, i32* %11
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds i32, i32* %133, i64 %135
%137 = load i32, i32* %136
%138 = load i32, i32* %16
%139 = shl i32 %137, %138
store i32 %139, i32* %15
%140 = load i32, i32* %15
%141 = load i32, i32* %17
%142 = call i32 @saturated_mul16(i32 %140, i32 %141)
store i32 %142, i32* %15
%143 = load i32, i32* %15
%144 = ashr i32 %143, 12
store i32 %144, i32* %15
%145 = load i32, i32* %15
%146 = add nsw i32 %145, 4
%147 = load i32*, i32** %7
%148 = load i32, i32* %11
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds i32, i32* %147, i64 %149
store i32 %146, i32* %150
br label %151
151: ; preds = %129
%152 = load i32, i32* %11
%153 = add nsw i32 %152, 1
store i32 %153, i32* %11
br label %120
154: ; preds = %120
%155 = load i32, i32* %19
%156 = load i32*, i32** %8
store i32 %155, i32* %156
%157 = load i32, i32* %18
%158 = load i32*, i32** %9
store i32 %157, i32* %158
%159 = load i32, i32* %14
%160 = load i32*, i32** %10
store i32 %159, i32* %160
ret void
}

LLVM IR (-O2):
@apcm_quantization.gsm_NRFAC = internal unnamed_addr constant [8 x i32] [i32 29128, i32 26215, i32 23832, i32 21846, i32 20165, i32 18725, i32 17476, i32 16384]
define void @apcm_quantization(i32* nocapture %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4) {
%6 = alloca i32
%7 = alloca i32
%8 = bitcast i32* %6 to i8*
%9 = bitcast i32* %7 to i8*
%10 = load i32, i32* %0
%11 = tail call i32 @saturated_abs16(i32 %10)
%12 = icmp sgt i32 %11, 0
%13 = select i1 %12, i32 %11, i32 0
%14 = getelementptr inbounds i32, i32* %0, i64 1
%15 = load i32, i32* %14
%16 = tail call i32 @saturated_abs16(i32 %15)
%17 = icmp sgt i32 %16, %13
%18 = select i1 %17, i32 %16, i32 %13
%19 = getelementptr inbounds i32, i32* %0, i64 2
%20 = load i32, i32* %19
%21 = tail call i32 @saturated_abs16(i32 %20)
%22 = icmp sgt i32 %21, %18
%23 = select i1 %22, i32 %21, i32 %18
%24 = getelementptr inbounds i32, i32* %0, i64 3
%25 = load i32, i32* %24
%26 = tail call i32 @saturated_abs16(i32 %25)
%27 = icmp sgt i32 %26, %23
%28 = select i1 %27, i32 %26, i32 %23
%29 = getelementptr inbounds i32, i32* %0, i64 4
%30 = load i32, i32* %29
%31 = tail call i32 @saturated_abs16(i32 %30)
%32 = icmp sgt i32 %31, %28
%33 = select i1 %32, i32 %31, i32 %28
%34 = getelementptr inbounds i32, i32* %0, i64 5
%35 = load i32, i32* %34
%36 = tail call i32 @saturated_abs16(i32 %35)
%37 = icmp sgt i32 %36, %33
%38 = select i1 %37, i32 %36, i32 %33
%39 = getelementptr inbounds i32, i32* %0, i64 6
%40 = load i32, i32* %39
%41 = tail call i32 @saturated_abs16(i32 %40)
%42 = icmp sgt i32 %41, %38
%43 = select i1 %42, i32 %41, i32 %38
%44 = getelementptr inbounds i32, i32* %0, i64 7
%45 = load i32, i32* %44
%46 = tail call i32 @saturated_abs16(i32 %45)
%47 = icmp sgt i32 %46, %43
%48 = select i1 %47, i32 %46, i32 %43
%49 = getelementptr inbounds i32, i32* %0, i64 8
%50 = load i32, i32* %49
%51 = tail call i32 @saturated_abs16(i32 %50)
%52 = icmp sgt i32 %51, %48
%53 = select i1 %52, i32 %51, i32 %48
%54 = getelementptr inbounds i32, i32* %0, i64 9
%55 = load i32, i32* %54
%56 = tail call i32 @saturated_abs16(i32 %55)
%57 = icmp sgt i32 %56, %53
%58 = select i1 %57, i32 %56, i32 %53
%59 = getelementptr inbounds i32, i32* %0, i64 10
%60 = load i32, i32* %59
%61 = tail call i32 @saturated_abs16(i32 %60)
%62 = icmp sgt i32 %61, %58
%63 = select i1 %62, i32 %61, i32 %58
%64 = getelementptr inbounds i32, i32* %0, i64 11
%65 = load i32, i32* %64
%66 = tail call i32 @saturated_abs16(i32 %65)
%67 = icmp sgt i32 %66, %63
%68 = select i1 %67, i32 %66, i32 %63
%69 = getelementptr inbounds i32, i32* %0, i64 12
%70 = load i32, i32* %69
%71 = tail call i32 @saturated_abs16(i32 %70)
%72 = icmp sgt i32 %71, %68
%73 = select i1 %72, i32 %71, i32 %68
%74 = tail call i32 @assert(i32 1)
%75 = tail call i32 @assert(i32 1)
%76 = insertelement <4 x i32> poison, i32 %73, i64 0
%77 = shufflevector <4 x i32> %76, <4 x i32> poison, <4 x i32> zeroinitializer
%78 = icmp ugt <4 x i32> %77, <i32 511, i32 1023, i32 2047, i32 4095>
%79 = tail call i32 @assert(i32 1)
%80 = tail call i32 @assert(i32 1)
%81 = icmp ugt i32 %73, 8191
%82 = tail call i32 @assert(i32 1)
%83 = zext i1 %81 to i32
%84 = icmp ugt i32 %73, 16383
%85 = tail call i32 @assert(i32 1)
%86 = zext i1 %84 to i32
%87 = bitcast <4 x i1> %78 to i4
%88 = call i4 @llvm.ctpop.i4(i4 %87)
%89 = zext i4 %88 to i32
%90 = add nuw nsw i32 %89, %83
%91 = add nuw nsw i32 %90, %86
store i32 %91, i32* %6
%92 = tail call i32 @assert(i32 1)
%93 = add nuw nsw i32 %91, 5
%94 = tail call i32 @assert(i32 1)
%95 = lshr i32 %73, %93
%96 = shl nuw nsw i32 %91, 3
%97 = tail call i32 @saturated_add16(i32 %95, i32 %96)
%98 = call i32 @apcm_quantization_xmaxc_to_exp_mant(i32 %97, i32* %6, i32* %7)
%99 = load i32, i32* %6
%100 = add i32 %99, 4096
%101 = icmp ult i32 %100, 8193
%102 = zext i1 %101 to i32
%103 = call i32 @assert(i32 %102)
%104 = load i32, i32* %7
%105 = icmp ult i32 %104, 8
%106 = zext i1 %105 to i32
%107 = call i32 @assert(i32 %106)
%108 = load i32, i32* %6
%109 = sub nsw i32 6, %108
%110 = load i32, i32* %7
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds [8 x i32], [8 x i32]* @apcm_quantization.gsm_NRFAC, i64 0, i64 %111
%113 = load i32, i32* %112
%114 = add i32 %108, 9
%115 = icmp ult i32 %114, 16
%116 = zext i1 %115 to i32
br label %117
117: ; preds = %5, %117
%118 = phi i64 [ 0, %5 ], [ %127, %117 ]
%119 = call i32 @assert(i32 %116)
%120 = getelementptr inbounds i32, i32* %0, i64 %118
%121 = load i32, i32* %120
%122 = shl i32 %121, %109
%123 = call i32 @saturated_mul16(i32 %122, i32 %113)
%124 = ashr i32 %123, 12
%125 = add nsw i32 %124, 4
%126 = getelementptr inbounds i32, i32* %1, i64 %118
store i32 %125, i32* %126
%127 = add nuw nsw i64 %118, 1
%128 = icmp eq i64 %127, 13
br i1 %128, label %129, label %117
129: ; preds = %117
%130 = load i32, i32* %7
store i32 %130, i32* %2
%131 = load i32, i32* %6
store i32 %131, i32* %3
store i32 %97, i32* %4
ret void
}