#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;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ stderr;
long strtod(char *, char **);
int isDoubleCL(char *input, int isVerbose) {
  char *end;
  long number;
  errno = 0;
  number = strtod(input, &end);
  if ((errno == ERANGE) || (errno != 0 && number == 0)) {
    if (isVerbose) {
      char msg[1024];
      sprintf(msg, "### Error for double '%s'", input);
      perror(msg);
    }
    return 0;
  } else if (end == input) {
    if (isVerbose) {
      fprintf(stderr, "### Error for double '%s': NaN\n", input);
    }
    return 0;
  } else if (*end != '\0') {
    if (1) {
      if (isVerbose) {
        fprintf(stderr, "### Error for double '%s': NaN, trailing '%s'\n",
                input, end);
      }
      return 0;
    } else {
      if (isVerbose) {
        fprintf(stderr, "### Warming for double '%s': trailing '%s'\n", input,
                end);
      }
      return 1;
    }
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<isDoubleCL>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    0x2e77(%rip),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strtod@plt>
mov    %rax,-0x28(%rbp)
mov    0x2e58(%rip),%rax
mov    (%rax),%rax
mov    0x2e66(%rip),%rcx
cmp    (%rcx),%rax
je     11a7 <isDoubleCL+0x67>
mov    0x2e3e(%rip),%rax
cmpq   $0x0,(%rax)
je     11e0 <isDoubleCL+0xa0>
cmpq   $0x0,-0x28(%rbp)
jne    11e0 <isDoubleCL+0xa0>
cmpl   $0x0,-0x14(%rbp)
je     11d4 <isDoubleCL+0x94>
lea    -0x430(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe3d(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x430(%rbp),%rdi
call   1050 <perror@plt>
movl   $0x0,-0x4(%rbp)
jmp    126b <isDoubleCL+0x12b>
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    121f <isDoubleCL+0xdf>
cmpl   $0x0,-0x14(%rbp)
je     1213 <isDoubleCL+0xd3>
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe0e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    126b <isDoubleCL+0x12b>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1264 <isDoubleCL+0x124>
cmpl   $0x0,-0x14(%rbp)
je     1258 <isDoubleCL+0x118>
mov    0x2d98(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xde9(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    126b <isDoubleCL+0x12b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isDoubleCL>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x418,%rsp
mov    %esi,%ebp
mov    %rdi,%r15
mov    0x2e77(%rip),%rbx
movq   $0x0,(%rbx)
lea    0x8(%rsp),%rsi
call   1030 <strtod@plt>
mov    (%rbx),%rcx
mov    0x2e74(%rip),%rdx
cmp    (%rdx),%rcx
je     1183 <isDoubleCL+0x43>
test   %rcx,%rcx
je     119b <isDoubleCL+0x5b>
test   %rax,%rax
jne    119b <isDoubleCL+0x5b>
xor    %r14d,%r14d
test   %ebp,%ebp
jne    11fd <isDoubleCL+0xbd>
mov    %r14d,%eax
add    $0x418,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%rsp),%rcx
cmp    %r15,%rcx
je     11cd <isDoubleCL+0x8d>
cmpb   $0x0,(%rcx)
je     11f5 <isDoubleCL+0xb5>
test   %ebp,%ebp
je     11f0 <isDoubleCL+0xb0>
mov    0x2e23(%rip),%rax
mov    (%rax),%edi
lea    0xe7c(%rip),%rsi
xor    %r14d,%r14d
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    118a <isDoubleCL+0x4a>
test   %ebp,%ebp
je     11f0 <isDoubleCL+0xb0>
mov    0x2e00(%rip),%rax
mov    (%rax),%edi
lea    0xe39(%rip),%rsi
xor    %r14d,%r14d
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    118a <isDoubleCL+0x4a>
xor    %r14d,%r14d
jmp    118a <isDoubleCL+0x4a>
mov    $0x1,%r14d
jmp    118a <isDoubleCL+0x4a>
lea    0xdfc(%rip),%rsi
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    %r15,%rdx
call   1060 <sprintf@plt>
mov    %rbp,%rdi
call   1050 <perror@plt>
jmp    118a <isDoubleCL+0x4a>

LLVM IR (-O0):
@errno = global i64 0
@ERANGE = global i64 0
@.str = [26 x i8] c"### Error for double '%s'\00"
@stderr = global i32 0
@.str.1 = [32 x i8] c"### Error for double '%s': NaN\0A\00"
@.str.2 = [47 x i8] c"### Error for double '%s': NaN, trailing '%s'\0A\00"
define i32 @isDoubleCL(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca [1024 x i8]
store i8* %0, i8** %4
store i32 %1, i32* %5
store i64 0, i64* @errno
%9 = load i8*, i8** %4
%10 = call i64 @strtod(i8* %9, i8** %6)
store i64 %10, i64* %7
%11 = load i64, i64* @errno
%12 = load i64, i64* @ERANGE
%13 = icmp eq i64 %11, %12
br i1 %13, label %20, label %14
14: ; preds = %2
%15 = load i64, i64* @errno
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %30
17: ; preds = %14
%18 = load i64, i64* %7
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %30
20: ; preds = %17, %2
%21 = load i32, i32* %5
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %20
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%25 = load i8*, i8** %4
%26 = call i32 @sprintf(i8* %24, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %25)
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%28 = call i32 @perror(i8* %27)
br label %29
29: ; preds = %23, %20
store i32 0, i32* %3
br label %57
30: ; preds = %17, %14
%31 = load i8*, i8** %6
%32 = load i8*, i8** %4
%33 = icmp eq i8* %31, %32
br i1 %33, label %34, label %42
34: ; preds = %30
%35 = load i32, i32* %5
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %41
37: ; preds = %34
%38 = load i32, i32* @stderr
%39 = load i8*, i8** %4
%40 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %39)
br label %41
41: ; preds = %37, %34
store i32 0, i32* %3
br label %57
42: ; preds = %30
%43 = load i8*, i8** %6
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %56
47: ; preds = %42
%48 = load i32, i32* %5
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %55
50: ; preds = %47
%51 = load i32, i32* @stderr
%52 = load i8*, i8** %4
%53 = load i8*, i8** %6
%54 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i8* %52, i8* %53)
br label %55
55: ; preds = %50, %47
store i32 0, i32* %3
br label %57
56: ; preds = %42
store i32 1, i32* %3
br label %57
57: ; preds = %56, %55, %41, %29
%58 = load i32, i32* %3
ret i32 %58
}

LLVM IR (-O2):
@errno = global i64 0
@ERANGE = global i64 0
@.str = [26 x i8] c"### Error for double '%s'\00"
@stderr = global i32 0
@.str.1 = [32 x i8] c"### Error for double '%s': NaN\0A\00"
@.str.2 = [47 x i8] c"### Error for double '%s': NaN, trailing '%s'\0A\00"
define i32 @isDoubleCL(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca [1024 x i8]
%5 = bitcast i8** %3 to i8*
store i64 0, i64* @errno
%6 = call i64 @strtod(i8* %0, i8** %3)
%7 = load i64, i64* @errno
%8 = load i64, i64* @ERANGE
%9 = icmp eq i64 %7, %8
br i1 %9, label %14, label %10
10: ; preds = %2
%11 = icmp ne i64 %7, 0
%12 = icmp eq i64 %6, 0
%13 = select i1 %11, i1 %12, i1 false
br i1 %13, label %14, label %20
14: ; preds = %10, %2
%15 = icmp eq i32 %1, 0
br i1 %15, label %36, label %16
16: ; preds = %14
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%18 = call i32 @sprintf(i8* %17, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %0)
%19 = call i32 @perror(i8* %17)
br label %36
20: ; preds = %10
%21 = load i8*, i8** %3
%22 = icmp eq i8* %21, %0
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = icmp eq i32 %1, 0
br i1 %24, label %36, label %25
25: ; preds = %23
%26 = load i32, i32* @stderr
%27 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %36
28: ; preds = %20
%29 = load i8, i8* %21
%30 = icmp eq i8 %29, 0
br i1 %30, label %36, label %31
31: ; preds = %28
%32 = icmp eq i32 %1, 0
br i1 %32, label %36, label %33
33: ; preds = %31
%34 = load i32, i32* @stderr
%35 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %21)
br label %36
36: ; preds = %28, %31, %33, %23, %25, %14, %16
%37 = phi i32 [ 0, %16 ], [ 0, %14 ], [ 0, %25 ], [ 0, %23 ], [ 0, %33 ], [ 0, %31 ], [ 1, %28 ]
ret i32 %37
}