#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*/ strcmp(char const *, char *);
int x264_atobool(const char *str, int *b_error) {
  if (!strcmp(str, "1") || !strcmp(str, "true") || !strcmp(str, "yes"))
    return 1;
  if (!strcmp(str, "0") || !strcmp(str, "false") || !strcmp(str, "no"))
    return 0;
  *b_error = 1;
  return 0;
}


x86 assembly (clang, -O0):
<x264_atobool>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed5(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     116b <x264_atobool+0x5b>
mov    -0x10(%rbp),%rdi
lea    0xebe(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     116b <x264_atobool+0x5b>
mov    -0x10(%rbp),%rdi
lea    0xeaa(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1177 <x264_atobool+0x67>
movl   $0x1,-0x4(%rbp)
jmp    11df <x264_atobool+0xcf>
mov    -0x10(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     11c2 <x264_atobool+0xb2>
mov    -0x10(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     11c2 <x264_atobool+0xb2>
mov    -0x10(%rbp),%rdi
lea    0xe5f(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11ce <x264_atobool+0xbe>
movl   $0x0,-0x4(%rbp)
jmp    11df <x264_atobool+0xcf>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x264_atobool>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xedf(%rip),%rsi
call   1030 <strcmp@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     1197 <x264_atobool+0x87>
lea    0xecc(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1197 <x264_atobool+0x87>
lea    0xebe(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1197 <x264_atobool+0x87>
lea    0xeaf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
xor    %ebp,%ebp
test   %eax,%eax
je     1197 <x264_atobool+0x87>
lea    0xe9c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1197 <x264_atobool+0x87>
lea    0xe8f(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1197 <x264_atobool+0x87>
movl   $0x1,(%r14)
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"1\00"
@.str.1 = [5 x i8] c"true\00"
@.str.2 = [4 x i8] c"yes\00"
@.str.3 = [2 x i8] c"0\00"
@.str.4 = [6 x i8] c"false\00"
@.str.5 = [3 x i8] c"no\00"
define i32 @x264_atobool(i8* nocapture %0, i32* nocapture writeonly %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %21, label %5
5: ; preds = %2
%6 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %21, label %8
8: ; preds = %5
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %21, label %11
11: ; preds = %8
%12 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %21, label %14
14: ; preds = %11
%15 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %14
%18 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %17
store i32 1, i32* %1
br label %21
21: ; preds = %11, %14, %17, %2, %5, %8, %20
%22 = phi i32 [ 0, %20 ], [ 1, %8 ], [ 1, %5 ], [ 1, %2 ], [ 0, %17 ], [ 0, %14 ], [ 0, %11 ]
ret i32 %22
}