#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*/ printByteDebug(unsigned char);
int /*<<< orphan*/ printf(char *);
short decodeReqmts(unsigned char info) {
  unsigned char x;
  if ((info & 3) == 1) {
    printf("Requirements inspection passed\n");
    return 1;
  } else if ((info & 3) == 2) {
    printf("\x1b[31m"
           "Malformed request\n"
           "\x1b[0m");
    printByteDebug(info);
    return -1;
  } else if ((info & 3) == 3) {
    printf("Requirements not met\n");
    printByteDebug(info);
    return -1;
  } else {
    printf("Malformed information byte ($DROP)\n");
    printByteDebug(info);
    return -1;
  }
}


x86 assembly (clang, -O0):
<decodeReqmts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
and    $0x3,%eax
cmp    $0x1,%eax
jne    1155 <decodeReqmts+0x35>
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
movw   $0x1,-0x2(%rbp)
jmp    11d0 <decodeReqmts+0xb0>
movzbl -0x3(%rbp),%eax
and    $0x3,%eax
cmp    $0x2,%eax
jne    1185 <decodeReqmts+0x65>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
movzbl -0x3(%rbp),%edi
call   1040 <printByteDebug@plt>
movw   $0xffff,-0x2(%rbp)
jmp    11d0 <decodeReqmts+0xb0>
movzbl -0x3(%rbp),%eax
and    $0x3,%eax
cmp    $0x3,%eax
jne    11b5 <decodeReqmts+0x95>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
movzbl -0x3(%rbp),%edi
call   1040 <printByteDebug@plt>
movw   $0xffff,-0x2(%rbp)
jmp    11d0 <decodeReqmts+0xb0>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
movzbl -0x3(%rbp),%edi
call   1040 <printByteDebug@plt>
movw   $0xffff,-0x2(%rbp)
movswl -0x2(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decodeReqmts>:
push   %rbx
mov    %edi,%ebx
mov    %ebx,%eax
and    $0x3,%al
cmp    $0x3,%al
je     1155 <decodeReqmts+0x25>
cmp    $0x2,%al
je     115e <decodeReqmts+0x2e>
cmp    $0x1,%al
jne    116c <decodeReqmts+0x3c>
lea    0xf0a(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ax
pop    %rbx
ret
lea    0xee3(%rip),%rdi
jmp    1173 <decodeReqmts+0x43>
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
jmp    1178 <decodeReqmts+0x48>
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
movzbl %bl,%edi
call   1050 <printByteDebug@plt>
mov    $0xffff,%ax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Requirements inspection passed\0A\00"
@.str.1 = [28 x i8] c"\1B[31mMalformed request\0A\1B[0m\00"
@.str.2 = [22 x i8] c"Requirements not met\0A\00"
@.str.3 = [36 x i8] c"Malformed information byte ($DROP)\0A\00"
define signext i16 @decodeReqmts(i8 zeroext %0) {
%2 = alloca i16
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = and i32 %6, 3
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
store i16 1, i16* %2
br label %33
11: ; preds = %1
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = and i32 %13, 3
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %20
16: ; preds = %11
%17 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%18 = load i8, i8* %3
%19 = call i32 @printByteDebug(i8 zeroext %18)
store i16 -1, i16* %2
br label %33
20: ; preds = %11
%21 = load i8, i8* %3
%22 = zext i8 %21 to i32
%23 = and i32 %22, 3
%24 = icmp eq i32 %23, 3
br i1 %24, label %25, label %29
25: ; preds = %20
%26 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%27 = load i8, i8* %3
%28 = call i32 @printByteDebug(i8 zeroext %27)
store i16 -1, i16* %2
br label %33
29: ; preds = %20
%30 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
%31 = load i8, i8* %3
%32 = call i32 @printByteDebug(i8 zeroext %31)
store i16 -1, i16* %2
br label %33
33: ; preds = %29, %25, %16, %9
%34 = load i16, i16* %2
ret i16 %34
}

LLVM IR (-O2):
@.str.1 = [28 x i8] c"\1B[31mMalformed request\0A\1B[0m\00"
@str = [35 x i8] c"Malformed information byte ($DROP)\00"
@str.4 = [21 x i8] c"Requirements not met\00"
@str.5 = [31 x i8] c"Requirements inspection passed\00"
define signext i16 @decodeReqmts(i8 zeroext %0) {
%2 = and i8 %0, 3
switch i8 %2, label %11 [
i8 1, label %3
i8 2, label %5
i8 3, label %8
]
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.5, i64 0, i64 0))
br label %14
5: ; preds = %1
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @printByteDebug(i8 zeroext %0)
br label %14
8: ; preds = %1
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.4, i64 0, i64 0))
%10 = tail call i32 @printByteDebug(i8 zeroext %0)
br label %14
11: ; preds = %1
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%13 = tail call i32 @printByteDebug(i8 zeroext %0)
br label %14
14: ; preds = %11, %8, %5, %3
%15 = phi i16 [ 1, %3 ], [ -1, %5 ], [ -1, %8 ], [ -1, %11 ]
ret i16 %15
}