int Operand_b4constu_encode(unsigned int *valp) {
  unsigned r_0, b4constu_0;
  b4constu_0 = *valp;
  switch (b4constu_0) {
  case 0x8000:
    r_0 = 0;
    break;
  case 0x10000:
    r_0 = 0x1;
    break;
  case 0x2:
    r_0 = 0x2;
    break;
  case 0x3:
    r_0 = 0x3;
    break;
  case 0x4:
    r_0 = 0x4;
    break;
  case 0x5:
    r_0 = 0x5;
    break;
  case 0x6:
    r_0 = 0x6;
    break;
  case 0x7:
    r_0 = 0x7;
    break;
  case 0x8:
    r_0 = 0x8;
    break;
  case 0xa:
    r_0 = 0x9;
    break;
  case 0xc:
    r_0 = 0xa;
    break;
  case 0x10:
    r_0 = 0xb;
    break;
  case 0x20:
    r_0 = 0xc;
    break;
  case 0x40:
    r_0 = 0xd;
    break;
  case 0x80:
    r_0 = 0xe;
    break;
  default:
    r_0 = 0xf;
    break;
  }
  *valp = r_0;
  return 0;
}


x86 assembly (clang, -O0):
<Operand_b4constu_encode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x2,%eax
je     1231 <Operand_b4constu_encode+0x131>
jmp    1125 <Operand_b4constu_encode+0x25>
mov    -0x14(%rbp),%eax
sub    $0x3,%eax
je     123d <Operand_b4constu_encode+0x13d>
jmp    1136 <Operand_b4constu_encode+0x36>
mov    -0x14(%rbp),%eax
sub    $0x4,%eax
je     1249 <Operand_b4constu_encode+0x149>
jmp    1147 <Operand_b4constu_encode+0x47>
mov    -0x14(%rbp),%eax
sub    $0x5,%eax
je     1255 <Operand_b4constu_encode+0x155>
jmp    1158 <Operand_b4constu_encode+0x58>
mov    -0x14(%rbp),%eax
sub    $0x6,%eax
je     1261 <Operand_b4constu_encode+0x161>
jmp    1169 <Operand_b4constu_encode+0x69>
mov    -0x14(%rbp),%eax
sub    $0x7,%eax
je     126d <Operand_b4constu_encode+0x16d>
jmp    117a <Operand_b4constu_encode+0x7a>
mov    -0x14(%rbp),%eax
sub    $0x8,%eax
je     1279 <Operand_b4constu_encode+0x179>
jmp    118b <Operand_b4constu_encode+0x8b>
mov    -0x14(%rbp),%eax
sub    $0xa,%eax
je     1285 <Operand_b4constu_encode+0x185>
jmp    119c <Operand_b4constu_encode+0x9c>
mov    -0x14(%rbp),%eax
sub    $0xc,%eax
je     1291 <Operand_b4constu_encode+0x191>
jmp    11ad <Operand_b4constu_encode+0xad>
mov    -0x14(%rbp),%eax
sub    $0x10,%eax
je     129d <Operand_b4constu_encode+0x19d>
jmp    11be <Operand_b4constu_encode+0xbe>
mov    -0x14(%rbp),%eax
sub    $0x20,%eax
je     12a9 <Operand_b4constu_encode+0x1a9>
jmp    11cf <Operand_b4constu_encode+0xcf>
mov    -0x14(%rbp),%eax
sub    $0x40,%eax
je     12b5 <Operand_b4constu_encode+0x1b5>
jmp    11e0 <Operand_b4constu_encode+0xe0>
mov    -0x14(%rbp),%eax
sub    $0x80,%eax
je     12c1 <Operand_b4constu_encode+0x1c1>
jmp    11f3 <Operand_b4constu_encode+0xf3>
mov    -0x14(%rbp),%eax
sub    $0x8000,%eax
je     1219 <Operand_b4constu_encode+0x119>
jmp    1206 <Operand_b4constu_encode+0x106>
mov    -0x14(%rbp),%eax
sub    $0x10000,%eax
je     1225 <Operand_b4constu_encode+0x125>
jmp    12cd <Operand_b4constu_encode+0x1cd>
movl   $0x0,-0xc(%rbp)
jmp    12d4 <Operand_b4constu_encode+0x1d4>
movl   $0x1,-0xc(%rbp)
jmp    12d4 <Operand_b4constu_encode+0x1d4>
movl   $0x2,-0xc(%rbp)
jmp    12d4 <Operand_b4constu_encode+0x1d4>
movl   $0x3,-0xc(%rbp)
jmp    12d4 <Operand_b4constu_encode+0x1d4>
movl   $0x4,-0xc(%rbp)
jmp    12d4 <Operand_b4constu_encode+0x1d4>
movl   $0x5,-0xc(%rbp)
jmp    12d4 <Operand_b4constu_encode+0x1d4>
movl   $0x6,-0xc(%rbp)
jmp    12d4 <Operand_b4constu_encode+0x1d4>
movl   $0x7,-0xc(%rbp)
jmp    12d4 <Operand_b4constu_encode+0x1d4>
movl   $0x8,-0xc(%rbp)
jmp    12d4 <Operand_b4constu_encode+0x1d4>
movl   $0x9,-0xc(%rbp)
jmp    12d4 <Operand_b4constu_encode+0x1d4>
movl   $0xa,-0xc(%rbp)
jmp    12d4 <Operand_b4constu_encode+0x1d4>
movl   $0xb,-0xc(%rbp)
jmp    12d4 <Operand_b4constu_encode+0x1d4>
movl   $0xc,-0xc(%rbp)
jmp    12d4 <Operand_b4constu_encode+0x1d4>
movl   $0xd,-0xc(%rbp)
jmp    12d4 <Operand_b4constu_encode+0x1d4>
movl   $0xe,-0xc(%rbp)
jmp    12d4 <Operand_b4constu_encode+0x1d4>
movl   $0xf,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Operand_b4constu_encode>:
mov    (%rdi),%eax
lea    -0x2(%rax),%ecx
cmp    $0x7e,%ecx
ja     111f <Operand_b4constu_encode+0x1f>
lea    0xeef(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    %eax,(%rdi)
xor    %eax,%eax
ret
cmp    $0x8000,%eax
je     1165 <Operand_b4constu_encode+0x65>
cmp    $0x10000,%eax
jne    1134 <Operand_b4constu_encode+0x34>
mov    $0x1,%eax
jmp    111a <Operand_b4constu_encode+0x1a>
mov    $0xf,%eax
jmp    111a <Operand_b4constu_encode+0x1a>
mov    $0x9,%eax
jmp    111a <Operand_b4constu_encode+0x1a>
mov    $0xa,%eax
jmp    111a <Operand_b4constu_encode+0x1a>
mov    $0xb,%eax
jmp    111a <Operand_b4constu_encode+0x1a>
mov    $0xc,%eax
jmp    111a <Operand_b4constu_encode+0x1a>
mov    $0xd,%eax
jmp    111a <Operand_b4constu_encode+0x1a>
mov    $0xe,%eax
jmp    111a <Operand_b4constu_encode+0x1a>
xor    %eax,%eax
jmp    111a <Operand_b4constu_encode+0x1a>

LLVM IR (-O0):
define i32 @Operand_b4constu_encode(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = load i32, i32* %5
store i32 %6, i32* %4
%7 = load i32, i32* %4
switch i32 %7, label %23 [
i32 32768, label %8
i32 65536, label %9
i32 2, label %10
i32 3, label %11
i32 4, label %12
i32 5, label %13
i32 6, label %14
i32 7, label %15
i32 8, label %16
i32 10, label %17
i32 12, label %18
i32 16, label %19
i32 32, label %20
i32 64, label %21
i32 128, label %22
]
8: ; preds = %1
store i32 0, i32* %3
br label %24
9: ; preds = %1
store i32 1, i32* %3
br label %24
10: ; preds = %1
store i32 2, i32* %3
br label %24
11: ; preds = %1
store i32 3, i32* %3
br label %24
12: ; preds = %1
store i32 4, i32* %3
br label %24
13: ; preds = %1
store i32 5, i32* %3
br label %24
14: ; preds = %1
store i32 6, i32* %3
br label %24
15: ; preds = %1
store i32 7, i32* %3
br label %24
16: ; preds = %1
store i32 8, i32* %3
br label %24
17: ; preds = %1
store i32 9, i32* %3
br label %24
18: ; preds = %1
store i32 10, i32* %3
br label %24
19: ; preds = %1
store i32 11, i32* %3
br label %24
20: ; preds = %1
store i32 12, i32* %3
br label %24
21: ; preds = %1
store i32 13, i32* %3
br label %24
22: ; preds = %1
store i32 14, i32* %3
br label %24
23: ; preds = %1
store i32 15, i32* %3
br label %24
24: ; preds = %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8
%25 = load i32, i32* %3
%26 = load i32*, i32** %2
store i32 %25, i32* %26
ret i32 0
}

LLVM IR (-O2):
define i32 @Operand_b4constu_encode(i32* nocapture %0) {
%2 = load i32, i32* %0
switch i32 %2, label %17 [
i32 32768, label %18
i32 65536, label %3
i32 2, label %4
i32 3, label %5
i32 4, label %6
i32 5, label %7
i32 6, label %8
i32 7, label %9
i32 8, label %10
i32 10, label %11
i32 12, label %12
i32 16, label %13
i32 32, label %14
i32 64, label %15
i32 128, label %16
]
3: ; preds = %1
br label %18
4: ; preds = %1
br label %18
5: ; preds = %1
br label %18
6: ; preds = %1
br label %18
7: ; preds = %1
br label %18
8: ; preds = %1
br label %18
9: ; preds = %1
br label %18
10: ; preds = %1
br label %18
11: ; preds = %1
br label %18
12: ; preds = %1
br label %18
13: ; preds = %1
br label %18
14: ; preds = %1
br label %18
15: ; preds = %1
br label %18
16: ; preds = %1
br label %18
17: ; preds = %1
br label %18
18: ; preds = %1, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3
%19 = phi i32 [ 15, %17 ], [ 14, %16 ], [ 13, %15 ], [ 12, %14 ], [ 11, %13 ], [ 10, %12 ], [ 9, %11 ], [ %2, %10 ], [ %2, %9 ], [ %2, %8 ], [ %2, %7 ], [ %2, %6 ], [ %2, %5 ], [ %2, %4 ], [ 1, %3 ], [ 0, %1 ]
store i32 %19, i32* %0
ret i32 0
}