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

/* Variables and functions */
int CLOCKS_PER_SEC;
int clock();
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  clock_t test1 = clock(), diff1;
  int i, msec1, msec2;
  for (i = 0; i < 100000000; i++) {
  }
  clock_t test2 = clock(), diff2;
  diff2 = clock() - test2;
  msec2 = diff2 * 1000 / CLOCKS_PER_SEC;
  diff1 = clock() - test1;
  msec1 = diff1 * 1000 / CLOCKS_PER_SEC;
  printf("Clock1: %d _ %d", msec1 / 1000, msec1 % 1000);
  printf("Clock2: %d _ %d", msec2 / 1000, msec2 % 1000);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x5f5e100,-0x10(%rbp)
jge    1160 <main+0x40>
jmp    1152 <main+0x32>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1140 <main+0x20>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
sub    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
imul   $0x3e8,-0x20(%rbp),%eax
mov    0x2e63(%rip),%rcx
cltd
idivl  (%rcx)
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
imul   $0x3e8,-0xc(%rbp),%eax
mov    0x2e42(%rip),%rcx
cltd
idivl  (%rcx)
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x14(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
lea    0xe35(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x18(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
lea    0xe21(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1030 <clock@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <clock@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <clock@plt>
sub    %ebx,%eax
imul   $0x3e8,%eax,%eax
mov    0x2e9c(%rip),%rbx
cltd
idivl  (%rbx)
mov    %eax,%r14d
xor    %eax,%eax
call   1030 <clock@plt>
sub    %ebp,%eax
imul   $0x3e8,%eax,%eax
cltd
idivl  (%rbx)
movslq %eax,%rdx
imul   $0x10624dd3,%rdx,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x26,%rsi
add    %eax,%esi
imul   $0x3e8,%esi,%eax
sub    %eax,%edx
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
movslq %r14d,%rdx
imul   $0x10624dd3,%rdx,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x26,%rsi
add    %eax,%esi
imul   $0x3e8,%esi,%eax
sub    %eax,%edx
lea    0xe5b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@CLOCKS_PER_SEC = global i32 0
@.str = [16 x i8] c"Clock1: %d _ %d\00"
@.str.1 = [16 x i8] c"Clock2: %d _ %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 (...) @clock()
store i32 %9, i32* %2
store i32 0, i32* %4
br label %10
10: ; preds = %14, %0
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 100000000
br i1 %12, label %13, label %17
13: ; preds = %10
br label %14
14: ; preds = %13
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
store i32 %16, i32* %4
br label %10
17: ; preds = %10
%18 = call i32 (...) @clock()
store i32 %18, i32* %7
%19 = call i32 (...) @clock()
%20 = load i32, i32* %7
%21 = sub nsw i32 %19, %20
store i32 %21, i32* %8
%22 = load i32, i32* %8
%23 = mul nsw i32 %22, 1000
%24 = load i32, i32* @CLOCKS_PER_SEC
%25 = sdiv i32 %23, %24
store i32 %25, i32* %6
%26 = call i32 (...) @clock()
%27 = load i32, i32* %2
%28 = sub nsw i32 %26, %27
store i32 %28, i32* %3
%29 = load i32, i32* %3
%30 = mul nsw i32 %29, 1000
%31 = load i32, i32* @CLOCKS_PER_SEC
%32 = sdiv i32 %30, %31
store i32 %32, i32* %5
%33 = load i32, i32* %5
%34 = sdiv i32 %33, 1000
%35 = load i32, i32* %5
%36 = srem i32 %35, 1000
%37 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %34, i32 %36)
%38 = load i32, i32* %6
%39 = sdiv i32 %38, 1000
%40 = load i32, i32* %6
%41 = srem i32 %40, 1000
%42 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %39, i32 %41)
%43 = load i32, i32* %1
ret i32 %43
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global i32 0
@.str = [16 x i8] c"Clock1: %d _ %d\00"
@.str.1 = [16 x i8] c"Clock2: %d _ %d\00"
define i32 @main() {
%1 = tail call i32 (...) @clock()
%2 = tail call i32 (...) @clock()
%3 = tail call i32 (...) @clock()
%4 = sub nsw i32 %3, %2
%5 = mul nsw i32 %4, 1000
%6 = load i32, i32* @CLOCKS_PER_SEC
%7 = sdiv i32 %5, %6
%8 = tail call i32 (...) @clock()
%9 = sub nsw i32 %8, %1
%10 = mul nsw i32 %9, 1000
%11 = load i32, i32* @CLOCKS_PER_SEC
%12 = sdiv i32 %10, %11
%13 = sdiv i32 %12, 1000
%14 = srem i32 %12, 1000
%15 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14)
%16 = sdiv i32 %7, 1000
%17 = srem i32 %7, 1000
%18 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 %17)
ret i32 0
}