void s16_encode(unsigned int **_w, unsigned int **_p, unsigned int m) {
  int cnum[16] = {28, 21, 21, 21, 14, 9, 8, 7, 6, 6, 5, 5, 4, 3, 2, 1};
  int cbits[16][28] = {{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
                       {2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
                        1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0},
                       {1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
                        1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0},
                       {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                        2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0},
                       {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                       {4, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0,
                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                       {3, 4, 4, 4, 4, 3, 3, 3, 0, 0, 0, 0, 0, 0,
                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                       {4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0,
                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                       {5, 5, 5, 5, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0,
                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                       {4, 4, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0,
                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                       {6, 6, 6, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                       {5, 5, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                       {7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                       {10, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                        0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                       {14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                        0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                       {28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                        0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
  unsigned int _k, _j, _m, _o;
  for (_k = 0; _k < 16; _k++) {
    (**_w) = _k << 28;
    _m = (cnum[_k] < m) ? cnum[_k] : m;
    for (_j = 0, _o = 0; (_j < _m) && (*((*_p) + _j) < (1 << cbits[_k][_j]));) {
      (**_w) += ((*((*_p) + _j)) << _o);
      _o += cbits[_k][_j];
      _j++;
    }
    if (_j == _m) {
      (*_p) += _m;
      (*_w)++;
      break;
    }
  }
}


x86 assembly (clang, -O0):
<s16_encode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x780,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xecf(%rip),%rsi
mov    $0x40,%edx
call   1030 <memcpy@plt>
lea    -0x760(%rbp),%rdi
lea    0xef7(%rip),%rsi
mov    $0x700,%edx
call   1030 <memcpy@plt>
movl   $0x0,-0x764(%rbp)
cmpl   $0x10,-0x764(%rbp)
jae    12f8 <s16_encode+0x1e8>
mov    -0x764(%rbp),%ecx
shl    $0x1c,%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %ecx,(%rax)
mov    -0x764(%rbp),%eax
mov    -0x60(%rbp,%rax,4),%eax
cmp    -0x14(%rbp),%eax
jae    11a4 <s16_encode+0x94>
mov    -0x764(%rbp),%eax
mov    -0x60(%rbp,%rax,4),%eax
mov    %eax,-0x774(%rbp)
jmp    11ad <s16_encode+0x9d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x774(%rbp)
mov    -0x774(%rbp),%eax
mov    %eax,-0x76c(%rbp)
movl   $0x0,-0x768(%rbp)
movl   $0x0,-0x770(%rbp)
mov    -0x768(%rbp),%ecx
xor    %eax,%eax
cmp    -0x76c(%rbp),%ecx
mov    %al,-0x775(%rbp)
jae    122a <s16_encode+0x11a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x768(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
mov    -0x764(%rbp),%ecx
mov    %ecx,%edx
lea    -0x760(%rbp),%rcx
imul   $0x70,%rdx,%rdx
add    %rdx,%rcx
mov    -0x768(%rbp),%edx
mov    (%rcx,%rdx,4),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
cmp    %ecx,%eax
setb   %al
mov    %al,-0x775(%rbp)
mov    -0x775(%rbp),%al
test   $0x1,%al
jne    123d <s16_encode+0x12d>
jmp    12a1 <s16_encode+0x191>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x768(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
mov    -0x770(%rbp),%ecx
shl    %cl,%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x764(%rbp),%eax
mov    %eax,%ecx
lea    -0x760(%rbp),%rax
imul   $0x70,%rcx,%rcx
add    %rcx,%rax
mov    -0x768(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
add    -0x770(%rbp),%eax
mov    %eax,-0x770(%rbp)
mov    -0x768(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x768(%rbp)
jmp    11cd <s16_encode+0xbd>
mov    -0x768(%rbp),%eax
cmp    -0x76c(%rbp),%eax
jne    12df <s16_encode+0x1cf>
mov    -0x76c(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
mov    %edx,%edx
shl    $0x2,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x4,%rcx
mov    %rcx,(%rax)
jmp    12f8 <s16_encode+0x1e8>
jmp    12e4 <s16_encode+0x1d4>
mov    -0x764(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x764(%rbp)
jmp    115d <s16_encode+0x4d>
add    $0x780,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s16_encode>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,-0x10(%rsp)
mov    %rdi,-0x8(%rsp)
mov    (%rdi),%r9
xor    %edi,%edi
lea    0xf20(%rip),%r11
lea    0xed9(%rip),%rcx
mov    %edi,%ebx
shl    $0x1c,%ebx
mov    %ebx,(%r9)
mov    %edi,%eax
mov    %rcx,%rsi
mov    (%rcx,%rax,4),%r15d
cmp    %edx,%r15d
cmovae %edx,%r15d
mov    $0x0,%ebp
test   %r15d,%r15d
je     1190 <s16_encode+0x90>
mov    -0x10(%rsp),%rax
mov    (%rax),%r12
mov    %r15d,%r13d
xor    %ebp,%ebp
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
mov    (%r12,%rbp,4),%r14d
mov    (%r11,%rbp,4),%r8d
mov    %r14d,%r10d
mov    %r8d,%ecx
shr    %cl,%r10d
test   %r10d,%r10d
jne    1190 <s16_encode+0x90>
mov    %eax,%ecx
shl    %cl,%r14d
add    %r14d,%ebx
mov    %ebx,(%r9)
add    %r8d,%eax
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1160 <s16_encode+0x60>
jmp    11a6 <s16_encode+0xa6>
nop
cmp    %r15d,%ebp
je     11a6 <s16_encode+0xa6>
add    $0x1,%edi
add    $0x70,%r11
cmp    $0x10,%edi
mov    %rsi,%rcx
jne    1127 <s16_encode+0x27>
jmp    11be <s16_encode+0xbe>
mov    %r15d,%eax
shl    $0x2,%rax
mov    -0x10(%rsp),%rcx
add    %rax,(%rcx)
mov    -0x8(%rsp),%rax
addq   $0x4,(%rax)
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.s16_encode.cnum = [16 x i32] [i32 28, i32 21, i32 21, i32 21, i32 14, i32 9, i32 8, i32 7, i32 6, i32 6, i32 5, i32 5, i32 4, i32 3, i32 2, i32 1]
@__const.s16_encode.cbits = <{ [28 x i32], [28 x i32], [28 x i32], [28 x i32], <{ [14 x i32], [14 x i32] }>, <{ [9 x i32], [19 x i32] }>, <{ [8 x i32], [20 x i32] }>, <{ i32, i32, i32, i32, i32, i32, i32, [21 x i32] }>, <{ i32, i32, i32, i32, i32, i32, [22 x i32] }>, <{ i32, i32, i32, i32, i32, i32, [22 x i32] }>, <{ i32, i32, i32, i32, i32, [23 x i32] }>, <{ i32, i32, i32, i32, i32, [23 x i32] }>, <{ i32, i32, i32, i32, [24 x i32] }>, <{ i32, i32, i32, [25 x i32] }>, <{ i32, i32, [26 x i32] }>, <{ i32, [27 x i32] }> }> <{ [28 x i32] [i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1], [28 x i32] [i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0], [28 x i32] [i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0], [28 x i32] [i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0], <{ [14 x i32], [14 x i32] }> <{ [14 x i32] [i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2], [14 x i32] zeroinitializer }>, <{ [9 x i32], [19 x i32] }> <{ [9 x i32] [i32 4, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3], [19 x i32] zeroinitializer }>, <{ [8 x i32], [20 x i32] }> <{ [8 x i32] [i32 3, i32 4, i32 4, i32 4, i32 4, i32 3, i32 3, i32 3], [20 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, i32, i32, i32, [21 x i32] }> <{ i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, [21 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, i32, i32, [22 x i32] }> <{ i32 5, i32 5, i32 5, i32 5, i32 4, i32 4, [22 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, i32, i32, [22 x i32] }> <{ i32 4, i32 4, i32 5, i32 5, i32 5, i32 5, [22 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, i32, [23 x i32] }> <{ i32 6, i32 6, i32 6, i32 5, i32 5, [23 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, i32, [23 x i32] }> <{ i32 5, i32 5, i32 6, i32 6, i32 6, [23 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, [24 x i32] }> <{ i32 7, i32 7, i32 7, i32 7, [24 x i32] zeroinitializer }>, <{ i32, i32, i32, [25 x i32] }> <{ i32 10, i32 9, i32 9, [25 x i32] zeroinitializer }>, <{ i32, i32, [26 x i32] }> <{ i32 14, i32 14, [26 x i32] zeroinitializer }>, <{ i32, [27 x i32] }> <{ i32 28, [27 x i32] zeroinitializer }> }>
define void @s16_encode(i32** %0, i32** %1, i32 %2) {
%4 = alloca i32**
%5 = alloca i32**
%6 = alloca i32
%7 = alloca [16 x i32]
%8 = alloca [16 x [28 x i32]]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32** %0, i32*** %4
store i32** %1, i32*** %5
store i32 %2, i32* %6
%13 = bitcast [16 x i32]* %7 to i8*
%14 = bitcast [16 x [28 x i32]]* %8 to i8*
store i32 0, i32* %9
br label %15
15: ; preds = %98, %3
%16 = load i32, i32* %9
%17 = icmp ult i32 %16, 16
br i1 %17, label %18, label %101
18: ; preds = %15
%19 = load i32, i32* %9
%20 = shl i32 %19, 28
%21 = load i32**, i32*** %4
%22 = load i32*, i32** %21
store i32 %20, i32* %22
%23 = load i32, i32* %9
%24 = zext i32 %23 to i64
%25 = getelementptr inbounds [16 x i32], [16 x i32]* %7, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = load i32, i32* %6
%28 = icmp ult i32 %26, %27
br i1 %28, label %29, label %34
29: ; preds = %18
%30 = load i32, i32* %9
%31 = zext i32 %30 to i64
%32 = getelementptr inbounds [16 x i32], [16 x i32]* %7, i64 0, i64 %31
%33 = load i32, i32* %32
br label %36
34: ; preds = %18
%35 = load i32, i32* %6
br label %36
36: ; preds = %34, %29
%37 = phi i32 [ %33, %29 ], [ %35, %34 ]
store i32 %37, i32* %11
store i32 0, i32* %10
store i32 0, i32* %12
br label %38
38: ; preds = %60, %36
%39 = load i32, i32* %10
%40 = load i32, i32* %11
%41 = icmp ult i32 %39, %40
br i1 %41, label %42, label %58
42: ; preds = %38
%43 = load i32**, i32*** %5
%44 = load i32*, i32** %43
%45 = load i32, i32* %10
%46 = zext i32 %45 to i64
%47 = getelementptr inbounds i32, i32* %44, i64 %46
%48 = load i32, i32* %47
%49 = load i32, i32* %9
%50 = zext i32 %49 to i64
%51 = getelementptr inbounds [16 x [28 x i32]], [16 x [28 x i32]]* %8, i64 0, i64 %50
%52 = load i32, i32* %10
%53 = zext i32 %52 to i64
%54 = getelementptr inbounds [28 x i32], [28 x i32]* %51, i64 0, i64 %53
%55 = load i32, i32* %54
%56 = shl i32 1, %55
%57 = icmp ult i32 %48, %56
br label %58
58: ; preds = %42, %38
%59 = phi i1 [ false, %38 ], [ %57, %42 ]
br i1 %59, label %60, label %84
60: ; preds = %58
%61 = load i32**, i32*** %5
%62 = load i32*, i32** %61
%63 = load i32, i32* %10
%64 = zext i32 %63 to i64
%65 = getelementptr inbounds i32, i32* %62, i64 %64
%66 = load i32, i32* %65
%67 = load i32, i32* %12
%68 = shl i32 %66, %67
%69 = load i32**, i32*** %4
%70 = load i32*, i32** %69
%71 = load i32, i32* %70
%72 = add i32 %71, %68
store i32 %72, i32* %70
%73 = load i32, i32* %9
%74 = zext i32 %73 to i64
%75 = getelementptr inbounds [16 x [28 x i32]], [16 x [28 x i32]]* %8, i64 0, i64 %74
%76 = load i32, i32* %10
%77 = zext i32 %76 to i64
%78 = getelementptr inbounds [28 x i32], [28 x i32]* %75, i64 0, i64 %77
%79 = load i32, i32* %78
%80 = load i32, i32* %12
%81 = add i32 %80, %79
store i32 %81, i32* %12
%82 = load i32, i32* %10
%83 = add i32 %82, 1
store i32 %83, i32* %10
br label %38
84: ; preds = %58
%85 = load i32, i32* %10
%86 = load i32, i32* %11
%87 = icmp eq i32 %85, %86
br i1 %87, label %88, label %97
88: ; preds = %84
%89 = load i32, i32* %11
%90 = load i32**, i32*** %5
%91 = load i32*, i32** %90
%92 = zext i32 %89 to i64
%93 = getelementptr inbounds i32, i32* %91, i64 %92
store i32* %93, i32** %90
%94 = load i32**, i32*** %4
%95 = load i32*, i32** %94
%96 = getelementptr inbounds i32, i32* %95, i32 1
store i32* %96, i32** %94
br label %101
97: ; preds = %84
br label %98
98: ; preds = %97
%99 = load i32, i32* %9
%100 = add i32 %99, 1
store i32 %100, i32* %9
br label %15
101: ; preds = %88, %15
ret void
}

LLVM IR (-O2):
@__const.s16_encode.cnum = [16 x i32] [i32 28, i32 21, i32 21, i32 21, i32 14, i32 9, i32 8, i32 7, i32 6, i32 6, i32 5, i32 5, i32 4, i32 3, i32 2, i32 1]
@__const.s16_encode.cbits = <{ [28 x i32], [28 x i32], [28 x i32], [28 x i32], <{ [14 x i32], [14 x i32] }>, <{ [9 x i32], [19 x i32] }>, <{ [8 x i32], [20 x i32] }>, <{ i32, i32, i32, i32, i32, i32, i32, [21 x i32] }>, <{ i32, i32, i32, i32, i32, i32, [22 x i32] }>, <{ i32, i32, i32, i32, i32, i32, [22 x i32] }>, <{ i32, i32, i32, i32, i32, [23 x i32] }>, <{ i32, i32, i32, i32, i32, [23 x i32] }>, <{ i32, i32, i32, i32, [24 x i32] }>, <{ i32, i32, i32, [25 x i32] }>, <{ i32, i32, [26 x i32] }>, <{ i32, [27 x i32] }> }> <{ [28 x i32] [i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1], [28 x i32] [i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0], [28 x i32] [i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0], [28 x i32] [i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0], <{ [14 x i32], [14 x i32] }> <{ [14 x i32] [i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2], [14 x i32] zeroinitializer }>, <{ [9 x i32], [19 x i32] }> <{ [9 x i32] [i32 4, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3], [19 x i32] zeroinitializer }>, <{ [8 x i32], [20 x i32] }> <{ [8 x i32] [i32 3, i32 4, i32 4, i32 4, i32 4, i32 3, i32 3, i32 3], [20 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, i32, i32, i32, [21 x i32] }> <{ i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, [21 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, i32, i32, [22 x i32] }> <{ i32 5, i32 5, i32 5, i32 5, i32 4, i32 4, [22 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, i32, i32, [22 x i32] }> <{ i32 4, i32 4, i32 5, i32 5, i32 5, i32 5, [22 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, i32, [23 x i32] }> <{ i32 6, i32 6, i32 6, i32 5, i32 5, [23 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, i32, [23 x i32] }> <{ i32 5, i32 5, i32 6, i32 6, i32 6, [23 x i32] zeroinitializer }>, <{ i32, i32, i32, i32, [24 x i32] }> <{ i32 7, i32 7, i32 7, i32 7, [24 x i32] zeroinitializer }>, <{ i32, i32, i32, [25 x i32] }> <{ i32 10, i32 9, i32 9, [25 x i32] zeroinitializer }>, <{ i32, i32, [26 x i32] }> <{ i32 14, i32 14, [26 x i32] zeroinitializer }>, <{ i32, [27 x i32] }> <{ i32 28, [27 x i32] zeroinitializer }> }>
define void @s16_encode(i32** nocapture %0, i32** nocapture %1, i32 %2) {
%4 = load i32*, i32** %0
br label %7
5: ; preds = %37
%6 = icmp eq i32 %40, 16
br i1 %6, label %47, label %7
7: ; preds = %3, %5
%8 = phi i32 [ 0, %3 ], [ %40, %5 ]
%9 = shl nuw i32 %8, 28
store i32 %9, i32* %4
%10 = zext i32 %8 to i64
%11 = getelementptr inbounds [16 x i32], [16 x i32]* @__const.s16_encode.cnum, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = icmp ult i32 %12, %2
%14 = select i1 %13, i32 %12, i32 %2
%15 = icmp eq i32 %14, 0
br i1 %15, label %37, label %16
16: ; preds = %7
%17 = load i32*, i32** %1
%18 = zext i32 %14 to i64
br label %19
19: ; preds = %16, %29
%20 = phi i32 [ %9, %16 ], [ %31, %29 ]
%21 = phi i64 [ 0, %16 ], [ %33, %29 ]
%22 = phi i32 [ 0, %16 ], [ %32, %29 ]
%23 = getelementptr inbounds i32, i32* %17, i64 %21
%24 = load i32, i32* %23
%25 = getelementptr inbounds [16 x [28 x i32]], [16 x [28 x i32]]* bitcast (<{ [28 x i32], [28 x i32], [28 x i32], [28 x i32], <{ [14 x i32], [14 x i32] }>, <{ [9 x i32], [19 x i32] }>, <{ [8 x i32], [20 x i32] }>, <{ i32, i32, i32, i32, i32, i32, i32, [21 x i32] }>, <{ i32, i32, i32, i32, i32, i32, [22 x i32] }>, <{ i32, i32, i32, i32, i32, i32, [22 x i32] }>, <{ i32, i32, i32, i32, i32, [23 x i32] }>, <{ i32, i32, i32, i32, i32, [23 x i32] }>, <{ i32, i32, i32, i32, [24 x i32] }>, <{ i32, i32, i32, [25 x i32] }>, <{ i32, i32, [26 x i32] }>, <{ i32, [27 x i32] }> }>* @__const.s16_encode.cbits to [16 x [28 x i32]]*), i64 0, i64 %10, i64 %21
%26 = load i32, i32* %25
%27 = lshr i32 %24, %26
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %35
29: ; preds = %19
%30 = shl i32 %24, %22
%31 = add i32 %20, %30
store i32 %31, i32* %4
%32 = add i32 %26, %22
%33 = add nuw nsw i64 %21, 1
%34 = icmp eq i64 %33, %18
br i1 %34, label %41, label %19
35: ; preds = %19
%36 = trunc i64 %21 to i32
br label %37
37: ; preds = %35, %7
%38 = phi i32 [ 0, %7 ], [ %36, %35 ]
%39 = icmp eq i32 %38, %14
%40 = add nuw nsw i32 %8, 1
br i1 %39, label %41, label %5
41: ; preds = %37, %29
%42 = load i32*, i32** %1
%43 = zext i32 %14 to i64
%44 = getelementptr inbounds i32, i32* %42, i64 %43
store i32* %44, i32** %1
%45 = load i32*, i32** %0
%46 = getelementptr inbounds i32, i32* %45, i64 1
store i32* %46, i32** %0
br label %47
47: ; preds = %5, %41
ret void
}