#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*/ getLine(char *, int);
int /*<<< orphan*/ sscanf(char *, char *, double *);
double getDouble() {
  char str[15];
  double result;
  getLine(str, 15);
  sscanf(str, "%lf", &result);
  int test = result;
  if ((test < -999999 && test != -9999999) || (test > 999999))
    return -8888888;
  return result;
}


x86 assembly (clang, -O0):
<getDouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x17(%rbp),%rdi
mov    $0xf,%esi
call   1040 <getLine@plt>
lea    -0x17(%rbp),%rdi
lea    0xec7(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1030 <sscanf@plt>
cvttsd2si -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0xfff0bdc1,-0x24(%rbp)
jge    116c <getDouble+0x4c>
cmpl   $0xff676981,-0x24(%rbp)
jne    1179 <getDouble+0x59>
cmpl   $0xf423f,-0x24(%rbp)
jle    118b <getDouble+0x6b>
movsd  0xe7f(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1195 <getDouble+0x75>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getDouble>:
push   %rbx
sub    $0x20,%rsp
lea    0x11(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xf,%esi
call   1040 <getLine@plt>
lea    0xeca(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1030 <sscanf@plt>
movsd  0x8(%rsp),%xmm2
cvttsd2si %xmm2,%eax
movsd  0xea3(%rip),%xmm0
movapd %xmm0,%xmm1
cmp    $0xff676981,%eax
je     1180 <getDouble+0x60>
cmp    $0xfff0bdc1,%eax
jge    118b <getDouble+0x6b>
cmp    $0xf4240,%eax
jge    117a <getDouble+0x5a>
movapd %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbx
ret
movapd %xmm2,%xmm1
cmp    $0xfff0bdc1,%eax
jl     116f <getDouble+0x4f>
movapd %xmm2,%xmm1
cmp    $0xf4240,%eax
jl     1176 <getDouble+0x56>
jmp    117a <getDouble+0x5a>

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
define double @getDouble() {
%1 = alloca double
%2 = alloca [15 x i8]
%3 = alloca double
%4 = alloca i32
%5 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%6 = call i32 @getLine(i8* %5, i32 15)
%7 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%8 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %3)
%9 = load double, double* %3
%10 = fptosi double %9 to i32
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, -999999
br i1 %12, label %13, label %16
13: ; preds = %0
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, -9999999
br i1 %15, label %19, label %16
16: ; preds = %13, %0
%17 = load i32, i32* %4
%18 = icmp sgt i32 %17, 999999
br i1 %18, label %19, label %20
19: ; preds = %16, %13
store double 0xC160F44700000000, double* %1
br label %22
20: ; preds = %16
%21 = load double, double* %3
store double %21, double* %1
br label %22
22: ; preds = %20, %19
%23 = load double, double* %1
ret double %23
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
define double @getDouble() {
%1 = alloca [15 x i8]
%2 = alloca double
%3 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%4 = bitcast double* %2 to i8*
%5 = call i32 @getLine(i8* %3, i32 15)
%6 = call i32 @sscanf(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%7 = load double, double* %2
%8 = fptosi double %7 to i32
%9 = icmp slt i32 %8, -999999
%10 = icmp ne i32 %8, -9999999
%11 = and i1 %9, %10
%12 = icmp sgt i32 %8, 999999
%13 = or i1 %12, %11
%14 = select i1 %13, double 0xC160F44700000000, double %7
ret double %14
}