char *dhcp6msgstr(type)
int type;
{
  static char genstr[sizeof("msg255") + 1];
  if (type > 255)
    return "INVALID msg";
  switch (type) {
  case 1:
    return "solicit";
  case 2:
    return "advertise";
  case 5:
    return "renew";
  case 6:
    return "rebind";
  case 3:
    return "request";
  case 7:
    return "reply";
  case 4:
    return "confirm";
  case 8:
    return "release";
  case 9:
    return "decline";
  case 11:
    return "information request";
  case 10:
    return "reconfigure";
  case 12:
    return "relay forwarding";
  case 13:
    return "relay reply";
  default:
    sprintf(genstr, "msg%d", type);
    return (genstr);
  }
}


x86 assembly (clang, -O0):
<dhcp6msgstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0xff,-0xc(%rbp)
jle    1138 <dhcp6msgstr+0x28>
lea    0xf05(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1254 <dhcp6msgstr+0x144>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0xc,%eax
ja     1231 <dhcp6msgstr+0x121>
mov    -0x18(%rbp),%rax
lea    0xea8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xed8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1254 <dhcp6msgstr+0x144>
lea    0xed0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1254 <dhcp6msgstr+0x144>
lea    0xeca(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1254 <dhcp6msgstr+0x144>
lea    0xec0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1254 <dhcp6msgstr+0x144>
lea    0xedb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1254 <dhcp6msgstr+0x144>
lea    0xef6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1254 <dhcp6msgstr+0x144>
lea    0xe97(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1254 <dhcp6msgstr+0x144>
lea    0xe8f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1254 <dhcp6msgstr+0x144>
lea    0xe87(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1254 <dhcp6msgstr+0x144>
lea    0xe7f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1254 <dhcp6msgstr+0x144>
lea    0xe83(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1254 <dhcp6msgstr+0x144>
lea    0xe7f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1254 <dhcp6msgstr+0x144>
lea    0xe80(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1254 <dhcp6msgstr+0x144>
mov    -0xc(%rbp),%edx
lea    0x2dee(%rip),%rdi
lea    0xe72(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
lea    0x2dd9(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dhcp6msgstr>:
push   %rbx
cmp    $0xff,%edi
jle    1122 <dhcp6msgstr+0x12>
lea    0xee0(%rip),%rbx
jmp    1156 <dhcp6msgstr+0x46>
mov    %edi,%edx
lea    -0x1(%rdx),%eax
cmp    $0xd,%eax
jae    113e <dhcp6msgstr+0x2e>
cltq
lea    0xf53(%rip),%rcx
movslq (%rcx,%rax,4),%rbx
add    %rcx,%rbx
jmp    1156 <dhcp6msgstr+0x46>
lea    0x2ee4(%rip),%rbx
lea    0xf34(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@dhcp6msgstr.genstr = internal global [8 x i8] zeroinitializer
@.str = [12 x i8] c"INVALID msg\00"
@.str.1 = [8 x i8] c"solicit\00"
@.str.2 = [10 x i8] c"advertise\00"
@.str.3 = [6 x i8] c"renew\00"
@.str.4 = [7 x i8] c"rebind\00"
@.str.5 = [8 x i8] c"request\00"
@.str.6 = [6 x i8] c"reply\00"
@.str.7 = [8 x i8] c"confirm\00"
@.str.8 = [8 x i8] c"release\00"
@.str.9 = [8 x i8] c"decline\00"
@.str.10 = [20 x i8] c"information request\00"
@.str.11 = [12 x i8] c"reconfigure\00"
@.str.12 = [17 x i8] c"relay forwarding\00"
@.str.13 = [12 x i8] c"relay reply\00"
@.str.14 = [6 x i8] c"msg%d\00"
define i8* @dhcp6msgstr(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sgt i32 %4, 255
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %2
br label %25
7: ; preds = %1
%8 = load i32, i32* %3
switch i32 %8, label %22 [
i32 1, label %9
i32 2, label %10
i32 5, label %11
i32 6, label %12
i32 3, label %13
i32 7, label %14
i32 4, label %15
i32 8, label %16
i32 9, label %17
i32 11, label %18
i32 10, label %19
i32 12, label %20
i32 13, label %21
]
9: ; preds = %7
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %25
10: ; preds = %7
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %25
11: ; preds = %7
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %25
12: ; preds = %7
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %25
13: ; preds = %7
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %25
14: ; preds = %7
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %25
15: ; preds = %7
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %25
16: ; preds = %7
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %25
17: ; preds = %7
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %25
18: ; preds = %7
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %25
19: ; preds = %7
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %25
20: ; preds = %7
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %25
21: ; preds = %7
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0), i8** %2
br label %25
22: ; preds = %7
%23 = load i32, i32* %3
%24 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @dhcp6msgstr.genstr, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i32 %23)
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @dhcp6msgstr.genstr, i64 0, i64 0), i8** %2
br label %25
25: ; preds = %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %6
%26 = load i8*, i8** %2
ret i8* %26
}

LLVM IR (-O2):
@dhcp6msgstr.genstr = internal global [8 x i8] zeroinitializer
@.str = [12 x i8] c"INVALID msg\00"
@.str.1 = [8 x i8] c"solicit\00"
@.str.2 = [10 x i8] c"advertise\00"
@.str.3 = [6 x i8] c"renew\00"
@.str.4 = [7 x i8] c"rebind\00"
@.str.5 = [8 x i8] c"request\00"
@.str.6 = [6 x i8] c"reply\00"
@.str.7 = [8 x i8] c"confirm\00"
@.str.8 = [8 x i8] c"release\00"
@.str.9 = [8 x i8] c"decline\00"
@.str.10 = [20 x i8] c"information request\00"
@.str.11 = [12 x i8] c"reconfigure\00"
@.str.12 = [17 x i8] c"relay forwarding\00"
@.str.13 = [12 x i8] c"relay reply\00"
@.str.14 = [6 x i8] c"msg%d\00"
@reltable.dhcp6msgstr = [13 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.1 to i64), i64 ptrtoint ([13 x i32]* @reltable.dhcp6msgstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.2 to i64), i64 ptrtoint ([13 x i32]* @reltable.dhcp6msgstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.5 to i64), i64 ptrtoint ([13 x i32]* @reltable.dhcp6msgstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.7 to i64), i64 ptrtoint ([13 x i32]* @reltable.dhcp6msgstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.3 to i64), i64 ptrtoint ([13 x i32]* @reltable.dhcp6msgstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.4 to i64), i64 ptrtoint ([13 x i32]* @reltable.dhcp6msgstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.6 to i64), i64 ptrtoint ([13 x i32]* @reltable.dhcp6msgstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.8 to i64), i64 ptrtoint ([13 x i32]* @reltable.dhcp6msgstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.9 to i64), i64 ptrtoint ([13 x i32]* @reltable.dhcp6msgstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.11 to i64), i64 ptrtoint ([13 x i32]* @reltable.dhcp6msgstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @.str.10 to i64), i64 ptrtoint ([13 x i32]* @reltable.dhcp6msgstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([17 x i8]* @.str.12 to i64), i64 ptrtoint ([13 x i32]* @reltable.dhcp6msgstr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.13 to i64), i64 ptrtoint ([13 x i32]* @reltable.dhcp6msgstr to i64)) to i32)]
define i8* @dhcp6msgstr(i32 %0) {
%2 = icmp sgt i32 %0, 255
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = add i32 %0, -1
%5 = icmp ult i32 %4, 13
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @dhcp6msgstr.genstr, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i32 %0)
br label %12
8: ; preds = %3
%9 = sext i32 %4 to i64
%10 = shl i64 %9, 2
%11 = call i8* @llvm.load.relative.i64(i8* bitcast ([13 x i32]* @reltable.dhcp6msgstr to i8*), i64 %10)
br label %12
12: ; preds = %8, %1, %6
%13 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @dhcp6msgstr.genstr, i64 0, i64 0), %6 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), %1 ], [ %11, %8 ]
ret i8* %13
}