#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 */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, float);
scalar_t__ scanf(char *, float *);
int main() {
  float n, out;
  while (scanf("%f", &n) != EOF) {
    if (n >= 0 && n < 2)
      out = n * (-1) + 2.5;
    else if (n >= 2 && n < 4)
      out = 2 - 1.5 * (n - 3) * (n - 3);
    else if (n >= 4 && n < 6)
      out = n / 2 - 1.5;
    printf("%0.3f\n", out);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xefa(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    0x2ea2(%rip),%rcx
cmp    (%rcx),%rax
je     12a2 <main+0x182>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     119d <main+0x7d>
movss  0xe98(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    119d <main+0x7d>
movss  0xe96(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe9d(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    128c <main+0x16c>
movss  -0x8(%rbp),%xmm0
movss  0xe56(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1230 <main+0x110>
movss  0xe49(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1230 <main+0x110>
movss  -0x8(%rbp),%xmm0
movss  0xe3a(%rip),%xmm1
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe36(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
movss  0xe19(%rip),%xmm2
subss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe02(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1287 <main+0x167>
movss  -0x8(%rbp),%xmm0
movss  0xdc7(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1282 <main+0x162>
movss  0xdba(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1282 <main+0x162>
movss  -0x8(%rbp),%xmm0
movss  0xd9b(%rip),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xda3(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1287 <main+0x167>
jmp    128c <main+0x16c>
movss  -0xc(%rbp),%xmm0
lea    0xd9b(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xf01(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x2ea8(%rip),%r12
cmp    (%r12),%rax
jne    1154 <main+0x34>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xed8(%rip),%r14
lea    0xece(%rip),%r15
lea    0x4(%rsp),%rbx
jmp    119d <main+0x7d>
nopl   0x0(%rax)
movss  0xea0(%rip),%xmm1
subss  %xmm0,%xmm1
mov    %r14,%rdi
movss  %xmm1,(%rsp)
movaps %xmm1,%xmm0
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmp    (%r12),%rax
je     1146 <main+0x26>
movss  0x4(%rsp),%xmm0
ucomiss 0xe72(%rip),%xmm0
jb     11b9 <main+0x99>
movss  0xe4c(%rip),%xmm1
ucomiss %xmm0,%xmm1
ja     1170 <main+0x50>
ucomiss 0xe40(%rip),%xmm0
jb     1200 <main+0xe0>
movss  0xe3a(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    1200 <main+0xe0>
addss  0xe3d(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
movaps %xmm0,%xmm1
mulsd  0xe3a(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xe36(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
jmp    117c <main+0x5c>
nopl   0x0(%rax,%rax,1)
ucomiss 0xdfd(%rip),%xmm0
jb     1237 <main+0x117>
movss  0xdf7(%rip),%xmm1
ucomiss %xmm0,%xmm1
movss  (%rsp),%xmm1
jbe    117c <main+0x5c>
mulss  0xde5(%rip),%xmm0
addss  0xde1(%rip),%xmm0
movaps %xmm0,%xmm1
jmp    117c <main+0x5c>
movss  (%rsp),%xmm1
jmp    117c <main+0x5c>

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@EOF = global i64 0
@.str.1 = [7 x i8] c"%0.3f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
br label %4
4: ; preds = %51, %0
%5 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %2)
%6 = load i64, i64* @EOF
%7 = icmp ne i64 %5, %6
br i1 %7, label %8, label %54
8: ; preds = %4
%9 = load float, float* %2
%10 = fcmp oge float %9, 0.000000e+00
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = load float, float* %2
%13 = fcmp olt float %12, 2.000000e+00
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load float, float* %2
%16 = fmul float %15, -1.000000e+00
%17 = fpext float %16 to double
%18 = fadd double %17, 2.500000e+00
%19 = fptrunc double %18 to float
store float %19, float* %3
br label %51
20: ; preds = %11, %8
%21 = load float, float* %2
%22 = fcmp oge float %21, 2.000000e+00
br i1 %22, label %23, label %37
23: ; preds = %20
%24 = load float, float* %2
%25 = fcmp olt float %24, 4.000000e+00
br i1 %25, label %26, label %37
26: ; preds = %23
%27 = load float, float* %2
%28 = fsub float %27, 3.000000e+00
%29 = fpext float %28 to double
%30 = fmul double 1.500000e+00, %29
%31 = load float, float* %2
%32 = fsub float %31, 3.000000e+00
%33 = fpext float %32 to double
%34 = fneg double %30
%35 = call double @llvm.fmuladd.f64(double %34, double %33, double 2.000000e+00)
%36 = fptrunc double %35 to float
store float %36, float* %3
br label %50
37: ; preds = %23, %20
%38 = load float, float* %2
%39 = fcmp oge float %38, 4.000000e+00
br i1 %39, label %40, label %49
40: ; preds = %37
%41 = load float, float* %2
%42 = fcmp olt float %41, 6.000000e+00
br i1 %42, label %43, label %49
43: ; preds = %40
%44 = load float, float* %2
%45 = fdiv float %44, 2.000000e+00
%46 = fpext float %45 to double
%47 = fsub double %46, 1.500000e+00
%48 = fptrunc double %47 to float
store float %48, float* %3
br label %49
49: ; preds = %43, %40, %37
br label %50
50: ; preds = %49, %26
br label %51
51: ; preds = %50, %14
%52 = load float, float* %3
%53 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), float %52)
br label %4
54: ; preds = %4
%55 = load i32, i32* %1
ret i32 %55
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@EOF = global i64 0
@.str.1 = [7 x i8] c"%0.3f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %37, label %6
6: ; preds = %0, %31
%7 = phi float [ %32, %31 ], [ undef, %0 ]
%8 = load float, float* %1
%9 = fcmp oge float %8, 0.000000e+00
%10 = fcmp olt float %8, 2.000000e+00
%11 = and i1 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %6
%13 = fsub float 2.500000e+00, %8
br label %31
14: ; preds = %6
%15 = fcmp oge float %8, 2.000000e+00
%16 = fcmp olt float %8, 4.000000e+00
%17 = and i1 %15, %16
br i1 %17, label %18, label %24
18: ; preds = %14
%19 = fadd float %8, -3.000000e+00
%20 = fpext float %19 to double
%21 = fmul double %20, -1.500000e+00
%22 = call double @llvm.fmuladd.f64(double %21, double %20, double 2.000000e+00)
%23 = fptrunc double %22 to float
br label %31
24: ; preds = %14
%25 = fcmp oge float %8, 4.000000e+00
%26 = fcmp olt float %8, 6.000000e+00
%27 = and i1 %25, %26
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = fmul float %8, 5.000000e-01
%30 = fadd float %29, -1.500000e+00
br label %31
31: ; preds = %18, %28, %24, %12
%32 = phi float [ %13, %12 ], [ %23, %18 ], [ %30, %28 ], [ %7, %24 ]
%33 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), float %32)
%34 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%35 = load i64, i64* @EOF
%36 = icmp eq i64 %34, %35
br i1 %36, label %37, label %6
37: ; preds = %31, %0
ret i32 0
}