#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__ strcasecmp(char *, char *);
int parse_boolean(char *str, int *boolean) {
  if (str == NULL)
    return 0;
  if (strcasecmp(str, "yes") == 0) {
    *boolean = 1;
    return 1;
  }
  if (strcasecmp(str, "no") == 0) {
    *boolean = 0;
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<parse_boolean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1137 <parse_boolean+0x27>
movl   $0x0,-0x4(%rbp)
jmp    119e <parse_boolean+0x8e>
mov    -0x10(%rbp),%rdi
lea    0xebe(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1167 <parse_boolean+0x57>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    119e <parse_boolean+0x8e>
mov    -0x10(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1197 <parse_boolean+0x87>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    119e <parse_boolean+0x8e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_boolean>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     115b <parse_boolean+0x4b>
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xeda(%rip),%rsi
call   1030 <strcasecmp@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1151 <parse_boolean+0x41>
lea    0xec5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    115d <parse_boolean+0x4d>
mov    %eax,(%r14)
mov    $0x1,%eax
jmp    115d <parse_boolean+0x4d>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"yes\00"
@.str.1 = [3 x i8] c"no\00"
define i32 @parse_boolean(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 = icmp eq i8* %6, null
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 0, i32* %3
br label %22
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = call i64 @strcasecmp(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = load i32*, i32** %5
store i32 1, i32* %14
store i32 1, i32* %3
br label %22
15: ; preds = %9
%16 = load i8*, i8** %4
%17 = call i64 @strcasecmp(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = load i32*, i32** %5
store i32 0, i32* %20
store i32 1, i32* %3
br label %22
21: ; preds = %15
store i32 0, i32* %3
br label %22
22: ; preds = %21, %19, %13, %8
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@.str = [4 x i8] c"yes\00"
@.str.1 = [3 x i8] c"no\00"
define i32 @parse_boolean(i8* %0, i32* nocapture writeonly %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7, %4
%11 = phi i32 [ 1, %4 ], [ 0, %7 ]
store i32 %11, i32* %1
br label %12
12: ; preds = %10, %7, %2
%13 = phi i32 [ 0, %2 ], [ 0, %7 ], [ 1, %10 ]
ret i32 %13
}