#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 */
typedef float int32_t;

/* Variables and functions */
float const copysignfk(float, float);
float fabsfk(float);
scalar_t__ xisinff(float);
__attribute__((visibility("default"))) const float xceilf(float x) {
  float fr = x - (int32_t)x;
  fr = fr <= 0 ? fr : fr - 1.0f;
  return (xisinff(x) || fabsfk(x) >= (float)(1LL << 23))
             ? x
             : copysignfk(x - fr, x);
}


x86 assembly (clang, -O0):
<xceilf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     1168 <xceilf+0x38>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    117e <xceilf+0x4e>
movss  -0x8(%rbp),%xmm0
movss  0xe8b(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <xisinff@plt>
cmp    $0x0,%rax
jne    11b7 <xceilf+0x87>
movss  -0x4(%rbp),%xmm0
call   1050 <fabsfk@plt>
movss  0xe56(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     11c6 <xceilf+0x96>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    11df <xceilf+0xaf>
movss  -0x4(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
call   1030 <copysignfk@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xceilf>:
push   %rax
movss  %xmm0,0x4(%rsp)
call   1040 <xisinff@plt>
test   %rax,%rax
jne    118f <xceilf+0x5f>
movss  0x4(%rsp),%xmm0
call   1050 <fabsfk@plt>
ucomiss 0xeb1(%rip),%xmm0
jae    118f <xceilf+0x5f>
movss  0x4(%rsp),%xmm1
movaps %xmm1,%xmm0
subss  %xmm1,%xmm0
movss  0xe96(%rip),%xmm4
addss  %xmm0,%xmm4
xorps  %xmm2,%xmm2
movaps %xmm0,%xmm3
cmpless %xmm2,%xmm3
andps  %xmm3,%xmm0
andnps %xmm4,%xmm3
orps   %xmm0,%xmm3
movaps %xmm1,%xmm0
subss  %xmm3,%xmm0
pop    %rax
jmp    1030 <copysignfk@plt>
movss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @xceilf(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = load float, float* %2
%6 = fsub float %4, %5
store float %6, float* %3
%7 = load float, float* %3
%8 = fcmp ole float %7, 0.000000e+00
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load float, float* %3
br label %14
11: ; preds = %1
%12 = load float, float* %3
%13 = fsub float %12, 1.000000e+00
br label %14
14: ; preds = %11, %9
%15 = phi float [ %10, %9 ], [ %13, %11 ]
store float %15, float* %3
%16 = load float, float* %2
%17 = call i64 @xisinff(float %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %14
%20 = load float, float* %2
%21 = call float @fabsfk(float %20)
%22 = fcmp oge float %21, 0x4160000000000000
br i1 %22, label %23, label %25
23: ; preds = %19, %14
%24 = load float, float* %2
br label %31
25: ; preds = %19
%26 = load float, float* %2
%27 = load float, float* %3
%28 = fsub float %26, %27
%29 = load float, float* %2
%30 = call float @copysignfk(float %28, float %29)
br label %31
31: ; preds = %25, %23
%32 = phi float [ %24, %23 ], [ %30, %25 ]
ret float %32
}

LLVM IR (-O2):
define float @xceilf(float %0) {
%2 = fsub float %0, %0
%3 = fcmp ole float %2, 0.000000e+00
%4 = fadd float %2, -1.000000e+00
%5 = select i1 %3, float %2, float %4
%6 = tail call i64 @xisinff(float %0)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = tail call float @fabsfk(float %0)
%10 = fcmp ult float %9, 0x4160000000000000
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = fsub float %0, %5
%13 = tail call float @copysignfk(float %12, float %0)
br label %14
14: ; preds = %1, %8, %11
%15 = phi float [ %13, %11 ], [ %0, %8 ], [ %0, %1 ]
ret float %15
}