#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 */
long input_long(long *);
scalar_t__ ipow(int, long);
long input_double(double *result) {
  long c;
  long is_neg;
  long is_checking;
  long n;
  double d;
  double scale;
  long rt;
  long ret;
  long e;
  n = 0;
  d = 0.0;
  is_neg = 0;
  is_checking = 1;
  ret = -1;
  e = 0;
  do {
    c = *(long *)0x100000200;
    if (c == (-1))
      goto input_double_exit;
    if (c == (long)'-') {
      c = *(long *)0x100000200;
      if (c <= (long)'9') {
        if (c >= (long)'0') {
          is_neg = 1;
          is_checking = 0;
          ret = 0;
        }
      }
    } else if (c <= (long)'9') {
      if (c >= (long)'0') {
        is_checking = 0;
        ret = 0;
      }
    }
  } while (is_checking == 1);
  is_checking = 1;
  do {
    n = n * 10 + (long)c - (long)'0';
    c = *(long *)0x100000200;
    if (c == (-1))
      goto input_double_exit;
    if (c == (long)'.')
      goto input_double_after_dot;
    if (c > (long)'9') {
      is_checking = 0;
    }
    if (c < (long)'0') {
      is_checking = 0;
    }
  } while (is_checking == 1);
  goto input_double_exit;
input_double_after_dot:
  is_checking = 1;
  scale = 0.1;
  do {
    c = *(long *)0x100000200;
    if (c == (-1))
      goto input_double_exit;
    if (c <= (long)'9') {
      if (c >= (long)'0') {
        c = (long)c - (long)'0';
        d = d + scale * (double)c;
        scale = scale / 10.0;
      } else {
        is_checking = 0;
      }
    } else {
      is_checking = 0;
    }
  } while (is_checking == 1);
input_double_exit:
  d = d + (double)n;
  if (c == 'E') {
    rt = input_long(&e);
    if (rt != 0)
      e = 0;
  }
  if (c == 'e') {
    rt = input_long(&e);
    if (rt != 0)
      e = 0;
  }
  if (e > 0) {
    d = d * (double)(ipow(10, e));
  } else if (e < 0) {
    d = d / (double)(ipow(10, e));
  }
  if (is_neg == 1) {
    d = 0.0 - d;
  }
  *result = d;
  return ret;
}


