#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*/ dd_inc_d(double *, double);
int /*<<< orphan*/ dd_minus(double *);
int /*<<< orphan*/ dd_mlt(double *, double *);
int /*<<< orphan*/ dd_mlt_d(double *, double);
int /*<<< orphan*/ dd_npwr(double *, int, double *);
int sscanf(char const *, char *, int *);
int dd_read(const char *s, double *a) {
  const char *p = s;
  char ch;
  int sign = 0;
  int point = -1;
  int nd = 0;
  int e = 0;
  int done = 0;
  int nread;
  while (*p == ' ')
    p++;
  a[0] = 0.0;
  a[1] = 0.0;
  while ((done == 0) && (ch = *p) != '\0') {
    if (ch >= '0' && ch <= '9') {
      int d = ch - '0';
      double cd = (double)d;
      dd_mlt_d(a, 10.0);
      dd_inc_d(a, cd);
      nd++;
    } else {
      switch (ch) {
      case '.':
        if (point >= 0)
          return -1;
        point = nd;
        break;
      case '-':
      case '+':
        if (sign != 0 || nd > 0)
          return -1;
        sign = (ch == '-') ? -1 : 1;
        break;
      case 'E':
      case 'e':
        nread = sscanf(p + 1, "%d", &e);
        done = 1;
        if (nread != 1)
          return -1;
        break;
      default:
        return -1;
      }
    }
    p++;
  }
  if (point >= 0)
    e -= (nd - point);
  if (e != 0) {
    double acc[2];
    acc[0] = 10.0;
    acc[1] = 0.0;
    dd_npwr(acc, e, acc);
    dd_mlt(a, acc);
  }
  if (sign == -1)
    dd_minus(a);
  return 0;
}


