#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*/ printf(char *, char *);
int get_bool_arg(int narg, int argc, char **argv, unsigned long *value) {
  switch (argv[narg][0]) {
  case 'y':
  case 'Y':
    *value = 1;
    break;
  case 'n':
  case 'N':
    *value = 0;
    break;
  default:
    printf("Invalid Bollean parameter '%s'\n", argv[narg]);
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<get_bool_arg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
mov    %eax,-0x24(%rbp)
sub    $0x4e,%eax
je     1189 <get_bool_arg+0x79>
jmp    1146 <get_bool_arg+0x36>
mov    -0x24(%rbp),%eax
sub    $0x59,%eax
je     1179 <get_bool_arg+0x69>
jmp    1157 <get_bool_arg+0x47>
mov    -0x24(%rbp),%eax
sub    $0x6e,%eax
je     1189 <get_bool_arg+0x79>
jmp    1168 <get_bool_arg+0x58>
mov    -0x24(%rbp),%eax
sub    $0x79,%eax
jne    1199 <get_bool_arg+0x89>
jmp    1179 <get_bool_arg+0x69>
mov    -0x20(%rbp),%rax
movq   $0x1,(%rax)
jmp    11bd <get_bool_arg+0xad>
mov    -0x20(%rbp),%rax
movq   $0x0,(%rax)
jmp    11bd <get_bool_arg+0xad>
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe54(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c4 <get_bool_arg+0xb4>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_bool_arg>:
push   %rax
movslq %edi,%rax
mov    (%rdx,%rax,8),%rsi
movsbl (%rsi),%edx
mov    $0x1,%eax
cmp    $0x6d,%edx
jg     1131 <get_bool_arg+0x21>
cmp    $0x4e,%edx
je     113b <get_bool_arg+0x2b>
cmp    $0x59,%edx
je     113d <get_bool_arg+0x2d>
jmp    1144 <get_bool_arg+0x34>
cmp    $0x79,%edx
je     113d <get_bool_arg+0x2d>
cmp    $0x6e,%edx
jne    1144 <get_bool_arg+0x34>
xor    %eax,%eax
mov    %rax,(%rcx)
xor    %eax,%eax
pop    %rcx
ret
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Invalid Bollean parameter '%s'\0A\00"
define i32 @get_bool_arg(i32 %0, i32 %1, i8** %2, i64* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i64*
store i32 %0, i32* %6
store i32 %1, i32* %7
store i8** %2, i8*** %8
store i64* %3, i64** %9
%10 = load i8**, i8*** %8
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8*, i8** %10, i64 %12
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
switch i32 %17, label %22 [
i32 121, label %18
i32 89, label %18
i32 110, label %20
i32 78, label %20
]
18: ; preds = %4, %4
%19 = load i64*, i64** %9
store i64 1, i64* %19
br label %29
20: ; preds = %4, %4
%21 = load i64*, i64** %9
store i64 0, i64* %21
br label %29
22: ; preds = %4
%23 = load i8**, i8*** %8
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
%28 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %27)
store i32 -1, i32* %5
br label %30
29: ; preds = %20, %18
store i32 0, i32* %5
br label %30
30: ; preds = %29, %22
%31 = load i32, i32* %5
ret i32 %31
}

LLVM IR (-O2):
@.str = [32 x i8] c"Invalid Bollean parameter '%s'\0A\00"
define i32 @get_bool_arg(i32 %0, i32 %1, i8** nocapture %2, i64* nocapture writeonly %3) {
%5 = sext i32 %0 to i64
%6 = getelementptr inbounds i8*, i8** %2, i64 %5
%7 = load i8*, i8** %6
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
switch i32 %9, label %11 [
i32 121, label %13
i32 89, label %13
i32 110, label %10
i32 78, label %10
]
10: ; preds = %4, %4
br label %13
11: ; preds = %4
%12 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %15
13: ; preds = %4, %4, %10
%14 = phi i64 [ 0, %10 ], [ 1, %4 ], [ 1, %4 ]
store i64 %14, i64* %3
br label %15
15: ; preds = %13, %11
%16 = phi i32 [ -1, %11 ], [ 0, %13 ]
ret i32 %16
}