#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 *);
scalar_t__ strcasecmp(char *, char const *);
int readOptionMatch(int argc, char **argv, int *i, const char *opt,
                    const char *arg) {
  if ((*i) < argc) {
    if (strcasecmp(argv[*i], opt) == 0) {
      if ((*i) < argc) {
        if (strcasecmp(argv[(*i) + 1], arg) == 0) {
          (*i) += 1;
          return 1;
        }
      } else {
        clParseError(argc, argv, (*i), "Option expects one argument");
      }
      return 0;
    }
  } else {
    clParseError(argc, argv, (*i), "Error parsing command line.");
  }
  return 0;
}


x86 assembly (clang, -O0):
<readOptionMatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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    11e8 <readOptionMatch+0xc8>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11e3 <readOptionMatch+0xc3>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    11be <readOptionMatch+0x9e>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11b9 <readOptionMatch+0x99>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1208 <readOptionMatch+0xe8>
jmp    11d7 <readOptionMatch+0xb7>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xe2e(%rip),%rcx
call   1040 <clParseError@plt>
movl   $0x0,-0x4(%rbp)
jmp    1208 <readOptionMatch+0xe8>
jmp    1201 <readOptionMatch+0xe1>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xe20(%rip),%rcx
call   1040 <clParseError@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readOptionMatch>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r12
movslq (%rdx),%rbx
cmp    %edi,%ebx
jge    116b <readOptionMatch+0x4b>
mov    %r8,%r15
mov    %rdx,%r14
mov    (%r12,%rbx,8),%rdi
mov    %rcx,%rsi
call   1030 <strcasecmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
jne    117e <readOptionMatch+0x5e>
mov    0x8(%r12,%rbx,8),%rdi
mov    %r15,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
jne    117e <readOptionMatch+0x5e>
add    $0x1,%rbx
mov    %ebx,(%r14)
mov    $0x1,%ebp
jmp    117e <readOptionMatch+0x5e>
lea    0xe8e(%rip),%rcx
mov    %r12,%rsi
mov    %ebx,%edx
call   1040 <clParseError@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Option expects one argument\00"
@.str.1 = [28 x i8] c"Error parsing command line.\00"
define i32 @readOptionMatch(i32 %0, i8** %1, i32* %2, i8* %3, i8* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i8*
store i32 %0, i32* %7
store i8** %1, i8*** %8
store i32* %2, i32** %9
store i8* %3, i8** %10
store i8* %4, i8** %11
%12 = load i32*, i32** %9
%13 = load i32, i32* %12
%14 = load i32, i32* %7
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %55
16: ; preds = %5
%17 = load i8**, i8*** %8
%18 = load i32*, i32** %9
%19 = load i32, i32* %18
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %17, i64 %20
%22 = load i8*, i8** %21
%23 = load i8*, i8** %10
%24 = call i64 @strcasecmp(i8* %22, i8* %23)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %54
26: ; preds = %16
%27 = load i32*, i32** %9
%28 = load i32, i32* %27
%29 = load i32, i32* %7
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %47
31: ; preds = %26
%32 = load i8**, i8*** %8
%33 = load i32*, i32** %9
%34 = load i32, i32* %33
%35 = add nsw i32 %34, 1
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %32, i64 %36
%38 = load i8*, i8** %37
%39 = load i8*, i8** %11
%40 = call i64 @strcasecmp(i8* %38, i8* %39)
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %46
42: ; preds = %31
%43 = load i32*, i32** %9
%44 = load i32, i32* %43
%45 = add nsw i32 %44, 1
store i32 %45, i32* %43
store i32 1, i32* %6
br label %62
46: ; preds = %31
br label %53
47: ; preds = %26
%48 = load i32, i32* %7
%49 = load i8**, i8*** %8
%50 = load i32*, i32** %9
%51 = load i32, i32* %50
%52 = call i32 @clParseError(i32 %48, i8** %49, i32 %51, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %53
53: ; preds = %47, %46
store i32 0, i32* %6
br label %62
54: ; preds = %16
br label %61
55: ; preds = %5
%56 = load i32, i32* %7
%57 = load i8**, i8*** %8
%58 = load i32*, i32** %9
%59 = load i32, i32* %58
%60 = call i32 @clParseError(i32 %56, i8** %57, i32 %59, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %61
61: ; preds = %55, %54
store i32 0, i32* %6
br label %62
62: ; preds = %61, %53, %42
%63 = load i32, i32* %6
ret i32 %63
}

LLVM IR (-O2):
@.str.1 = [28 x i8] c"Error parsing command line.\00"
define i32 @readOptionMatch(i32 %0, i8** %1, i32* nocapture %2, i8* nocapture %3, i8* nocapture %4) {
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, %0
br i1 %7, label %8, label %22
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 i64 @strcasecmp(i8* %11, i8* %3)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %24
14: ; preds = %8
%15 = add nsw i32 %6, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8*, i8** %1, i64 %16
%18 = load i8*, i8** %17
%19 = tail call i64 @strcasecmp(i8* %18, i8* %4)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %14
store i32 %15, i32* %2
br label %24
22: ; preds = %5
%23 = tail call i32 @clParseError(i32 %0, i8** %1, i32 %6, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %24
24: ; preds = %22, %8, %14, %21
%25 = phi i32 [ 1, %21 ], [ 0, %14 ], [ 0, %8 ], [ 0, %22 ]
ret i32 %25
}