#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 */
int /*<<< orphan*/ printf(char *, char const *, double);
double strtod(char const *, int /*<<< orphan*/ *);
int long_dbl(void) {
  static const char longestdbl[] =
      "17976931348623157081452742373170435679807056752584499659891747680315"
      "72607800285387605895586327668781715404589535143824642343213268894641"
      "82768467546703537516986049910576551282076245490090389328944075868508"
      "45513394230458323690322294816580855933212334827479782620414472316873"
      "8177180919299881250404026184124858368";
  double d = strtod(longestdbl, NULL);
  printf("strtod (\"%s\", NULL) = %g\n", longestdbl, d);
  if (d !=
      179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<long_dbl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xffd(%rip),%rdi
lea    0xec0(%rip),%rsi
call   1040 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xe9e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1177 <long_dbl+0x57>
jp     1177 <long_dbl+0x57>
jmp    1183 <long_dbl+0x63>
movl   $0x1,-0x4(%rbp)
jmp    118a <long_dbl+0x6a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<long_dbl>:
push   %rbx
sub    $0x10,%rsp
lea    0xee4(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <strtod@plt>
movsd  %xmm0,0x8(%rsp)
lea    0x1003(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
cmpneqsd 0xea6(%rip),%xmm0
movq   %xmm0,%rax
and    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@long_dbl.longestdbl = internal constant [310 x i8] c"179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368\00"
@.str = [26 x i8] c"strtod (\22%s\22, NULL) = %g\0A\00"
define i32 @long_dbl() {
%1 = alloca i32
%2 = alloca double
%3 = call double @strtod(i8* getelementptr inbounds ([310 x i8], [310 x i8]* @long_dbl.longestdbl, i64 0, i64 0), i32* null)
store double %3, double* %2
%4 = load double, double* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([310 x i8], [310 x i8]* @long_dbl.longestdbl, i64 0, i64 0), double %4)
%6 = load double, double* %2
%7 = fcmp une double %6, 0x7FEFFFFFFFFFFFFF
br i1 %7, label %8, label %9
8: ; preds = %0
store i32 1, i32* %1
br label %10
9: ; preds = %0
store i32 0, i32* %1
br label %10
10: ; preds = %9, %8
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@long_dbl.longestdbl = internal constant [310 x i8] c"179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368\00"
@.str = [26 x i8] c"strtod (\22%s\22, NULL) = %g\0A\00"
define i32 @long_dbl() {
%1 = tail call double @strtod(i8* nocapture getelementptr inbounds ([310 x i8], [310 x i8]* @long_dbl.longestdbl, i64 0, i64 0), i32* null)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([310 x i8], [310 x i8]* @long_dbl.longestdbl, i64 0, i64 0), double %1)
%3 = fcmp une double %1, 0x7FEFFFFFFFFFFFFF
%4 = zext i1 %3 to i32
ret i32 %4
}