#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 timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, long, long, long, long, long);
void print_measurement(struct timeval ktv_start, struct timeval ktv_end,
                       long int *diff) {
  *diff = (((long int)ktv_end.tv_usec - (long int)ktv_start.tv_usec) +
           (((long int)ktv_end.tv_sec % 1000000 -
             (long int)ktv_start.tv_sec % 1000000) *
            1000000));
  printf("%ld.%.6ld : %ld.%.6ld : %ld\n",
         ((long int)ktv_start.tv_sec) % 1000000, (long int)ktv_start.tv_usec,
         ((long int)ktv_end.tv_sec) % 1000000, (long int)ktv_end.tv_usec,
         *diff);
}


x86 assembly (clang, -O0):
<print_measurement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x8(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x20(%rbp),%rcx
sub    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    $0xf4240,%esi
cqto
idiv   %rsi
mov    %rdx,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xf4240,%esi
cqto
idiv   %rsi
mov    %rdx,%rax
mov    -0x38(%rbp),%rdx
sub    %rax,%rdx
imul   $0xf4240,%rdx,%rax
add    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    $0xf4240,%ecx
cqto
idiv   %rcx
mov    %rdx,%rsi
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    $0xf4240,%ecx
cqto
idiv   %rcx
mov    %rdx,%rcx
mov    -0x30(%rbp),%rdx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%rax
mov    (%rax),%r9
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_measurement>:
mov    %rdx,%r10
mov    %rdi,%r11
mov    %rdx,%rdi
sub    %r11,%rdi
movabs $0x431bde82d7b634db,%r9
de 1b 43
mov    %rcx,%rax
imul   %r9
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x12,%rdx
add    %rax,%rdx
imul   $0xf4240,%rdx,%rax
sub    %rax,%rcx
mov    %rsi,%rax
imul   %r9
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x12,%rdx
add    %rax,%rdx
imul   $0xf4240,%rdx,%rax
sub    %rax,%rsi
mov    %rcx,%rax
sub    %rsi,%rax
imul   $0xf4240,%rax,%r9
add    %rdi,%r9
mov    %r9,(%r8)
lea    0xe84(%rip),%rdi
mov    %r10,%r8
mov    %r11,%rdx
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
@.str = [29 x i8] c"%ld.%.6ld : %ld.%.6ld : %ld\0A\00"
define void @print_measurement(i64 %0, i64 %1, i64 %2, i64 %3, i64* %4) {
%6 = alloca %struct.timeval
%7 = alloca %struct.timeval
%8 = alloca i64*
%9 = bitcast %struct.timeval* %6 to { i64, i64 }*
%10 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %9, i32 0, i32 0
store i64 %0, i64* %10
%11 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %9, i32 0, i32 1
store i64 %1, i64* %11
%12 = bitcast %struct.timeval* %7 to { i64, i64 }*
%13 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %12, i32 0, i32 0
store i64 %2, i64* %13
%14 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %12, i32 0, i32 1
store i64 %3, i64* %14
store i64* %4, i64** %8
%15 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 0
%16 = load i64, i64* %15
%17 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
%18 = load i64, i64* %17
%19 = sub nsw i64 %16, %18
%20 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 1
%21 = load i64, i64* %20
%22 = srem i64 %21, 1000000
%23 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
%24 = load i64, i64* %23
%25 = srem i64 %24, 1000000
%26 = sub nsw i64 %22, %25
%27 = mul nsw i64 %26, 1000000
%28 = add nsw i64 %19, %27
%29 = load i64*, i64** %8
store i64 %28, i64* %29
%30 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
%31 = load i64, i64* %30
%32 = srem i64 %31, 1000000
%33 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
%34 = load i64, i64* %33
%35 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 1
%36 = load i64, i64* %35
%37 = srem i64 %36, 1000000
%38 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 0
%39 = load i64, i64* %38
%40 = load i64*, i64** %8
%41 = load i64, i64* %40
%42 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i64 %32, i64 %34, i64 %37, i64 %39, i64 %41)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"%ld.%.6ld : %ld.%.6ld : %ld\0A\00"
define void @print_measurement(i64 %0, i64 %1, i64 %2, i64 %3, i64* nocapture writeonly %4) {
%6 = sub nsw i64 %2, %0
%7 = srem i64 %3, 1000000
%8 = srem i64 %1, 1000000
%9 = sub nsw i64 %7, %8
%10 = mul nsw i64 %9, 1000000
%11 = add nsw i64 %10, %6
store i64 %11, i64* %4
%12 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i64 %8, i64 %0, i64 %7, i64 %2, i64 %11)
ret void
}