#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 */
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ usleep(int);
void sleeps(float time) {
  if (time > 0) {
    int sec = (int)time;
    int usec = (time - sec) * 1000000;
    if (sec > 0) {
      sleep(sec);
    }
    if (usec > 0) {
      usleep(usec);
    }
  }
}


x86 assembly (clang, -O0):
<sleeps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1190 <sleeps+0x70>
cvttss2si -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
subss  %xmm1,%xmm0
movss  0xea4(%rip),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1179 <sleeps+0x59>
mov    -0x8(%rbp),%edi
call   1030 <sleep@plt>
cmpl   $0x0,-0xc(%rbp)
jle    118b <sleeps+0x6b>
mov    -0xc(%rbp),%edi
call   1040 <usleep@plt>
jmp    1190 <sleeps+0x70>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sleeps>:
push   %rbx
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1159 <sleeps+0x39>
cvttss2si %xmm0,%edi
cvttps2dq %xmm0,%xmm1
cvtdq2ps %xmm1,%xmm1
subss  %xmm1,%xmm0
mulss  0xec0(%rip),%xmm0
cvttss2si %xmm0,%ebx
test   %edi,%edi
jle    114d <sleeps+0x2d>
call   1030 <sleep@plt>
test   %ebx,%ebx
jle    1159 <sleeps+0x39>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <usleep@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @sleeps(float %0) {
%2 = alloca float
%3 = alloca i32
%4 = alloca i32
store float %0, float* %2
%5 = load float, float* %2
%6 = fcmp ogt float %5, 0.000000e+00
br i1 %6, label %7, label %28
7: ; preds = %1
%8 = load float, float* %2
%9 = fptosi float %8 to i32
store i32 %9, i32* %3
%10 = load float, float* %2
%11 = load i32, i32* %3
%12 = sitofp i32 %11 to float
%13 = fsub float %10, %12
%14 = fmul float %13, 1.000000e+06
%15 = fptosi float %14 to i32
store i32 %15, i32* %4
%16 = load i32, i32* %3
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %7
%19 = load i32, i32* %3
%20 = call i32 @sleep(i32 %19)
br label %21
21: ; preds = %18, %7
%22 = load i32, i32* %4
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load i32, i32* %4
%26 = call i32 @usleep(i32 %25)
br label %27
27: ; preds = %24, %21
br label %28
28: ; preds = %27, %1
ret void
}

LLVM IR (-O2):
define void @sleeps(float %0) {
%2 = fcmp ogt float %0, 0.000000e+00
br i1 %2, label %3, label %16
3: ; preds = %1
%4 = fptosi float %0 to i32
%5 = sitofp i32 %4 to float
%6 = fsub float %0, %5
%7 = fmul float %6, 1.000000e+06
%8 = fptosi float %7 to i32
%9 = icmp sgt i32 %4, 0
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = tail call i32 @sleep(i32 %4)
br label %12
12: ; preds = %10, %3
%13 = icmp sgt i32 %8, 0
br i1 %13, label %14, label %16
14: ; preds = %12
%15 = tail call i32 @usleep(i32 %8)
br label %16
16: ; preds = %12, %14, %1
ret void
}