#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 scalar_t__ clock_t;

/* Variables and functions */
float CLOCKS_PER_SEC;
float ceil(float);
scalar_t__ clock();
int /*<<< orphan*/ printf(char *, float);
int main(int argc, char **argv) {
  printf("Booting selected item automatically in %d seconds\n", 10);
  clock_t t = clock();
  int timeLeft = 10;
  const float timeoutFloat = (float)10;
  float timeLeftFloat = (float)timeLeft;
  float passed;
  while (passed < 10) {
    passed = ceil(((float)(clock() - t)) / CLOCKS_PER_SEC);
    if ((timeoutFloat - passed) < timeLeftFloat) {
      timeLeftFloat = (timeoutFloat - passed);
      timeLeft = (int)timeLeftFloat;
      printf("Booting selected item automatically in %d seconds\n", timeLeft);
    }
  }
  printf("passed=%f\n", passed);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb7(%rip),%rdi
movss  0xeab(%rip),%xmm0
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x18(%rbp)
movl   $0xa,-0x1c(%rbp)
movss  0xe8c(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
cvtsi2ssl -0x1c(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  0xe75(%rip),%xmm0
ucomiss -0x28(%rbp),%xmm0
jbe    1205 <main+0xd5>
mov    $0x0,%al
call   1040 <clock@plt>
sub    -0x18(%rbp),%rax
cvtsi2ss %rax,%xmm0
mov    0x2e3c(%rip),%rax
divss  (%rax),%xmm0
call   1030 <ceil@plt>
movss  %xmm0,-0x28(%rbp)
movss  0xe3e(%rip),%xmm1
subss  -0x28(%rbp),%xmm1
movss  -0x24(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1200 <main+0xd0>
movss  0xe23(%rip),%xmm0
subss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
cvttss2si -0x24(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cvtsi2ssl -0x1c(%rbp),%xmm0
lea    0xe09(%rip),%rdi
call   1050 <printf@plt>
jmp    1183 <main+0x53>
movss  -0x28(%rbp),%xmm0
lea    0xe26(%rip),%rdi
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedc(%rip),%rdi
movss  0xed0(%rip),%xmm0
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <clock@plt>
lea    0xef4(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [51 x i8] c"Booting selected item automatically in %d seconds\0A\00"
@CLOCKS_PER_SEC = global float 0.000000e+00
@.str.1 = [11 x i8] c"passed=%f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), float 1.000000e+01)
%12 = call i64 (...) @clock()
store i64 %12, i64* %6
store i32 10, i32* %7
store float 1.000000e+01, float* %8
%13 = load i32, i32* %7
%14 = sitofp i32 %13 to float
store float %14, float* %9
br label %15
15: ; preds = %38, %2
%16 = load float, float* %10
%17 = fcmp olt float %16, 1.000000e+01
br i1 %17, label %18, label %39
18: ; preds = %15
%19 = call i64 (...) @clock()
%20 = load i64, i64* %6
%21 = sub nsw i64 %19, %20
%22 = sitofp i64 %21 to float
%23 = load float, float* @CLOCKS_PER_SEC
%24 = fdiv float %22, %23
%25 = call float @ceil(float %24)
store float %25, float* %10
%26 = load float, float* %10
%27 = fsub float 1.000000e+01, %26
%28 = load float, float* %9
%29 = fcmp olt float %27, %28
br i1 %29, label %30, label %38
30: ; preds = %18
%31 = load float, float* %10
%32 = fsub float 1.000000e+01, %31
store float %32, float* %9
%33 = load float, float* %9
%34 = fptosi float %33 to i32
store i32 %34, i32* %7
%35 = load i32, i32* %7
%36 = sitofp i32 %35 to float
%37 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), float %36)
br label %38
38: ; preds = %30, %18
br label %15
39: ; preds = %15
%40 = load float, float* %10
%41 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), float %40)
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
@.str = [51 x i8] c"Booting selected item automatically in %d seconds\0A\00"
@CLOCKS_PER_SEC = global float 0.000000e+00
@.str.1 = [11 x i8] c"passed=%f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), float 1.000000e+01)
%4 = tail call i64 (...) @clock()
%5 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), float undef)
ret i32 0
}