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


x86 assembly (clang, -O0):
<readOptionDouble2>:
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    %r9,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    1243 <readOptionDouble2+0x113>
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    123e <readOptionDouble2+0x10e>
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    11be <readOptionDouble2+0x8e>
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    11d7 <readOptionDouble2+0xa7>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xe2e(%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    1219 <readOptionDouble2+0xe9>
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    1263 <readOptionDouble2+0x133>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xdd3(%rip),%rcx
call   1050 <clParseError@plt>
movl   $0x0,-0x4(%rbp)
jmp    1263 <readOptionDouble2+0x133>
jmp    125c <readOptionDouble2+0x12c>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xdc6(%rip),%rcx
call   1050 <clParseError@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%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    118f <readOptionDouble2+0x5f>
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   %eax,%eax
jne    11a6 <readOptionDouble2+0x76>
mov    %r14,0x8(%rsp)
lea    0x1(%r13),%r14d
mov    %r14d,(%rbx)
cmp    %ebp,%r14d
jge    11b8 <readOptionDouble2+0x88>
mov    0x8(%r12,%r13,8),%rdi
call   1040 <atof@plt>
mov    0x10(%rsp),%rax
movsd  %xmm0,(%rax)
jmp    11cf <readOptionDouble2+0x9f>
lea    0xe87(%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    0xe41(%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    11f8 <readOptionDouble2+0xc8>
movslq %r14d,%rax
mov    (%r12,%rax,8),%rdi
call   1040 <atof@plt>
mov    0x8(%rsp),%rax
movsd  %xmm0,(%rax)
mov    $0x1,%r15d
jmp    11a6 <readOptionDouble2+0x76>
lea    0xe01(%rip),%rcx
mov    %ebp,%edi
mov    %r12,%rsi
mov    %r14d,%edx
call   1050 <clParseError@plt>
jmp    11a6 <readOptionDouble2+0x76>

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*
%14 = alloca i32
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
%15 = load i32*, i32** %10
%16 = load i32, i32* %15
%17 = load i32, i32* %8
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %78
19: ; preds = %6
%20 = load i8**, i8*** %9
%21 = load i32*, i32** %10
%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** %11
%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** %10
%32 = load i32, i32* %31
%33 = add nsw i32 %32, 1
store i32 %33, i32* %31
%34 = load i32*, i32** %10
%35 = load i32, i32* %34
%36 = load i32, i32* %8
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %47
38: ; preds = %30
%39 = load i8**, i8*** %9
%40 = load i32*, i32** %10
%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 double @atof(i8* %44)
%46 = load double*, double** %12
store double %45, double* %46
br label %53
47: ; preds = %30
%48 = load i32, i32* %8
%49 = load i8**, i8*** %9
%50 = load i32*, i32** %10
%51 = load i32, i32* %50
%52 = call i32 @clParseError(i32 %48, i8** %49, i32 %51, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %53
53: ; preds = %47, %38
%54 = load i32*, i32** %10
%55 = load i32, i32* %54
%56 = add nsw i32 %55, 1
store i32 %56, i32* %54
%57 = load i32*, i32** %10
%58 = load i32, i32* %57
%59 = load i32, i32* %8
%60 = icmp slt i32 %58, %59
br i1 %60, label %61, label %70
61: ; preds = %53
%62 = load i8**, i8*** %9
%63 = load i32*, i32** %10
%64 = load i32, i32* %63
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8*, i8** %62, i64 %65
%67 = load i8*, i8** %66
%68 = call double @atof(i8* %67)
%69 = load double*, double** %13
store double %68, double* %69
store i32 1, i32* %7
br label %85
70: ; preds = %53
%71 = load i32, i32* %8
%72 = load i8**, i8*** %9
%73 = load i32*, i32** %10
%74 = load i32, i32* %73
%75 = call i32 @clParseError(i32 %71, i8** %72, i32 %74, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %76
76: ; preds = %70
store i32 0, i32* %7
br label %85
77: ; preds = %19
br label %84
78: ; preds = %6
%79 = load i32, i32* %8
%80 = load i8**, i8*** %9
%81 = load i32*, i32** %10
%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.1, i64 0, i64 0))
br label %84
84: ; preds = %78, %77
store i32 0, i32* %7
br label %85
85: ; preds = %84, %76, %61
%86 = load i32, i32* %7
ret i32 %86
}

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 i32 @strcasecmp(i8* %12, i8* %3)
%14 = icmp eq i32 %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
}