#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 uint32_t;
typedef int uint16_t;

/* Variables and functions */
int GetProtoColorVal(uint32_t ethproto) {
  uint16_t ipflag = (ethproto >> 16) & 0xff;
  switch (ipflag) {
  case (0x0 + 10):
    return 42;
  case (0x40 + 1):
    return 44;
  case (0x40 + 2):
    return 45;
  case (0x40 + 20):
    return 100;
  case (0x40 + 24):
    return 102;
  case (0x40 + 38):
    return 103;
  case (0x40 + 80):
    return 104;
  default:
    break;
  }
  return 49;
}


x86 assembly (clang, -O0):
<GetProtoColorVal>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movzbl -0x6(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0xa,%eax
je     118a <GetProtoColorVal+0x8a>
jmp    1122 <GetProtoColorVal+0x22>
mov    -0x10(%rbp),%eax
sub    $0x41,%eax
je     1196 <GetProtoColorVal+0x96>
jmp    1133 <GetProtoColorVal+0x33>
mov    -0x10(%rbp),%eax
sub    $0x42,%eax
je     11a2 <GetProtoColorVal+0xa2>
jmp    1144 <GetProtoColorVal+0x44>
mov    -0x10(%rbp),%eax
sub    $0x54,%eax
je     11ae <GetProtoColorVal+0xae>
jmp    1155 <GetProtoColorVal+0x55>
mov    -0x10(%rbp),%eax
sub    $0x58,%eax
je     11ba <GetProtoColorVal+0xba>
jmp    1166 <GetProtoColorVal+0x66>
mov    -0x10(%rbp),%eax
sub    $0x66,%eax
je     11c6 <GetProtoColorVal+0xc6>
jmp    1177 <GetProtoColorVal+0x77>
mov    -0x10(%rbp),%eax
sub    $0x90,%eax
je     11d2 <GetProtoColorVal+0xd2>
jmp    11de <GetProtoColorVal+0xde>
movl   $0x2a,-0x4(%rbp)
jmp    11ea <GetProtoColorVal+0xea>
movl   $0x2c,-0x4(%rbp)
jmp    11ea <GetProtoColorVal+0xea>
movl   $0x2d,-0x4(%rbp)
jmp    11ea <GetProtoColorVal+0xea>
movl   $0x64,-0x4(%rbp)
jmp    11ea <GetProtoColorVal+0xea>
movl   $0x66,-0x4(%rbp)
jmp    11ea <GetProtoColorVal+0xea>
movl   $0x67,-0x4(%rbp)
jmp    11ea <GetProtoColorVal+0xea>
movl   $0x68,-0x4(%rbp)
jmp    11ea <GetProtoColorVal+0xea>
jmp    11e3 <GetProtoColorVal+0xe3>
movl   $0x31,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetProtoColorVal>:
shr    $0x10,%edi
lea    -0x41(%rdi),%eax
cmp    $0x25,%al
ja     1123 <GetProtoColorVal+0x23>
movzbl %al,%eax
lea    0xeec(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x2c,%eax
ret
cmp    $0x90,%dil
je     1152 <GetProtoColorVal+0x52>
mov    $0x2a,%eax
cmp    $0xa,%dil
je     1157 <GetProtoColorVal+0x57>
mov    $0x31,%eax
ret
mov    $0x2d,%eax
ret
mov    $0x64,%eax
ret
mov    $0x66,%eax
ret
mov    $0x67,%eax
ret
mov    $0x68,%eax
ret

LLVM IR (-O0):
define i32 @GetProtoColorVal(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = ashr i32 %5, 16
%7 = and i32 %6, 255
store i32 %7, i32* %4
%8 = load i32, i32* %4
switch i32 %8, label %16 [
i32 10, label %9
i32 65, label %10
i32 66, label %11
i32 84, label %12
i32 88, label %13
i32 102, label %14
i32 144, label %15
]
9: ; preds = %1
store i32 42, i32* %2
br label %18
10: ; preds = %1
store i32 44, i32* %2
br label %18
11: ; preds = %1
store i32 45, i32* %2
br label %18
12: ; preds = %1
store i32 100, i32* %2
br label %18
13: ; preds = %1
store i32 102, i32* %2
br label %18
14: ; preds = %1
store i32 103, i32* %2
br label %18
15: ; preds = %1
store i32 104, i32* %2
br label %18
16: ; preds = %1
br label %17
17: ; preds = %16
store i32 49, i32* %2
br label %18
18: ; preds = %17, %15, %14, %13, %12, %11, %10, %9
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @GetProtoColorVal(i32 %0) {
%2 = lshr i32 %0, 16
%3 = trunc i32 %2 to i8
switch i8 %3, label %10 [
i8 10, label %11
i8 65, label %4
i8 66, label %5
i8 84, label %6
i8 88, label %7
i8 102, label %8
i8 -112, label %9
]
4: ; preds = %1
br label %11
5: ; preds = %1
br label %11
6: ; preds = %1
br label %11
7: ; preds = %1
br label %11
8: ; preds = %1
br label %11
9: ; preds = %1
br label %11
10: ; preds = %1
br label %11
11: ; preds = %1, %10, %9, %8, %7, %6, %5, %4
%12 = phi i32 [ 49, %10 ], [ 104, %9 ], [ 103, %8 ], [ 102, %7 ], [ 100, %6 ], [ 45, %5 ], [ 44, %4 ], [ 42, %1 ]
ret i32 %12
}