#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 caamParseDECOError(unsigned int error) {
  int ret = 0;
  switch (error & 0xFF) {
  case 0x04:
    WOLFSSL_MSG("\tInvalid Descriptor Command");
    break;
  case 0x06:
    WOLFSSL_MSG("\tInvalid KEY Command");
    break;
  case 0x07:
    WOLFSSL_MSG("\tInvalid Load Command");
    break;
  case 0x08:
    WOLFSSL_MSG("\tInvalid Store Command");
    break;
  case 0x09:
    WOLFSSL_MSG("\tInvalid Operation Command");
    break;
  case 0x82:
    WOLFSSL_MSG("\tInvalid PRB setting");
    break;
  case 0x86:
    WOLFSSL_MSG("\tVerify ECC/RSA signature fail");
    break;
  default:
    WOLFSSL_MSG("\tUnknown error");
  }
  return ret;
}


x86 assembly (clang, -O0):
<caamParseDECOError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movzbl -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x4,%eax
je     11a1 <caamParseDECOError+0x91>
jmp    1137 <caamParseDECOError+0x27>
mov    -0xc(%rbp),%eax
sub    $0x6,%eax
je     11b2 <caamParseDECOError+0xa2>
jmp    1148 <caamParseDECOError+0x38>
mov    -0xc(%rbp),%eax
sub    $0x7,%eax
je     11c3 <caamParseDECOError+0xb3>
jmp    1159 <caamParseDECOError+0x49>
mov    -0xc(%rbp),%eax
sub    $0x8,%eax
je     11d4 <caamParseDECOError+0xc4>
jmp    116a <caamParseDECOError+0x5a>
mov    -0xc(%rbp),%eax
sub    $0x9,%eax
je     11e5 <caamParseDECOError+0xd5>
jmp    117b <caamParseDECOError+0x6b>
mov    -0xc(%rbp),%eax
sub    $0x82,%eax
je     11f6 <caamParseDECOError+0xe6>
jmp    118e <caamParseDECOError+0x7e>
mov    -0xc(%rbp),%eax
sub    $0x86,%eax
je     1207 <caamParseDECOError+0xf7>
jmp    1218 <caamParseDECOError+0x108>
lea    0xe58(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
jmp    1224 <caamParseDECOError+0x114>
lea    0xe63(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
jmp    1224 <caamParseDECOError+0x114>
lea    0xe67(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
jmp    1224 <caamParseDECOError+0x114>
lea    0xe6c(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
jmp    1224 <caamParseDECOError+0x114>
lea    0xe72(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
jmp    1224 <caamParseDECOError+0x114>
lea    0xe7c(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
jmp    1224 <caamParseDECOError+0x114>
lea    0xe80(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
jmp    1224 <caamParseDECOError+0x114>
lea    0xe8e(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<caamParseDECOError>:
push   %rax
lea    -0x4(%rdi),%eax
cmp    $0x5,%al
ja     113b <caamParseDECOError+0x2b>
lea    0xef9(%rip),%rdi
movzbl %al,%eax
lea    0xed7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xefb(%rip),%rdi
jmp    117b <caamParseDECOError+0x6b>
cmp    $0x82,%dil
je     1174 <caamParseDECOError+0x64>
cmp    $0x86,%dil
jne    1150 <caamParseDECOError+0x40>
lea    0xf58(%rip),%rdi
jmp    117b <caamParseDECOError+0x6b>
lea    0xf6e(%rip),%rdi
jmp    117b <caamParseDECOError+0x6b>
lea    0xee9(%rip),%rdi
jmp    117b <caamParseDECOError+0x6b>
lea    0xef6(%rip),%rdi
jmp    117b <caamParseDECOError+0x6b>
lea    0xf04(%rip),%rdi
jmp    117b <caamParseDECOError+0x6b>
lea    0xf16(%rip),%rdi
call   1030 <WOLFSSL_MSG@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"\09Invalid Descriptor Command\00"
@.str.1 = [21 x i8] c"\09Invalid KEY Command\00"
@.str.2 = [22 x i8] c"\09Invalid Load Command\00"
@.str.3 = [23 x i8] c"\09Invalid Store Command\00"
@.str.4 = [27 x i8] c"\09Invalid Operation Command\00"
@.str.5 = [21 x i8] c"\09Invalid PRB setting\00"
@.str.6 = [31 x i8] c"\09Verify ECC/RSA signature fail\00"
@.str.7 = [15 x i8] c"\09Unknown error\00"
define i32 @caamParseDECOError(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = and i32 %4, 255
switch i32 %5, label %20 [
i32 4, label %6
i32 6, label %8
i32 7, label %10
i32 8, label %12
i32 9, label %14
i32 130, label %16
i32 134, label %18
]
6: ; preds = %1
%7 = call i32 @WOLFSSL_MSG(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %22
8: ; preds = %1
%9 = call i32 @WOLFSSL_MSG(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %22
10: ; preds = %1
%11 = call i32 @WOLFSSL_MSG(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %22
12: ; preds = %1
%13 = call i32 @WOLFSSL_MSG(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %22
14: ; preds = %1
%15 = call i32 @WOLFSSL_MSG(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %22
16: ; preds = %1
%17 = call i32 @WOLFSSL_MSG(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
br label %22
18: ; preds = %1
%19 = call i32 @WOLFSSL_MSG(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
br label %22
20: ; preds = %1
%21 = call i32 @WOLFSSL_MSG(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
br label %22
22: ; preds = %20, %18, %16, %14, %12, %10, %8, %6
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@.str = [28 x i8] c"\09Invalid Descriptor Command\00"
@.str.1 = [21 x i8] c"\09Invalid KEY Command\00"
@.str.2 = [22 x i8] c"\09Invalid Load Command\00"
@.str.3 = [23 x i8] c"\09Invalid Store Command\00"
@.str.4 = [27 x i8] c"\09Invalid Operation Command\00"
@.str.5 = [21 x i8] c"\09Invalid PRB setting\00"
@.str.6 = [31 x i8] c"\09Verify ECC/RSA signature fail\00"
@.str.7 = [15 x i8] c"\09Unknown error\00"
define i32 @caamParseDECOError(i32 %0) {
%2 = trunc i32 %0 to i8
switch i8 %2, label %9 [
i8 4, label %10
i8 6, label %3
i8 7, label %4
i8 8, label %5
i8 9, label %6
i8 -126, label %7
i8 -122, label %8
]
3: ; preds = %1
br label %10
4: ; preds = %1
br label %10
5: ; preds = %1
br label %10
6: ; preds = %1
br label %10
7: ; preds = %1
br label %10
8: ; preds = %1
br label %10
9: ; preds = %1
br label %10
10: ; preds = %1, %9, %8, %7, %6, %5, %4, %3
%11 = phi i8* [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), %9 ], [ getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), %8 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), %7 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), %6 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), %1 ]
%12 = tail call i32 @WOLFSSL_MSG(i8* %11)
ret i32 0
}