#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 const fabsf(float);
float __rintf(float x) {
  static const float TWO23 = 8388608.0;
  if (fabsf(x) < TWO23) {
    if (x > 0.0) {
      x += TWO23;
      x -= TWO23;
    } else if (x < 0.0) {
      x = TWO23 - x;
      x = -(x - TWO23);
    }
  }
  return x;
}


x86 assembly (clang, -O0):
<__rintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <fabsf@plt>
movaps %xmm0,%xmm1
movss  0xece(%rip),%xmm0
ucomiss %xmm1,%xmm0
jbe    11d3 <__rintf+0xc3>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    117e <__rintf+0x6e>
movss  0xea7(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xe90(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ce <__rintf+0xbe>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    11c9 <__rintf+0xb9>
movss  0xe64(%rip),%xmm0
subss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xe4d(%rip),%xmm1
subss  %xmm1,%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ce <__rintf+0xbe>
jmp    11d3 <__rintf+0xc3>
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__rintf>:
movaps 0xef9(%rip),%xmm2
andps  %xmm0,%xmm2
movss  0xf0e(%rip),%xmm1
ucomiss %xmm2,%xmm1
jbe    114b <__rintf+0x4b>
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm0
jbe    1130 <__rintf+0x30>
addss  0xef9(%rip),%xmm0
addss  0xef5(%rip),%xmm0
ret
ucomiss %xmm0,%xmm2
jbe    114b <__rintf+0x4b>
subss  %xmm0,%xmm1
addss  0xee3(%rip),%xmm1
xorps  0xec8(%rip),%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
@__rintf.TWO23 = internal constant float 0x4160000000000000
define float @__rintf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @fabsf(float %3)
%5 = fcmp olt float %4, 0x4160000000000000
br i1 %5, label %6, label %27
6: ; preds = %1
%7 = load float, float* %2
%8 = fpext float %7 to double
%9 = fcmp ogt double %8, 0.000000e+00
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = load float, float* %2
%12 = fadd float %11, 0x4160000000000000
store float %12, float* %2
%13 = load float, float* %2
%14 = fsub float %13, 0x4160000000000000
store float %14, float* %2
br label %26
15: ; preds = %6
%16 = load float, float* %2
%17 = fpext float %16 to double
%18 = fcmp olt double %17, 0.000000e+00
br i1 %18, label %19, label %25
19: ; preds = %15
%20 = load float, float* %2
%21 = fsub float 0x4160000000000000, %20
store float %21, float* %2
%22 = load float, float* %2
%23 = fsub float %22, 0x4160000000000000
%24 = fneg float %23
store float %24, float* %2
br label %25
25: ; preds = %19, %15
br label %26
26: ; preds = %25, %10
br label %27
27: ; preds = %26, %1
%28 = load float, float* %2
ret float %28
}

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