#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 *);
scalar_t__ strcmp(char *, char const *const);
double lc_read_double(int const argc, char **argv, char const *const er_long,
                      char const *const er_short, double er_default) {
  for (int er_parse = 0; er_parse < argc; er_parse++) {
    if ((strcmp(argv[er_parse], er_long) == 0) ||
        (strcmp(argv[er_parse], er_short) == 0)) {
      if ((++er_parse) < argc) {
        return (atof(argv[er_parse]));
      } else {
        return (er_default);
      }
    }
  }
  return (er_default);
}


x86 assembly (clang, -O0):
<lc_read_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11dc <lc_read_double+0xbc>
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     118d <lc_read_double+0x6d>
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11c9 <lc_read_double+0xa9>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
cmp    -0xc(%rbp),%eax
jge    11ba <lc_read_double+0x9a>
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11e6 <lc_read_double+0xc6>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11e6 <lc_read_double+0xc6>
jmp    11ce <lc_read_double+0xae>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1143 <lc_read_double+0x23>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lc_read_double>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movsd  %xmm0,(%rsp)
test   %edi,%edi
jle    11a7 <lc_read_double+0x87>
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %edi,%r15d
mov    %edi,%r13d
neg    %r13
mov    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
mov    -0x8(%rbx,%rbp,8),%rdi
mov    %r12,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     118b <lc_read_double+0x6b>
mov    -0x8(%rbx,%rbp,8),%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     118b <lc_read_double+0x6b>
lea    0x1(,%rbp,1),%rax
add    %r13,%rax
add    $0x1,%rbp
cmp    $0x1,%rax
jne    1150 <lc_read_double+0x30>
jmp    11a7 <lc_read_double+0x87>
cmp    %r15d,%ebp
jge    11a7 <lc_read_double+0x87>
mov    (%rbx,%rbp,8),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <atof@plt>
movsd  (%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @lc_read_double(i32 %0, i8** %1, i8* %2, i8* %3, double %4) {
%6 = alloca double
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca double
%12 = alloca i32
store i32 %0, i32* %7
store i8** %1, i8*** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store double %4, double* %11
store i32 0, i32* %12
br label %13
13: ; preds = %50, %5
%14 = load i32, i32* %12
%15 = load i32, i32* %7
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %53
17: ; preds = %13
%18 = load i8**, i8*** %8
%19 = load i32, i32* %12
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = load i8*, i8** %9
%24 = call i64 @strcmp(i8* %22, i8* %23)
%25 = icmp eq i64 %24, 0
br i1 %25, label %35, label %26
26: ; preds = %17
%27 = load i8**, i8*** %8
%28 = load i32, i32* %12
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
%31 = load i8*, i8** %30
%32 = load i8*, i8** %10
%33 = call i64 @strcmp(i8* %31, i8* %32)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %49
35: ; preds = %26, %17
%36 = load i32, i32* %12
%37 = add nsw i32 %36, 1
store i32 %37, i32* %12
%38 = load i32, i32* %7
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %47
40: ; preds = %35
%41 = load i8**, i8*** %8
%42 = load i32, i32* %12
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8*, i8** %41, i64 %43
%45 = load i8*, i8** %44
%46 = call double @atof(i8* %45)
store double %46, double* %6
br label %55
47: ; preds = %35
%48 = load double, double* %11
store double %48, double* %6
br label %55
49: ; preds = %26
br label %50
50: ; preds = %49
%51 = load i32, i32* %12
%52 = add nsw i32 %51, 1
store i32 %52, i32* %12
br label %13
53: ; preds = %13
%54 = load double, double* %11
store double %54, double* %6
br label %55
55: ; preds = %53, %47, %40
%56 = load double, double* %6
ret double %56
}

LLVM IR (-O2):
define double @lc_read_double(i32 %0, i8** nocapture %1, i8* %2, i8* %3, double %4) {
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %31
7: ; preds = %5
%8 = zext i32 %0 to i64
br label %9
9: ; preds = %7, %28
%10 = phi i64 [ 0, %7 ], [ %29, %28 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 %10
%12 = load i8*, i8** %11
%13 = tail call i64 @strcmp(i8* %12, i8* %2)
%14 = icmp eq i64 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %9
%16 = load i8*, i8** %11
%17 = tail call i64 @strcmp(i8* %16, i8* %3)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %28
19: ; preds = %15, %9
%20 = trunc i64 %10 to i32
%21 = add nuw nsw i32 %20, 1
%22 = icmp slt i32 %21, %0
br i1 %22, label %23, label %31
23: ; preds = %19
%24 = zext i32 %21 to i64
%25 = getelementptr inbounds i8*, i8** %1, i64 %24
%26 = load i8*, i8** %25
%27 = tail call double @atof(i8* %26)
br label %31
28: ; preds = %15
%29 = add nuw nsw i64 %10, 1
%30 = icmp eq i64 %29, %8
br i1 %30, label %31, label %9
31: ; preds = %28, %5, %19, %23
%32 = phi double [ %27, %23 ], [ %4, %19 ], [ %4, %5 ], [ %4, %28 ]
ret double %32
}