#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 */
unsigned short abs(short);
void vcb11_check_LAV(unsigned char cb, signed short *sp) {
  static const unsigned short vcb11_LAV_tab[] = {16,  31,  47,   63,  95,  127,
                                                 159, 191, 223,  255, 319, 383,
                                                 511, 767, 1023, 2047};
  unsigned short max = 0;
  if (cb < 16 || cb > 31)
    return;
  max = vcb11_LAV_tab[cb - 16];
  if ((abs(sp[0]) > max) || (abs(sp[1]) > max)) {
    sp[0] = 0;
    sp[1] = 0;
  }
}


x86 assembly (clang, -O0):
<vcb11_check_LAV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movw   $0x0,-0x12(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x10,%eax
jl     1142 <vcb11_check_LAV+0x32>
movzbl -0x1(%rbp),%eax
cmp    $0x1f,%eax
jle    1147 <vcb11_check_LAV+0x37>
jmp    11aa <vcb11_check_LAV+0x9a>
movzbl -0x1(%rbp),%eax
sub    $0x10,%eax
movslq %eax,%rcx
lea    0xea8(%rip),%rax
mov    (%rax,%rcx,2),%ax
mov    %ax,-0x12(%rbp)
mov    -0x10(%rbp),%rax
movswl (%rax),%edi
call   1030 <abs@plt>
movzwl %ax,%eax
movzwl -0x12(%rbp),%ecx
cmp    %ecx,%eax
jg     1197 <vcb11_check_LAV+0x87>
mov    -0x10(%rbp),%rax
movswl 0x2(%rax),%edi
call   1030 <abs@plt>
movzwl %ax,%eax
movzwl -0x12(%rbp),%ecx
cmp    %ecx,%eax
jle    11aa <vcb11_check_LAV+0x9a>
mov    -0x10(%rbp),%rax
movw   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movw   $0x0,0x2(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vcb11_check_LAV>:
mov    %edi,%eax
and    $0xf0,%al
cmp    $0x10,%al
jne    1143 <vcb11_check_LAV+0x43>
movzbl %dil,%eax
add    $0xfffffff0,%eax
lea    0xeea(%rip),%rcx
movzwl (%rcx,%rax,2),%eax
movzwl (%rsi),%ecx
mov    %ecx,%edx
neg    %dx
cmovs  %cx,%dx
cmp    %ax,%dx
ja     113d <vcb11_check_LAV+0x3d>
movzwl 0x2(%rsi),%ecx
mov    %ecx,%edx
neg    %dx
cmovs  %cx,%dx
cmp    %ax,%dx
jbe    1143 <vcb11_check_LAV+0x43>
movl   $0x0,(%rsi)
ret

LLVM IR (-O0):
@vcb11_check_LAV.vcb11_LAV_tab = internal constant [16 x i16] [i16 16, i16 31, i16 47, i16 63, i16 95, i16 127, i16 159, i16 191, i16 223, i16 255, i16 319, i16 383, i16 511, i16 767, i16 1023, i16 2047]
define void @vcb11_check_LAV(i8 zeroext %0, i16* %1) {
%3 = alloca i8
%4 = alloca i16*
%5 = alloca i16
store i8 %0, i8* %3
store i16* %1, i16** %4
store i16 0, i16* %5
%6 = load i8, i8* %3
%7 = zext i8 %6 to i32
%8 = icmp slt i32 %7, 16
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = icmp sgt i32 %11, 31
br i1 %12, label %13, label %14
13: ; preds = %9, %2
br label %43
14: ; preds = %9
%15 = load i8, i8* %3
%16 = zext i8 %15 to i32
%17 = sub nsw i32 %16, 16
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [16 x i16], [16 x i16]* @vcb11_check_LAV.vcb11_LAV_tab, i64 0, i64 %18
%20 = load i16, i16* %19
store i16 %20, i16* %5
%21 = load i16*, i16** %4
%22 = getelementptr inbounds i16, i16* %21, i64 0
%23 = load i16, i16* %22
%24 = call zeroext i16 @abs(i16 signext %23)
%25 = zext i16 %24 to i32
%26 = load i16, i16* %5
%27 = zext i16 %26 to i32
%28 = icmp sgt i32 %25, %27
br i1 %28, label %38, label %29
29: ; preds = %14
%30 = load i16*, i16** %4
%31 = getelementptr inbounds i16, i16* %30, i64 1
%32 = load i16, i16* %31
%33 = call zeroext i16 @abs(i16 signext %32)
%34 = zext i16 %33 to i32
%35 = load i16, i16* %5
%36 = zext i16 %35 to i32
%37 = icmp sgt i32 %34, %36
br i1 %37, label %38, label %43
38: ; preds = %29, %14
%39 = load i16*, i16** %4
%40 = getelementptr inbounds i16, i16* %39, i64 0
store i16 0, i16* %40
%41 = load i16*, i16** %4
%42 = getelementptr inbounds i16, i16* %41, i64 1
store i16 0, i16* %42
br label %43
43: ; preds = %13, %38, %29
ret void
}

LLVM IR (-O2):
@vcb11_check_LAV.vcb11_LAV_tab = internal unnamed_addr constant [16 x i16] [i16 16, i16 31, i16 47, i16 63, i16 95, i16 127, i16 159, i16 191, i16 223, i16 255, i16 319, i16 383, i16 511, i16 767, i16 1023, i16 2047]
define void @vcb11_check_LAV(i8 zeroext %0, i16* nocapture %1) {
%3 = and i8 %0, -16
%4 = icmp eq i8 %3, 16
br i1 %4, label %5, label %21
5: ; preds = %2
%6 = zext i8 %0 to i64
%7 = add nuw nsw i64 %6, 4294967280
%8 = and i64 %7, 4294967295
%9 = getelementptr inbounds [16 x i16], [16 x i16]* @vcb11_check_LAV.vcb11_LAV_tab, i64 0, i64 %8
%10 = load i16, i16* %9
%11 = load i16, i16* %1
%12 = tail call i16 @llvm.abs.i16(i16 %11, i1 true)
%13 = icmp ugt i16 %12, %10
br i1 %13, label %19, label %14
14: ; preds = %5
%15 = getelementptr inbounds i16, i16* %1, i64 1
%16 = load i16, i16* %15
%17 = tail call i16 @llvm.abs.i16(i16 %16, i1 true)
%18 = icmp ugt i16 %17, %10
br i1 %18, label %19, label %21
19: ; preds = %14, %5
store i16 0, i16* %1
%20 = getelementptr inbounds i16, i16* %1, i64 1
store i16 0, i16* %20
br label %21
21: ; preds = %14, %19, %2
ret void
}