#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__ iupStrEqualNoCase(char const *, char *);
int iupStrBoolean(const char *str) {
  if (!str || str[0] == 0)
    return 0;
  if (str[0] == '1' && str[1] == 0)
    return 1;
  if (iupStrEqualNoCase(str, "YES"))
    return 1;
  if (iupStrEqualNoCase(str, "ON"))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<iupStrBoolean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1137 <iupStrBoolean+0x27>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1143 <iupStrBoolean+0x33>
movl   $0x0,-0x4(%rbp)
jmp    11c3 <iupStrBoolean+0xb3>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x31,%eax
jne    1170 <iupStrBoolean+0x60>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    1170 <iupStrBoolean+0x60>
movl   $0x1,-0x4(%rbp)
jmp    11c3 <iupStrBoolean+0xb3>
mov    -0x10(%rbp),%rdi
lea    0xe85(%rip),%rsi
call   1030 <iupStrEqualNoCase@plt>
cmp    $0x0,%rax
je     1196 <iupStrBoolean+0x86>
movl   $0x1,-0x4(%rbp)
jmp    11c3 <iupStrBoolean+0xb3>
mov    -0x10(%rbp),%rdi
lea    0xe63(%rip),%rsi
call   1030 <iupStrEqualNoCase@plt>
cmp    $0x0,%rax
je     11bc <iupStrBoolean+0xac>
movl   $0x1,-0x4(%rbp)
jmp    11c3 <iupStrBoolean+0xb3>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iupStrBoolean>:
push   %rbx
xor    %eax,%eax
test   %rdi,%rdi
je     1148 <iupStrBoolean+0x38>
mov    %rdi,%rbx
mov    (%rdi),%cl
test   %cl,%cl
je     1148 <iupStrBoolean+0x38>
cmp    $0x31,%cl
jne    112c <iupStrBoolean+0x1c>
cmpb   $0x0,0x1(%rbx)
je     1166 <iupStrBoolean+0x56>
lea    0xecd(%rip),%rsi
mov    %rbx,%rdi
call   1030 <iupStrEqualNoCase@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     114a <iupStrBoolean+0x3a>
pop    %rbx
ret
lea    0xeb3(%rip),%rsi
mov    %rbx,%rdi
call   1030 <iupStrEqualNoCase@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"YES\00"
@.str.1 = [3 x i8] c"ON\00"
define i32 @iupStrBoolean(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %6, %1
store i32 0, i32* %2
br label %37
13: ; preds = %6
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 49
br i1 %18, label %19, label %26
19: ; preds = %13
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %19
store i32 1, i32* %2
br label %37
26: ; preds = %19, %13
%27 = load i8*, i8** %3
%28 = call i64 @iupStrEqualNoCase(i8* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %26
store i32 1, i32* %2
br label %37
31: ; preds = %26
%32 = load i8*, i8** %3
%33 = call i64 @iupStrEqualNoCase(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %31
store i32 1, i32* %2
br label %37
36: ; preds = %31
store i32 0, i32* %2
br label %37
37: ; preds = %36, %35, %30, %25, %12
%38 = load i32, i32* %2
ret i32 %38
}

LLVM IR (-O2):
@.str = [4 x i8] c"YES\00"
@.str.1 = [3 x i8] c"ON\00"
define i32 @iupStrBoolean(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %16, label %3
3: ; preds = %1
%4 = load i8, i8* %0
switch i8 %4, label %9 [
i8 0, label %16
i8 49, label %5
]
5: ; preds = %3
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %3, %5
%10 = tail call i64 @iupStrEqualNoCase(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = tail call i64 @iupStrEqualNoCase(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp ne i64 %13, 0
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %12, %9, %5, %3, %1
%17 = phi i32 [ 0, %3 ], [ 0, %1 ], [ 1, %5 ], [ 1, %9 ], [ %15, %12 ]
ret i32 %17
}