#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 */
double atof(char *);
int /*<<< orphan*/ clParseError(int, char **, int, char *);
scalar_t__ strcasecmp(char *, char const *);
int readOptionDouble2(int argc, char **argv, int *i, const char *opt,
                      double *arg1, double *arg2) {
  if ((*i) < argc) {
    if (strcasecmp(argv[(*i)], opt) == 0) {
      (*i) += 1;
      if ((*i) < argc) {
        (*arg1) = atof(argv[(*i)]);
      } else {
        clParseError(argc, argv, (*i), "Option expects two arguments");
      }
      (*i) += 1;
      if ((*i) < argc) {
        (*arg2) = atof(argv[(*i)]);
        return 1;
      } else {
        clParseError(argc, argv, (*i), "Option expects two arguments");
      }
      return 0;
    }
  } else {
    clParseError(argc, argv, (*i), "Error parsing command line.");
  }
  return 0;
}


x86 assembly (clang, -O0):
<readOptionDouble2>:
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    %r9,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    1240 <readOptionDouble2+0x110>
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    123b <readOptionDouble2+0x10b>
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    11bb <readOptionDouble2+0x8b>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <atof@plt>
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    11d4 <readOptionDouble2+0xa4>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xe31(%rip),%rcx
call   1050 <clParseError@plt>
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    1216 <readOptionDouble2+0xe6>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <atof@plt>
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1260 <readOptionDouble2+0x130>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xdd6(%rip),%rcx
call   1050 <clParseError@plt>
movl   $0x0,-0x4(%rbp)
jmp    1260 <readOptionDouble2+0x130>
jmp    1259 <readOptionDouble2+0x129>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xdc9(%rip),%rcx
call   1050 <clParseError@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readOptionDouble2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r12
mov    %edi,%ebp
movslq (%rdx),%r13
cmp    %edi,%r13d
jge    1190 <readOptionDouble2+0x60>
mov    %r9,%r14
mov    %rdx,%rbx
mov    %r8,0x10(%rsp)
mov    (%r12,%r13,8),%rdi
mov    %rcx,%rsi
call   1030 <strcasecmp@plt>
xor    %r15d,%r15d
test   %rax,%rax
jne    11a7 <readOptionDouble2+0x77>
mov    %r14,0x8(%rsp)
lea    0x1(%r13),%r14d
mov    %r14d,(%rbx)
cmp    %ebp,%r14d
jge    11b9 <readOptionDouble2+0x89>
mov    0x8(%r12,%r13,8),%rdi
call   1040 <atof@plt>
mov    0x10(%rsp),%rax
movsd  %xmm0,(%rax)
jmp    11d0 <readOptionDouble2+0xa0>
lea    0xe86(%rip),%rcx
mov    %ebp,%edi
mov    %r12,%rsi
mov    %r13d,%edx
call   1050 <clParseError@plt>
xor    %r15d,%r15d
mov    %r15d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe40(%rip),%rcx
mov    %ebp,%edi
mov    %r12,%rsi
mov    %r14d,%edx
call   1050 <clParseError@plt>
mov    (%rbx),%r14d
add    $0x1,%r14d
mov    %r14d,(%rbx)
cmp    %ebp,%r14d
jge    11f9 <readOptionDouble2+0xc9>
movslq %r14d,%rax
mov    (%r12,%rax,8),%rdi
call   1040 <atof@plt>
mov    0x8(%rsp),%rax
movsd  %xmm0,(%rax)
mov    $0x1,%r15d
jmp    11a7 <readOptionDouble2+0x77>
lea    0xe00(%rip),%rcx
mov    %ebp,%edi
mov    %r12,%rsi
mov    %r14d,%edx
call   1050 <clParseError@plt>
jmp    11a7 <readOptionDouble2+0x77>

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

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