#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 */
float fabs(float);
float floorf(float);
float __rnint(float x) {
  if (fabs(x) >= 8388608.0F)
    return (x);
  else
    return (x >= 0.0F ? floorf(x + .5F) : -floorf(.5F - x));
}


x86 assembly (clang, -O0):
<__rnint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
call   1040 <fabs@plt>
movss  0xec1(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1157 <__rnint+0x37>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11b2 <__rnint+0x92>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1184 <__rnint+0x64>
movss  0xe94(%rip),%xmm0
addss  -0x8(%rbp),%xmm0
call   1030 <floorf@plt>
movss  %xmm0,-0xc(%rbp)
jmp    11a8 <__rnint+0x88>
movss  0xe78(%rip),%xmm0
subss  -0x8(%rbp),%xmm0
call   1030 <floorf@plt>
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__rnint>:
push   %rax
movaps 0xee8(%rip),%xmm1
andps  %xmm0,%xmm1
ucomiss 0xefe(%rip),%xmm1
jae    1147 <__rnint+0x37>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jae    1149 <__rnint+0x39>
movss  0xef0(%rip),%xmm1
subss  %xmm0,%xmm1
movaps %xmm1,%xmm0
call   1030 <floorf@plt>
xorps  0xec9(%rip),%xmm0
pop    %rax
ret
addss  0xed3(%rip),%xmm0
pop    %rax
jmp    1030 <floorf@plt>

LLVM IR (-O0):
define float @__rnint(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = call float @fabs(float %4)
%6 = fcmp oge float %5, 0x4160000000000000
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load float, float* %3
store float %8, float* %2
br label %23
9: ; preds = %1
%10 = load float, float* %3
%11 = fcmp oge float %10, 0.000000e+00
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load float, float* %3
%14 = fadd float %13, 5.000000e-01
%15 = call float @llvm.floor.f32(float %14)
br label %21
16: ; preds = %9
%17 = load float, float* %3
%18 = fsub float 5.000000e-01, %17
%19 = call float @llvm.floor.f32(float %18)
%20 = fneg float %19
br label %21
21: ; preds = %16, %12
%22 = phi float [ %15, %12 ], [ %20, %16 ]
store float %22, float* %2
br label %23
23: ; preds = %21, %7
%24 = load float, float* %2
ret float %24
}

LLVM IR (-O2):
define float @__rnint(float %0) {
%2 = tail call float @llvm.fabs.f32(float %0)
%3 = fcmp ult float %2, 0x4160000000000000
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = fcmp ult float %0, 0.000000e+00
br i1 %5, label %9, label %6
6: ; preds = %4
%7 = fadd float %0, 5.000000e-01
%8 = tail call float @llvm.floor.f32(float %7)
br label %13
9: ; preds = %4
%10 = fsub float 5.000000e-01, %0
%11 = tail call float @llvm.floor.f32(float %10)
%12 = fneg float %11
br label %13
13: ; preds = %6, %9, %1
%14 = phi float [ %0, %1 ], [ %8, %6 ], [ %12, %9 ]
ret float %14
}