#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 saturated_add16(int, int);
int saturated_mul16(int, int);
void quantization_and_coding(int16_t LAR[8]) {
  int16_t temp;
  temp = saturated_mul16(20480, *LAR);
  temp = saturated_add16(temp, 0);
  temp = saturated_add16(temp, 256);
  temp >>= 9;
  *LAR = (int16_t)((temp > 31) ? 31 - -32 : ((temp < -32) ? 0 : temp - -32));
  LAR++;
  ;
  temp = saturated_mul16(20480, *LAR);
  temp = saturated_add16(temp, 0);
  temp = saturated_add16(temp, 256);
  temp >>= 9;
  *LAR = (int16_t)((temp > 31) ? 31 - -32 : ((temp < -32) ? 0 : temp - -32));
  LAR++;
  ;
  temp = saturated_mul16(20480, *LAR);
  temp = saturated_add16(temp, 2048);
  temp = saturated_add16(temp, 256);
  temp >>= 9;
  *LAR = (int16_t)((temp > 15) ? 15 - -16 : ((temp < -16) ? 0 : temp - -16));
  LAR++;
  ;
  temp = saturated_mul16(20480, *LAR);
  temp = saturated_add16(temp, -2560);
  temp = saturated_add16(temp, 256);
  temp >>= 9;
  *LAR = (int16_t)((temp > 15) ? 15 - -16 : ((temp < -16) ? 0 : temp - -16));
  LAR++;
  ;
  temp = saturated_mul16(13964, *LAR);
  temp = saturated_add16(temp, 94);
  temp = saturated_add16(temp, 256);
  temp >>= 9;
  *LAR = (int16_t)((temp > 7) ? 7 - -8 : ((temp < -8) ? 0 : temp - -8));
  LAR++;
  ;
  temp = saturated_mul16(15360, *LAR);
  temp = saturated_add16(temp, -1792);
  temp = saturated_add16(temp, 256);
  temp >>= 9;
  *LAR = (int16_t)((temp > 7) ? 7 - -8 : ((temp < -8) ? 0 : temp - -8));
  LAR++;
  ;
  temp = saturated_mul16(8534, *LAR);
  temp = saturated_add16(temp, -341);
  temp = saturated_add16(temp, 256);
  temp >>= 9;
  *LAR = (int16_t)((temp > 3) ? 3 - -4 : ((temp < -4) ? 0 : temp - -4));
  LAR++;
  ;
  temp = saturated_mul16(9036, *LAR);
  temp = saturated_add16(temp, -1144);
  temp = saturated_add16(temp, 256);
  temp >>= 9;
  *LAR = (int16_t)((temp > 3) ? 3 - -4 : ((temp < -4) ? 0 : temp - -4));
  LAR++;
  ;
}


