#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__ isnum_float(char);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int get_command_line_double(int argc, char *argv[], char *match, double *val,
                            int *found_list) {
  int i;
  char *value_start;
  i = 1;
  while ((i <= argc) && (strncmp(argv[i], match, strlen(match)) != 0))
    i++;
  if (i == argc + 1)
    return 1;
  found_list[i] = 1;
  if (strlen(argv[i]) > strlen(match))
    value_start = argv[i] + strlen(match);
  else {
    if (i == argc)
      return 1;
    value_start = argv[i + 1];
    if (isnum_float(value_start[0]))
      found_list[i + 1] = 1;
  }
  if (isnum_float(value_start[0])) {
    *val = atof(value_start);
  } else {
    return 2;
  }
  return 0;
}


x86 assembly (clang, -O0):
<get_command_line_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0x39(%rbp)
jg     11ad <get_command_line_double+0x6d>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x50(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
test   $0x1,%al
jne    11bd <get_command_line_double+0x7d>
jmp    11cb <get_command_line_double+0x8b>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1162 <get_command_line_double+0x22>
mov    -0x2c(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    11e8 <get_command_line_double+0xa8>
movl   $0x1,-0x4(%rbp)
jmp    12ea <get_command_line_double+0x1aa>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x54(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
cmp    %ecx,%eax
jle    124f <get_command_line_double+0x10f>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x60(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x60(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
jmp    12ab <get_command_line_double+0x16b>
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1267 <get_command_line_double+0x127>
movl   $0x1,-0x4(%rbp)
jmp    12ea <get_command_line_double+0x1aa>
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movsbl (%rax),%edi
call   1060 <isnum_float@plt>
cmp    $0x0,%rax
je     12a6 <get_command_line_double+0x166>
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    12ab <get_command_line_double+0x16b>
mov    -0x38(%rbp),%rax
movsbl (%rax),%edi
call   1060 <isnum_float@plt>
cmp    $0x0,%rax
je     12d7 <get_command_line_double+0x197>
mov    -0x38(%rbp),%rdi
call   1040 <atof@plt>
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    12e3 <get_command_line_double+0x1a3>
movl   $0x2,-0x4(%rbp)
jmp    12ea <get_command_line_double+0x1aa>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_command_line_double>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,0x10(%rsp)
mov    %rdx,%rbp
mov    %rsi,%rbx
mov    %edi,%r13d
lea    0x1(%r13),%ecx
mov    $0x1,%eax
mov    $0x1,%r15d
test   %edi,%edi
mov    %r8,0x8(%rsp)
jle    11cf <get_command_line_double+0x8f>
mov    %ecx,0x4(%rsp)
mov    %ecx,%r12d
mov    $0x1,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rbx,%r15,8),%r14
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11c1 <get_command_line_double+0x81>
add    $0x1,%r15
cmp    %r15,%r12
jne    1190 <get_command_line_double+0x50>
mov    $0x1,%eax
jmp    1265 <get_command_line_double+0x125>
mov    0x8(%rsp),%r8
mov    $0x1,%eax
mov    0x4(%rsp),%ecx
cmp    %ecx,%r15d
je     1265 <get_command_line_double+0x125>
mov    %r15d,%r12d
movl   $0x1,(%r8,%r12,4)
mov    (%rbx,%r12,8),%rdi
call   1050 <strlen@plt>
mov    %eax,%r14d
mov    %rbp,%rdi
call   1050 <strlen@plt>
cmp    %eax,%r14d
jle    1210 <get_command_line_double+0xd0>
mov    (%rbx,%r12,8),%r14
mov    %rbp,%rdi
call   1050 <strlen@plt>
movslq %eax,%rbx
add    %r14,%rbx
jmp    123e <get_command_line_double+0xfe>
mov    0x8(%rsp),%rbp
cmp    %r13d,%r15d
mov    $0x1,%eax
je     1265 <get_command_line_double+0x125>
mov    0x8(%rbx,%r12,8),%rbx
movsbl (%rbx),%edi
call   1060 <isnum_float@plt>
test   %rax,%rax
je     123e <get_command_line_double+0xfe>
add    $0x1,%r12
movl   $0x1,0x0(%rbp,%r12,4)
movsbl (%rbx),%edi
call   1060 <isnum_float@plt>
test   %rax,%rax
je     1260 <get_command_line_double+0x120>
mov    %rbx,%rdi
call   1040 <atof@plt>
mov    0x10(%rsp),%rax
movsd  %xmm0,(%rax)
xor    %eax,%eax
jmp    1265 <get_command_line_double+0x125>
mov    $0x2,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get_command_line_double(i32 %0, i8** %1, i8* %2, double* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i8*
%10 = alloca double*
%11 = alloca i32*
%12 = alloca i32
%13 = alloca i8*
store i32 %0, i32* %7
store i8** %1, i8*** %8
store i8* %2, i8** %9
store double* %3, double** %10
store i32* %4, i32** %11
store i32 1, i32* %12
br label %14
14: ; preds = %31, %5
%15 = load i32, i32* %12
%16 = load i32, i32* %7
%17 = icmp sle i32 %15, %16
br i1 %17, label %18, label %29
18: ; preds = %14
%19 = load i8**, i8*** %8
%20 = load i32, i32* %12
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %19, i64 %21
%23 = load i8*, i8** %22
%24 = load i8*, i8** %9
%25 = load i8*, i8** %9
%26 = call i32 @strlen(i8* %25)
%27 = call i64 @strncmp(i8* %23, i8* %24, i32 %26)
%28 = icmp ne i64 %27, 0
br label %29
29: ; preds = %18, %14
%30 = phi i1 [ false, %14 ], [ %28, %18 ]
br i1 %30, label %31, label %34
31: ; preds = %29
%32 = load i32, i32* %12
%33 = add nsw i32 %32, 1
store i32 %33, i32* %12
br label %14
34: ; preds = %29
%35 = load i32, i32* %12
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
%38 = icmp eq i32 %35, %37
br i1 %38, label %39, label %40
39: ; preds = %34
store i32 1, i32* %6
br label %100
40: ; preds = %34
%41 = load i32*, i32** %11
%42 = load i32, i32* %12
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i32, i32* %41, i64 %43
store i32 1, i32* %44
%45 = load i8**, i8*** %8
%46 = load i32, i32* %12
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8*, i8** %45, i64 %47
%49 = load i8*, i8** %48
%50 = call i32 @strlen(i8* %49)
%51 = load i8*, i8** %9
%52 = call i32 @strlen(i8* %51)
%53 = icmp sgt i32 %50, %52
br i1 %53, label %54, label %64
54: ; preds = %40
%55 = load i8**, i8*** %8
%56 = load i32, i32* %12
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8*, i8** %55, i64 %57
%59 = load i8*, i8** %58
%60 = load i8*, i8** %9
%61 = call i32 @strlen(i8* %60)
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8, i8* %59, i64 %62
store i8* %63, i8** %13
br label %88
64: ; preds = %40
%65 = load i32, i32* %12
%66 = load i32, i32* %7
%67 = icmp eq i32 %65, %66
br i1 %67, label %68, label %69
68: ; preds = %64
store i32 1, i32* %6
br label %100
69: ; preds = %64
%70 = load i8**, i8*** %8
%71 = load i32, i32* %12
%72 = add nsw i32 %71, 1
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i8*, i8** %70, i64 %73
%75 = load i8*, i8** %74
store i8* %75, i8** %13
%76 = load i8*, i8** %13
%77 = getelementptr inbounds i8, i8* %76, i64 0
%78 = load i8, i8* %77
%79 = call i64 @isnum_float(i8 signext %78)
%80 = icmp ne i64 %79, 0
br i1 %80, label %81, label %87
81: ; preds = %69
%82 = load i32*, i32** %11
%83 = load i32, i32* %12
%84 = add nsw i32 %83, 1
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i32, i32* %82, i64 %85
store i32 1, i32* %86
br label %87
87: ; preds = %81, %69
br label %88
88: ; preds = %87, %54
%89 = load i8*, i8** %13
%90 = getelementptr inbounds i8, i8* %89, i64 0
%91 = load i8, i8* %90
%92 = call i64 @isnum_float(i8 signext %91)
%93 = icmp ne i64 %92, 0
br i1 %93, label %94, label %98
94: ; preds = %88
%95 = load i8*, i8** %13
%96 = call double @atof(i8* %95)
%97 = load double*, double** %10
store double %96, double* %97
br label %99
98: ; preds = %88
store i32 2, i32* %6
br label %100
99: ; preds = %94
store i32 0, i32* %6
br label %100
100: ; preds = %99, %98, %68, %39
%101 = load i32, i32* %6
ret i32 %101
}

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