#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 NAN;
double fabsf(float);
scalar_t__ isnan(float);
int /*<<< orphan*/ modff(float, float *);
float ceilf(float x) {
  float x1 = x;
  if (isnan(x)) {
    return NAN;
  }
  modff(x, &x);
  if (x1 > 0.0 && fabsf(x1 - x) > 0.0) {
    x += 1.0;
  }
  return x;
}


x86 assembly (clang, -O0):
<ceilf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
call   1050 <isnan@plt>
cmp    $0x0,%rax
je     1170 <ceilf+0x40>
mov    0x2e96(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11d8 <ceilf+0xa8>
movss  -0x8(%rbp),%xmm0
lea    -0x8(%rbp),%rdi
call   1040 <modff@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11ce <ceilf+0x9e>
movss  -0xc(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
call   1030 <fabsf@plt>
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11ce <ceilf+0x9e>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe3f(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ceilf>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0x8(%rsp)
movss  %xmm0,0x4(%rsp)
call   1050 <isnan@plt>
test   %rax,%rax
je     1154 <ceilf+0x24>
mov    0x2ea6(%rip),%rbx
jmp    11ad <ceilf+0x7d>
lea    0x8(%rsp),%rbx
movss  0x4(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <modff@plt>
xorps  %xmm0,%xmm0
movss  0x4(%rsp),%xmm1
ucomiss %xmm0,%xmm1
jbe    11ad <ceilf+0x7d>
movss  0x8(%rsp),%xmm1
movss  0x4(%rsp),%xmm0
movss  %xmm1,0xc(%rsp)
subss  %xmm1,%xmm0
call   1030 <fabsf@plt>
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11ad <ceilf+0x7d>
movss  0xc(%rsp),%xmm0
addss  0xe59(%rip),%xmm0
movss  %xmm0,0x8(%rsp)
movss  (%rbx),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@NAN = global float 0.000000e+00
define float @ceilf(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %3
%5 = load float, float* %3
store float %5, float* %4
%6 = load float, float* %3
%7 = call i64 @isnan(float %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load float, float* @NAN
store float %10, float* %2
br label %30
11: ; preds = %1
%12 = load float, float* %3
%13 = call i32 @modff(float %12, float* %3)
%14 = load float, float* %4
%15 = fpext float %14 to double
%16 = fcmp ogt double %15, 0.000000e+00
br i1 %16, label %17, label %28
17: ; preds = %11
%18 = load float, float* %4
%19 = load float, float* %3
%20 = fsub float %18, %19
%21 = call double @fabsf(float %20)
%22 = fcmp ogt double %21, 0.000000e+00
br i1 %22, label %23, label %28
23: ; preds = %17
%24 = load float, float* %3
%25 = fpext float %24 to double
%26 = fadd double %25, 1.000000e+00
%27 = fptrunc double %26 to float
store float %27, float* %3
br label %28
28: ; preds = %23, %17, %11
%29 = load float, float* %3
store float %29, float* %2
br label %30
30: ; preds = %28, %9
%31 = load float, float* %2
ret float %31
}

LLVM IR (-O2):
@NAN = global float 0.000000e+00
define float @ceilf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = tail call i64 @isnan(float %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %15
5: ; preds = %1
%6 = call i32 @modff(float %0, float* %2)
%7 = fcmp ogt float %0, 0.000000e+00
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = load float, float* %2
%10 = fsub float %0, %9
%11 = tail call double @fabsf(float %10)
%12 = fcmp ogt double %11, 0.000000e+00
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = fadd float %9, 1.000000e+00
store float %14, float* %2
br label %15
15: ; preds = %5, %8, %13, %1
%16 = phi float* [ @NAN, %1 ], [ %2, %13 ], [ %2, %8 ], [ %2, %5 ]
%17 = load float, float* %16
ret float %17
}