x86 assembly (clang, -O0):
<input_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x1,-0x20(%rbp)
movq   $0xffffffffffffffff,-0x48(%rbp)
ff
movq   $0x0,-0x50(%rbp)
movabs $0x100000200,%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0xffffffffffffffff,-0x10(%rbp)
jne    117d <input_double+0x5d>
jmp    1350 <input_double+0x230>
cmpq   $0x2d,-0x10(%rbp)
jne    11d1 <input_double+0xb1>
movabs $0x100000200,%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x39,-0x10(%rbp)
jg     11cc <input_double+0xac>
cmpq   $0x30,-0x10(%rbp)
jl     11c7 <input_double+0xa7>
movq   $0x1,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x48(%rbp)
jmp    11cc <input_double+0xac>
jmp    1201 <input_double+0xe1>
cmpq   $0x39,-0x10(%rbp)
jg     11fc <input_double+0xdc>
cmpq   $0x30,-0x10(%rbp)
jl     11f7 <input_double+0xd7>
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x48(%rbp)
jmp    11fc <input_double+0xdc>
jmp    1201 <input_double+0xe1>
jmp    1206 <input_double+0xe6>
cmpq   $0x1,-0x20(%rbp)
je     115c <input_double+0x3c>
movq   $0x1,-0x20(%rbp)
imul   $0xa,-0x28(%rbp),%rax
add    -0x10(%rbp),%rax
sub    $0x30,%rax
mov    %rax,-0x28(%rbp)
movabs $0x100000200,%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0xffffffffffffffff,-0x10(%rbp)
jne    124b <input_double+0x12b>
jmp    1350 <input_double+0x230>
cmpq   $0x2e,-0x10(%rbp)
jne    125b <input_double+0x13b>
jmp    1296 <input_double+0x176>
cmpq   $0x39,-0x10(%rbp)
jle    126e <input_double+0x14e>
movq   $0x0,-0x20(%rbp)
cmpq   $0x30,-0x10(%rbp)
jge    1281 <input_double+0x161>
movq   $0x0,-0x20(%rbp)
jmp    1286 <input_double+0x166>
cmpq   $0x1,-0x20(%rbp)
je     1219 <input_double+0xf9>
jmp    1350 <input_double+0x230>
movq   $0x1,-0x20(%rbp)
movsd  0xd5a(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movabs $0x100000200,%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0xffffffffffffffff,-0x10(%rbp)
jne    12cc <input_double+0x1ac>
jmp    1350 <input_double+0x230>
cmpq   $0x39,-0x10(%rbp)
jg     1333 <input_double+0x213>
cmpq   $0x30,-0x10(%rbp)
jl     1326 <input_double+0x206>
mov    -0x10(%rbp),%rax
sub    $0x30,%rax
mov    %rax,-0x10(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0xcf0(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    132e <input_double+0x20e>
movq   $0x0,-0x20(%rbp)
jmp    133b <input_double+0x21b>
movq   $0x0,-0x20(%rbp)
jmp    1340 <input_double+0x220>
cmpq   $0x1,-0x20(%rbp)
je     12ab <input_double+0x18b>
jmp    1350 <input_double+0x230>
movsd  -0x30(%rbp),%xmm0
cvtsi2sdq -0x28(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
cmpq   $0x45,-0x10(%rbp)
jne    1394 <input_double+0x274>
lea    -0x50(%rbp),%rdi
call   1030 <input_long@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
je     138f <input_double+0x26f>
movq   $0x0,-0x50(%rbp)
jmp    1394 <input_double+0x274>
cmpq   $0x65,-0x10(%rbp)
jne    13c4 <input_double+0x2a4>
lea    -0x50(%rbp),%rdi
call   1030 <input_long@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
je     13bf <input_double+0x29f>
movq   $0x0,-0x50(%rbp)
jmp    13c4 <input_double+0x2a4>
cmpq   $0x0,-0x50(%rbp)
jle    13ff <input_double+0x2df>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x50(%rbp),%rsi
mov    $0xa,%edi
call   1040 <ipow@plt>
movsd  -0x58(%rbp),%xmm0
cvtsi2sd %rax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    143a <input_double+0x31a>
cmpq   $0x0,-0x50(%rbp)
jge    1435 <input_double+0x315>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x50(%rbp),%rsi
mov    $0xa,%edi
call   1040 <ipow@plt>
movsd  -0x60(%rbp),%xmm0
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    143a <input_double+0x31a>
cmpq   $0x1,-0x18(%rbp)
jne    1452 <input_double+0x332>
xorps  %xmm0,%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x48(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input_double>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movq   $0x0,0x8(%rsp)
movabs $0x100000200,%rax
mov    (%rax),%rax
xchg   %ax,%ax
cmp    $0xffffffffffffffff,%rax
jne    1130 <input_double+0x20>
mov    0x8(%rsp),%rsi
test   %rsi,%rsi
jle    1159 <input_double+0x49>
mov    $0xa,%edi
call   1030 <ipow@plt>
cvtsi2sd %rax,%xmm1
xorpd  %xmm0,%xmm0
mulsd  %xmm1,%xmm0
jmp    1176 <input_double+0x66>
xorpd  %xmm0,%xmm0
jns    1176 <input_double+0x66>
mov    $0xa,%edi
call   1030 <ipow@plt>
cvtsi2sd %rax,%xmm1
xorpd  %xmm0,%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx)
mov    $0xffffffffffffffff,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i64 @input_double(double* %0) {
%2 = alloca double*
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca double
%8 = alloca double
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
store double* %0, double** %2
store i64 0, i64* %6
store double 0.000000e+00, double* %7
store i64 0, i64* %4
store i64 1, i64* %5
store i64 -1, i64* %10
store i64 0, i64* %11
br label %12
12: ; preds = %40, %1
%13 = load i64, i64* inttoptr (i64 4294967808 to i64*)
store i64 %13, i64* %3
%14 = load i64, i64* %3
%15 = icmp eq i64 %14, -1
br i1 %15, label %16, label %17
16: ; preds = %12
br label %101
17: ; preds = %12
%18 = load i64, i64* %3
%19 = icmp eq i64 %18, 45
br i1 %19, label %20, label %30
20: ; preds = %17
%21 = load i64, i64* inttoptr (i64 4294967808 to i64*)
store i64 %21, i64* %3
%22 = load i64, i64* %3
%23 = icmp sle i64 %22, 57
br i1 %23, label %24, label %29
24: ; preds = %20
%25 = load i64, i64* %3
%26 = icmp sge i64 %25, 48
br i1 %26, label %27, label %28
27: ; preds = %24
store i64 1, i64* %4
store i64 0, i64* %5
store i64 0, i64* %10
br label %28
28: ; preds = %27, %24
br label %29
29: ; preds = %28, %20
br label %39
30: ; preds = %17
%31 = load i64, i64* %3
%32 = icmp sle i64 %31, 57
br i1 %32, label %33, label %38
33: ; preds = %30
%34 = load i64, i64* %3
%35 = icmp sge i64 %34, 48
br i1 %35, label %36, label %37
36: ; preds = %33
store i64 0, i64* %5
store i64 0, i64* %10
br label %37
37: ; preds = %36, %33
br label %38
38: ; preds = %37, %30
br label %39
39: ; preds = %38, %29
br label %40
40: ; preds = %39
%41 = load i64, i64* %5
%42 = icmp eq i64 %41, 1
br i1 %42, label %12, label %43
43: ; preds = %40
store i64 1, i64* %5
br label %44
44: ; preds = %67, %43
%45 = load i64, i64* %6
%46 = mul nsw i64 %45, 10
%47 = load i64, i64* %3
%48 = add nsw i64 %46, %47
%49 = sub nsw i64 %48, 48
store i64 %49, i64* %6
%50 = load i64, i64* inttoptr (i64 4294967808 to i64*)
store i64 %50, i64* %3
%51 = load i64, i64* %3
%52 = icmp eq i64 %51, -1
br i1 %52, label %53, label %54
53: ; preds = %44
br label %101
54: ; preds = %44
%55 = load i64, i64* %3
%56 = icmp eq i64 %55, 46
br i1 %56, label %57, label %58
57: ; preds = %54
br label %71
58: ; preds = %54
%59 = load i64, i64* %3
%60 = icmp sgt i64 %59, 57
br i1 %60, label %61, label %62
61: ; preds = %58
store i64 0, i64* %5
br label %62
62: ; preds = %61, %58
%63 = load i64, i64* %3
%64 = icmp slt i64 %63, 48
br i1 %64, label %65, label %66
65: ; preds = %62
store i64 0, i64* %5
br label %66
66: ; preds = %65, %62
br label %67
67: ; preds = %66
%68 = load i64, i64* %5
%69 = icmp eq i64 %68, 1
br i1 %69, label %44, label %70
70: ; preds = %67
br label %101
71: ; preds = %57
store i64 1, i64* %5
store double 1.000000e-01, double* %8
br label %72
72: ; preds = %97, %71
%73 = load i64, i64* inttoptr (i64 4294967808 to i64*)
store i64 %73, i64* %3
%74 = load i64, i64* %3
%75 = icmp eq i64 %74, -1
br i1 %75, label %76, label %77
76: ; preds = %72
br label %101
77: ; preds = %72
%78 = load i64, i64* %3
%79 = icmp sle i64 %78, 57
br i1 %79, label %80, label %95
80: ; preds = %77
%81 = load i64, i64* %3
%82 = icmp sge i64 %81, 48
br i1 %82, label %83, label %93
83: ; preds = %80
%84 = load i64, i64* %3
%85 = sub nsw i64 %84, 48
store i64 %85, i64* %3
%86 = load double, double* %7
%87 = load double, double* %8
%88 = load i64, i64* %3
%89 = sitofp i64 %88 to double
%90 = call double @llvm.fmuladd.f64(double %87, double %89, double %86)
store double %90, double* %7
%91 = load double, double* %8
%92 = fdiv double %91, 1.000000e+01
store double %92, double* %8
br label %94
93: ; preds = %80
store i64 0, i64* %5
br label %94
94: ; preds = %93, %83
br label %96
95: ; preds = %77
store i64 0, i64* %5
br label %96
96: ; preds = %95, %94
br label %97
97: ; preds = %96
%98 = load i64, i64* %5
%99 = icmp eq i64 %98, 1
br i1 %99, label %72, label %100
100: ; preds = %97
br label %101
101: ; preds = %100, %76, %70, %53, %16
%102 = load double, double* %7
%103 = load i64, i64* %6
%104 = sitofp i64 %103 to double
%105 = fadd double %102, %104
store double %105, double* %7
%106 = load i64, i64* %3
%107 = icmp eq i64 %106, 69
br i1 %107, label %108, label %114
108: ; preds = %101
%109 = call i64 @input_long(i64* %11)
store i64 %109, i64* %9
%110 = load i64, i64* %9
%111 = icmp ne i64 %110, 0
br i1 %111, label %112, label %113
112: ; preds = %108
store i64 0, i64* %11
br label %113
113: ; preds = %112, %108
br label %114
114: ; preds = %113, %101
%115 = load i64, i64* %3
%116 = icmp eq i64 %115, 101
br i1 %116, label %117, label %123
117: ; preds = %114
%118 = call i64 @input_long(i64* %11)
store i64 %118, i64* %9
%119 = load i64, i64* %9
%120 = icmp ne i64 %119, 0
br i1 %120, label %121, label %122
121: ; preds = %117
store i64 0, i64* %11
br label %122
122: ; preds = %121, %117
br label %123
123: ; preds = %122, %114
%124 = load i64, i64* %11
%125 = icmp sgt i64 %124, 0
br i1 %125, label %126, label %132
126: ; preds = %123
%127 = load double, double* %7
%128 = load i64, i64* %11
%129 = call i64 @ipow(i32 10, i64 %128)
%130 = sitofp i64 %129 to double
%131 = fmul double %127, %130
store double %131, double* %7
br label %142
132: ; preds = %123
%133 = load i64, i64* %11
%134 = icmp slt i64 %133, 0
br i1 %134, label %135, label %141
135: ; preds = %132
%136 = load double, double* %7
%137 = load i64, i64* %11
%138 = call i64 @ipow(i32 10, i64 %137)
%139 = sitofp i64 %138 to double
%140 = fdiv double %136, %139
store double %140, double* %7
br label %141
141: ; preds = %135, %132
br label %142
142: ; preds = %141, %126
%143 = load i64, i64* %4
%144 = icmp eq i64 %143, 1
br i1 %144, label %145, label %148
145: ; preds = %142
%146 = load double, double* %7
%147 = fsub double 0.000000e+00, %146
store double %147, double* %7
br label %148
148: ; preds = %145, %142
%149 = load double, double* %7
%150 = load double*, double** %2
store double %149, double* %150
%151 = load i64, i64* %10
ret i64 %151
}

LLVM IR (-O2):
define i64 @input_double(double* nocapture writeonly %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%4 = load i64, i64* inttoptr (i64 4294967808 to i64*)
%5 = add i64 %4, -58
%6 = icmp ult i64 %5, -10
br label %7
7: ; preds = %8, %1
switch i64 %4, label %9 [
i64 -1, label %10
i64 45, label %8
]
8: ; preds = %7, %9
br label %7
9: ; preds = %7
br label %8
10: ; preds = %7
%11 = load i64, i64* %2
%12 = icmp sgt i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = call i64 @ipow(i32 10, i64 %11)
%15 = sitofp i64 %14 to double
%16 = fmul double %15, 0.000000e+00
br label %23
17: ; preds = %10
%18 = icmp slt i64 %11, 0
br i1 %18, label %19, label %23
19: ; preds = %17
%20 = call i64 @ipow(i32 10, i64 %11)
%21 = sitofp i64 %20 to double
%22 = fdiv double 0.000000e+00, %21
br label %23
23: ; preds = %13, %19, %17
%24 = phi double [ %16, %13 ], [ %22, %19 ], [ 0.000000e+00, %17 ]
store double %24, double* %0
ret i64 -1
}