#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 ushort;

/* Variables and functions */
int instruction_size(ushort instruction) {
  int size = 1;
  if ((((instruction >> 4) & 0x3f) >= 0x10 &&
       ((instruction >> 4) & 0x3f) <= 0x17) ||
      ((instruction >> 4) & 0x3f) == 0x1e ||
      ((instruction >> 4) & 0x3f) == 0x1f)
    size++;
  if ((((instruction >> 10) & 0x3f) >= 0x10 &&
       ((instruction >> 10) & 0x3f) <= 0x17) ||
      ((instruction >> 10) & 0x3f) == 0x1e ||
      ((instruction >> 10) & 0x3f) == 0x1f)
    size++;
  return size;
}


x86 assembly (clang, -O0):
<instruction_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
and    $0x3f,%eax
cmp    $0x10,%eax
jl     1132 <instruction_size+0x32>
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
and    $0x3f,%eax
cmp    $0x17,%eax
jle    1156 <instruction_size+0x56>
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
and    $0x3f,%eax
cmp    $0x1e,%eax
je     1156 <instruction_size+0x56>
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
and    $0x3f,%eax
cmp    $0x1f,%eax
jne    115f <instruction_size+0x5f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0xa,%eax
and    $0x3f,%eax
cmp    $0x10,%eax
jl     1183 <instruction_size+0x83>
mov    -0x4(%rbp),%eax
sar    $0xa,%eax
and    $0x3f,%eax
cmp    $0x17,%eax
jle    11a7 <instruction_size+0xa7>
mov    -0x4(%rbp),%eax
sar    $0xa,%eax
and    $0x3f,%eax
cmp    $0x1e,%eax
je     11a7 <instruction_size+0xa7>
mov    -0x4(%rbp),%eax
sar    $0xa,%eax
and    $0x3f,%eax
cmp    $0x1f,%eax
jne    11b0 <instruction_size+0xb0>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<instruction_size>:
mov    %edi,%eax
and    $0x380,%eax
cmp    $0x100,%eax
sete   %al
mov    %edi,%ecx
and    $0x3e0,%ecx
cmp    $0x1e0,%ecx
sete   %cl
or     %al,%cl
movzbl %cl,%eax
mov    %edi,%ecx
and    $0xe000,%ecx
cmp    $0x4000,%ecx
sete   %cl
and    $0xf800,%edi
cmp    $0x7800,%edi
sete   %dl
or     %cl,%dl
movzbl %dl,%ecx
add    %ecx,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @instruction_size(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
%4 = load i32, i32* %2
%5 = ashr i32 %4, 4
%6 = and i32 %5, 63
%7 = icmp sge i32 %6, 16
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i32, i32* %2
%10 = ashr i32 %9, 4
%11 = and i32 %10, 63
%12 = icmp sle i32 %11, 23
br i1 %12, label %23, label %13
13: ; preds = %8, %1
%14 = load i32, i32* %2
%15 = ashr i32 %14, 4
%16 = and i32 %15, 63
%17 = icmp eq i32 %16, 30
br i1 %17, label %23, label %18
18: ; preds = %13
%19 = load i32, i32* %2
%20 = ashr i32 %19, 4
%21 = and i32 %20, 63
%22 = icmp eq i32 %21, 31
br i1 %22, label %23, label %26
23: ; preds = %18, %13, %8
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %26
26: ; preds = %23, %18
%27 = load i32, i32* %2
%28 = ashr i32 %27, 10
%29 = and i32 %28, 63
%30 = icmp sge i32 %29, 16
br i1 %30, label %31, label %36
31: ; preds = %26
%32 = load i32, i32* %2
%33 = ashr i32 %32, 10
%34 = and i32 %33, 63
%35 = icmp sle i32 %34, 23
br i1 %35, label %46, label %36
36: ; preds = %31, %26
%37 = load i32, i32* %2
%38 = ashr i32 %37, 10
%39 = and i32 %38, 63
%40 = icmp eq i32 %39, 30
br i1 %40, label %46, label %41
41: ; preds = %36
%42 = load i32, i32* %2
%43 = ashr i32 %42, 10
%44 = and i32 %43, 63
%45 = icmp eq i32 %44, 31
br i1 %45, label %46, label %49
46: ; preds = %41, %36, %31
%47 = load i32, i32* %3
%48 = add nsw i32 %47, 1
store i32 %48, i32* %3
br label %49
49: ; preds = %46, %41
%50 = load i32, i32* %3
ret i32 %50
}

LLVM IR (-O2):
define i32 @instruction_size(i32 %0) {
%2 = and i32 %0, 896
%3 = icmp eq i32 %2, 256
%4 = and i32 %0, 992
%5 = icmp eq i32 %4, 480
%6 = or i1 %5, %3
%7 = select i1 %6, i32 2, i32 1
%8 = and i32 %0, 57344
%9 = icmp eq i32 %8, 16384
%10 = and i32 %0, 63488
%11 = icmp eq i32 %10, 30720
%12 = or i1 %11, %9
%13 = zext i1 %12 to i32
%14 = add nuw nsw i32 %7, %13
ret i32 %14
}