#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*/ WOLFSSL_MSG(char *);
int caamParseCCBError(unsigned int error) {
  int ret = 0;
  switch ((error >> 4) & 0xF) {
  case 0:
    WOLFSSL_MSG("\tCHAID: CCB");
    break;
  case 1:
    WOLFSSL_MSG("\tCHAID: AESA");
    break;
  case 2:
    WOLFSSL_MSG("\tCHAID: DESA");
    break;
  case 3:
    WOLFSSL_MSG("\tCHAID: AFHA (ARC4)");
    break;
  case 4:
    WOLFSSL_MSG("\tCHAID: MDHA hash");
    break;
  case 5:
    WOLFSSL_MSG("\tCHAID: RNG - ERRID:");
    ret = -1;
    switch (error & 0xF) {
    case 3:
      WOLFSSL_MSG(" RNG instantiate error");
      break;
    case 4:
      WOLFSSL_MSG(" RNG not instantiated error");
      break;
    case 5:
      WOLFSSL_MSG(" RNG test instantiate error");
      break;
    case 6:
      WOLFSSL_MSG(" RNG prediction resistance error");
      break;
    default:
      WOLFSSL_MSG(" Unknown");
    }
    break;
  case 8:
    WOLFSSL_MSG("\tCHAID: PKHA");
    break;
  default:
    WOLFSSL_MSG("\tCHAID: Unknown CCB error");
  }
  return ret;
}


