#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*/ pcap_snprintf(char *, int, char *, int);
const char *pcap_statustostr(int errnum) {
  static char ebuf[15 + 10 + 1];
  switch (errnum) {
  case 1:
    return ("Generic warning");
  case 3:
    return ("That type of time stamp is not supported by that device");
  case 2:
    return ("That device doesn't support promiscuous mode");
  case -1:
    return ("Generic error");
  case -2:
    return ("Loop terminated by pcap_breakloop");
  case -3:
    return ("The pcap_t has not been activated");
  case -4:
    return ("The setting can't be changed after the pcap_t is activated");
  case -5:
    return ("No such device exists");
  case -6:
    return ("That device doesn't support monitor mode");
  case -7:
    return ("That operation is supported only in monitor mode");
  case -8:
    return ("You don't have permission to capture on that device");
  case -9:
    return ("That device is not up");
  case -10:
    return ("That device doesn't support setting the time stamp type");
  case -11:
    return ("You don't have permission to capture in promiscuous mode on that "
            "device");
  case -12:
    return ("That device doesn't support that time stamp precision");
  }
  (void)pcap_snprintf(ebuf, sizeof ebuf, "Unknown error: %d", errnum);
  return (ebuf);
}


x86 assembly (clang, -O0):
<pcap_statustostr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xc,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0xf,%eax
ja     1234 <pcap_statustostr+0x124>
mov    -0x18(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xef5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    125a <pcap_statustostr+0x14a>
lea    0xef5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    125a <pcap_statustostr+0x14a>
lea    0xf1d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    125a <pcap_statustostr+0x14a>
lea    0xf3a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    125a <pcap_statustostr+0x14a>
lea    0xf38(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    125a <pcap_statustostr+0x14a>
lea    0xf4a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    125a <pcap_statustostr+0x14a>
lea    0xf5c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    125a <pcap_statustostr+0x14a>
lea    0xf87(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    125a <pcap_statustostr+0x14a>
lea    0xf8d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    125a <pcap_statustostr+0x14a>
lea    0xfa6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    125a <pcap_statustostr+0x14a>
lea    0xfc7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    125a <pcap_statustostr+0x14a>
lea    0xfeb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    125a <pcap_statustostr+0x14a>
lea    0xff1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    125a <pcap_statustostr+0x14a>
lea    0x1019(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    125a <pcap_statustostr+0x14a>
lea    0x1051(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    125a <pcap_statustostr+0x14a>
mov    -0xc(%rbp),%ecx
lea    0x2e02(%rip),%rdi
mov    $0x1a,%esi
lea    0x1068(%rip),%rdx
call   1030 <pcap_snprintf@plt>
lea    0x2dea(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pcap_statustostr>:
push   %rbx
mov    %edi,%ecx
lea    0xc(%rcx),%eax
cmp    $0x10,%eax
jae    1125 <pcap_statustostr+0x15>
mov    $0xefff,%edx
bt     %eax,%edx
jb     1142 <pcap_statustostr+0x32>
lea    0x2f14(%rip),%rbx
lea    0x113f(%rip),%rdx
mov    %rbx,%rdi
mov    $0x1a,%esi
call   1030 <pcap_snprintf@plt>
jmp    1152 <pcap_statustostr+0x42>
cltq
lea    0x1139(%rip),%rcx
movslq (%rcx,%rax,4),%rbx
add    %rcx,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@pcap_statustostr.ebuf = internal global [26 x i8] zeroinitializer
@.str = [16 x i8] c"Generic warning\00"
@.str.1 = [56 x i8] c"That type of time stamp is not supported by that device\00"
@.str.2 = [45 x i8] c"That device doesn't support promiscuous mode\00"
@.str.3 = [14 x i8] c"Generic error\00"
@.str.4 = [34 x i8] c"Loop terminated by pcap_breakloop\00"
@.str.5 = [34 x i8] c"The pcap_t has not been activated\00"
@.str.6 = [59 x i8] c"The setting can't be changed after the pcap_t is activated\00"
@.str.7 = [22 x i8] c"No such device exists\00"
@.str.8 = [41 x i8] c"That device doesn't support monitor mode\00"
@.str.9 = [49 x i8] c"That operation is supported only in monitor mode\00"
@.str.10 = [52 x i8] c"You don't have permission to capture on that device\00"
@.str.11 = [22 x i8] c"That device is not up\00"
@.str.12 = [56 x i8] c"That device doesn't support setting the time stamp type\00"
@.str.13 = [72 x i8] c"You don't have permission to capture in promiscuous mode on that device\00"
@.str.14 = [54 x i8] c"That device doesn't support that time stamp precision\00"
@.str.15 = [18 x i8] c"Unknown error: %d\00"
define i8* @pcap_statustostr(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %20 [
i32 1, label %5
i32 3, label %6
i32 2, label %7
i32 -1, label %8
i32 -2, label %9
i32 -3, label %10
i32 -4, label %11
i32 -5, label %12
i32 -6, label %13
i32 -7, label %14
i32 -8, label %15
i32 -9, label %16
i32 -10, label %17
i32 -11, label %18
i32 -12, label %19
]
5: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8** %2
br label %23
6: ; preds = %1
store i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %23
7: ; preds = %1
store i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %23
8: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %23
9: ; preds = %1
store i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %23
10: ; preds = %1
store i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %23
11: ; preds = %1
store i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %23
12: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %23
13: ; preds = %1
store i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %23
14: ; preds = %1
store i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.9, i64 0, i64 0), i8** %2
br label %23
15: ; preds = %1
store i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.10, i64 0, i64 0), i8** %2
br label %23
16: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0), i8** %2
br label %23
17: ; preds = %1
store i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %23
18: ; preds = %1
store i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.13, i64 0, i64 0), i8** %2
br label %23
19: ; preds = %1
store i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.14, i64 0, i64 0), i8** %2
br label %23
20: ; preds = %1
%21 = load i32, i32* %3
%22 = call i32 @pcap_snprintf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @pcap_statustostr.ebuf, i64 0, i64 0), i32 26, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.15, i64 0, i64 0), i32 %21)
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @pcap_statustostr.ebuf, i64 0, i64 0), i8** %2
br label %23
23: ; preds = %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%24 = load i8*, i8** %2
ret i8* %24
}

