#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 */
scalar_t__ strcasestr(char *, char *);
int _libunaccept_strtopolicy(char *s) {
  int policy = 0;
  if (strcasestr(s, "verbose"))
    policy |= 0x80000000;
  if (strcasestr(s, "host"))
    policy |= 0x40000000;
  if (strcasestr(s, "allow")) {
    policy |= 0x00000001;
  } else if (strcasestr(s, "deny")) {
    policy |= 0x00000002;
  } else if (strcasestr(s, "tarpit")) {
    policy |= 0x00000004;
  }
  return policy;
}


x86 assembly (clang, -O0):
<_libunaccept_strtopolicy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed2(%rip),%rsi
call   1030 <strcasestr@plt>
cmp    $0x0,%rax
je     1148 <_libunaccept_strtopolicy+0x38>
mov    -0xc(%rbp),%eax
or     $0x80000000,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1030 <strcasestr@plt>
cmp    $0x0,%rax
je     116d <_libunaccept_strtopolicy+0x5d>
mov    -0xc(%rbp),%eax
or     $0x40000000,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1030 <strcasestr@plt>
cmp    $0x0,%rax
je     1195 <_libunaccept_strtopolicy+0x85>
mov    -0xc(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ea <_libunaccept_strtopolicy+0xda>
mov    -0x8(%rbp),%rdi
lea    0xe73(%rip),%rsi
call   1030 <strcasestr@plt>
cmp    $0x0,%rax
je     11bd <_libunaccept_strtopolicy+0xad>
mov    -0xc(%rbp),%eax
or     $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    11e5 <_libunaccept_strtopolicy+0xd5>
mov    -0x8(%rbp),%rdi
lea    0xe50(%rip),%rsi
call   1030 <strcasestr@plt>
cmp    $0x0,%rax
je     11e0 <_libunaccept_strtopolicy+0xd0>
mov    -0xc(%rbp),%eax
or     $0x4,%eax
mov    %eax,-0xc(%rbp)
jmp    11e5 <_libunaccept_strtopolicy+0xd5>
jmp    11ea <_libunaccept_strtopolicy+0xda>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_libunaccept_strtopolicy>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
lea    0xee2(%rip),%rsi
call   1030 <strcasestr@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
shl    $0x1f,%ebx
lea    0xed3(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcasestr@plt>
lea    0x40000000(%rbx),%ebp
test   %rax,%rax
cmove  %ebx,%ebp
lea    0xebd(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcasestr@plt>
test   %rax,%rax
je     1162 <_libunaccept_strtopolicy+0x52>
or     $0x1,%ebp
jmp    1195 <_libunaccept_strtopolicy+0x85>
lea    0xeaa(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcasestr@plt>
test   %rax,%rax
je     117b <_libunaccept_strtopolicy+0x6b>
or     $0x2,%ebp
jmp    1195 <_libunaccept_strtopolicy+0x85>
lea    0xe96(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcasestr@plt>
mov    %ebp,%ecx
or     $0x4,%ecx
test   %rax,%rax
cmovne %ecx,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"verbose\00"
@.str.1 = [5 x i8] c"host\00"
@.str.2 = [6 x i8] c"allow\00"
@.str.3 = [5 x i8] c"deny\00"
@.str.4 = [7 x i8] c"tarpit\00"
define i32 @_libunaccept_strtopolicy(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
%4 = load i8*, i8** %2
%5 = call i64 @strcasestr(i8* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* %3
%9 = or i32 %8, -2147483648
store i32 %9, i32* %3
br label %10
10: ; preds = %7, %1
%11 = load i8*, i8** %2
%12 = call i64 @strcasestr(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i32, i32* %3
%16 = or i32 %15, 1073741824
store i32 %16, i32* %3
br label %17
17: ; preds = %14, %10
%18 = load i8*, i8** %2
%19 = call i64 @strcasestr(i8* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i32, i32* %3
%23 = or i32 %22, 1
store i32 %23, i32* %3
br label %40
24: ; preds = %17
%25 = load i8*, i8** %2
%26 = call i64 @strcasestr(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = load i32, i32* %3
%30 = or i32 %29, 2
store i32 %30, i32* %3
br label %39
31: ; preds = %24
%32 = load i8*, i8** %2
%33 = call i64 @strcasestr(i8* %32, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %31
%36 = load i32, i32* %3
%37 = or i32 %36, 4
store i32 %37, i32* %3
br label %38
38: ; preds = %35, %31
br label %39
39: ; preds = %38, %28
br label %40
40: ; preds = %39, %21
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
@.str = [8 x i8] c"verbose\00"
@.str.1 = [5 x i8] c"host\00"
@.str.2 = [6 x i8] c"allow\00"
@.str.3 = [5 x i8] c"deny\00"
@.str.4 = [7 x i8] c"tarpit\00"
define i32 @_libunaccept_strtopolicy(i8* %0) {
%2 = tail call i64 @strcasestr(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 0, i32 -2147483648
%5 = tail call i64 @strcasestr(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
%7 = or i32 %4, 1073741824
%8 = select i1 %6, i32 %4, i32 %7
%9 = tail call i64 @strcasestr(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %1
%12 = or i32 %8, 1
br label %23
13: ; preds = %1
%14 = tail call i64 @strcasestr(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %13
%17 = or i32 %8, 2
br label %23
18: ; preds = %13
%19 = tail call i64 @strcasestr(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
%21 = or i32 %8, 4
%22 = select i1 %20, i32 %8, i32 %21
br label %23
23: ; preds = %18, %16, %11
%24 = phi i32 [ %12, %11 ], [ %17, %16 ], [ %22, %18 ]
ret i32 %24
}