x86 assembly (clang, -O0):
<dd_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0xffffffff,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    11bc <dd_read+0x5c>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    119b <dd_read+0x3b>
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
xor    %eax,%eax
cmpl   $0x0,-0x38(%rbp)
mov    %al,-0x61(%rbp)
jne    11f7 <dd_read+0x97>
mov    -0x20(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x21(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x61(%rbp)
mov    -0x61(%rbp),%al
test   $0x1,%al
jne    1207 <dd_read+0xa7>
jmp    1377 <dd_read+0x217>
movsbl -0x21(%rbp),%eax
cmp    $0x30,%eax
jl     1262 <dd_read+0x102>
movsbl -0x21(%rbp),%eax
cmp    $0x39,%eax
jg     1262 <dd_read+0x102>
movsbl -0x21(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x40(%rbp)
cvtsi2sdl -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
movsd  0xdbf(%rip),%xmm0
call   1050 <dd_mlt_d@plt>
mov    -0x18(%rbp),%rdi
movsd  -0x48(%rbp),%xmm0
call   1070 <dd_inc_d@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1366 <dd_read+0x206>
movsbl -0x21(%rbp),%eax
mov    %eax,-0x68(%rbp)
sub    $0x2b,%eax
je     12dc <dd_read+0x17c>
jmp    1277 <dd_read+0x117>
mov    -0x68(%rbp),%eax
sub    $0x2d,%eax
je     12dc <dd_read+0x17c>
jmp    1288 <dd_read+0x128>
mov    -0x68(%rbp),%eax
sub    $0x2e,%eax
je     12bb <dd_read+0x15b>
jmp    1299 <dd_read+0x139>
mov    -0x68(%rbp),%eax
sub    $0x45,%eax
je     1318 <dd_read+0x1b8>
jmp    12aa <dd_read+0x14a>
mov    -0x68(%rbp),%eax
sub    $0x65,%eax
je     1318 <dd_read+0x1b8>
jmp    1355 <dd_read+0x1f5>
cmpl   $0x0,-0x2c(%rbp)
jl     12d1 <dd_read+0x171>
movl   $0xffffffff,-0x4(%rbp)
jmp    13e5 <dd_read+0x285>
mov    -0x30(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    1361 <dd_read+0x201>
cmpl   $0x0,-0x28(%rbp)
jne    12f0 <dd_read+0x190>
cmpl   $0x0,-0x30(%rbp)
jle    12fc <dd_read+0x19c>
movl   $0xffffffff,-0x4(%rbp)
jmp    13e5 <dd_read+0x285>
movsbl -0x21(%rbp),%edx
mov    $0x1,%eax
mov    $0xffffffff,%ecx
cmp    $0x2d,%edx
cmove  %ecx,%eax
mov    %eax,-0x28(%rbp)
jmp    1361 <dd_read+0x201>
mov    -0x20(%rbp),%rdi
add    $0x1,%rdi
lea    0xce1(%rip),%rsi
lea    -0x34(%rbp),%rdx
call   1060 <sscanf@plt>
mov    %eax,-0x3c(%rbp)
movl   $0x1,-0x38(%rbp)
cmpl   $0x1,-0x3c(%rbp)
je     1350 <dd_read+0x1f0>
movl   $0xffffffff,-0x4(%rbp)
jmp    13e5 <dd_read+0x285>
jmp    1361 <dd_read+0x201>
movl   $0xffffffff,-0x4(%rbp)
jmp    13e5 <dd_read+0x285>
jmp    1366 <dd_read+0x206>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11d3 <dd_read+0x73>
cmpl   $0x0,-0x2c(%rbp)
jl     138f <dd_read+0x22f>
mov    -0x30(%rbp),%ecx
sub    -0x2c(%rbp),%ecx
mov    -0x34(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     13cb <dd_read+0x26b>
movsd  0xc5f(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x34(%rbp),%esi
lea    -0x60(%rbp),%rdx
call   1040 <dd_npwr@plt>
mov    -0x18(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1030 <dd_mlt@plt>
cmpl   $0xffffffff,-0x28(%rbp)
jne    13de <dd_read+0x27e>
mov    -0x18(%rbp),%rdi
call   1080 <dd_minus@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dd_read>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movl   $0x0,0x4(%rsp)
nopl   0x0(%rax)
cmpb   $0x20,(%rbx)
lea    0x1(%rbx),%rbx
je     1180 <dd_read+0x20>
xorps  %xmm0,%xmm0
movups %xmm0,(%r14)
mov    -0x1(%rbx),%al
test   %al,%al
je     1239 <dd_read+0xd9>
xor    %r13d,%r13d
mov    $0xffffffff,%r15d
xor    %r12d,%r12d
mov    $0xffffffff,%ebp
jmp    11ed <dd_read+0x8d>
xchg   %ax,%ax
add    $0xffffffd0,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r14,%rdi
movsd  0xe35(%rip),%xmm0
call   1050 <dd_mlt_d@plt>
mov    %r14,%rdi
movsd  0x8(%rsp),%xmm0
call   1070 <dd_inc_d@plt>
add    $0x1,%r13d
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1245 <dd_read+0xe5>
movsbl %al,%ecx
lea    -0x30(%rcx),%edx
cmp    $0x9,%dl
jbe    11b0 <dd_read+0x50>
lea    -0x2b(%rcx),%edx
cmp    $0x1a,%edx
ja     12b4 <dd_read+0x154>
lea    0xdfd(%rip),%rsi
movslq (%rsi,%rdx,4),%rcx
add    %rsi,%rcx
jmp    *%rcx
test   %r12d,%r12d
jne    1297 <dd_read+0x137>
test   %r13d,%r13d
jg     1297 <dd_read+0x137>
xor    %ecx,%ecx
cmp    $0x2d,%al
setne  %cl
lea    (%rcx,%rcx,1),%r12d
add    $0xffffffff,%r12d
jmp    11e2 <dd_read+0x82>
test   %r15d,%r15d
mov    %r13d,%r15d
js     11e2 <dd_read+0x82>
jmp    1297 <dd_read+0x137>
mov    $0xffffffff,%r15d
xor    %r12d,%r12d
xor    %r13d,%r13d
test   %r15d,%r15d
js     12a8 <dd_read+0x148>
sub    %r13d,%r15d
add    0x4(%rsp),%r15d
mov    %r15d,0x4(%rsp)
test   %r15d,%r15d
je     1287 <dd_read+0x127>
movsd  0xd9c(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %rbx,%rdx
call   1040 <dd_npwr@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <dd_mlt@plt>
xor    %ebp,%ebp
cmp    $0xffffffff,%r12d
jne    1297 <dd_read+0x137>
mov    %r14,%rdi
call   1080 <dd_minus@plt>
mov    %ebp,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x4(%rsp),%r15d
test   %r15d,%r15d
jne    125c <dd_read+0xfc>
jmp    1287 <dd_read+0x127>
cmp    $0x65,%ecx
jne    1297 <dd_read+0x137>
lea    0xdb4(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
call   1060 <sscanf@plt>
cmp    $0x1,%eax
je     1245 <dd_read+0xe5>
jmp    1297 <dd_read+0x137>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @dd_read(i8* %0, double* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca double*
%6 = alloca i8*
%7 = alloca i8
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca double
%16 = alloca [2 x double]
store i8* %0, i8** %4
store double* %1, double** %5
%17 = load i8*, i8** %4
store i8* %17, i8** %6
store i32 0, i32* %8
store i32 -1, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
br label %18
18: ; preds = %23, %2
%19 = load i8*, i8** %6
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 32
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = load i8*, i8** %6
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %6
br label %18
26: ; preds = %18
%27 = load double*, double** %5
%28 = getelementptr inbounds double, double* %27, i64 0
store double 0.000000e+00, double* %28
%29 = load double*, double** %5
%30 = getelementptr inbounds double, double* %29, i64 1
store double 0.000000e+00, double* %30
br label %31
31: ; preds = %94, %26
%32 = load i32, i32* %12
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %39
34: ; preds = %31
%35 = load i8*, i8** %6
%36 = load i8, i8* %35
store i8 %36, i8* %7
%37 = sext i8 %36 to i32
%38 = icmp ne i32 %37, 0
br label %39
39: ; preds = %34, %31
%40 = phi i1 [ false, %31 ], [ %38, %34 ]
br i1 %40, label %41, label %97
41: ; preds = %39
%42 = load i8, i8* %7
%43 = sext i8 %42 to i32
%44 = icmp sge i32 %43, 48
br i1 %44, label %45, label %62
45: ; preds = %41
%46 = load i8, i8* %7
%47 = sext i8 %46 to i32
%48 = icmp sle i32 %47, 57
br i1 %48, label %49, label %62
49: ; preds = %45
%50 = load i8, i8* %7
%51 = sext i8 %50 to i32
%52 = sub nsw i32 %51, 48
store i32 %52, i32* %14
%53 = load i32, i32* %14
%54 = sitofp i32 %53 to double
store double %54, double* %15
%55 = load double*, double** %5
%56 = call i32 @dd_mlt_d(double* %55, double 1.000000e+01)
%57 = load double*, double** %5
%58 = load double, double* %15
%59 = call i32 @dd_inc_d(double* %57, double %58)
%60 = load i32, i32* %10
%61 = add nsw i32 %60, 1
store i32 %61, i32* %10
br label %94
62: ; preds = %45, %41
%63 = load i8, i8* %7
%64 = sext i8 %63 to i32
switch i32 %64, label %92 [
i32 46, label %65
i32 45, label %71
i32 43, label %71
i32 69, label %84
i32 101, label %84
]
65: ; preds = %62
%66 = load i32, i32* %9
%67 = icmp sge i32 %66, 0
br i1 %67, label %68, label %69
68: ; preds = %65
store i32 -1, i32* %3
br label %126
69: ; preds = %65
%70 = load i32, i32* %10
store i32 %70, i32* %9
br label %93
71: ; preds = %62, %62
%72 = load i32, i32* %8
%73 = icmp ne i32 %72, 0
br i1 %73, label %77, label %74
74: ; preds = %71
%75 = load i32, i32* %10
%76 = icmp sgt i32 %75, 0
br i1 %76, label %77, label %78
77: ; preds = %74, %71
store i32 -1, i32* %3
br label %126
78: ; preds = %74
%79 = load i8, i8* %7
%80 = sext i8 %79 to i32
%81 = icmp eq i32 %80, 45
%82 = zext i1 %81 to i64
%83 = select i1 %81, i32 -1, i32 1
store i32 %83, i32* %8
br label %93
84: ; preds = %62, %62
%85 = load i8*, i8** %6
%86 = getelementptr inbounds i8, i8* %85, i64 1
%87 = call i32 @sscanf(i8* %86, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %11)
store i32 %87, i32* %13
store i32 1, i32* %12
%88 = load i32, i32* %13
%89 = icmp ne i32 %88, 1
br i1 %89, label %90, label %91
90: ; preds = %84
store i32 -1, i32* %3
br label %126
91: ; preds = %84
br label %93
92: ; preds = %62
store i32 -1, i32* %3
br label %126
93: ; preds = %91, %78, %69
br label %94
94: ; preds = %93, %49
%95 = load i8*, i8** %6
%96 = getelementptr inbounds i8, i8* %95, i32 1
store i8* %96, i8** %6
br label %31
97: ; preds = %39
%98 = load i32, i32* %9
%99 = icmp sge i32 %98, 0
br i1 %99, label %100, label %106
100: ; preds = %97
%101 = load i32, i32* %10
%102 = load i32, i32* %9
%103 = sub nsw i32 %101, %102
%104 = load i32, i32* %11
%105 = sub nsw i32 %104, %103
store i32 %105, i32* %11
br label %106
106: ; preds = %100, %97
%107 = load i32, i32* %11
%108 = icmp ne i32 %107, 0
br i1 %108, label %109, label %119
109: ; preds = %106
%110 = getelementptr inbounds [2 x double], [2 x double]* %16, i64 0, i64 0
store double 1.000000e+01, double* %110
%111 = getelementptr inbounds [2 x double], [2 x double]* %16, i64 0, i64 1
store double 0.000000e+00, double* %111
%112 = getelementptr inbounds [2 x double], [2 x double]* %16, i64 0, i64 0
%113 = load i32, i32* %11
%114 = getelementptr inbounds [2 x double], [2 x double]* %16, i64 0, i64 0
%115 = call i32 @dd_npwr(double* %112, i32 %113, double* %114)
%116 = load double*, double** %5
%117 = getelementptr inbounds [2 x double], [2 x double]* %16, i64 0, i64 0
%118 = call i32 @dd_mlt(double* %116, double* %117)
br label %119
119: ; preds = %109, %106
%120 = load i32, i32* %8
%121 = icmp eq i32 %120, -1
br i1 %121, label %122, label %125
122: ; preds = %119
%123 = load double*, double** %5
%124 = call i32 @dd_minus(double* %123)
br label %125
125: ; preds = %122, %119
store i32 0, i32* %3
br label %126
126: ; preds = %125, %92, %90, %77, %68
%127 = load i32, i32* %3
ret i32 %127
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @dd_read(i8* nocapture %0, double* %1) {
%3 = alloca i32
%4 = alloca <2 x double>
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
br label %6
6: ; preds = %6, %2
%7 = phi i8* [ %0, %2 ], [ %10, %6 ]
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 32
%10 = getelementptr inbounds i8, i8* %7, i64 1
br i1 %9, label %6, label %11
11: ; preds = %6
%12 = bitcast double* %1 to i8*
%13 = load i8, i8* %7
%14 = icmp eq i8 %13, 0
br i1 %14, label %51, label %15
15: ; preds = %11, %44
%16 = phi i8 [ %49, %44 ], [ %13, %11 ]
%17 = phi i32 [ %45, %44 ], [ -1, %11 ]
%18 = phi i32 [ %46, %44 ], [ 0, %11 ]
%19 = phi i32 [ %47, %44 ], [ 0, %11 ]
%20 = phi i8* [ %48, %44 ], [ %7, %11 ]
%21 = sext i8 %16 to i32
%22 = add i8 %16, -48
%23 = icmp ult i8 %22, 10
br i1 %23, label %24, label %30
24: ; preds = %15
%25 = add nsw i32 %21, -48
%26 = sitofp i32 %25 to double
%27 = call i32 @dd_mlt_d(double* %1, double 1.000000e+01)
%28 = call i32 @dd_inc_d(double* %1, double %26)
%29 = add nsw i32 %18, 1
br label %44
30: ; preds = %15
switch i32 %21, label %74 [
i32 46, label %31
i32 45, label %33
i32 43, label %33
i32 69, label %40
i32 101, label %40
]
31: ; preds = %30
%32 = icmp sgt i32 %17, -1
br i1 %32, label %74, label %44
33: ; preds = %30, %30
%34 = icmp ne i32 %19, 0
%35 = icmp sgt i32 %18, 0
%36 = select i1 %34, i1 true, i1 %35
br i1 %36, label %74, label %37
37: ; preds = %33
%38 = icmp eq i8 %16, 45
%39 = select i1 %38, i32 -1, i32 1
br label %44
40: ; preds = %30, %30
%41 = getelementptr inbounds i8, i8* %20, i64 1
%42 = call i32 @sscanf(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%43 = icmp eq i32 %42, 1
br i1 %43, label %51, label %74
44: ; preds = %31, %37, %24
%45 = phi i32 [ %17, %24 ], [ %17, %37 ], [ %18, %31 ]
%46 = phi i32 [ %29, %24 ], [ %18, %37 ], [ %18, %31 ]
%47 = phi i32 [ %19, %24 ], [ %39, %37 ], [ %19, %31 ]
%48 = getelementptr inbounds i8, i8* %20, i64 1
%49 = load i8, i8* %48
%50 = icmp eq i8 %49, 0
br i1 %50, label %51, label %15
51: ; preds = %44, %11, %40
%52 = phi i32 [ %19, %40 ], [ 0, %11 ], [ %47, %44 ]
%53 = phi i32 [ %18, %40 ], [ 0, %11 ], [ %46, %44 ]
%54 = phi i32 [ %17, %40 ], [ -1, %11 ], [ %45, %44 ]
%55 = icmp sgt i32 %54, -1
br i1 %55, label %56, label %60
56: ; preds = %51
%57 = sub i32 %54, %53
%58 = load i32, i32* %3
%59 = add i32 %58, %57
store i32 %59, i32* %3
br label %62
60: ; preds = %51
%61 = load i32, i32* %3
br label %62
62: ; preds = %60, %56
%63 = phi i32 [ %61, %60 ], [ %59, %56 ]
%64 = icmp eq i32 %63, 0
br i1 %64, label %70, label %65
65: ; preds = %62
%66 = bitcast <2 x double>* %4 to i8*
%67 = getelementptr inbounds <2 x double>, <2 x double>* %4, i64 0, i64 0
store <2 x double> <double 1.000000e+01, double 0.000000e+00>, <2 x double>* %4
%68 = call i32 @dd_npwr(double* %67, i32 %63, double* %67)
%69 = call i32 @dd_mlt(double* %1, double* %67)
br label %70
70: ; preds = %65, %62
%71 = icmp eq i32 %52, -1
br i1 %71, label %72, label %74
72: ; preds = %70
%73 = call i32 @dd_minus(double* %1)
br label %74
74: ; preds = %30, %33, %31, %40, %70, %72
%75 = phi i32 [ 0, %72 ], [ 0, %70 ], [ -1, %40 ], [ -1, %31 ], [ -1, %33 ], [ -1, %30 ]
ret i32 %75
}