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

/* Variables and functions */
char *opttostring(uint8_t option) {
  char *ret;
  switch (option) {
  case 53:
    ret = "DHCP_MSG_TYPE";
    break;
  case 55:
    ret = "DHCP_PARAM_LIST";
    break;
  case 0x36:
    ret = "DHCP_SEVER_IDENTIFIER";
    break;
  case 51:
    ret = "DHCP_LEASE_TIME";
    break;
  case 1:
    ret = "PARAM_SUBNET";
    break;
  case 28:
    ret = "PARAM_BROADCASTADDR";
    break;
  case 3:
    ret = "PARAM_ROUTER";
    break;
  case 6:
    ret = "PARAM_DNS_ADDR";
    break;
  default:
    ret = "unknown";
  }
  return ret;
}


x86 assembly (clang, -O0):
<opttostring>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x36,%eax
ja     11b0 <opttostring+0xb0>
mov    -0x18(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xfa5(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11bb <opttostring+0xbb>
lea    0xfa3(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11bb <opttostring+0xbb>
lea    0xfa3(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11bb <opttostring+0xbb>
lea    0xfa9(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11bb <opttostring+0xbb>
lea    0xfa9(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11bb <opttostring+0xbb>
lea    0xfa6(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11bb <opttostring+0xbb>
lea    0xfaa(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11bb <opttostring+0xbb>
lea    0xfa7(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11bb <opttostring+0xbb>
lea    0xfa6(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<opttostring>:
add    $0xffffffff,%edi
cmp    $0x36,%edi
ja     1127 <opttostring+0x27>
lea    0xfcd(%rip),%rax
lea    0xeea(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
lea    0xffa(%rip),%rax
ret
lea    0x102f(%rip),%rax
ret
lea    0x100b(%rip),%rax
ret
lea    0x1010(%rip),%rax
ret
lea    0xfe7(%rip),%rax
ret
lea    0xfc2(%rip),%rax
ret
lea    0xfa4(%rip),%rax
ret
lea    0xf8c(%rip),%rax
ret

LLVM IR (-O0):
@.str = [14 x i8] c"DHCP_MSG_TYPE\00"
@.str.1 = [16 x i8] c"DHCP_PARAM_LIST\00"
@.str.2 = [22 x i8] c"DHCP_SEVER_IDENTIFIER\00"
@.str.3 = [16 x i8] c"DHCP_LEASE_TIME\00"
@.str.4 = [13 x i8] c"PARAM_SUBNET\00"
@.str.5 = [20 x i8] c"PARAM_BROADCASTADDR\00"
@.str.6 = [13 x i8] c"PARAM_ROUTER\00"
@.str.7 = [15 x i8] c"PARAM_DNS_ADDR\00"
@.str.8 = [8 x i8] c"unknown\00"
define i8* @opttostring(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %13 [
i32 53, label %5
i32 55, label %6
i32 54, label %7
i32 51, label %8
i32 1, label %9
i32 28, label %10
i32 3, label %11
i32 6, label %12
]
5: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %3
br label %14
6: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %14
7: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %14
8: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8** %3
br label %14
9: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8** %3
br label %14
10: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8** %3
br label %14
11: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8** %3
br label %14
12: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8** %3
br label %14
13: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8** %3
br label %14
14: ; preds = %13, %12, %11, %10, %9, %8, %7, %6, %5
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
@.str = [14 x i8] c"DHCP_MSG_TYPE\00"
@.str.1 = [16 x i8] c"DHCP_PARAM_LIST\00"
@.str.2 = [22 x i8] c"DHCP_SEVER_IDENTIFIER\00"
@.str.3 = [16 x i8] c"DHCP_LEASE_TIME\00"
@.str.4 = [13 x i8] c"PARAM_SUBNET\00"
@.str.5 = [20 x i8] c"PARAM_BROADCASTADDR\00"
@.str.6 = [13 x i8] c"PARAM_ROUTER\00"
@.str.7 = [15 x i8] c"PARAM_DNS_ADDR\00"
@.str.8 = [8 x i8] c"unknown\00"
define i8* @opttostring(i32 %0) {
switch i32 %0, label %9 [
i32 53, label %10
i32 55, label %2
i32 54, label %3
i32 51, label %4
i32 1, label %5
i32 28, label %6
i32 3, label %7
i32 6, label %8
]
2: ; preds = %1
br label %10
3: ; preds = %1
br label %10
4: ; preds = %1
br label %10
5: ; preds = %1
br label %10
6: ; preds = %1
br label %10
7: ; preds = %1
br label %10
8: ; preds = %1
br label %10
9: ; preds = %1
br label %10
10: ; preds = %1, %9, %8, %7, %6, %5, %4, %3, %2
%11 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), %9 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), %8 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %11
}