#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 *, int, double);
int /*<<< orphan*/ scanf(char *, double *);
int main() {
  int b, c;
  double a;
  scanf("%lf", &a);
  if (a >= 0)
    printf("+ %d %g", (int)a, a - (int)a);
  if (a < 0)
    a = -a, printf("- %d %g", (int)a, a - (int)a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1174 <main+0x54>
cvttsd2si -0x18(%rbp),%esi
movsd  -0x18(%rbp),%xmm0
cvttsd2si -0x18(%rbp),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11c6 <main+0xa6>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
cvttsd2si -0x18(%rbp),%esi
movsd  -0x18(%rbp),%xmm0
cvttsd2si -0x18(%rbp),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
lea    0xe4b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
movsd  (%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1164 <main+0x44>
cvttsd2si %xmm0,%esi
cvttpd2dq %xmm0,%xmm1
cvtdq2pd %xmm1,%xmm1
subsd  %xmm1,%xmm0
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
xorpd  %xmm1,%xmm1
movsd  (%rsp),%xmm0
ucomisd %xmm0,%xmm1
jbe    1193 <main+0x73>
xorpd  0xe8e(%rip),%xmm0
cvttsd2si %xmm0,%esi
cvttpd2dq %xmm0,%xmm1
movlpd %xmm0,(%rsp)
cvtdq2pd %xmm1,%xmm1
subsd  %xmm1,%xmm0
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [8 x i8] c"+ %d %g\00"
@.str.2 = [8 x i8] c"- %d %g\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %4)
%6 = load double, double* %4
%7 = fcmp oge double %6, 0.000000e+00
br i1 %7, label %8, label %17
8: ; preds = %0
%9 = load double, double* %4
%10 = fptosi double %9 to i32
%11 = load double, double* %4
%12 = load double, double* %4
%13 = fptosi double %12 to i32
%14 = sitofp i32 %13 to double
%15 = fsub double %11, %14
%16 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %10, double %15)
br label %17
17: ; preds = %8, %0
%18 = load double, double* %4
%19 = fcmp olt double %18, 0.000000e+00
br i1 %19, label %20, label %31
20: ; preds = %17
%21 = load double, double* %4
%22 = fneg double %21
store double %22, double* %4
%23 = load double, double* %4
%24 = fptosi double %23 to i32
%25 = load double, double* %4
%26 = load double, double* %4
%27 = fptosi double %26 to i32
%28 = sitofp i32 %27 to double
%29 = fsub double %25, %28
%30 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %24, double %29)
br label %31
31: ; preds = %20, %17
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [8 x i8] c"+ %d %g\00"
@.str.2 = [8 x i8] c"- %d %g\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%4 = load double, double* %1
%5 = fcmp ult double %4, 0.000000e+00
br i1 %5, label %12, label %6
6: ; preds = %0
%7 = fptosi double %4 to i32
%8 = sitofp i32 %7 to double
%9 = fsub double %4, %8
%10 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %7, double %9)
%11 = load double, double* %1
br label %12
12: ; preds = %6, %0
%13 = phi double [ %11, %6 ], [ %4, %0 ]
%14 = fcmp olt double %13, 0.000000e+00
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = fneg double %13
store double %16, double* %1
%17 = fptosi double %16 to i32
%18 = sitofp i32 %17 to double
%19 = fsub double %16, %18
%20 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %17, double %19)
br label %21
21: ; preds = %15, %12
ret i32 0
}