#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*/ output_char(char);
int /*<<< orphan*/ output_double_binary(double);
int /*<<< orphan*/ output_q(long);
void output_double(double d) {
  long n;
  long i;
  if (d < 0.0) {
    d = 0.0 - d;
    output_char('-');
  }
  if (d > 9220000000000000000.0) {
    output_double_binary(d);
    return;
  }
  if (d < 0.0000001) {
    output_double_binary(d);
    return;
  }
  n = (long)d;
  output_q(n);
  d = d - (double)n;
  output_char('.');
  for (i = 0; i < 16; i = i + 1) {
    d = d * 10.0;
    n = (long)d;
    output_q(n);
    d = d - (double)n;
  }
  return;
}


x86 assembly (clang, -O0):
<output_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1162 <output_double+0x32>
xorps  %xmm0,%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    $0x2d,%edi
call   1040 <output_char@plt>
movsd  -0x8(%rbp),%xmm0
movsd  0xe91(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1188 <output_double+0x58>
movsd  -0x8(%rbp),%xmm0
call   1050 <output_double_binary@plt>
jmp    123d <output_double+0x10d>
movsd  0xe78(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    11aa <output_double+0x7a>
movsd  -0x8(%rbp),%xmm0
call   1050 <output_double_binary@plt>
jmp    123d <output_double+0x10d>
cvttsd2si -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <output_q@plt>
movsd  -0x8(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    $0x2e,%edi
call   1040 <output_char@plt>
movq   $0x0,-0x18(%rbp)
cmpq   $0x10,-0x18(%rbp)
jge    1238 <output_double+0x108>
movsd  0xe1a(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <output_q@plt>
movsd  -0x8(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11e3 <output_double+0xb3>
jmp    123d <output_double+0x10d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_double>:
push   %rbx
sub    $0x10,%rsp
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    1159 <output_double+0x29>
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
mov    $0x2d,%edi
call   1040 <output_char@plt>
movsd  0x8(%rsp),%xmm0
ucomisd 0xe9f(%rip),%xmm0
ja     1171 <output_double+0x41>
movsd  0xe9d(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    117b <output_double+0x4b>
add    $0x10,%rsp
pop    %rbx
jmp    1050 <output_double_binary@plt>
cvttsd2si %xmm0,%rbx
mov    %rbx,%rdi
movsd  %xmm0,0x8(%rsp)
call   1030 <output_q@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
mov    $0x2e,%edi
call   1040 <output_char@plt>
movsd  0x8(%rsp),%xmm0
mulsd  0xe52(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
cvttsd2si %xmm0,%rbx
mov    %rbx,%rdi
call   1030 <output_q@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xe25(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
cvttsd2si %xmm1,%rbx
mov    %rbx,%rdi
call   1030 <output_q@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xdf8(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
cvttsd2si %xmm1,%rbx
mov    %rbx,%rdi
call   1030 <output_q@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xdcb(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
cvttsd2si %xmm1,%rbx
mov    %rbx,%rdi
call   1030 <output_q@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xd9e(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
cvttsd2si %xmm1,%rbx
mov    %rbx,%rdi
call   1030 <output_q@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xd71(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
cvttsd2si %xmm1,%rbx
mov    %rbx,%rdi
call   1030 <output_q@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xd44(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
cvttsd2si %xmm1,%rbx
mov    %rbx,%rdi
call   1030 <output_q@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xd17(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
cvttsd2si %xmm1,%rbx
mov    %rbx,%rdi
call   1030 <output_q@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xcea(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
cvttsd2si %xmm1,%rbx
mov    %rbx,%rdi
call   1030 <output_q@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xcbd(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
cvttsd2si %xmm1,%rbx
mov    %rbx,%rdi
call   1030 <output_q@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xc90(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
cvttsd2si %xmm1,%rbx
mov    %rbx,%rdi
call   1030 <output_q@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xc63(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
cvttsd2si %xmm1,%rbx
mov    %rbx,%rdi
call   1030 <output_q@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xc36(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
cvttsd2si %xmm1,%rbx
mov    %rbx,%rdi
call   1030 <output_q@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xc09(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
cvttsd2si %xmm1,%rbx
mov    %rbx,%rdi
call   1030 <output_q@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xbdc(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
cvttsd2si %xmm1,%rbx
mov    %rbx,%rdi
call   1030 <output_q@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xbaf(%rip),%xmm1
cvttsd2si %xmm1,%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1030 <output_q@plt>

LLVM IR (-O0):
define void @output_double(double %0) {
%2 = alloca double
%3 = alloca i64
%4 = alloca i64
store double %0, double* %2
%5 = load double, double* %2
%6 = fcmp olt double %5, 0.000000e+00
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load double, double* %2
%9 = fsub double 0.000000e+00, %8
store double %9, double* %2
%10 = call i32 @output_char(i8 signext 45)
br label %11
11: ; preds = %7, %1
%12 = load double, double* %2
%13 = fcmp ogt double %12, 9.220000e+18
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load double, double* %2
%16 = call i32 @output_double_binary(double %15)
br label %51
17: ; preds = %11
%18 = load double, double* %2
%19 = fcmp olt double %18, 0x3E7AD7F29ABCAF48
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load double, double* %2
%22 = call i32 @output_double_binary(double %21)
br label %51
23: ; preds = %17
%24 = load double, double* %2
%25 = fptosi double %24 to i64
store i64 %25, i64* %3
%26 = load i64, i64* %3
%27 = call i32 @output_q(i64 %26)
%28 = load double, double* %2
%29 = load i64, i64* %3
%30 = sitofp i64 %29 to double
%31 = fsub double %28, %30
store double %31, double* %2
%32 = call i32 @output_char(i8 signext 46)
store i64 0, i64* %4
br label %33
33: ; preds = %47, %23
%34 = load i64, i64* %4
%35 = icmp slt i64 %34, 16
br i1 %35, label %36, label %50
36: ; preds = %33
%37 = load double, double* %2
%38 = fmul double %37, 1.000000e+01
store double %38, double* %2
%39 = load double, double* %2
%40 = fptosi double %39 to i64
store i64 %40, i64* %3
%41 = load i64, i64* %3
%42 = call i32 @output_q(i64 %41)
%43 = load double, double* %2
%44 = load i64, i64* %3
%45 = sitofp i64 %44 to double
%46 = fsub double %43, %45
store double %46, double* %2
br label %47
47: ; preds = %36
%48 = load i64, i64* %4
%49 = add nsw i64 %48, 1
store i64 %49, i64* %4
br label %33
50: ; preds = %33
br label %51
51: ; preds = %50, %20, %14
ret void
}

LLVM IR (-O2):
define void @output_double(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = fsub double 0.000000e+00, %0
%5 = tail call i32 @output_char(i8 signext 45)
br label %6
6: ; preds = %3, %1
%7 = phi double [ %4, %3 ], [ %0, %1 ]
%8 = fcmp ogt double %7, 9.220000e+18
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 @output_double_binary(double %7)
br label %99
11: ; preds = %6
%12 = fcmp olt double %7, 0x3E7AD7F29ABCAF48
br i1 %12, label %13, label %15
13: ; preds = %11
%14 = tail call i32 @output_double_binary(double %7)
br label %99
15: ; preds = %11
%16 = fptosi double %7 to i64
%17 = tail call i32 @output_q(i64 %16)
%18 = sitofp i64 %16 to double
%19 = fsub double %7, %18
%20 = tail call i32 @output_char(i8 signext 46)
%21 = fmul double %19, 1.000000e+01
%22 = fptosi double %21 to i64
%23 = tail call i32 @output_q(i64 %22)
%24 = sitofp i64 %22 to double
%25 = fsub double %21, %24
%26 = fmul double %25, 1.000000e+01
%27 = fptosi double %26 to i64
%28 = tail call i32 @output_q(i64 %27)
%29 = sitofp i64 %27 to double
%30 = fsub double %26, %29
%31 = fmul double %30, 1.000000e+01
%32 = fptosi double %31 to i64
%33 = tail call i32 @output_q(i64 %32)
%34 = sitofp i64 %32 to double
%35 = fsub double %31, %34
%36 = fmul double %35, 1.000000e+01
%37 = fptosi double %36 to i64
%38 = tail call i32 @output_q(i64 %37)
%39 = sitofp i64 %37 to double
%40 = fsub double %36, %39
%41 = fmul double %40, 1.000000e+01
%42 = fptosi double %41 to i64
%43 = tail call i32 @output_q(i64 %42)
%44 = sitofp i64 %42 to double
%45 = fsub double %41, %44
%46 = fmul double %45, 1.000000e+01
%47 = fptosi double %46 to i64
%48 = tail call i32 @output_q(i64 %47)
%49 = sitofp i64 %47 to double
%50 = fsub double %46, %49
%51 = fmul double %50, 1.000000e+01
%52 = fptosi double %51 to i64
%53 = tail call i32 @output_q(i64 %52)
%54 = sitofp i64 %52 to double
%55 = fsub double %51, %54
%56 = fmul double %55, 1.000000e+01
%57 = fptosi double %56 to i64
%58 = tail call i32 @output_q(i64 %57)
%59 = sitofp i64 %57 to double
%60 = fsub double %56, %59
%61 = fmul double %60, 1.000000e+01
%62 = fptosi double %61 to i64
%63 = tail call i32 @output_q(i64 %62)
%64 = sitofp i64 %62 to double
%65 = fsub double %61, %64
%66 = fmul double %65, 1.000000e+01
%67 = fptosi double %66 to i64
%68 = tail call i32 @output_q(i64 %67)
%69 = sitofp i64 %67 to double
%70 = fsub double %66, %69
%71 = fmul double %70, 1.000000e+01
%72 = fptosi double %71 to i64
%73 = tail call i32 @output_q(i64 %72)
%74 = sitofp i64 %72 to double
%75 = fsub double %71, %74
%76 = fmul double %75, 1.000000e+01
%77 = fptosi double %76 to i64
%78 = tail call i32 @output_q(i64 %77)
%79 = sitofp i64 %77 to double
%80 = fsub double %76, %79
%81 = fmul double %80, 1.000000e+01
%82 = fptosi double %81 to i64
%83 = tail call i32 @output_q(i64 %82)
%84 = sitofp i64 %82 to double
%85 = fsub double %81, %84
%86 = fmul double %85, 1.000000e+01
%87 = fptosi double %86 to i64
%88 = tail call i32 @output_q(i64 %87)
%89 = sitofp i64 %87 to double
%90 = fsub double %86, %89
%91 = fmul double %90, 1.000000e+01
%92 = fptosi double %91 to i64
%93 = tail call i32 @output_q(i64 %92)
%94 = sitofp i64 %92 to double
%95 = fsub double %91, %94
%96 = fmul double %95, 1.000000e+01
%97 = fptosi double %96 to i64
%98 = tail call i32 @output_q(i64 %97)
br label %99
99: ; preds = %15, %13, %9
ret void
}