#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 */
scalar_t__ ERANGE;
scalar_t__ errno;
double strtod(char *, char **);
int get_doubleVDC(char *val, double *F) {
  char *eptr;
  errno = 0;
  double f = strtod(val, &eptr);
  if (eptr != val && errno != ERANGE) {
    *F = f;
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<get_doubleVDC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0x2eb1(%rip),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strtod@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     1181 <get_doubleVDC+0x71>
mov    0x2e83(%rip),%rax
mov    (%rax),%rax
mov    0x2e89(%rip),%rcx
cmp    (%rcx),%rax
je     1181 <get_doubleVDC+0x71>
movsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1188 <get_doubleVDC+0x78>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_doubleVDC>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2eb2(%rip),%r15
movq   $0x0,(%r15)
lea    0x8(%rsp),%rsi
call   1030 <strtod@plt>
xor    %eax,%eax
cmp    %rbx,0x8(%rsp)
je     1159 <get_doubleVDC+0x49>
mov    (%r15),%rcx
mov    0x2e9e(%rip),%rdx
cmp    (%rdx),%rcx
je     1159 <get_doubleVDC+0x49>
movsd  %xmm0,(%r14)
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@errno = global i64 0
@ERANGE = global i64 0
define i32 @get_doubleVDC(i8* %0, double* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca double*
%6 = alloca i8*
%7 = alloca double
store i8* %0, i8** %4
store double* %1, double** %5
store i64 0, i64* @errno
%8 = load i8*, i8** %4
%9 = call double @strtod(i8* %8, i8** %6)
store double %9, double* %7
%10 = load i8*, i8** %6
%11 = load i8*, i8** %4
%12 = icmp ne i8* %10, %11
br i1 %12, label %13, label %20
13: ; preds = %2
%14 = load i64, i64* @errno
%15 = load i64, i64* @ERANGE
%16 = icmp ne i64 %14, %15
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = load double, double* %7
%19 = load double*, double** %5
store double %18, double* %19
store i32 1, i32* %3
br label %21
20: ; preds = %13, %2
store i32 0, i32* %3
br label %21
21: ; preds = %20, %17
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@errno = global i64 0
@ERANGE = global i64 0
define i32 @get_doubleVDC(i8* %0, double* nocapture writeonly %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store i64 0, i64* @errno
%5 = call double @strtod(i8* %0, i8** %3)
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, %0
br i1 %7, label %13, label %8
8: ; preds = %2
%9 = load i64, i64* @errno
%10 = load i64, i64* @ERANGE
%11 = icmp eq i64 %9, %10
br i1 %11, label %13, label %12
12: ; preds = %8
store double %5, double* %1
br label %13
13: ; preds = %2, %8, %12
%14 = phi i32 [ 1, %12 ], [ 0, %8 ], [ 0, %2 ]
ret i32 %14
}