#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 int time_t;

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, int);
int time(int /*<<< orphan*/ *);
int /*<<< orphan*/ usleep(int);
int main(void) {
  time_t current_time1;
  time_t current_time2;
  time_t temp_time;
  char *c_time_string;
  int i = 0;
  int k = 0;
  float j;
  current_time1 = time(NULL);
  for (i = 0; i <= 1000000000; i++) {
    usleep(8000);
    j = j + i / 3;
    if ((time(NULL) - current_time1) >= 10) {
      current_time1 = time(NULL);
      k = i;
    }
    if ((i - k) < 100)
      printf(":%d:", i - k);
  }
  current_time2 = time(NULL);
  (void)printf("1T loops take: %d sec.\n", current_time2 - current_time1);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3b9aca00,-0x1c(%rbp)
jg     11ef <main+0xbf>
mov    $0x1f40,%edi
call   1050 <usleep@plt>
movss  -0x24(%rbp),%xmm0
mov    -0x1c(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
sub    -0x8(%rbp),%eax
cmp    $0xa,%eax
jl     11bb <main+0x8b>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x8(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
sub    -0x20(%rbp),%eax
cmp    $0x64,%eax
jge    11dc <main+0xac>
mov    -0x1c(%rbp),%esi
sub    -0x20(%rbp),%esi
lea    0xe29(%rip),%rdi
call   1030 <printf@plt>
jmp    11e1 <main+0xb1>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1160 <main+0x30>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
sub    -0x8(%rbp),%esi
lea    0xdfd(%rip),%rdi
call   1030 <printf@plt>
mov    0x2dcc(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%r15d
lea    0xeb6(%rip),%r14
xor    %ebp,%ebp
jmp    115b <main+0x2b>
xchg   %ax,%ax
add    $0x1,%ebp
cmp    $0x3b9aca01,%ebp
je     1193 <main+0x63>
mov    $0x1f40,%edi
call   1050 <usleep@plt>
xor    %edi,%edi
call   1040 <time@plt>
sub    %r15d,%eax
cmp    $0xa,%eax
jl     1180 <main+0x50>
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%r15d
mov    %ebp,%ebx
mov    %ebp,%esi
sub    %ebx,%esi
cmp    $0x63,%esi
jg     1150 <main+0x20>
mov    %r14,%rdi
call   1030 <printf@plt>
jmp    1150 <main+0x20>
xor    %edi,%edi
call   1040 <time@plt>
sub    %r15d,%eax
lea    0xe61(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0x2e2e(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c":%d:\00"
@.str.1 = [24 x i8] c"1T loops take: %d sec.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca float
store i32 0, i32* %1
store i32 0, i32* %6
store i32 0, i32* %7
%9 = call i32 @time(i32* null)
store i32 %9, i32* %2
store i32 0, i32* %6
br label %10
10: ; preds = %38, %0
%11 = load i32, i32* %6
%12 = icmp sle i32 %11, 1000000000
br i1 %12, label %13, label %41
13: ; preds = %10
%14 = call i32 @usleep(i32 8000)
%15 = load float, float* %8
%16 = load i32, i32* %6
%17 = sdiv i32 %16, 3
%18 = sitofp i32 %17 to float
%19 = fadd float %15, %18
store float %19, float* %8
%20 = call i32 @time(i32* null)
%21 = load i32, i32* %2
%22 = sub nsw i32 %20, %21
%23 = icmp sge i32 %22, 10
br i1 %23, label %24, label %27
24: ; preds = %13
%25 = call i32 @time(i32* null)
store i32 %25, i32* %2
%26 = load i32, i32* %6
store i32 %26, i32* %7
br label %27
27: ; preds = %24, %13
%28 = load i32, i32* %6
%29 = load i32, i32* %7
%30 = sub nsw i32 %28, %29
%31 = icmp slt i32 %30, 100
br i1 %31, label %32, label %37
32: ; preds = %27
%33 = load i32, i32* %6
%34 = load i32, i32* %7
%35 = sub nsw i32 %33, %34
%36 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %32, %27
br label %38
38: ; preds = %37
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %10
41: ; preds = %10
%42 = call i32 @time(i32* null)
store i32 %42, i32* %3
%43 = load i32, i32* %3
%44 = load i32, i32* %2
%45 = sub nsw i32 %43, %44
%46 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %45)
%47 = load i32, i32* @EXIT_SUCCESS
ret i32 %47
}

LLVM IR (-O2):
@.str = [5 x i8] c":%d:\00"
@.str.1 = [24 x i8] c"1T loops take: %d sec.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @time(i32* null)
br label %2
2: ; preds = %0, %19
%3 = phi i32 [ 0, %0 ], [ %14, %19 ]
%4 = phi i32 [ 0, %0 ], [ %20, %19 ]
%5 = phi i32 [ %1, %0 ], [ %13, %19 ]
%6 = tail call i32 @usleep(i32 8000)
%7 = tail call i32 @time(i32* null)
%8 = sub nsw i32 %7, %5
%9 = icmp sgt i32 %8, 9
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = tail call i32 @time(i32* null)
br label %12
12: ; preds = %10, %2
%13 = phi i32 [ %11, %10 ], [ %5, %2 ]
%14 = phi i32 [ %4, %10 ], [ %3, %2 ]
%15 = sub nsw i32 %4, %14
%16 = icmp slt i32 %15, 100
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %19
19: ; preds = %12, %17
%20 = add nuw nsw i32 %4, 1
%21 = icmp eq i32 %20, 1000000001
br i1 %21, label %22, label %2
22: ; preds = %19
%23 = tail call i32 @time(i32* null)
%24 = sub nsw i32 %23, %13
%25 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = load i32, i32* @EXIT_SUCCESS
ret i32 %26
}