#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 */
char const *HexStr(unsigned int, int /*<<< orphan*/ *, int /*<<< orphan*/);
const char *protoname(unsigned proto) {
  static const char *const cftypes[] = {
      NULL,         "MRU",      "ACCMAP",    "AUTHPROTO", "QUALPROTO",
      "MAGICNUM",   "RESERVED", "PROTOCOMP", "ACFCOMP",   "FCSALT",
      "SDP",        "NUMMODE",  "MULTIPROC", "CALLBACK",  "CONTIME",
      "COMPFRAME",  "NDE",      "MRRU",      "SHORTSEQ",  "ENDDISC",
      "PROPRIETRY", "DCEID",    "MULTIPP",   "LDBACP",
  };
  if (proto > sizeof cftypes / sizeof *cftypes || cftypes[proto] == NULL)
    return HexStr(proto, NULL, 0);
  return cftypes[proto];
}


x86 assembly (clang, -O0):
<protoname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    $0x18,%rax
ja     113f <protoname+0x2f>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
lea    0x2c2c(%rip),%rax
cmpq   $0x0,(%rax,%rcx,8)
jne    1156 <protoname+0x46>
mov    -0xc(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1030 <HexStr@plt>
mov    %rax,-0x8(%rbp)
jmp    116a <protoname+0x5a>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
lea    0x2bfe(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<protoname>:
lea    -0x19(%rdi),%eax
cmp    $0xffffffe7,%eax
ja     1121 <protoname+0x11>
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <HexStr@plt>
mov    %edi,%eax
lea    0x2c36(%rip),%rcx
mov    (%rcx,%rax,8),%rax
ret

LLVM IR (-O0):
@protoname.cftypes = internal constant [24 x i8*] [i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.22, i32 0, i32 0)]
@.str = [4 x i8] c"MRU\00"
@.str.1 = [7 x i8] c"ACCMAP\00"
@.str.2 = [10 x i8] c"AUTHPROTO\00"
@.str.3 = [10 x i8] c"QUALPROTO\00"
@.str.4 = [9 x i8] c"MAGICNUM\00"
@.str.5 = [9 x i8] c"RESERVED\00"
@.str.6 = [10 x i8] c"PROTOCOMP\00"
@.str.7 = [8 x i8] c"ACFCOMP\00"
@.str.8 = [7 x i8] c"FCSALT\00"
@.str.9 = [4 x i8] c"SDP\00"
@.str.10 = [8 x i8] c"NUMMODE\00"
@.str.11 = [10 x i8] c"MULTIPROC\00"
@.str.12 = [9 x i8] c"CALLBACK\00"
@.str.13 = [8 x i8] c"CONTIME\00"
@.str.14 = [10 x i8] c"COMPFRAME\00"
@.str.15 = [4 x i8] c"NDE\00"
@.str.16 = [5 x i8] c"MRRU\00"
@.str.17 = [9 x i8] c"SHORTSEQ\00"
@.str.18 = [8 x i8] c"ENDDISC\00"
@.str.19 = [11 x i8] c"PROPRIETRY\00"
@.str.20 = [6 x i8] c"DCEID\00"
@.str.21 = [8 x i8] c"MULTIPP\00"
@.str.22 = [7 x i8] c"LDBACP\00"
define i8* @protoname(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = zext i32 %4 to i64
%6 = icmp ugt i64 %5, 24
br i1 %6, label %13, label %7
7: ; preds = %1
%8 = load i32, i32* %3
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds [24 x i8*], [24 x i8*]* @protoname.cftypes, i64 0, i64 %9
%11 = load i8*, i8** %10
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %16
13: ; preds = %7, %1
%14 = load i32, i32* %3
%15 = call i8* @HexStr(i32 %14, i32* null, i32 0)
store i8* %15, i8** %2
br label %21
16: ; preds = %7
%17 = load i32, i32* %3
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds [24 x i8*], [24 x i8*]* @protoname.cftypes, i64 0, i64 %18
%20 = load i8*, i8** %19
store i8* %20, i8** %2
br label %21
21: ; preds = %16, %13
%22 = load i8*, i8** %2
ret i8* %22
}

LLVM IR (-O2):
@protoname.cftypes = internal unnamed_addr constant [24 x i8*] [i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.22, i32 0, i32 0)]
@.str = [4 x i8] c"MRU\00"
@.str.1 = [7 x i8] c"ACCMAP\00"
@.str.2 = [10 x i8] c"AUTHPROTO\00"
@.str.3 = [10 x i8] c"QUALPROTO\00"
@.str.4 = [9 x i8] c"MAGICNUM\00"
@.str.5 = [9 x i8] c"RESERVED\00"
@.str.6 = [10 x i8] c"PROTOCOMP\00"
@.str.7 = [8 x i8] c"ACFCOMP\00"
@.str.8 = [7 x i8] c"FCSALT\00"
@.str.9 = [4 x i8] c"SDP\00"
@.str.10 = [8 x i8] c"NUMMODE\00"
@.str.11 = [10 x i8] c"MULTIPROC\00"
@.str.12 = [9 x i8] c"CALLBACK\00"
@.str.13 = [8 x i8] c"CONTIME\00"
@.str.14 = [10 x i8] c"COMPFRAME\00"
@.str.15 = [4 x i8] c"NDE\00"
@.str.16 = [5 x i8] c"MRRU\00"
@.str.17 = [9 x i8] c"SHORTSEQ\00"
@.str.18 = [8 x i8] c"ENDDISC\00"
@.str.19 = [11 x i8] c"PROPRIETRY\00"
@.str.20 = [6 x i8] c"DCEID\00"
@.str.21 = [8 x i8] c"MULTIPP\00"
@.str.22 = [7 x i8] c"LDBACP\00"
define i8* @protoname(i32 %0) {
%2 = add i32 %0, -25
%3 = icmp ult i32 %2, -24
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i8* @HexStr(i32 %0, i32* null, i32 0)
br label %10
6: ; preds = %1
%7 = zext i32 %0 to i64
%8 = getelementptr inbounds [24 x i8*], [24 x i8*]* @protoname.cftypes, i64 0, i64 %7
%9 = load i8*, i8** %8
br label %10
10: ; preds = %6, %4
%11 = phi i8* [ %5, %4 ], [ %9, %6 ]
ret i8* %11
}