#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 */
double modf(double, double *);
int /*<<< orphan*/ printf(char *, double, ...);
int /*<<< orphan*/ scanf(char *, double *);
int main(void) {
  double num, frac, ni, arred;
  scanf("%lf", &num);
  frac = modf(num, &ni);
  printf("%.0lf\n%.4lf\n", ni, frac);
  if (frac < 0.5) {
    arred = ni;
  } else {
    arred = ni + 1;
  }
  printf("%.0lf", arred);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
lea    -0x20(%rbp),%rdi
call   1040 <modf@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xea1(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  0xe7e(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    119c <main+0x6c>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    11ae <main+0x7e>
movsd  0xe64(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xe67(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
lea    0xed5(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
movsd  0x8(%rsp),%xmm0
mov    %rsp,%rdi
call   1040 <modf@plt>
movaps %xmm0,%xmm1
movaps %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0xea8(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  0xe85(%rip),%xmm0
movapd 0x10(%rsp),%xmm1
cmpltsd 0xe7e(%rip),%xmm1
movapd 0x20(%rsp),%xmm2
addsd  %xmm2,%xmm0
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm0
lea    0xe76(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [13 x i8] c"%.0lf\0A%.4lf\0A\00"
@.str.2 = [6 x i8] c"%.0lf\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%7 = load double, double* %2
%8 = call double @modf(double %7, double* %4)
store double %8, double* %3
%9 = load double, double* %4
%10 = load double, double* %3
%11 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %9, double %10)
%12 = load double, double* %3
%13 = fcmp olt double %12, 5.000000e-01
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = load double, double* %4
store double %15, double* %5
br label %19
16: ; preds = %0
%17 = load double, double* %4
%18 = fadd double %17, 1.000000e+00
store double %18, double* %5
br label %19
19: ; preds = %16, %14
%20 = load double, double* %5
%21 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [13 x i8] c"%.0lf\0A%.4lf\0A\00"
@.str.2 = [6 x i8] c"%.0lf\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = bitcast double* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%6 = load double, double* %1
%7 = call double @modf(double %6, double* %2)
%8 = load double, double* %2
%9 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %8, double %7)
%10 = fcmp olt double %7, 5.000000e-01
%11 = fadd double %8, 1.000000e+00
%12 = select i1 %10, double %8, double %11
%13 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %12)
ret i32 0
}