#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long long, unsigned long long);
void show_wakeup_timings(unsigned long long total, unsigned long count,
                         unsigned long long lat_max,
                         unsigned long long time_max,
                         unsigned long long lat_min,
                         unsigned long long time_min) {
  total /= count;
  printf("\nAverage wakeup latency: %llu.%03llu usecs\n", total / 1000,
         total % 1000);
  printf("Maximum Latency: %llu.%03llu usecs at ", lat_max / 1000,
         lat_max % 1000);
  printf("timestamp: %llu.%06llu\n", time_max / 1000000000,
         ((time_max + 500) % 1000000000) / 1000);
  printf("Minimum Latency: %llu.%03llu usecs at ", lat_min / 1000,
         lat_min % 1000);
  printf("timestamp: %llu.%06llu\n\n", time_min / 1000000000,
         ((time_min + 500) % 1000000000) / 1000);
}


x86 assembly (clang, -O0):
<show_wakeup_timings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
xor    %edx,%edx
div    %rcx
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rsi
mov    -0x8(%rbp),%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rsi
mov    -0x18(%rbp),%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    $0x3b9aca00,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rsi
mov    -0x20(%rbp),%rax
add    $0x1f4,%rax
mov    $0x3b9aca00,%ecx
xor    %edx,%edx
div    %rcx
mov    %rdx,%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rdx
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rsi
mov    -0x28(%rbp),%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x30(%rbp),%rax
mov    $0x3b9aca00,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rsi
mov    -0x30(%rbp),%rax
add    $0x1f4,%rax
mov    $0x3b9aca00,%ecx
xor    %edx,%edx
div    %rcx
mov    %rdx,%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rdx
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_wakeup_timings>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r9,%r14
mov    %r8,%r12
mov    %rcx,%r15
mov    %rdx,%rbx
mov    %rdi,%rax
mov    %rdi,%rcx
or     %rsi,%rcx
shr    $0x20,%rcx
je     113e <show_wakeup_timings+0x2e>
xor    %edx,%edx
div    %rsi
mov    %rax,%rcx
jmp    1144 <show_wakeup_timings+0x34>
xor    %edx,%edx
div    %esi
mov    %eax,%ecx
mov    %rcx,%rax
shr    $0x3,%rax
movabs $0x20c49ba5e353f7cf,%r13
9b c4 20
mul    %r13
shr    $0x4,%rdx
imul   $0x3e8,%rdx,%rax
sub    %rax,%rcx
lea    0xe93(%rip),%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
call   1030 <printf@plt>
mov    %rbx,%rax
shr    $0x3,%rax
mul    %r13
shr    $0x4,%rdx
imul   $0x3e8,%rdx,%rax
sub    %rax,%rbx
lea    0xe95(%rip),%rdi
mov    %rdx,%rsi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    %r15,%rax
shr    $0x9,%rax
movabs $0x44b82fa09b5a53,%rbx
mul    %rbx
mov    %rdx,%rsi
shr    $0xb,%rsi
lea    0x1f4(%r15),%rax
shr    $0x9,%rax
mul    %rbx
shr    $0xb,%rdx
imul   $0x3b9aca00,%rdx,%rax
neg    %rax
add    %r15,%rax
add    $0x1f4,%rax
imul   $0x10624dd3,%rax,%rdx
shr    $0x26,%rdx
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
mov    %r12,%rax
shr    $0x3,%rax
mul    %r13
shr    $0x4,%rdx
imul   $0x3e8,%rdx,%rax
sub    %rax,%r12
lea    0xe53(%rip),%rdi
mov    %rdx,%rsi
mov    %r12,%rdx
call   1030 <printf@plt>
mov    %r14,%rax
shr    $0x9,%rax
mul    %rbx
mov    %rdx,%rsi
lea    0x1f4(%r14),%rax
shr    $0x9,%rax
mul    %rbx
shr    $0xb,%rsi
shr    $0xb,%rdx
imul   $0x3b9aca00,%rdx,%rax
neg    %rax
add    %r14,%rax
add    $0x1f4,%rax
imul   $0x10624dd3,%rax,%rdx
shr    $0x26,%rdx
lea    0xe27(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"\0AAverage wakeup latency: %llu.%03llu usecs\0A\00"
@.str.1 = [39 x i8] c"Maximum Latency: %llu.%03llu usecs at \00"
@.str.2 = [24 x i8] c"timestamp: %llu.%06llu\0A\00"
@.str.3 = [39 x i8] c"Minimum Latency: %llu.%03llu usecs at \00"
@.str.4 = [25 x i8] c"timestamp: %llu.%06llu\0A\0A\00"
define void @show_wakeup_timings(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5) {
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
store i64 %0, i64* %7
store i64 %1, i64* %8
store i64 %2, i64* %9
store i64 %3, i64* %10
store i64 %4, i64* %11
store i64 %5, i64* %12
%13 = load i64, i64* %8
%14 = load i64, i64* %7
%15 = udiv i64 %14, %13
store i64 %15, i64* %7
%16 = load i64, i64* %7
%17 = udiv i64 %16, 1000
%18 = load i64, i64* %7
%19 = urem i64 %18, 1000
%20 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i64 %17, i64 %19)
%21 = load i64, i64* %9
%22 = udiv i64 %21, 1000
%23 = load i64, i64* %9
%24 = urem i64 %23, 1000
%25 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i64 %22, i64 %24)
%26 = load i64, i64* %10
%27 = udiv i64 %26, 1000000000
%28 = load i64, i64* %10
%29 = add i64 %28, 500
%30 = urem i64 %29, 1000000000
%31 = udiv i64 %30, 1000
%32 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i64 %27, i64 %31)
%33 = load i64, i64* %11
%34 = udiv i64 %33, 1000
%35 = load i64, i64* %11
%36 = urem i64 %35, 1000
%37 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i64 %34, i64 %36)
%38 = load i64, i64* %12
%39 = udiv i64 %38, 1000000000
%40 = load i64, i64* %12
%41 = add i64 %40, 500
%42 = urem i64 %41, 1000000000
%43 = udiv i64 %42, 1000
%44 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i64 %39, i64 %43)
ret void
}

