#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 *);
unsigned char encodeReqmts(unsigned char info) {
  unsigned char x;
  if (((info >> 2) & 3) != 0 && (info >> 4) != 0 && (info >> 4) < 9) {
    printf("Requirements inspection passed\n");
    x = 1;
  } else {
    printf("\x1b[31m"
           "Malformed information byte (DROP)\n"
           "\x1b[0m");
    printByteDebug(info);
    x = 0;
  }
  printf("setting reqmts info\n");
  info = (info & 252) | (x & ~252);
  return info;
}


x86 assembly (clang, -O0):
<encodeReqmts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
sar    $0x2,%eax
and    $0x3,%eax
cmp    $0x0,%eax
je     1176 <encodeReqmts+0x56>
movzbl -0x1(%rbp),%eax
sar    $0x4,%eax
cmp    $0x0,%eax
je     1176 <encodeReqmts+0x56>
movzbl -0x1(%rbp),%eax
sar    $0x4,%eax
cmp    $0x9,%eax
jge    1176 <encodeReqmts+0x56>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
movb   $0x1,-0x2(%rbp)
jmp    118f <encodeReqmts+0x6f>
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
movzbl -0x1(%rbp),%edi
call   1040 <printByteDebug@plt>
movb   $0x0,-0x2(%rbp)
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
movzbl -0x1(%rbp),%eax
and    $0xfc,%eax
movzbl -0x2(%rbp),%ecx
and    $0xffffff03,%ecx
or     %ecx,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<encodeReqmts>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %ebx,%eax
add    $0xf0,%al
js     1152 <encodeReqmts+0x22>
mov    %ebx,%eax
and    $0xc,%al
je     1152 <encodeReqmts+0x22>
lea    0xef8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%bpl
jmp    1168 <encodeReqmts+0x38>
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
movzbl %bl,%edi
call   1050 <printByteDebug@plt>
xor    %ebp,%ebp
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
and    $0xfc,%bl
or     %bpl,%bl
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Requirements inspection passed\0A\00"
@.str.1 = [44 x i8] c"\1B[31mMalformed information byte (DROP)\0A\1B[0m\00"
@.str.2 = [21 x i8] c"setting reqmts info\0A\00"
define zeroext i8 @encodeReqmts(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
%6 = ashr i32 %5, 2
%7 = and i32 %6, 3
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %21
9: ; preds = %1
%10 = load i8, i8* %2
%11 = zext i8 %10 to i32
%12 = ashr i32 %11, 4
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %9
%15 = load i8, i8* %2
%16 = zext i8 %15 to i32
%17 = ashr i32 %16, 4
%18 = icmp slt i32 %17, 9
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
store i8 1, i8* %3
br label %25
21: ; preds = %14, %9, %1
%22 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%23 = load i8, i8* %2
%24 = call i32 @printByteDebug(i8 zeroext %23)
store i8 0, i8* %3
br label %25
25: ; preds = %21, %19
%26 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%27 = load i8, i8* %2
%28 = zext i8 %27 to i32
%29 = and i32 %28, 252
%30 = load i8, i8* %3
%31 = zext i8 %30 to i32
%32 = and i32 %31, -253
%33 = or i32 %29, %32
%34 = trunc i32 %33 to i8
store i8 %34, i8* %2
%35 = load i8, i8* %2
ret i8 %35
}

LLVM IR (-O2):
@.str.1 = [44 x i8] c"\1B[31mMalformed information byte (DROP)\0A\1B[0m\00"
@str = [20 x i8] c"setting reqmts info\00"
@str.3 = [31 x i8] c"Requirements inspection passed\00"
define zeroext i8 @encodeReqmts(i8 zeroext %0) {
%2 = and i8 %0, 12
%3 = icmp ne i8 %2, 0
%4 = add i8 %0, -16
%5 = icmp sgt i8 %4, -1
%6 = and i1 %5, %3
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.3, i64 0, i64 0))
br label %12
9: ; preds = %1
%10 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call i32 @printByteDebug(i8 zeroext %0)
br label %12
12: ; preds = %9, %7
%13 = phi i8 [ 1, %7 ], [ 0, %9 ]
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%15 = and i8 %0, -4
%16 = or i8 %13, %15
ret i8 %16
}