x86 assembly (clang, -O0):
<caamParseCCBError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x4,%eax
and    $0xf,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x8,%eax
ja     1248 <caamParseCCBError+0x138>
mov    -0x10(%rbp),%rax
lea    0xebb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xedf(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
jmp    1254 <caamParseCCBError+0x144>
lea    0xeda(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
jmp    1254 <caamParseCCBError+0x144>
lea    0xed6(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
jmp    1254 <caamParseCCBError+0x144>
lea    0xed2(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
jmp    1254 <caamParseCCBError+0x144>
lea    0xed5(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
jmp    1254 <caamParseCCBError+0x144>
lea    0xed6(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
movl   $0xffffffff,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
add    $0xfffffffd,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x3,%eax
ja     1226 <caamParseCCBError+0x116>
mov    -0x18(%rbp),%rax
lea    0xe4b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeac(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
jmp    1232 <caamParseCCBError+0x122>
lea    0xeb2(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
jmp    1232 <caamParseCCBError+0x122>
lea    0xebd(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
jmp    1232 <caamParseCCBError+0x122>
lea    0xec8(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
jmp    1232 <caamParseCCBError+0x122>
lea    0xed8(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
jmp    1254 <caamParseCCBError+0x144>
lea    0xed0(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
jmp    1254 <caamParseCCBError+0x144>
lea    0xecc(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<caamParseCCBError>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
shr    $0x4,%ebx
and    $0xf,%ebx
cmp    $0x8,%ebx
ja     1173 <caamParseCCBError+0x63>
mov    %edi,%ebp
lea    0xf0b(%rip),%rdi
lea    0xed0(%rip),%rax
movslq (%rax,%rbx,4),%rcx
add    %rax,%rcx
jmp    *%rcx
xor    %ebx,%ebx
lea    0xefe(%rip),%rdi
jmp    11b1 <caamParseCCBError+0xa1>
lea    0xf35(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
and    $0xf,%ebp
add    $0xfffffffd,%ebp
mov    $0xffffffff,%ebx
cmp    $0x4,%ebp
jae    11aa <caamParseCCBError+0x9a>
movslq %ebp,%rax
lea    0xeba(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    11b1 <caamParseCCBError+0xa1>
xor    %ebx,%ebx
lea    0xf9f(%rip),%rdi
jmp    11b1 <caamParseCCBError+0xa1>
xor    %ebx,%ebx
lea    0xec6(%rip),%rdi
jmp    11b1 <caamParseCCBError+0xa1>
xor    %ebx,%ebx
lea    0xec8(%rip),%rdi
jmp    11b1 <caamParseCCBError+0xa1>
xor    %ebx,%ebx
lea    0xed1(%rip),%rdi
jmp    11b1 <caamParseCCBError+0xa1>
xor    %ebx,%ebx
lea    0xf66(%rip),%rdi
jmp    11b1 <caamParseCCBError+0xa1>
lea    0xf54(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"\09CHAID: CCB\00"
@.str.1 = [13 x i8] c"\09CHAID: AESA\00"
@.str.2 = [13 x i8] c"\09CHAID: DESA\00"
@.str.3 = [20 x i8] c"\09CHAID: AFHA (ARC4)\00"
@.str.4 = [18 x i8] c"\09CHAID: MDHA hash\00"
@.str.5 = [21 x i8] c"\09CHAID: RNG - ERRID:\00"
@.str.6 = [23 x i8] c" RNG instantiate error\00"
@.str.7 = [28 x i8] c" RNG not instantiated error\00"
@.str.8 = [28 x i8] c" RNG test instantiate error\00"
@.str.9 = [33 x i8] c" RNG prediction resistance error\00"
@.str.10 = [9 x i8] c" Unknown\00"
@.str.11 = [13 x i8] c"\09CHAID: PKHA\00"
@.str.12 = [26 x i8] c"\09CHAID: Unknown CCB error\00"
define i32 @caamParseCCBError(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = lshr i32 %4, 4
%6 = and i32 %5, 15
switch i32 %6, label %34 [
i32 0, label %7
i32 1, label %9
i32 2, label %11
i32 3, label %13
i32 4, label %15
i32 5, label %17
i32 8, label %32
]
7: ; preds = %1
%8 = call i32 @WOLFSSL_MSG(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %36
9: ; preds = %1
%10 = call i32 @WOLFSSL_MSG(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %36
11: ; preds = %1
%12 = call i32 @WOLFSSL_MSG(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %36
13: ; preds = %1
%14 = call i32 @WOLFSSL_MSG(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %36
15: ; preds = %1
%16 = call i32 @WOLFSSL_MSG(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %36
17: ; preds = %1
%18 = call i32 @WOLFSSL_MSG(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %3
%19 = load i32, i32* %2
%20 = and i32 %19, 15
switch i32 %20, label %29 [
i32 3, label %21
i32 4, label %23
i32 5, label %25
i32 6, label %27
]
21: ; preds = %17
%22 = call i32 @WOLFSSL_MSG(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
br label %31
23: ; preds = %17
%24 = call i32 @WOLFSSL_MSG(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
br label %31
25: ; preds = %17
%26 = call i32 @WOLFSSL_MSG(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
br label %31
27: ; preds = %17
%28 = call i32 @WOLFSSL_MSG(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0))
br label %31
29: ; preds = %17
%30 = call i32 @WOLFSSL_MSG(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0))
br label %31
31: ; preds = %29, %27, %25, %23, %21
br label %36
32: ; preds = %1
%33 = call i32 @WOLFSSL_MSG(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0))
br label %36
34: ; preds = %1
%35 = call i32 @WOLFSSL_MSG(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0))
br label %36
36: ; preds = %34, %32, %31, %15, %13, %11, %9, %7
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
@.str = [12 x i8] c"\09CHAID: CCB\00"
@.str.1 = [13 x i8] c"\09CHAID: AESA\00"
@.str.2 = [13 x i8] c"\09CHAID: DESA\00"
@.str.3 = [20 x i8] c"\09CHAID: AFHA (ARC4)\00"
@.str.4 = [18 x i8] c"\09CHAID: MDHA hash\00"
@.str.5 = [21 x i8] c"\09CHAID: RNG - ERRID:\00"
@.str.6 = [23 x i8] c" RNG instantiate error\00"
@.str.7 = [28 x i8] c" RNG not instantiated error\00"
@.str.8 = [28 x i8] c" RNG test instantiate error\00"
@.str.9 = [33 x i8] c" RNG prediction resistance error\00"
@.str.10 = [9 x i8] c" Unknown\00"
@.str.11 = [13 x i8] c"\09CHAID: PKHA\00"
@.str.12 = [26 x i8] c"\09CHAID: Unknown CCB error\00"
@reltable.caamParseCCBError = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([23 x i8]* @.str.6 to i64), i64 ptrtoint ([4 x i32]* @reltable.caamParseCCBError to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([28 x i8]* @.str.7 to i64), i64 ptrtoint ([4 x i32]* @reltable.caamParseCCBError to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([28 x i8]* @.str.8 to i64), i64 ptrtoint ([4 x i32]* @reltable.caamParseCCBError to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([33 x i8]* @.str.9 to i64), i64 ptrtoint ([4 x i32]* @reltable.caamParseCCBError to i64)) to i32)]
define i32 @caamParseCCBError(i32 %0) {
%2 = lshr i32 %0, 4
%3 = and i32 %2, 15
switch i32 %3, label %14 [
i32 0, label %19
i32 1, label %4
i32 2, label %5
i32 3, label %6
i32 4, label %7
i32 5, label %8
i32 8, label %13
]
4: ; preds = %1
br label %19
5: ; preds = %1
br label %19
6: ; preds = %1
br label %19
7: ; preds = %1
br label %19
8: ; preds = %1
%9 = tail call i32 @WOLFSSL_MSG(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%10 = and i32 %0, 15
%11 = add nsw i32 %10, -3
%12 = icmp ult i32 %11, 4
br i1 %12, label %15, label %19
13: ; preds = %1
br label %19
14: ; preds = %1
br label %19
15: ; preds = %8
%16 = sext i32 %11 to i64
%17 = shl i64 %16, 2
%18 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.caamParseCCBError to i8*), i64 %17)
br label %19
19: ; preds = %8, %15, %1, %14, %13, %7, %6, %5, %4
%20 = phi i8* [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), %14 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), %13 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), %7 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), %6 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), %5 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), %1 ], [ %18, %15 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), %8 ]
%21 = phi i32 [ 0, %14 ], [ 0, %13 ], [ 0, %7 ], [ 0, %6 ], [ 0, %5 ], [ 0, %4 ], [ %3, %1 ], [ -1, %15 ], [ -1, %8 ]
%22 = tail call i32 @WOLFSSL_MSG(i8* %20)
ret i32 %21
}