#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 readOption(int argc, char **argv, int *i, char const *opt) {
  int tmp;
  {
    if (*i < argc) {
      tmp = strcasecmp((char const *)*(argv + *i), opt);
      if (tmp == 0) {
        return (1);
      }
    } else {
      clParseError(argc, argv, *i, (char *)"Error parsing command line.");
    }
    return (0);
  }
}


x86 assembly (clang, -O0):
<readOption>:
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    -0x18(%rbp),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    117c <readOption+0x5c>
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,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    1177 <readOption+0x57>
movl   $0x1,-0x4(%rbp)
jmp    119c <readOption+0x7c>
jmp    1195 <readOption+0x75>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xe70(%rip),%rcx
call   1040 <clParseError@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readOption>:
push   %rax
movslq (%rdx),%rdx
cmp    %edi,%edx
jge    113f <readOption+0x1f>
mov    (%rsi,%rdx,8),%rdi
mov    %rcx,%rsi
call   1030 <strcasecmp@plt>
test   %eax,%eax
jne    114b <readOption+0x2b>
mov    $0x1,%eax
pop    %rcx
ret
lea    0xeba(%rip),%rcx
call   1040 <clParseError@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [28 x i8] c"Error parsing command line.\00"
define i32 @readOption(i32 %0, i8** %1, i32* nocapture %2, i8* nocapture %3) {
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, %0
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = sext i32 %5 to i64
%9 = getelementptr inbounds i8*, i8** %1, i64 %8
%10 = load i8*, i8** %9
%11 = tail call i32 @strcasecmp(i8* %10, i8* %3)
%12 = icmp eq i32 %11, 0
br i1 %12, label %16, label %15
13: ; preds = %4
%14 = tail call i32 @clParseError(i32 %0, i8** %1, i32 %5, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %7, %13
br label %16
16: ; preds = %7, %15
%17 = phi i32 [ 0, %15 ], [ 1, %7 ]
ret i32 %17
}