x86 assembly (clang, -O0):
<quantization_and_coding>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
mov    $0x5000,%edi
call   1040 <saturated_mul16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
xor    %esi,%esi
call   1030 <saturated_add16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x100,%esi
call   1030 <saturated_add16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x9,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1f,-0xc(%rbp)
jle    117c <quantization_and_coding+0x5c>
mov    $0x3f,%eax
mov    %eax,-0x10(%rbp)
jmp    119f <quantization_and_coding+0x7f>
cmpl   $0xffffffe0,-0xc(%rbp)
jge    1190 <quantization_and_coding+0x70>
xor    %eax,%eax
mov    %eax,-0x14(%rbp)
jmp    1199 <quantization_and_coding+0x79>
mov    -0xc(%rbp),%eax
sub    $0xffffffe0,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
mov    $0x5000,%edi
call   1040 <saturated_mul16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
xor    %esi,%esi
call   1030 <saturated_add16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x100,%esi
call   1030 <saturated_add16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x9,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1f,-0xc(%rbp)
jle    1204 <quantization_and_coding+0xe4>
mov    $0x3f,%eax
mov    %eax,-0x18(%rbp)
jmp    1227 <quantization_and_coding+0x107>
cmpl   $0xffffffe0,-0xc(%rbp)
jge    1218 <quantization_and_coding+0xf8>
xor    %eax,%eax
mov    %eax,-0x1c(%rbp)
jmp    1221 <quantization_and_coding+0x101>
mov    -0xc(%rbp),%eax
sub    $0xffffffe0,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
mov    $0x5000,%edi
call   1040 <saturated_mul16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x800,%esi
call   1030 <saturated_add16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x100,%esi
call   1030 <saturated_add16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x9,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0xf,-0xc(%rbp)
jle    128f <quantization_and_coding+0x16f>
mov    $0x1f,%eax
mov    %eax,-0x20(%rbp)
jmp    12b2 <quantization_and_coding+0x192>
cmpl   $0xfffffff0,-0xc(%rbp)
jge    12a3 <quantization_and_coding+0x183>
xor    %eax,%eax
mov    %eax,-0x24(%rbp)
jmp    12ac <quantization_and_coding+0x18c>
mov    -0xc(%rbp),%eax
sub    $0xfffffff0,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
mov    $0x5000,%edi
call   1040 <saturated_mul16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0xfffff600,%esi
call   1030 <saturated_add16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x100,%esi
call   1030 <saturated_add16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x9,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0xf,-0xc(%rbp)
jle    131a <quantization_and_coding+0x1fa>
mov    $0x1f,%eax
mov    %eax,-0x28(%rbp)
jmp    133d <quantization_and_coding+0x21d>
cmpl   $0xfffffff0,-0xc(%rbp)
jge    132e <quantization_and_coding+0x20e>
xor    %eax,%eax
mov    %eax,-0x2c(%rbp)
jmp    1337 <quantization_and_coding+0x217>
mov    -0xc(%rbp),%eax
sub    $0xfffffff0,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
mov    $0x368c,%edi
call   1040 <saturated_mul16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x5e,%esi
call   1030 <saturated_add16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x100,%esi
call   1030 <saturated_add16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x9,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x7,-0xc(%rbp)
jle    13a5 <quantization_and_coding+0x285>
mov    $0xf,%eax
mov    %eax,-0x30(%rbp)
jmp    13c8 <quantization_and_coding+0x2a8>
cmpl   $0xfffffff8,-0xc(%rbp)
jge    13b9 <quantization_and_coding+0x299>
xor    %eax,%eax
mov    %eax,-0x34(%rbp)
jmp    13c2 <quantization_and_coding+0x2a2>
mov    -0xc(%rbp),%eax
sub    $0xfffffff8,%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
mov    $0x3c00,%edi
call   1040 <saturated_mul16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0xfffff900,%esi
call   1030 <saturated_add16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x100,%esi
call   1030 <saturated_add16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x9,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x7,-0xc(%rbp)
jle    1430 <quantization_and_coding+0x310>
mov    $0xf,%eax
mov    %eax,-0x38(%rbp)
jmp    1453 <quantization_and_coding+0x333>
cmpl   $0xfffffff8,-0xc(%rbp)
jge    1444 <quantization_and_coding+0x324>
xor    %eax,%eax
mov    %eax,-0x3c(%rbp)
jmp    144d <quantization_and_coding+0x32d>
mov    -0xc(%rbp),%eax
sub    $0xfffffff8,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
mov    $0x2156,%edi
call   1040 <saturated_mul16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0xfffffeab,%esi
call   1030 <saturated_add16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x100,%esi
call   1030 <saturated_add16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x9,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jle    14bb <quantization_and_coding+0x39b>
mov    $0x7,%eax
mov    %eax,-0x40(%rbp)
jmp    14de <quantization_and_coding+0x3be>
cmpl   $0xfffffffc,-0xc(%rbp)
jge    14cf <quantization_and_coding+0x3af>
xor    %eax,%eax
mov    %eax,-0x44(%rbp)
jmp    14d8 <quantization_and_coding+0x3b8>
mov    -0xc(%rbp),%eax
sub    $0xfffffffc,%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
mov    $0x234c,%edi
call   1040 <saturated_mul16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0xfffffb88,%esi
call   1030 <saturated_add16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x100,%esi
call   1030 <saturated_add16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x9,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jle    1546 <quantization_and_coding+0x426>
mov    $0x7,%eax
mov    %eax,-0x48(%rbp)
jmp    1569 <quantization_and_coding+0x449>
cmpl   $0xfffffffc,-0xc(%rbp)
jge    155a <quantization_and_coding+0x43a>
xor    %eax,%eax
mov    %eax,-0x4c(%rbp)
jmp    1563 <quantization_and_coding+0x443>
mov    -0xc(%rbp),%eax
sub    $0xfffffffc,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quantization_and_coding>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%esi
mov    $0x5000,%edi
call   1040 <saturated_mul16@plt>
xor    %r14d,%r14d
mov    %eax,%edi
xor    %esi,%esi
call   1030 <saturated_add16@plt>
mov    %eax,%edi
mov    $0x100,%esi
call   1030 <saturated_add16@plt>
mov    %eax,%ecx
sar    $0x9,%ecx
add    $0x20,%ecx
cmp    $0xffffc000,%eax
cmovl  %r14d,%ecx
cmp    $0x4000,%eax
mov    $0x3f,%ebp
cmovge %ebp,%ecx
mov    %ecx,(%rbx)
mov    0x4(%rbx),%esi
mov    $0x5000,%edi
call   1040 <saturated_mul16@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1030 <saturated_add16@plt>
mov    %eax,%edi
mov    $0x100,%esi
call   1030 <saturated_add16@plt>
mov    %eax,%ecx
sar    $0x9,%ecx
add    $0x20,%ecx
cmp    $0xffffc000,%eax
cmovl  %r14d,%ecx
cmp    $0x4000,%eax
cmovge %ebp,%ecx
mov    %ecx,0x4(%rbx)
mov    0x8(%rbx),%esi
mov    $0x5000,%edi
call   1040 <saturated_mul16@plt>
mov    %eax,%edi
mov    $0x800,%esi
call   1030 <saturated_add16@plt>
mov    %eax,%edi
mov    $0x100,%esi
call   1030 <saturated_add16@plt>
mov    %eax,%ecx
sar    $0x9,%ecx
add    $0x10,%ecx
cmp    $0xffffe000,%eax
cmovl  %r14d,%ecx
cmp    $0x2000,%eax
mov    $0x1f,%ebp
cmovge %ebp,%ecx
mov    %ecx,0x8(%rbx)
mov    0xc(%rbx),%esi
mov    $0x5000,%edi
call   1040 <saturated_mul16@plt>
mov    %eax,%edi
mov    $0xfffff600,%esi
call   1030 <saturated_add16@plt>
mov    %eax,%edi
mov    $0x100,%esi
call   1030 <saturated_add16@plt>
mov    %eax,%ecx
sar    $0x9,%ecx
add    $0x10,%ecx
cmp    $0xffffe000,%eax
cmovl  %r14d,%ecx
cmp    $0x2000,%eax
cmovge %ebp,%ecx
mov    %ecx,0xc(%rbx)
mov    0x10(%rbx),%esi
mov    $0x368c,%edi
call   1040 <saturated_mul16@plt>
mov    %eax,%edi
mov    $0x5e,%esi
call   1030 <saturated_add16@plt>
mov    %eax,%edi
mov    $0x100,%esi
call   1030 <saturated_add16@plt>
mov    %eax,%ecx
sar    $0x9,%ecx
add    $0x8,%ecx
cmp    $0xfffff000,%eax
cmovl  %r14d,%ecx
cmp    $0x1000,%eax
mov    $0xf,%ebp
cmovge %ebp,%ecx
mov    %ecx,0x10(%rbx)
mov    0x14(%rbx),%esi
mov    $0x3c00,%edi
call   1040 <saturated_mul16@plt>
mov    %eax,%edi
mov    $0xfffff900,%esi
call   1030 <saturated_add16@plt>
mov    %eax,%edi
mov    $0x100,%esi
call   1030 <saturated_add16@plt>
mov    %eax,%ecx
sar    $0x9,%ecx
add    $0x8,%ecx
cmp    $0xfffff000,%eax
cmovl  %r14d,%ecx
cmp    $0x1000,%eax
cmovge %ebp,%ecx
mov    %ecx,0x14(%rbx)
mov    0x18(%rbx),%esi
mov    $0x2156,%edi
call   1040 <saturated_mul16@plt>
mov    %eax,%edi
mov    $0xfffffeab,%esi
call   1030 <saturated_add16@plt>
mov    %eax,%edi
mov    $0x100,%esi
call   1030 <saturated_add16@plt>
mov    %eax,%ecx
sar    $0x9,%ecx
add    $0x4,%ecx
cmp    $0xfffff800,%eax
cmovl  %r14d,%ecx
cmp    $0x800,%eax
mov    $0x7,%ebp
cmovge %ebp,%ecx
mov    %ecx,0x18(%rbx)
mov    0x1c(%rbx),%esi
mov    $0x234c,%edi
call   1040 <saturated_mul16@plt>
mov    %eax,%edi
mov    $0xfffffb88,%esi
call   1030 <saturated_add16@plt>
mov    %eax,%edi
mov    $0x100,%esi
call   1030 <saturated_add16@plt>
mov    %eax,%ecx
sar    $0x9,%ecx
add    $0x4,%ecx
cmp    $0xfffff800,%eax
cmovl  %r14d,%ecx
cmp    $0x800,%eax
cmovge %ebp,%ecx
mov    %ecx,0x1c(%rbx)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @quantization_and_coding(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = load i32, i32* %4
%6 = call i32 @saturated_mul16(i32 20480, i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @saturated_add16(i32 %7, i32 0)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = call i32 @saturated_add16(i32 %9, i32 256)
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = ashr i32 %11, 9
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = icmp sgt i32 %13, 31
br i1 %14, label %15, label %16
15: ; preds = %1
br label %25
16: ; preds = %1
%17 = load i32, i32* %3
%18 = icmp slt i32 %17, -32
br i1 %18, label %19, label %20
19: ; preds = %16
br label %23
20: ; preds = %16
%21 = load i32, i32* %3
%22 = sub nsw i32 %21, -32
br label %23
23: ; preds = %20, %19
%24 = phi i32 [ 0, %19 ], [ %22, %20 ]
br label %25
25: ; preds = %23, %15
%26 = phi i32 [ 63, %15 ], [ %24, %23 ]
%27 = load i32*, i32** %2
store i32 %26, i32* %27
%28 = load i32*, i32** %2
%29 = getelementptr inbounds i32, i32* %28, i32 1
store i32* %29, i32** %2
%30 = load i32*, i32** %2
%31 = load i32, i32* %30
%32 = call i32 @saturated_mul16(i32 20480, i32 %31)
store i32 %32, i32* %3
%33 = load i32, i32* %3
%34 = call i32 @saturated_add16(i32 %33, i32 0)
store i32 %34, i32* %3
%35 = load i32, i32* %3
%36 = call i32 @saturated_add16(i32 %35, i32 256)
store i32 %36, i32* %3
%37 = load i32, i32* %3
%38 = ashr i32 %37, 9
store i32 %38, i32* %3
%39 = load i32, i32* %3
%40 = icmp sgt i32 %39, 31
br i1 %40, label %41, label %42
41: ; preds = %25
br label %51
42: ; preds = %25
%43 = load i32, i32* %3
%44 = icmp slt i32 %43, -32
br i1 %44, label %45, label %46
45: ; preds = %42
br label %49
46: ; preds = %42
%47 = load i32, i32* %3
%48 = sub nsw i32 %47, -32
br label %49
49: ; preds = %46, %45
%50 = phi i32 [ 0, %45 ], [ %48, %46 ]
br label %51
51: ; preds = %49, %41
%52 = phi i32 [ 63, %41 ], [ %50, %49 ]
%53 = load i32*, i32** %2
store i32 %52, i32* %53
%54 = load i32*, i32** %2
%55 = getelementptr inbounds i32, i32* %54, i32 1
store i32* %55, i32** %2
%56 = load i32*, i32** %2
%57 = load i32, i32* %56
%58 = call i32 @saturated_mul16(i32 20480, i32 %57)
store i32 %58, i32* %3
%59 = load i32, i32* %3
%60 = call i32 @saturated_add16(i32 %59, i32 2048)
store i32 %60, i32* %3
%61 = load i32, i32* %3
%62 = call i32 @saturated_add16(i32 %61, i32 256)
store i32 %62, i32* %3
%63 = load i32, i32* %3
%64 = ashr i32 %63, 9
store i32 %64, i32* %3
%65 = load i32, i32* %3
%66 = icmp sgt i32 %65, 15
br i1 %66, label %67, label %68
67: ; preds = %51
br label %77
68: ; preds = %51
%69 = load i32, i32* %3
%70 = icmp slt i32 %69, -16
br i1 %70, label %71, label %72
71: ; preds = %68
br label %75
72: ; preds = %68
%73 = load i32, i32* %3
%74 = sub nsw i32 %73, -16
br label %75
75: ; preds = %72, %71
%76 = phi i32 [ 0, %71 ], [ %74, %72 ]
br label %77
77: ; preds = %75, %67
%78 = phi i32 [ 31, %67 ], [ %76, %75 ]
%79 = load i32*, i32** %2
store i32 %78, i32* %79
%80 = load i32*, i32** %2
%81 = getelementptr inbounds i32, i32* %80, i32 1
store i32* %81, i32** %2
%82 = load i32*, i32** %2
%83 = load i32, i32* %82
%84 = call i32 @saturated_mul16(i32 20480, i32 %83)
store i32 %84, i32* %3
%85 = load i32, i32* %3
%86 = call i32 @saturated_add16(i32 %85, i32 -2560)
store i32 %86, i32* %3
%87 = load i32, i32* %3
%88 = call i32 @saturated_add16(i32 %87, i32 256)
store i32 %88, i32* %3
%89 = load i32, i32* %3
%90 = ashr i32 %89, 9
store i32 %90, i32* %3
%91 = load i32, i32* %3
%92 = icmp sgt i32 %91, 15
br i1 %92, label %93, label %94
93: ; preds = %77
br label %103
94: ; preds = %77
%95 = load i32, i32* %3
%96 = icmp slt i32 %95, -16
br i1 %96, label %97, label %98
97: ; preds = %94
br label %101
98: ; preds = %94
%99 = load i32, i32* %3
%100 = sub nsw i32 %99, -16
br label %101
101: ; preds = %98, %97
%102 = phi i32 [ 0, %97 ], [ %100, %98 ]
br label %103
103: ; preds = %101, %93
%104 = phi i32 [ 31, %93 ], [ %102, %101 ]
%105 = load i32*, i32** %2
store i32 %104, i32* %105
%106 = load i32*, i32** %2
%107 = getelementptr inbounds i32, i32* %106, i32 1
store i32* %107, i32** %2
%108 = load i32*, i32** %2
%109 = load i32, i32* %108
%110 = call i32 @saturated_mul16(i32 13964, i32 %109)
store i32 %110, i32* %3
%111 = load i32, i32* %3
%112 = call i32 @saturated_add16(i32 %111, i32 94)
store i32 %112, i32* %3
%113 = load i32, i32* %3
%114 = call i32 @saturated_add16(i32 %113, i32 256)
store i32 %114, i32* %3
%115 = load i32, i32* %3
%116 = ashr i32 %115, 9
store i32 %116, i32* %3
%117 = load i32, i32* %3
%118 = icmp sgt i32 %117, 7
br i1 %118, label %119, label %120
119: ; preds = %103
br label %129
120: ; preds = %103
%121 = load i32, i32* %3
%122 = icmp slt i32 %121, -8
br i1 %122, label %123, label %124
123: ; preds = %120
br label %127
124: ; preds = %120
%125 = load i32, i32* %3
%126 = sub nsw i32 %125, -8
br label %127
127: ; preds = %124, %123
%128 = phi i32 [ 0, %123 ], [ %126, %124 ]
br label %129
129: ; preds = %127, %119
%130 = phi i32 [ 15, %119 ], [ %128, %127 ]
%131 = load i32*, i32** %2
store i32 %130, i32* %131
%132 = load i32*, i32** %2
%133 = getelementptr inbounds i32, i32* %132, i32 1
store i32* %133, i32** %2
%134 = load i32*, i32** %2
%135 = load i32, i32* %134
%136 = call i32 @saturated_mul16(i32 15360, i32 %135)
store i32 %136, i32* %3
%137 = load i32, i32* %3
%138 = call i32 @saturated_add16(i32 %137, i32 -1792)
store i32 %138, i32* %3
%139 = load i32, i32* %3
%140 = call i32 @saturated_add16(i32 %139, i32 256)
store i32 %140, i32* %3
%141 = load i32, i32* %3
%142 = ashr i32 %141, 9
store i32 %142, i32* %3
%143 = load i32, i32* %3
%144 = icmp sgt i32 %143, 7
br i1 %144, label %145, label %146
145: ; preds = %129
br label %155
146: ; preds = %129
%147 = load i32, i32* %3
%148 = icmp slt i32 %147, -8
br i1 %148, label %149, label %150
149: ; preds = %146
br label %153
150: ; preds = %146
%151 = load i32, i32* %3
%152 = sub nsw i32 %151, -8
br label %153
153: ; preds = %150, %149
%154 = phi i32 [ 0, %149 ], [ %152, %150 ]
br label %155
155: ; preds = %153, %145
%156 = phi i32 [ 15, %145 ], [ %154, %153 ]
%157 = load i32*, i32** %2
store i32 %156, i32* %157
%158 = load i32*, i32** %2
%159 = getelementptr inbounds i32, i32* %158, i32 1
store i32* %159, i32** %2
%160 = load i32*, i32** %2
%161 = load i32, i32* %160
%162 = call i32 @saturated_mul16(i32 8534, i32 %161)
store i32 %162, i32* %3
%163 = load i32, i32* %3
%164 = call i32 @saturated_add16(i32 %163, i32 -341)
store i32 %164, i32* %3
%165 = load i32, i32* %3
%166 = call i32 @saturated_add16(i32 %165, i32 256)
store i32 %166, i32* %3
%167 = load i32, i32* %3
%168 = ashr i32 %167, 9
store i32 %168, i32* %3
%169 = load i32, i32* %3
%170 = icmp sgt i32 %169, 3
br i1 %170, label %171, label %172
171: ; preds = %155
br label %181
172: ; preds = %155
%173 = load i32, i32* %3
%174 = icmp slt i32 %173, -4
br i1 %174, label %175, label %176
175: ; preds = %172
br label %179
176: ; preds = %172
%177 = load i32, i32* %3
%178 = sub nsw i32 %177, -4
br label %179
179: ; preds = %176, %175
%180 = phi i32 [ 0, %175 ], [ %178, %176 ]
br label %181
181: ; preds = %179, %171
%182 = phi i32 [ 7, %171 ], [ %180, %179 ]
%183 = load i32*, i32** %2
store i32 %182, i32* %183
%184 = load i32*, i32** %2
%185 = getelementptr inbounds i32, i32* %184, i32 1
store i32* %185, i32** %2
%186 = load i32*, i32** %2
%187 = load i32, i32* %186
%188 = call i32 @saturated_mul16(i32 9036, i32 %187)
store i32 %188, i32* %3
%189 = load i32, i32* %3
%190 = call i32 @saturated_add16(i32 %189, i32 -1144)
store i32 %190, i32* %3
%191 = load i32, i32* %3
%192 = call i32 @saturated_add16(i32 %191, i32 256)
store i32 %192, i32* %3
%193 = load i32, i32* %3
%194 = ashr i32 %193, 9
store i32 %194, i32* %3
%195 = load i32, i32* %3
%196 = icmp sgt i32 %195, 3
br i1 %196, label %197, label %198
197: ; preds = %181
br label %207
198: ; preds = %181
%199 = load i32, i32* %3
%200 = icmp slt i32 %199, -4
br i1 %200, label %201, label %202
201: ; preds = %198
br label %205
202: ; preds = %198
%203 = load i32, i32* %3
%204 = sub nsw i32 %203, -4
br label %205
205: ; preds = %202, %201
%206 = phi i32 [ 0, %201 ], [ %204, %202 ]
br label %207
207: ; preds = %205, %197
%208 = phi i32 [ 7, %197 ], [ %206, %205 ]
%209 = load i32*, i32** %2
store i32 %208, i32* %209
%210 = load i32*, i32** %2
%211 = getelementptr inbounds i32, i32* %210, i32 1
store i32* %211, i32** %2
ret void
}

LLVM IR (-O2):
define void @quantization_and_coding(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @saturated_mul16(i32 20480, i32 %2)
%4 = tail call i32 @saturated_add16(i32 %3, i32 0)
%5 = tail call i32 @saturated_add16(i32 %4, i32 256)
%6 = icmp sgt i32 %5, 16383
%7 = ashr i32 %5, 9
%8 = icmp slt i32 %5, -16384
%9 = add nsw i32 %7, 32
%10 = select i1 %8, i32 0, i32 %9
%11 = select i1 %6, i32 63, i32 %10
store i32 %11, i32* %0
%12 = getelementptr inbounds i32, i32* %0, i64 1
%13 = load i32, i32* %12
%14 = tail call i32 @saturated_mul16(i32 20480, i32 %13)
%15 = tail call i32 @saturated_add16(i32 %14, i32 0)
%16 = tail call i32 @saturated_add16(i32 %15, i32 256)
%17 = icmp sgt i32 %16, 16383
%18 = ashr i32 %16, 9
%19 = icmp slt i32 %16, -16384
%20 = add nsw i32 %18, 32
%21 = select i1 %19, i32 0, i32 %20
%22 = select i1 %17, i32 63, i32 %21
store i32 %22, i32* %12
%23 = getelementptr inbounds i32, i32* %0, i64 2
%24 = load i32, i32* %23
%25 = tail call i32 @saturated_mul16(i32 20480, i32 %24)
%26 = tail call i32 @saturated_add16(i32 %25, i32 2048)
%27 = tail call i32 @saturated_add16(i32 %26, i32 256)
%28 = icmp sgt i32 %27, 8191
%29 = ashr i32 %27, 9
%30 = icmp slt i32 %27, -8192
%31 = add nsw i32 %29, 16
%32 = select i1 %30, i32 0, i32 %31
%33 = select i1 %28, i32 31, i32 %32
store i32 %33, i32* %23
%34 = getelementptr inbounds i32, i32* %0, i64 3
%35 = load i32, i32* %34
%36 = tail call i32 @saturated_mul16(i32 20480, i32 %35)
%37 = tail call i32 @saturated_add16(i32 %36, i32 -2560)
%38 = tail call i32 @saturated_add16(i32 %37, i32 256)
%39 = icmp sgt i32 %38, 8191
%40 = ashr i32 %38, 9
%41 = icmp slt i32 %38, -8192
%42 = add nsw i32 %40, 16
%43 = select i1 %41, i32 0, i32 %42
%44 = select i1 %39, i32 31, i32 %43
store i32 %44, i32* %34
%45 = getelementptr inbounds i32, i32* %0, i64 4
%46 = load i32, i32* %45
%47 = tail call i32 @saturated_mul16(i32 13964, i32 %46)
%48 = tail call i32 @saturated_add16(i32 %47, i32 94)
%49 = tail call i32 @saturated_add16(i32 %48, i32 256)
%50 = icmp sgt i32 %49, 4095
%51 = ashr i32 %49, 9
%52 = icmp slt i32 %49, -4096
%53 = add nsw i32 %51, 8
%54 = select i1 %52, i32 0, i32 %53
%55 = select i1 %50, i32 15, i32 %54
store i32 %55, i32* %45
%56 = getelementptr inbounds i32, i32* %0, i64 5
%57 = load i32, i32* %56
%58 = tail call i32 @saturated_mul16(i32 15360, i32 %57)
%59 = tail call i32 @saturated_add16(i32 %58, i32 -1792)
%60 = tail call i32 @saturated_add16(i32 %59, i32 256)
%61 = icmp sgt i32 %60, 4095
%62 = ashr i32 %60, 9
%63 = icmp slt i32 %60, -4096
%64 = add nsw i32 %62, 8
%65 = select i1 %63, i32 0, i32 %64
%66 = select i1 %61, i32 15, i32 %65
store i32 %66, i32* %56
%67 = getelementptr inbounds i32, i32* %0, i64 6
%68 = load i32, i32* %67
%69 = tail call i32 @saturated_mul16(i32 8534, i32 %68)
%70 = tail call i32 @saturated_add16(i32 %69, i32 -341)
%71 = tail call i32 @saturated_add16(i32 %70, i32 256)
%72 = icmp sgt i32 %71, 2047
%73 = ashr i32 %71, 9
%74 = icmp slt i32 %71, -2048
%75 = add nsw i32 %73, 4
%76 = select i1 %74, i32 0, i32 %75
%77 = select i1 %72, i32 7, i32 %76
store i32 %77, i32* %67
%78 = getelementptr inbounds i32, i32* %0, i64 7
%79 = load i32, i32* %78
%80 = tail call i32 @saturated_mul16(i32 9036, i32 %79)
%81 = tail call i32 @saturated_add16(i32 %80, i32 -1144)
%82 = tail call i32 @saturated_add16(i32 %81, i32 256)
%83 = icmp sgt i32 %82, 2047
%84 = ashr i32 %82, 9
%85 = icmp slt i32 %82, -2048
%86 = add nsw i32 %84, 4
%87 = select i1 %85, i32 0, i32 %86
%88 = select i1 %83, i32 7, i32 %87
store i32 %88, i32* %78
ret void
}