#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 u_int8_t;
typedef int u_int16_t;

/* Variables and functions */
u_int16_t message_payload_sz(u_int8_t payload) {
  switch (payload) {
  case 1:
    return 8;
  case 2:
    return 8;
  case 3:
    return 8;
  case 4:
    return 4;
  case 5:
    return 8;
  case 6:
    return 5;
  case 7:
    return 5;
  case 8:
    return 4;
  case 9:
    return 4;
  case 10:
    return 4;
  case 11:
    return 12;
  case 12:
    return 12;
  case 13:
    return 4;
  case 14:
    return 8;
  case 20:
  case 130:
    return 4;
  case 21:
  case 131:
    return 8;
  case 15:
  case 16:
  case 17:
  case 18:
  case 19:
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<message_payload_sz>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x82,%eax
ja     11f7 <message_payload_sz+0xf7>
mov    -0x10(%rbp),%rax
lea    0xed7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x8,-0x4(%rbp)
jmp    11fe <message_payload_sz+0xfe>
movl   $0x8,-0x4(%rbp)
jmp    11fe <message_payload_sz+0xfe>
movl   $0x8,-0x4(%rbp)
jmp    11fe <message_payload_sz+0xfe>
movl   $0x4,-0x4(%rbp)
jmp    11fe <message_payload_sz+0xfe>
movl   $0x8,-0x4(%rbp)
jmp    11fe <message_payload_sz+0xfe>
movl   $0x5,-0x4(%rbp)
jmp    11fe <message_payload_sz+0xfe>
movl   $0x5,-0x4(%rbp)
jmp    11fe <message_payload_sz+0xfe>
movl   $0x4,-0x4(%rbp)
jmp    11fe <message_payload_sz+0xfe>
movl   $0x4,-0x4(%rbp)
jmp    11fe <message_payload_sz+0xfe>
movl   $0x4,-0x4(%rbp)
jmp    11fe <message_payload_sz+0xfe>
movl   $0xc,-0x4(%rbp)
jmp    11fe <message_payload_sz+0xfe>
movl   $0xc,-0x4(%rbp)
jmp    11fe <message_payload_sz+0xfe>
movl   $0x4,-0x4(%rbp)
jmp    11fe <message_payload_sz+0xfe>
movl   $0x8,-0x4(%rbp)
jmp    11fe <message_payload_sz+0xfe>
movl   $0x4,-0x4(%rbp)
jmp    11fe <message_payload_sz+0xfe>
movl   $0x8,-0x4(%rbp)
jmp    11fe <message_payload_sz+0xfe>
jmp    11f7 <message_payload_sz+0xf7>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<message_payload_sz>:
lea    -0x1(%rdi),%ecx
cmp    $0x82,%ecx
ja     1136 <message_payload_sz+0x36>
mov    $0x8,%eax
lea    0xee9(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
ret
mov    $0x4,%eax
ret
mov    %edi,%eax
ret
mov    $0x5,%eax
ret
mov    $0xc,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @message_payload_sz(i32 %0) {
switch i32 %0, label %12 [
i32 1, label %13
i32 2, label %13
i32 3, label %13
i32 4, label %2
i32 5, label %13
i32 6, label %3
i32 7, label %4
i32 8, label %5
i32 9, label %6
i32 10, label %7
i32 11, label %8
i32 12, label %9
i32 13, label %10
i32 14, label %13
i32 20, label %11
i32 130, label %11
i32 21, label %13
i32 131, label %13
]
2: ; preds = %1
br label %13
3: ; preds = %1
br label %13
4: ; preds = %1
br label %13
5: ; preds = %1
br label %13
6: ; preds = %1
br label %13
7: ; preds = %1
br label %13
8: ; preds = %1
br label %13
9: ; preds = %1
br label %13
10: ; preds = %1
br label %13
11: ; preds = %1, %1
br label %13
12: ; preds = %1
br label %13
13: ; preds = %1, %1, %1, %1, %1, %1, %1, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%14 = phi i32 [ 0, %12 ], [ 4, %11 ], [ 4, %10 ], [ %0, %9 ], [ 12, %8 ], [ 4, %7 ], [ 4, %6 ], [ 4, %5 ], [ 5, %4 ], [ 5, %3 ], [ %0, %2 ], [ 8, %1 ], [ 8, %1 ], [ 8, %1 ], [ 8, %1 ], [ 8, %1 ], [ 8, %1 ], [ 8, %1 ]
ret i32 %14
}