#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*/ exit(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ strcasecmp(char *, char *);
int eval_bool(char *value, int line) {
  if (!strcasecmp(value, "YES"))
    return 1;
  else if (!strcasecmp(value, "NO"))
    return 0;
  else {
    printf("Invalid value in configuration file on line %i!\n", line);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<eval_bool>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb6(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1164 <eval_bool+0x34>
movl   $0x1,-0x4(%rbp)
jmp    11a2 <eval_bool+0x72>
mov    -0x10(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1189 <eval_bool+0x59>
movl   $0x0,-0x4(%rbp)
jmp    11a2 <eval_bool+0x72>
mov    -0x14(%rbp),%esi
lea    0xe74(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eval_bool>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xec1(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     1177 <eval_bool+0x47>
lea    0xeb5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
je     117c <eval_bool+0x4c>
lea    0xea1(%rip),%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"YES\00"
@.str.1 = [3 x i8] c"NO\00"
@.str.2 = [49 x i8] c"Invalid value in configuration file on line %i!\0A\00"
define i32 @eval_bool(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 @strcasecmp(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %2
store i32 1, i32* %3
br label %19
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = call i32 @strcasecmp(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp ne i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %10
store i32 0, i32* %3
br label %19
15: ; preds = %10
%16 = load i32, i32* %5
%17 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %14, %9
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@.str = [4 x i8] c"YES\00"
@.str.1 = [3 x i8] c"NO\00"
@.str.2 = [49 x i8] c"Invalid value in configuration file on line %i!\0A\00"
define i32 @eval_bool(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %11, label %5
5: ; preds = %2
%6 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = tail call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i32 %1)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %5, %2
%12 = phi i32 [ 1, %2 ], [ 0, %5 ]
ret i32 %12
}