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

/* Variables and functions */
long CLOCKS_PER_SEC;
int /*<<< orphan*/ assert(int);
long clock();
int /*<<< orphan*/ func();
int main() {
  clock_t start = clock();
  for (int i = 0; i < 1000000; i++) {
    func();
  }
  clock_t end = clock();
  long time = (end - start) / CLOCKS_PER_SEC;
  assert(time >= 0 && time < 100);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xf4240,-0x14(%rbp)
jge    1173 <main+0x43>
mov    $0x0,%al
call   1050 <func@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1151 <main+0x21>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
sub    -0x10(%rbp),%rax
mov    0x2e5b(%rip),%rcx
cqto
idivq  (%rcx)
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x28(%rbp)
mov    %al,-0x29(%rbp)
jl     11b1 <main+0x81>
cmpq   $0x64,-0x28(%rbp)
setl   %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,%rbx
mov    $0xf4240,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <func@plt>
add    $0xffffffff,%ebp
jne    1150 <main+0x20>
xor    %eax,%eax
call   1030 <clock@plt>
sub    %rbx,%rax
mov    0x2e7b(%rip),%rcx
mov    (%rcx),%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
je     1183 <main+0x53>
cqto
idiv   %rcx
jmp    1187 <main+0x57>
xor    %edx,%edx
div    %ecx
xor    %edi,%edi
cmp    $0x64,%rax
setb   %dil
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@CLOCKS_PER_SEC = global i64 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
store i32 0, i32* %1
%6 = call i64 (...) @clock()
store i64 %6, i64* %2
store i32 0, i32* %3
br label %7
7: ; preds = %12, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 1000000
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = call i32 (...) @func()
br label %12
12: ; preds = %10
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %7
15: ; preds = %7
%16 = call i64 (...) @clock()
store i64 %16, i64* %4
%17 = load i64, i64* %4
%18 = load i64, i64* %2
%19 = sub nsw i64 %17, %18
%20 = load i64, i64* @CLOCKS_PER_SEC
%21 = sdiv i64 %19, %20
store i64 %21, i64* %5
%22 = load i64, i64* %5
%23 = icmp sge i64 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %15
%25 = load i64, i64* %5
%26 = icmp slt i64 %25, 100
br label %27
27: ; preds = %24, %15
%28 = phi i1 [ false, %15 ], [ %26, %24 ]
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global i64 0
define i32 @main() {
%1 = tail call i64 (...) @clock()
br label %10
2: ; preds = %10
%3 = tail call i64 (...) @clock()
%4 = sub nsw i64 %3, %1
%5 = load i64, i64* @CLOCKS_PER_SEC
%6 = sdiv i64 %4, %5
%7 = icmp ult i64 %6, 100
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
ret i32 0
10: ; preds = %0, %10
%11 = phi i32 [ 0, %0 ], [ %13, %10 ]
%12 = tail call i32 (...) @func()
%13 = add nuw nsw i32 %11, 1
%14 = icmp eq i32 %13, 1000000
br i1 %14, label %2, label %10
}