#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 EINVAL;
int /*<<< orphan*/ strcmp(char *, char *);
int parse_opt_bool(char *param, void *arg) {
  if (param == NULL || !strcmp(param, "on") || !strcmp(param, "yes") ||
      !strcmp(param, "true")) {
    *(int *)arg = 1;
    return 0;
  }
  if (!strcmp(param, "off") || !strcmp(param, "no") ||
      !strcmp(param, "false")) {
    *(int *)arg = 0;
    return 0;
  }
  return -EINVAL;
}


x86 assembly (clang, -O0):
<parse_opt_bool>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1176 <parse_opt_bool+0x66>
mov    -0x10(%rbp),%rdi
lea    0xeca(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     1176 <parse_opt_bool+0x66>
mov    -0x10(%rbp),%rdi
lea    0xeb4(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     1176 <parse_opt_bool+0x66>
mov    -0x10(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    118c <parse_opt_bool+0x7c>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    11fb <parse_opt_bool+0xeb>
mov    -0x10(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     11d7 <parse_opt_bool+0xc7>
mov    -0x10(%rbp),%rdi
lea    0xe60(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     11d7 <parse_opt_bool+0xc7>
mov    -0x10(%rbp),%rdi
lea    0xe4a(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11ed <parse_opt_bool+0xdd>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    11fb <parse_opt_bool+0xeb>
xor    %eax,%eax
mov    0x2dea(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_opt_bool>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
test   %rdi,%rdi
je     119b <parse_opt_bool+0x8b>
mov    %rdi,%rbx
lea    0xeda(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     119b <parse_opt_bool+0x8b>
lea    0xecd(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     119b <parse_opt_bool+0x8b>
lea    0xebe(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     119b <parse_opt_bool+0x8b>
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11ac <parse_opt_bool+0x9c>
lea    0xea1(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11ac <parse_opt_bool+0x9c>
lea    0xe91(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11ac <parse_opt_bool+0x9c>
mov    0x2e4b(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
jmp    11a4 <parse_opt_bool+0x94>
movl   $0x1,(%r14)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
movl   $0x0,(%r14)
jmp    11a2 <parse_opt_bool+0x92>

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

LLVM IR (-O2):
@.str = [3 x i8] c"on\00"
@.str.1 = [4 x i8] c"yes\00"
@.str.2 = [5 x i8] c"true\00"
@.str.3 = [4 x i8] c"off\00"
@.str.4 = [3 x i8] c"no\00"
@.str.5 = [6 x i8] c"false\00"
@EINVAL = global i32 0
define i32 @parse_opt_bool(i8* %0, i8* nocapture writeonly %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %13, label %4
4: ; preds = %2
%5 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %4
%8 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10, %7, %4, %2
%14 = bitcast i8* %1 to i32*
store i32 1, i32* %14
br label %29
15: ; preds = %10
%16 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
br i1 %17, label %24, label %18
18: ; preds = %15
%19 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21, %18, %15
%25 = bitcast i8* %1 to i32*
store i32 0, i32* %25
br label %29
26: ; preds = %21
%27 = load i32, i32* @EINVAL
%28 = sub nsw i32 0, %27
br label %29
29: ; preds = %26, %24, %13
%30 = phi i32 [ 0, %13 ], [ %28, %26 ], [ 0, %24 ]
ret i32 %30
}