#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ usleep(int);
void wait(double t) {
  while (t >= 0) {
    printf("  wait: %.1f  \r", t);
    fflush(stdout);
    t -= 0.1;
    usleep(100000);
  }
  printf("                  \r");
}


x86 assembly (clang, -O0):
<wait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1195 <wait+0x65>
movsd  -0x8(%rbp),%xmm0
lea    0xead(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
movsd  -0x8(%rbp),%xmm0
movsd  0xe83(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    $0x186a0,%edi
call   1050 <usleep@plt>
jmp    113d <wait+0xd>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait>:
push   %r14
push   %rbx
push   %rax
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1196 <wait+0x66>
lea    0xec3(%rip),%r14
mov    0x2e94(%rip),%rbx
nopl   0x0(%rax)
movsd  %xmm0,(%rsp)
mov    %r14,%rdi
movsd  (%rsp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
mov    (%rbx),%edi
call   1040 <fflush@plt>
movsd  (%rsp),%xmm0
addsd  0xe88(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    $0x186a0,%edi
call   1050 <usleep@plt>
xorpd  %xmm1,%xmm1
movsd  (%rsp),%xmm0
ucomisd %xmm1,%xmm0
jae    1150 <wait+0x20>
lea    0xe7b(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c" wait: %.1f \0D\00"
@stdout = global i32 0
@.str.1 = [20 x i8] c" \0D\00"
define void @wait(double %0) {
%2 = alloca double
store double %0, double* %2
br label %3
3: ; preds = %6, %1
%4 = load double, double* %2
%5 = fcmp oge double %4, 0.000000e+00
br i1 %5, label %6, label %14
6: ; preds = %3
%7 = load double, double* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %7)
%9 = load i32, i32* @stdout
%10 = call i32 @fflush(i32 %9)
%11 = load double, double* %2
%12 = fsub double %11, 1.000000e-01
store double %12, double* %2
%13 = call i32 @usleep(i32 100000)
br label %3
14: ; preds = %3
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c" wait: %.1f \0D\00"
@stdout = global i32 0
@.str.1 = [20 x i8] c" \0D\00"
define void @wait(double %0) {
%2 = fcmp ult double %0, 0.000000e+00
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi double [ %8, %3 ], [ %0, %1 ]
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %4)
%6 = load i32, i32* @stdout
%7 = tail call i32 @fflush(i32 %6)
%8 = fadd double %4, -1.000000e-01
%9 = tail call i32 @usleep(i32 100000)
%10 = fcmp ult double %8, 0.000000e+00
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
ret void
}