#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 */
scalar_t__ CLOCKS_PER_SEC;
scalar_t__ clock();
int /*<<< orphan*/ printf(char *, unsigned int);
int main(int argc, char *argv[]) {
  double delay, frameStart, frameTime;
  unsigned int i, j, running;
  delay = ((double)CLOCKS_PER_SEC / 1000) / 60;
  running = 1;
  i = j = 0;
  while (running) {
    frameStart = frameTime = (double)clock();
    ++i;
    if (i > 60) {
      printf("%u \n", j);
      i = 0;
      j++;
    }
    while (frameTime / ((double)CLOCKS_PER_SEC / 1000) -
               frameStart / ((double)CLOCKS_PER_SEC / 1000) <
           delay) {
      frameTime = (double)clock();
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eab(%rip),%rax
cvtsi2sdq (%rax),%xmm0
movsd  0xebe(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xeaa(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x1,-0x34(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     123b <main+0x11b>
mov    $0x0,%al
call   1030 <clock@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x3c,-0x2c(%rbp)
jbe    11c6 <main+0xa6>
mov    -0x30(%rbp),%esi
lea    0xe5f(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11cb <main+0xab>
movsd  -0x28(%rbp),%xmm1
mov    0x2e11(%rip),%rax
cvtsi2sdq (%rax),%xmm0
movsd  0xe24(%rip),%xmm2
divsd  %xmm2,%xmm0
divsd  %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mov    0x2df0(%rip),%rax
cvtsi2sdq (%rax),%xmm2
movsd  0xe03(%rip),%xmm3
divsd  %xmm3,%xmm2
divsd  %xmm2,%xmm0
subsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1236 <main+0x116>
mov    $0x0,%al
call   1030 <clock@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    11cb <main+0xab>
jmp    1174 <main+0x54>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    0x2eb5(%rip),%rbp
cvtsi2sdq 0x0(%rbp),%xmm0
divsd  0xebf(%rip),%xmm0
divsd  0xebf(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xeba(%rip),%r14
xor    %r12d,%r12d
xor    %r15d,%r15d
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,%rbx
add    $0x1,%r12d
cmp    $0x3d,%r12d
jb     1186 <main+0x66>
mov    %r14,%rdi
mov    %r15d,%esi
call   1040 <printf@plt>
add    $0x1,%r15d
xor    %r12d,%r12d
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
unpcklpd %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
nopl   0x0(%rax,%rax,1)
xorps  %xmm1,%xmm1
cvtsi2sdq 0x0(%rbp),%xmm1
shufpd $0x2,0x10(%rsp),%xmm0
divsd  0xe48(%rip),%xmm1
unpcklpd %xmm1,%xmm1
divpd  %xmm1,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
subsd  %xmm1,%xmm0
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    1160 <main+0x40>
xor    %eax,%eax
call   1030 <clock@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
jmp    11a0 <main+0x80>

LLVM IR (-O0):
@CLOCKS_PER_SEC = global i64 0
@.str = [5 x i8] c"%u \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i64, i64* @CLOCKS_PER_SEC
%13 = sitofp i64 %12 to double
%14 = fdiv double %13, 1.000000e+03
%15 = fdiv double %14, 6.000000e+01
store double %15, double* %6
store i32 1, i32* %11
store i32 0, i32* %10
store i32 0, i32* %9
br label %16
16: ; preds = %49, %2
%17 = load i32, i32* %11
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %50
19: ; preds = %16
%20 = call i64 (...) @clock()
%21 = sitofp i64 %20 to double
store double %21, double* %8
store double %21, double* %7
%22 = load i32, i32* %9
%23 = add i32 %22, 1
store i32 %23, i32* %9
%24 = load i32, i32* %9
%25 = icmp ugt i32 %24, 60
br i1 %25, label %26, label %31
26: ; preds = %19
%27 = load i32, i32* %10
%28 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %27)
store i32 0, i32* %9
%29 = load i32, i32* %10
%30 = add i32 %29, 1
store i32 %30, i32* %10
br label %31
31: ; preds = %26, %19
br label %32
32: ; preds = %46, %31
%33 = load double, double* %8
%34 = load i64, i64* @CLOCKS_PER_SEC
%35 = sitofp i64 %34 to double
%36 = fdiv double %35, 1.000000e+03
%37 = fdiv double %33, %36
%38 = load double, double* %7
%39 = load i64, i64* @CLOCKS_PER_SEC
%40 = sitofp i64 %39 to double
%41 = fdiv double %40, 1.000000e+03
%42 = fdiv double %38, %41
%43 = fsub double %37, %42
%44 = load double, double* %6
%45 = fcmp olt double %43, %44
br i1 %45, label %46, label %49
46: ; preds = %32
%47 = call i64 (...) @clock()
%48 = sitofp i64 %47 to double
store double %48, double* %8
br label %32
49: ; preds = %32
br label %16
50: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global i64 0
@.str = [5 x i8] c"%u \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i64, i64* @CLOCKS_PER_SEC
%4 = sitofp i64 %3 to double
%5 = fdiv double %4, 1.000000e+03
%6 = fdiv double %5, 6.000000e+01
br label %7
7: ; preds = %21, %2
%8 = phi i32 [ 0, %2 ], [ %18, %21 ]
%9 = phi i32 [ 0, %2 ], [ %19, %21 ]
%10 = tail call i64 (...) @clock()
%11 = sitofp i64 %10 to double
%12 = add i32 %8, 1
%13 = icmp ugt i32 %12, 60
br i1 %13, label %14, label %17
14: ; preds = %7
%15 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %9)
%16 = add i32 %9, 1
br label %17
17: ; preds = %14, %7
%18 = phi i32 [ 0, %14 ], [ %12, %7 ]
%19 = phi i32 [ %16, %14 ], [ %9, %7 ]
%20 = insertelement <2 x double> poison, double %11, i64 1
br label %21
21: ; preds = %34, %17
%22 = phi double [ %11, %17 ], [ %36, %34 ]
%23 = load i64, i64* @CLOCKS_PER_SEC
%24 = sitofp i64 %23 to double
%25 = fdiv double %24, 1.000000e+03
%26 = insertelement <2 x double> %20, double %22, i64 0
%27 = insertelement <2 x double> poison, double %25, i64 0
%28 = shufflevector <2 x double> %27, <2 x double> poison, <2 x i32> zeroinitializer
%29 = fdiv <2 x double> %26, %28
%30 = shufflevector <2 x double> %29, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%31 = fsub <2 x double> %29, %30
%32 = extractelement <2 x double> %31, i64 0
%33 = fcmp olt double %32, %6
br i1 %33, label %34, label %7
34: ; preds = %21
%35 = tail call i64 (...) @clock()
%36 = sitofp i64 %35 to double
br label %21
}