LLVM IR (-O2):
@.str = [44 x i8] c"\0AAverage wakeup latency: %llu.%03llu usecs\0A\00"
@.str.1 = [39 x i8] c"Maximum Latency: %llu.%03llu usecs at \00"
@.str.2 = [24 x i8] c"timestamp: %llu.%06llu\0A\00"
@.str.3 = [39 x i8] c"Minimum Latency: %llu.%03llu usecs at \00"
@.str.4 = [25 x i8] c"timestamp: %llu.%06llu\0A\0A\00"
define void @show_wakeup_timings(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5) {
%7 = udiv i64 %0, %1
%8 = udiv i64 %7, 1000
%9 = urem i64 %7, 1000
%10 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i64 %8, i64 %9)
%11 = udiv i64 %2, 1000
%12 = urem i64 %2, 1000
%13 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i64 %11, i64 %12)
%14 = udiv i64 %3, 1000000000
%15 = add i64 %3, 500
%16 = urem i64 %15, 1000000000
%17 = trunc i64 %16 to i32
%18 = udiv i32 %17, 1000
%19 = zext i32 %18 to i64
%20 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i64 %14, i64 %19)
%21 = udiv i64 %4, 1000
%22 = urem i64 %4, 1000
%23 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i64 %21, i64 %22)
%24 = udiv i64 %5, 1000000000
%25 = add i64 %5, 500
%26 = urem i64 %25, 1000000000
%27 = trunc i64 %26 to i32
%28 = udiv i32 %27, 1000
%29 = zext i32 %28 to i64
%30 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i64 %24, i64 %29)
ret void
}