#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*/ clParseError(int, char **, int, char *);
int strcasecmp(char const *, char const *);
int readOptionYesNo(int argc, char **argv, int *i, char const *opt,
                    int *flag___0) {
  int tmp;
  int tmp___0;
  int tmp___1;
  {
    if (*i < argc) {
      tmp___1 = strcasecmp((char const *)*(argv + *i), opt);
      if (tmp___1 == 0) {
        (*i)++;
        if (*i < argc) {
          tmp___0 = strcasecmp((char const *)*(argv + *i), "YES");
          if (tmp___0 == 0) {
            *flag___0 = 1;
            return (1);
          } else {
            tmp = strcasecmp((char const *)*(argv + *i), "NO");
            if (tmp == 0) {
              *flag___0 = 0;
              return (1);
            } else {
              clParseError(argc, argv, *i, (char *)"Option expects YES or NO.");
            }
          }
        } else {
          clParseError(argc, argv, *i, (char *)"Option expects YES or NO.");
        }
        return (1);
      }
    } else {
      clParseError(argc, argv, *i, (char *)"Error parsing command line.");
    }
    return (0);
  }
}


x86 assembly (clang, -O0):
<readOptionYesNo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    1252 <readOptionYesNo+0x132>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcasecmp@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    124d <readOptionYesNo+0x12d>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    1228 <readOptionYesNo+0x108>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe61(%rip),%rsi
call   1030 <strcasecmp@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jne    11c7 <readOptionYesNo+0xa7>
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1272 <readOptionYesNo+0x152>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe27(%rip),%rsi
call   1030 <strcasecmp@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jne    1205 <readOptionYesNo+0xe5>
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1272 <readOptionYesNo+0x152>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xdee(%rip),%rcx
call   1040 <clParseError@plt>
jmp    1223 <readOptionYesNo+0x103>
jmp    1241 <readOptionYesNo+0x121>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xdcb(%rip),%rcx
call   1040 <clParseError@plt>
movl   $0x1,-0x4(%rbp)
jmp    1272 <readOptionYesNo+0x152>
jmp    126b <readOptionYesNo+0x14b>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xdbb(%rip),%rcx
call   1040 <clParseError@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readOptionYesNo>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %edi,%r13d
movslq (%rdx),%rbx
cmp    %edi,%ebx
jge    11a6 <readOptionYesNo+0x86>
mov    %r8,%r14
mov    %rdx,%rbp
mov    (%r12,%rbx,8),%rdi
mov    %rcx,%rsi
call   1030 <strcasecmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
jne    11bc <readOptionYesNo+0x9c>
lea    0x1(%rbx),%r15d
mov    %r15d,0x0(%rbp)
cmp    %r13d,%r15d
jge    118a <readOptionYesNo+0x6a>
mov    0x8(%r12,%rbx,8),%rbx
lea    0xe95(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     11cb <readOptionYesNo+0xab>
lea    0xe86(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     11d9 <readOptionYesNo+0xb9>
lea    0xe76(%rip),%rcx
mov    %r13d,%edi
mov    %r12,%rsi
mov    %r15d,%edx
call   1040 <clParseError@plt>
mov    $0x1,%eax
jmp    11bc <readOptionYesNo+0x9c>
lea    0xe74(%rip),%rcx
mov    %r13d,%edi
mov    %r12,%rsi
mov    %ebx,%edx
call   1040 <clParseError@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movl   $0x1,(%r14)
mov    $0x1,%eax
jmp    11bc <readOptionYesNo+0x9c>
movl   $0x0,(%r14)
mov    $0x1,%eax
jmp    11bc <readOptionYesNo+0x9c>

LLVM IR (-O0):
@.str = [4 x i8] c"YES\00"
@.str.1 = [3 x i8] c"NO\00"
@.str.2 = [26 x i8] c"Option expects YES or NO.\00"
@.str.3 = [28 x i8] c"Error parsing command line.\00"
define i32 @readOptionYesNo(i32 %0, i8** %1, i32* %2, i8* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i32*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 %0, i32* %7
store i8** %1, i8*** %8
store i32* %2, i32** %9
store i8* %3, i8** %10
store i32* %4, i32** %11
%15 = load i32*, i32** %9
%16 = load i32, i32* %15
%17 = load i32, i32* %7
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %78
19: ; preds = %5
%20 = load i8**, i8*** %8
%21 = load i32*, i32** %9
%22 = load i32, i32* %21
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %20, i64 %23
%25 = load i8*, i8** %24
%26 = load i8*, i8** %10
%27 = call i32 @strcasecmp(i8* %25, i8* %26)
store i32 %27, i32* %14
%28 = load i32, i32* %14
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %77
30: ; preds = %19
%31 = load i32*, i32** %9
%32 = load i32, i32* %31
%33 = add nsw i32 %32, 1
store i32 %33, i32* %31
%34 = load i32*, i32** %9
%35 = load i32, i32* %34
%36 = load i32, i32* %7
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %70
38: ; preds = %30
%39 = load i8**, i8*** %8
%40 = load i32*, i32** %9
%41 = load i32, i32* %40
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %39, i64 %42
%44 = load i8*, i8** %43
%45 = call i32 @strcasecmp(i8* %44, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 %45, i32* %13
%46 = load i32, i32* %13
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %38
%49 = load i32*, i32** %11
store i32 1, i32* %49
store i32 1, i32* %6
br label %85
50: ; preds = %38
%51 = load i8**, i8*** %8
%52 = load i32*, i32** %9
%53 = load i32, i32* %52
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8*, i8** %51, i64 %54
%56 = load i8*, i8** %55
%57 = call i32 @strcasecmp(i8* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 %57, i32* %12
%58 = load i32, i32* %12
%59 = icmp eq i32 %58, 0
br i1 %59, label %60, label %62
60: ; preds = %50
%61 = load i32*, i32** %11
store i32 0, i32* %61
store i32 1, i32* %6
br label %85
62: ; preds = %50
%63 = load i32, i32* %7
%64 = load i8**, i8*** %8
%65 = load i32*, i32** %9
%66 = load i32, i32* %65
%67 = call i32 @clParseError(i32 %63, i8** %64, i32 %66, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %68
68: ; preds = %62
br label %69
69: ; preds = %68
br label %76
70: ; preds = %30
%71 = load i32, i32* %7
%72 = load i8**, i8*** %8
%73 = load i32*, i32** %9
%74 = load i32, i32* %73
%75 = call i32 @clParseError(i32 %71, i8** %72, i32 %74, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %76
76: ; preds = %70, %69
store i32 1, i32* %6
br label %85
77: ; preds = %19
br label %84
78: ; preds = %5
%79 = load i32, i32* %7
%80 = load i8**, i8*** %8
%81 = load i32*, i32** %9
%82 = load i32, i32* %81
%83 = call i32 @clParseError(i32 %79, i8** %80, i32 %82, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
br label %84
84: ; preds = %78, %77
store i32 0, i32* %6
br label %85
85: ; preds = %84, %76, %60, %48
%86 = load i32, i32* %6
ret i32 %86
}

LLVM IR (-O2):
@.str = [4 x i8] c"YES\00"
@.str.1 = [3 x i8] c"NO\00"
@.str.2 = [26 x i8] c"Option expects YES or NO.\00"
@.str.3 = [28 x i8] c"Error parsing command line.\00"
define i32 @readOptionYesNo(i32 %0, i8** %1, i32* nocapture %2, i8* nocapture %3, i32* nocapture writeonly %4) {
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, %0
br i1 %7, label %8, label %32
8: ; preds = %5
%9 = sext i32 %6 to i64
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i32 @strcasecmp(i8* %11, i8* %3)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %34
14: ; preds = %8
%15 = add nsw i32 %6, 1
store i32 %15, i32* %2
%16 = icmp slt i32 %15, %0
br i1 %16, label %17, label %30
17: ; preds = %14
%18 = sext i32 %15 to i64
%19 = getelementptr inbounds i8*, i8** %1, i64 %18
%20 = load i8*, i8** %19
%21 = tail call i32 @strcasecmp(i8* %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %17
store i32 1, i32* %4
br label %34
24: ; preds = %17
%25 = tail call i32 @strcasecmp(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %24
store i32 0, i32* %4
br label %34
28: ; preds = %24
%29 = tail call i32 @clParseError(i32 %0, i8** %1, i32 %15, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %34
30: ; preds = %14
%31 = tail call i32 @clParseError(i32 %0, i8** %1, i32 %15, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %34
32: ; preds = %5
%33 = tail call i32 @clParseError(i32 %0, i8** %1, i32 %6, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
br label %34
34: ; preds = %32, %8, %28, %30, %27, %23
%35 = phi i32 [ 1, %23 ], [ 1, %27 ], [ 1, %30 ], [ 1, %28 ], [ 0, %8 ], [ 0, %32 ]
ret i32 %35
}