LLVM IR (-O2):
@pcap_statustostr.ebuf = internal global [26 x i8] zeroinitializer
@.str = [16 x i8] c"Generic warning\00"
@.str.1 = [56 x i8] c"That type of time stamp is not supported by that device\00"
@.str.2 = [45 x i8] c"That device doesn't support promiscuous mode\00"
@.str.3 = [14 x i8] c"Generic error\00"
@.str.4 = [34 x i8] c"Loop terminated by pcap_breakloop\00"
@.str.5 = [34 x i8] c"The pcap_t has not been activated\00"
@.str.6 = [59 x i8] c"The setting can't be changed after the pcap_t is activated\00"
@.str.7 = [22 x i8] c"No such device exists\00"
@.str.8 = [41 x i8] c"That device doesn't support monitor mode\00"
@.str.9 = [49 x i8] c"That operation is supported only in monitor mode\00"
@.str.10 = [52 x i8] c"You don't have permission to capture on that device\00"
@.str.11 = [22 x i8] c"That device is not up\00"
@.str.12 = [56 x i8] c"That device doesn't support setting the time stamp type\00"
@.str.13 = [72 x i8] c"You don't have permission to capture in promiscuous mode on that device\00"
@.str.14 = [54 x i8] c"That device doesn't support that time stamp precision\00"
@.str.15 = [18 x i8] c"Unknown error: %d\00"
@reltable.pcap_statustostr = [16 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([54 x i8]* @.str.14 to i64), i64 ptrtoint ([16 x i32]* @reltable.pcap_statustostr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([72 x i8]* @.str.13 to i64), i64 ptrtoint ([16 x i32]* @reltable.pcap_statustostr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([56 x i8]* @.str.12 to i64), i64 ptrtoint ([16 x i32]* @reltable.pcap_statustostr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str.11 to i64), i64 ptrtoint ([16 x i32]* @reltable.pcap_statustostr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([52 x i8]* @.str.10 to i64), i64 ptrtoint ([16 x i32]* @reltable.pcap_statustostr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([49 x i8]* @.str.9 to i64), i64 ptrtoint ([16 x i32]* @reltable.pcap_statustostr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([41 x i8]* @.str.8 to i64), i64 ptrtoint ([16 x i32]* @reltable.pcap_statustostr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str.7 to i64), i64 ptrtoint ([16 x i32]* @reltable.pcap_statustostr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([59 x i8]* @.str.6 to i64), i64 ptrtoint ([16 x i32]* @reltable.pcap_statustostr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([34 x i8]* @.str.5 to i64), i64 ptrtoint ([16 x i32]* @reltable.pcap_statustostr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([34 x i8]* @.str.4 to i64), i64 ptrtoint ([16 x i32]* @reltable.pcap_statustostr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.3 to i64), i64 ptrtoint ([16 x i32]* @reltable.pcap_statustostr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str to i64), i64 ptrtoint ([16 x i32]* @reltable.pcap_statustostr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str to i64), i64 ptrtoint ([16 x i32]* @reltable.pcap_statustostr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([45 x i8]* @.str.2 to i64), i64 ptrtoint ([16 x i32]* @reltable.pcap_statustostr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([56 x i8]* @.str.1 to i64), i64 ptrtoint ([16 x i32]* @reltable.pcap_statustostr to i64)) to i32)]
define i8* @pcap_statustostr(i32 %0) {
%2 = add i32 %0, 12
%3 = icmp ult i32 %2, 16
br i1 %3, label %6, label %4
4: ; preds = %6, %1
%5 = tail call i32 @pcap_snprintf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @pcap_statustostr.ebuf, i64 0, i64 0), i32 26, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.15, i64 0, i64 0), i32 %0)
br label %15
6: ; preds = %1
%7 = trunc i32 %2 to i16
%8 = lshr i16 -4097, %7
%9 = and i16 %8, 1
%10 = icmp eq i16 %9, 0
br i1 %10, label %4, label %11
11: ; preds = %6
%12 = sext i32 %2 to i64
%13 = shl i64 %12, 2
%14 = call i8* @llvm.load.relative.i64(i8* bitcast ([16 x i32]* @reltable.pcap_statustostr to i8*), i64 %13)
br label %15
15: ; preds = %11, %4
%16 = phi i8* [ getelementptr inbounds ([26 x i8], [26 x i8]* @pcap_statustostr.ebuf, i64 0, i64 0), %4 ], [ %14, %11 ]
ret i8* %16
}