#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 /*<<< orphan*/ clockid_t;

/* Variables and functions */
int /*<<< orphan*/ clock();
void bench_clock(clockid_t clkid) {
  unsigned long loop;
  for (loop = 0; loop < 100000; loop++) {
    (void)clock();
    (void)clock();
    (void)clock();
    (void)clock();
    (void)clock();
    (void)clock();
    (void)clock();
    (void)clock();
    (void)clock();
    (void)clock();
  }
}


x86 assembly (clang, -O0):
<bench_clock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x186a0,-0x10(%rbp)
jae    1188 <bench_clock+0x78>
mov    $0x0,%al
call   1030 <clock@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1123 <bench_clock+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bench_clock>:
push   %rbx
mov    $0x186a0,%ebx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <clock@plt>
xor    %eax,%eax
call   1030 <clock@plt>
xor    %eax,%eax
call   1030 <clock@plt>
xor    %eax,%eax
call   1030 <clock@plt>
xor    %eax,%eax
call   1030 <clock@plt>
xor    %eax,%eax
call   1030 <clock@plt>
xor    %eax,%eax
call   1030 <clock@plt>
xor    %eax,%eax
call   1030 <clock@plt>
xor    %eax,%eax
call   1030 <clock@plt>
xor    %eax,%eax
call   1030 <clock@plt>
add    $0xffffffffffffffff,%rbx
jne    1120 <bench_clock+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @bench_clock(i32 %0) {
%2 = alloca i32
%3 = alloca i64
store i32 %0, i32* %2
store i64 0, i64* %3
br label %4
4: ; preds = %18, %1
%5 = load i64, i64* %3
%6 = icmp ult i64 %5, 100000
br i1 %6, label %7, label %21
7: ; preds = %4
%8 = call i32 (...) @clock()
%9 = call i32 (...) @clock()
%10 = call i32 (...) @clock()
%11 = call i32 (...) @clock()
%12 = call i32 (...) @clock()
%13 = call i32 (...) @clock()
%14 = call i32 (...) @clock()
%15 = call i32 (...) @clock()
%16 = call i32 (...) @clock()
%17 = call i32 (...) @clock()
br label %18
18: ; preds = %7
%19 = load i64, i64* %3
%20 = add i64 %19, 1
store i64 %20, i64* %3
br label %4
21: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @bench_clock(i32 %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ 0, %1 ], [ %14, %2 ]
%4 = tail call i32 (...) @clock()
%5 = tail call i32 (...) @clock()
%6 = tail call i32 (...) @clock()
%7 = tail call i32 (...) @clock()
%8 = tail call i32 (...) @clock()
%9 = tail call i32 (...) @clock()
%10 = tail call i32 (...) @clock()
%11 = tail call i32 (...) @clock()
%12 = tail call i32 (...) @clock()
%13 = tail call i32 (...) @clock()
%14 = add nuw nsw i64 %3, 1
%15 = icmp eq i64 %14, 100000
br i1 %15, label %16, label %2
16: ; preds = %2
ret void
}