#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 */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ MD5(char const *, int *);
unsigned short Get_Door_States(const char *inputPath) {
  uint8_t hash[16];
  unsigned short state = 0x0;
  MD5(inputPath, hash);
  if ((hash[0] >> 4) >= 0xb)
    state |= (1 << 0);
  if ((hash[0] & 0x0f) >= 0xb)
    state |= (1 << 1);
  if ((hash[1] >> 4) >= 0xb)
    state |= (1 << 2);
  if ((hash[1] & 0x0f) >= 0xb)
    state |= (1 << 3);
  return state;
}


x86 assembly (clang, -O0):
<Get_Door_States>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
movw   $0x0,-0x52(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1030 <MD5@plt>
mov    -0x50(%rbp),%eax
sar    $0x4,%eax
cmp    $0xb,%eax
jl     1149 <Get_Door_States+0x39>
movzwl -0x52(%rbp),%eax
or     $0x1,%eax
mov    %ax,-0x52(%rbp)
mov    -0x50(%rbp),%eax
and    $0xf,%eax
cmp    $0xb,%eax
jl     1163 <Get_Door_States+0x53>
movzwl -0x52(%rbp),%eax
or     $0x2,%eax
mov    %ax,-0x52(%rbp)
mov    -0x4c(%rbp),%eax
sar    $0x4,%eax
cmp    $0xb,%eax
jl     117d <Get_Door_States+0x6d>
movzwl -0x52(%rbp),%eax
or     $0x4,%eax
mov    %ax,-0x52(%rbp)
mov    -0x4c(%rbp),%eax
and    $0xf,%eax
cmp    $0xb,%eax
jl     1197 <Get_Door_States+0x87>
movzwl -0x52(%rbp),%eax
or     $0x8,%eax
mov    %ax,-0x52(%rbp)
movzwl -0x52(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Get_Door_States>:
sub    $0x48,%rsp
mov    %rsp,%rsi
call   1030 <MD5@plt>
mov    (%rsp),%eax
mov    0x4(%rsp),%ecx
xor    %edx,%edx
cmp    $0xb0,%eax
setge  %dl
and    $0xf,%eax
lea    0x2(%rdx),%esi
cmp    $0xb,%eax
cmovb  %edx,%esi
lea    0x4(%rsi),%edx
cmp    $0xb0,%ecx
cmovl  %esi,%edx
and    $0xf,%ecx
lea    0x8(%rdx),%eax
cmp    $0xb,%ecx
cmovb  %edx,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
define zeroext i16 @Get_Door_States(i8* %0) {
%2 = alloca i8*
%3 = alloca [16 x i32]
%4 = alloca i16
store i8* %0, i8** %2
store i16 0, i16* %4
%5 = load i8*, i8** %2
%6 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 0
%7 = call i32 @MD5(i8* %5, i32* %6)
%8 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 0
%9 = load i32, i32* %8
%10 = ashr i32 %9, 4
%11 = icmp sge i32 %10, 11
br i1 %11, label %12, label %17
12: ; preds = %1
%13 = load i16, i16* %4
%14 = zext i16 %13 to i32
%15 = or i32 %14, 1
%16 = trunc i32 %15 to i16
store i16 %16, i16* %4
br label %17
17: ; preds = %12, %1
%18 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 0
%19 = load i32, i32* %18
%20 = and i32 %19, 15
%21 = icmp sge i32 %20, 11
br i1 %21, label %22, label %27
22: ; preds = %17
%23 = load i16, i16* %4
%24 = zext i16 %23 to i32
%25 = or i32 %24, 2
%26 = trunc i32 %25 to i16
store i16 %26, i16* %4
br label %27
27: ; preds = %22, %17
%28 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 1
%29 = load i32, i32* %28
%30 = ashr i32 %29, 4
%31 = icmp sge i32 %30, 11
br i1 %31, label %32, label %37
32: ; preds = %27
%33 = load i16, i16* %4
%34 = zext i16 %33 to i32
%35 = or i32 %34, 4
%36 = trunc i32 %35 to i16
store i16 %36, i16* %4
br label %37
37: ; preds = %32, %27
%38 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 1
%39 = load i32, i32* %38
%40 = and i32 %39, 15
%41 = icmp sge i32 %40, 11
br i1 %41, label %42, label %47
42: ; preds = %37
%43 = load i16, i16* %4
%44 = zext i16 %43 to i32
%45 = or i32 %44, 8
%46 = trunc i32 %45 to i16
store i16 %46, i16* %4
br label %47
47: ; preds = %42, %37
%48 = load i16, i16* %4
ret i16 %48
}

LLVM IR (-O2):
define zeroext i16 @Get_Door_States(i8* %0) {
%2 = alloca [16 x i32]
%3 = bitcast [16 x i32]* %2 to i8*
%4 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
%5 = call i32 @MD5(i8* %0, i32* %4)
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 175
%8 = zext i1 %7 to i16
%9 = and i32 %6, 15
%10 = icmp ugt i32 %9, 10
%11 = or i16 %8, 2
%12 = select i1 %10, i16 %11, i16 %8
%13 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 1
%14 = load i32, i32* %13
%15 = icmp sgt i32 %14, 175
%16 = or i16 %12, 4
%17 = select i1 %15, i16 %16, i16 %12
%18 = and i32 %14, 15
%19 = icmp ugt i32 %18, 10
%20 = or i16 %17, 8
%21 = select i1 %19, i16 %20, i16 %17
ret i16 %21
}