#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 */

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
char *aocClientPacketName(int type) {
  static char buf[32];
  switch (type) {
  case 2:
    return "LOGIN_RESPONSE";
  case 3:
    return "LOGIN_SELCHAR";
  case 21:
    return "NAME_LOOKUP";
  case 30:
    return "PRIVATE_MSG";
  case 40:
    return "BUDDY_ADD";
  case 41:
    return "BUDDY_REMOVE";
  case 42:
    return "ONLINE_STATUS";
  case 50:
    return "PRIVGRP_INVITE";
  case 51:
    return "PRIVGRP_KICK";
  case 52:
    return "PRIVGRP_JOIN";
  case 54:
    return "PRIVGRP_KICKALL";
  case 57:
    return "PRIVGRP_MSG";
  case 64:
    return "GROUP_DATASET";
  case 65:
    return "GROUP_MESSAGE";
  case 66:
    return "GROUP_CLIMODE";
  case 70:
    return "CLIMODE_GET";
  case 71:
    return "CLIMODE_SET";
  case 100:
    return "PING";
  case 120:
    return "CHAT_COMMAND";
  default:
    sprintf(buf, "UNKNOWN_%d", type);
    return buf;
  }
}


x86 assembly (clang, -O0):
<aocClientPacketName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xfffffffe,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x76,%eax
ja     1274 <aocClientPacketName+0x164>
mov    -0x18(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x1091(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1295 <aocClientPacketName+0x185>
lea    0x1090(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1295 <aocClientPacketName+0x185>
lea    0x108e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1295 <aocClientPacketName+0x185>
lea    0x108a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1295 <aocClientPacketName+0x185>
lea    0x1086(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1295 <aocClientPacketName+0x185>
lea    0x1080(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1295 <aocClientPacketName+0x185>
lea    0x107d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1295 <aocClientPacketName+0x185>
lea    0x107b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1295 <aocClientPacketName+0x185>
lea    0x107a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1295 <aocClientPacketName+0x185>
lea    0x1077(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1295 <aocClientPacketName+0x185>
lea    0x1074(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1295 <aocClientPacketName+0x185>
lea    0x1074(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1295 <aocClientPacketName+0x185>
lea    0x1070(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1295 <aocClientPacketName+0x185>
lea    0x106e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1295 <aocClientPacketName+0x185>
lea    0x106c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1295 <aocClientPacketName+0x185>
lea    0x106a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1295 <aocClientPacketName+0x185>
lea    0x1066(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1295 <aocClientPacketName+0x185>
lea    0x1062(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1295 <aocClientPacketName+0x185>
lea    0x1057(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1295 <aocClientPacketName+0x185>
mov    -0xc(%rbp),%edx
lea    0x2dc2(%rip),%rdi
lea    0x104a(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2daf(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aocClientPacketName>:
push   %rbx
mov    %edi,%edx
lea    -0x2(%rdx),%eax
cmp    $0x76,%eax
ja     11ea <aocClientPacketName+0xda>
lea    0x10b6(%rip),%rbx
lea    0xed3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x10ae(%rip),%rbx
jmp    1200 <aocClientPacketName+0xf0>
lea    0x10b0(%rip),%rbx
jmp    1200 <aocClientPacketName+0xf0>
lea    0x10b0(%rip),%rbx
jmp    1200 <aocClientPacketName+0xf0>
lea    0x10b0(%rip),%rbx
jmp    1200 <aocClientPacketName+0xf0>
lea    0x10ae(%rip),%rbx
jmp    1200 <aocClientPacketName+0xf0>
lea    0x10af(%rip),%rbx
jmp    1200 <aocClientPacketName+0xf0>
lea    0x10b1(%rip),%rbx
jmp    1200 <aocClientPacketName+0xf0>
lea    0x10b7(%rip),%rbx
jmp    1200 <aocClientPacketName+0xf0>
lea    0x10bb(%rip),%rbx
jmp    1200 <aocClientPacketName+0xf0>
lea    0x10bf(%rip),%rbx
jmp    1200 <aocClientPacketName+0xf0>
lea    0x10c6(%rip),%rbx
jmp    1200 <aocClientPacketName+0xf0>
lea    0x10c9(%rip),%rbx
jmp    1200 <aocClientPacketName+0xf0>
lea    0x10ce(%rip),%rbx
jmp    1200 <aocClientPacketName+0xf0>
lea    0x10d3(%rip),%rbx
jmp    1200 <aocClientPacketName+0xf0>
lea    0x10d8(%rip),%rbx
jmp    1200 <aocClientPacketName+0xf0>
lea    0x10db(%rip),%rbx
jmp    1200 <aocClientPacketName+0xf0>
lea    0x10de(%rip),%rbx
jmp    1200 <aocClientPacketName+0xf0>
lea    0x10da(%rip),%rbx
jmp    1200 <aocClientPacketName+0xf0>
lea    0x2e4f(%rip),%rbx
lea    0x10d7(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@aocClientPacketName.buf = internal global [32 x i8] zeroinitializer
@.str = [15 x i8] c"LOGIN_RESPONSE\00"
@.str.1 = [14 x i8] c"LOGIN_SELCHAR\00"
@.str.2 = [12 x i8] c"NAME_LOOKUP\00"
@.str.3 = [12 x i8] c"PRIVATE_MSG\00"
@.str.4 = [10 x i8] c"BUDDY_ADD\00"
@.str.5 = [13 x i8] c"BUDDY_REMOVE\00"
@.str.6 = [14 x i8] c"ONLINE_STATUS\00"
@.str.7 = [15 x i8] c"PRIVGRP_INVITE\00"
@.str.8 = [13 x i8] c"PRIVGRP_KICK\00"
@.str.9 = [13 x i8] c"PRIVGRP_JOIN\00"
@.str.10 = [16 x i8] c"PRIVGRP_KICKALL\00"
@.str.11 = [12 x i8] c"PRIVGRP_MSG\00"
@.str.12 = [14 x i8] c"GROUP_DATASET\00"
@.str.13 = [14 x i8] c"GROUP_MESSAGE\00"
@.str.14 = [14 x i8] c"GROUP_CLIMODE\00"
@.str.15 = [12 x i8] c"CLIMODE_GET\00"
@.str.16 = [12 x i8] c"CLIMODE_SET\00"
@.str.17 = [5 x i8] c"PING\00"
@.str.18 = [13 x i8] c"CHAT_COMMAND\00"
@.str.19 = [11 x i8] c"UNKNOWN_%d\00"
define i8* @aocClientPacketName(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %24 [
i32 2, label %5
i32 3, label %6
i32 21, label %7
i32 30, label %8
i32 40, label %9
i32 41, label %10
i32 42, label %11
i32 50, label %12
i32 51, label %13
i32 52, label %14
i32 54, label %15
i32 57, label %16
i32 64, label %17
i32 65, label %18
i32 66, label %19
i32 70, label %20
i32 71, label %21
i32 100, label %22
i32 120, label %23
]
5: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %2
br label %27
6: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %27
7: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %27
8: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %27
9: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %27
10: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %27
11: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %27
12: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %27
13: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %27
14: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %27
15: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %27
16: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %27
17: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %27
18: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0), i8** %2
br label %27
19: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0), i8** %2
br label %27
20: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0), i8** %2
br label %27
21: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0), i8** %2
br label %27
22: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), i8** %2
br label %27
23: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.18, i64 0, i64 0), i8** %2
br label %27
24: ; preds = %1
%25 = load i32, i32* %3
%26 = call i32 @sprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @aocClientPacketName.buf, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.19, i64 0, i64 0), i32 %25)
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @aocClientPacketName.buf, i64 0, i64 0), i8** %2
br label %27
27: ; preds = %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%28 = load i8*, i8** %2
ret i8* %28
}

LLVM IR (-O2):
@aocClientPacketName.buf = internal global [32 x i8] zeroinitializer
@.str = [15 x i8] c"LOGIN_RESPONSE\00"
@.str.1 = [14 x i8] c"LOGIN_SELCHAR\00"
@.str.2 = [12 x i8] c"NAME_LOOKUP\00"
@.str.3 = [12 x i8] c"PRIVATE_MSG\00"
@.str.4 = [10 x i8] c"BUDDY_ADD\00"
@.str.5 = [13 x i8] c"BUDDY_REMOVE\00"
@.str.6 = [14 x i8] c"ONLINE_STATUS\00"
@.str.7 = [15 x i8] c"PRIVGRP_INVITE\00"
@.str.8 = [13 x i8] c"PRIVGRP_KICK\00"
@.str.9 = [13 x i8] c"PRIVGRP_JOIN\00"
@.str.10 = [16 x i8] c"PRIVGRP_KICKALL\00"
@.str.11 = [12 x i8] c"PRIVGRP_MSG\00"
@.str.12 = [14 x i8] c"GROUP_DATASET\00"
@.str.13 = [14 x i8] c"GROUP_MESSAGE\00"
@.str.14 = [14 x i8] c"GROUP_CLIMODE\00"
@.str.15 = [12 x i8] c"CLIMODE_GET\00"
@.str.16 = [12 x i8] c"CLIMODE_SET\00"
@.str.17 = [5 x i8] c"PING\00"
@.str.18 = [13 x i8] c"CHAT_COMMAND\00"
@.str.19 = [11 x i8] c"UNKNOWN_%d\00"
define i8* @aocClientPacketName(i32 %0) {
switch i32 %0, label %20 [
i32 2, label %22
i32 3, label %2
i32 21, label %3
i32 30, label %4
i32 40, label %5
i32 41, label %6
i32 42, label %7
i32 50, label %8
i32 51, label %9
i32 52, label %10
i32 54, label %11
i32 57, label %12
i32 64, label %13
i32 65, label %14
i32 66, label %15
i32 70, label %16
i32 71, label %17
i32 100, label %18
i32 120, label %19
]
2: ; preds = %1
br label %22
3: ; preds = %1
br label %22
4: ; preds = %1
br label %22
5: ; preds = %1
br label %22
6: ; preds = %1
br label %22
7: ; preds = %1
br label %22
8: ; preds = %1
br label %22
9: ; preds = %1
br label %22
10: ; preds = %1
br label %22
11: ; preds = %1
br label %22
12: ; preds = %1
br label %22
13: ; preds = %1
br label %22
14: ; preds = %1
br label %22
15: ; preds = %1
br label %22
16: ; preds = %1
br label %22
17: ; preds = %1
br label %22
18: ; preds = %1
br label %22
19: ; preds = %1
br label %22
20: ; preds = %1
%21 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @aocClientPacketName.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.19, i64 0, i64 0), i32 %0)
br label %22
22: ; preds = %1, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%23 = phi i8* [ getelementptr inbounds ([32 x i8], [32 x i8]* @aocClientPacketName.buf, i64 0, i64 0), %20 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.18, i64 0, i64 0), %19 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), %18 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0), %17 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0), %16 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0), %15 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0), %14 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), %13 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), %12 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), %11 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), %10 ], [ getelementptr inbounds ([13 x i8], [13 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 ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %23
}