#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 readOptionMatch(int argc, char **argv, int *i, char const *opt,
                    char const *arg) {
  int tmp;
  int tmp___0;
  {
    if (*i < argc) {
      tmp___0 = strcasecmp((char const *)*(argv + *i), opt);
      if (tmp___0 == 0) {
        if (*i < argc) {
          tmp = strcasecmp((char const *)*(argv + (*i + 1)), arg);
          if (tmp == 0) {
            (*i)++;
            return (1);
          }
        } else {
          clParseError(argc, argv, *i, (char *)"Option expects one argument");
        }
        return (0);
      }
    } else {
      clParseError(argc, argv, *i, (char *)"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    11ee <readOptionMatch+0xce>
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,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jne    11e9 <readOptionMatch+0xc9>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    11c4 <readOptionMatch+0xa4>
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>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jne    11bf <readOptionMatch+0x9f>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    120e <readOptionMatch+0xee>
jmp    11dd <readOptionMatch+0xbd>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xe28(%rip),%rcx
call   1040 <clParseError@plt>
movl   $0x0,-0x4(%rbp)
jmp    120e <readOptionMatch+0xee>
jmp    1207 <readOptionMatch+0xe7>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xe1a(%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    1169 <readOptionMatch+0x49>
mov    %r8,%r15
mov    %rdx,%r14
mov    (%r12,%rbx,8),%rdi
mov    %rcx,%rsi
call   1030 <strcasecmp@plt>
xor    %ebp,%ebp
test   %eax,%eax
jne    117c <readOptionMatch+0x5c>
mov    0x8(%r12,%rbx,8),%rdi
mov    %r15,%rsi
call   1030 <strcasecmp@plt>
test   %eax,%eax
jne    117c <readOptionMatch+0x5c>
add    $0x1,%rbx
mov    %ebx,(%r14)
mov    $0x1,%ebp
jmp    117c <readOptionMatch+0x5c>
lea    0xe90(%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*
%12 = alloca i32
%13 = alloca i32
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
%14 = load i32*, i32** %9
%15 = load i32, i32* %14
%16 = load i32, i32* %7
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %59
18: ; preds = %5
%19 = load i8**, i8*** %8
%20 = load i32*, i32** %9
%21 = load i32, i32* %20
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %19, i64 %22
%24 = load i8*, i8** %23
%25 = load i8*, i8** %10
%26 = call i32 @strcasecmp(i8* %24, i8* %25)
store i32 %26, i32* %13
%27 = load i32, i32* %13
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %58
29: ; preds = %18
%30 = load i32*, i32** %9
%31 = load i32, i32* %30
%32 = load i32, i32* %7
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %51
34: ; preds = %29
%35 = load i8**, i8*** %8
%36 = load i32*, i32** %9
%37 = load i32, i32* %36
%38 = add nsw i32 %37, 1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %35, i64 %39
%41 = load i8*, i8** %40
%42 = load i8*, i8** %11
%43 = call i32 @strcasecmp(i8* %41, i8* %42)
store i32 %43, i32* %12
%44 = load i32, i32* %12
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %50
46: ; preds = %34
%47 = load i32*, i32** %9
%48 = load i32, i32* %47
%49 = add nsw i32 %48, 1
store i32 %49, i32* %47
store i32 1, i32* %6
br label %66
50: ; preds = %34
br label %57
51: ; preds = %29
%52 = load i32, i32* %7
%53 = load i8**, i8*** %8
%54 = load i32*, i32** %9
%55 = load i32, i32* %54
%56 = call i32 @clParseError(i32 %52, i8** %53, i32 %55, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %57
57: ; preds = %51, %50
store i32 0, i32* %6
br label %66
58: ; preds = %18
br label %65
59: ; preds = %5
%60 = load i32, i32* %7
%61 = load i8**, i8*** %8
%62 = load i32*, i32** %9
%63 = load i32, i32* %62
%64 = call i32 @clParseError(i32 %60, i8** %61, i32 %63, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %65
65: ; preds = %59, %58
store i32 0, i32* %6
br label %66
66: ; preds = %65, %57, %46
%67 = load i32, i32* %6
ret i32 %67
}

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 i32 @strcasecmp(i8* %11, i8* %3)
%13 = icmp eq i32 %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 i32 @strcasecmp(i8* %18, i8* %4)
%20 = icmp eq i32 %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
}