#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*/ strcasecmp(char *, char *);
int strlen(char *);
short int is_bool(char *str) {
  char *ch;
  if (!strcasecmp(str, "enable") || !strcasecmp(str, "disable"))
    return 1;
  ch = str;
  if (strlen(ch) != 1)
    return 0;
  if (*ch != '0' && *ch != '1')
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<is_bool>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
je     115e <is_bool+0x3e>
mov    -0x10(%rbp),%rdi
lea    0xeb7(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1169 <is_bool+0x49>
movw   $0x1,-0x2(%rbp)
jmp    11bf <is_bool+0x9f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x1,%eax
je     118e <is_bool+0x6e>
movw   $0x0,-0x2(%rbp)
jmp    11bf <is_bool+0x9f>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
je     11b9 <is_bool+0x99>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x31,%eax
je     11b9 <is_bool+0x99>
movw   $0x0,-0x2(%rbp)
jmp    11bf <is_bool+0x9f>
movw   $0x1,-0x2(%rbp)
movswl -0x2(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_bool>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed3(%rip),%rsi
call   1030 <strcasecmp@plt>
mov    $0x1,%bp
test   %eax,%eax
je     116a <is_bool+0x4a>
lea    0xec6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     116a <is_bool+0x4a>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x1,%eax
jne    1168 <is_bool+0x48>
mov    (%rbx),%al
and    $0xfe,%al
xor    %ebp,%ebp
cmp    $0x30,%al
sete   %bpl
jmp    116a <is_bool+0x4a>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"enable\00"
@.str.1 = [8 x i8] c"disable\00"
define signext i16 @is_bool(i8* %0) {
%2 = alloca i16
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @strcasecmp(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i32 @strcasecmp(i8* %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp ne i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %8, %1
store i16 1, i16* %2
br label %31
13: ; preds = %8
%14 = load i8*, i8** %3
store i8* %14, i8** %4
%15 = load i8*, i8** %4
%16 = call i32 @strlen(i8* %15)
%17 = icmp ne i32 %16, 1
br i1 %17, label %18, label %19
18: ; preds = %13
store i16 0, i16* %2
br label %31
19: ; preds = %13
%20 = load i8*, i8** %4
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 48
br i1 %23, label %24, label %30
24: ; preds = %19
%25 = load i8*, i8** %4
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 49
br i1 %28, label %29, label %30
29: ; preds = %24
store i16 0, i16* %2
br label %31
30: ; preds = %24, %19
store i16 1, i16* %2
br label %31
31: ; preds = %30, %29, %18, %12
%32 = load i16, i16* %2
ret i16 %32
}

LLVM IR (-O2):
@.str = [7 x i8] c"enable\00"
@.str.1 = [8 x i8] c"disable\00"
define signext i16 @is_bool(i8* %0) {
%2 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1
%5 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %4
%8 = tail call i32 @strlen(i8* %0)
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = load i8, i8* %0
%12 = and i8 %11, -2
%13 = icmp eq i8 %12, 48
%14 = zext i1 %13 to i16
br label %15
15: ; preds = %10, %7, %1, %4
%16 = phi i16 [ 1, %4 ], [ 1, %1 ], [ 0, %7 ], [ %14, %10 ]
ret i16 %16
}