#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*/ time(int /*<<< orphan*/ *);
void bench_time(clockid_t clkid) {
  unsigned long loop;
  for (loop = 0; loop < 100000; loop++) {
    (void)time(NULL);
    (void)time(NULL);
    (void)time(NULL);
    (void)time(NULL);
    (void)time(NULL);
    (void)time(NULL);
    (void)time(NULL);
    (void)time(NULL);
    (void)time(NULL);
    (void)time(NULL);
  }
}


x86 assembly (clang, -O0):
<bench_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x186a0,-0x10(%rbp)
jae    119c <bench_time+0x8c>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1123 <bench_time+0x13>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @bench_time(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 @time(i32* null)
%9 = call i32 @time(i32* null)
%10 = call i32 @time(i32* null)
%11 = call i32 @time(i32* null)
%12 = call i32 @time(i32* null)
%13 = call i32 @time(i32* null)
%14 = call i32 @time(i32* null)
%15 = call i32 @time(i32* null)
%16 = call i32 @time(i32* null)
%17 = call i32 @time(i32* null)
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_time(i32 %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ 0, %1 ], [ %14, %2 ]
%4 = tail call i32 @time(i32* null)
%5 = tail call i32 @time(i32* null)
%6 = tail call i32 @time(i32* null)
%7 = tail call i32 @time(i32* null)
%8 = tail call i32 @time(i32* null)
%9 = tail call i32 @time(i32* null)
%10 = tail call i32 @time(i32* null)
%11 = tail call i32 @time(i32* null)
%12 = tail call i32 @time(i32* null)
%13 = tail call i32 @time(i32* null)
%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
}