#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 */
struct thread_info {
  int dummy;
};
typedef int clock_t;

/* Variables and functions */
int CLOCKS_PER_SEC;
int /*<<< orphan*/ body(struct thread_info *);
int clock();
int /*<<< orphan*/ maincont_code(struct thread_info *);
struct thread_info *make_tinfo();
int /*<<< orphan*/ printf(char *, int, int);
int main(int argc, char *argv[]) {
  struct thread_info *tinfo;
  tinfo = make_tinfo();
  clock_t start = clock(), diff;
  body(tinfo);
  diff = clock() - start;
  int msec = diff * 1000 / CLOCKS_PER_SEC;
  printf("Time taken %d seconds %d milliseconds\n", msec / 1000, msec % 1000);
  maincont_code(tinfo);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1070 <make_tinfo@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <clock@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <body@plt>
mov    $0x0,%al
call   1040 <clock@plt>
sub    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
imul   $0x3e8,-0x20(%rbp),%eax
mov    0x2e49(%rip),%rcx
cltd
idivl  (%rcx)
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x24(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
lea    0xe3c(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <maincont_code@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1070 <make_tinfo@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <clock@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <body@plt>
xor    %eax,%eax
call   1040 <clock@plt>
sub    %ebp,%eax
imul   $0x3e8,%eax,%eax
mov    0x2e64(%rip),%rcx
cltd
idivl  (%rcx)
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    0xe53(%rip),%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1060 <maincont_code@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.thread_info = type { i32 }
@CLOCKS_PER_SEC = global i32 0
@.str = [39 x i8] c"Time taken %d seconds %d milliseconds\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.thread_info*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call %struct.thread_info* (...) @make_tinfo()
store %struct.thread_info* %10, %struct.thread_info** %6
%11 = call i32 (...) @clock()
store i32 %11, i32* %7
%12 = load %struct.thread_info*, %struct.thread_info** %6
%13 = call i32 @body(%struct.thread_info* %12)
%14 = call i32 (...) @clock()
%15 = load i32, i32* %7
%16 = sub nsw i32 %14, %15
store i32 %16, i32* %8
%17 = load i32, i32* %8
%18 = mul nsw i32 %17, 1000
%19 = load i32, i32* @CLOCKS_PER_SEC
%20 = sdiv i32 %18, %19
store i32 %20, i32* %9
%21 = load i32, i32* %9
%22 = sdiv i32 %21, 1000
%23 = load i32, i32* %9
%24 = srem i32 %23, 1000
%25 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %22, i32 %24)
%26 = load %struct.thread_info*, %struct.thread_info** %6
%27 = call i32 @maincont_code(%struct.thread_info* %26)
ret i32 0
}

LLVM IR (-O2):
%struct.thread_info = type { i32 }
@CLOCKS_PER_SEC = global i32 0
@.str = [39 x i8] c"Time taken %d seconds %d milliseconds\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call %struct.thread_info* (...) @make_tinfo()
%4 = tail call i32 (...) @clock()
%5 = tail call i32 @body(%struct.thread_info* %3)
%6 = tail call i32 (...) @clock()
%7 = sub nsw i32 %6, %4
%8 = mul nsw i32 %7, 1000
%9 = load i32, i32* @CLOCKS_PER_SEC
%10 = sdiv i32 %8, %9
%11 = sdiv i32 %10, 1000
%12 = srem i32 %10, 1000
%13 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %12)
%14 = tail call i32 @maincont_code(%struct.thread_info* %3)
ret i32 0
}