#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 timespec {
  long double tv_sec;
  double tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ __NR_write;
int /*<<< orphan*/ itoa(long double, char *);
int strlen(char *);
int /*<<< orphan*/ syscall(int /*<<< orphan*/, int, char *, int);
void print_time(struct timespec *tms, struct timespec *tme) {
  long double time;
  char buf[32];
  time = tme->tv_sec - tms->tv_sec;
  time += (tme->tv_nsec - tms->tv_nsec) / 1000000000.0;
  itoa((long)time, buf);
  syscall(__NR_write, 1, buf, strlen(buf));
  syscall(__NR_write, 1, ".", 1);
  itoa(time * 1000000000L, buf);
  syscall(__NR_write, 1, buf, strlen(buf));
}


x86 assembly (clang, -O0):
<print_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
fldt   (%rax)
mov    -0x8(%rbp),%rax
fldt   (%rax)
fsubrp %st,%st(1)
fstpt  -0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe8e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
fldl   -0x58(%rbp)
fldt   -0x20(%rbp)
faddp  %st,%st(1)
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
fnstcw -0x5a(%rbp)
movzwl -0x5a(%rbp),%eax
or     $0xc00,%eax
mov    %ax,-0x5c(%rbp)
fldcw  -0x5c(%rbp)
fistpll -0x50(%rbp)
fldcw  -0x5a(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x48(%rbp)
fildll -0x48(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
lea    -0x40(%rbp),%rdi
mov    %rdi,-0x88(%rbp)
call   1050 <itoa@plt>
mov    -0x88(%rbp),%rdi
mov    0x2e18(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    (%rax),%eax
mov    %eax,-0x8c(%rbp)
call   1030 <strlen@plt>
mov    -0x8c(%rbp),%edi
mov    -0x88(%rbp),%rdx
mov    %eax,%ecx
mov    $0x1,%esi
mov    %esi,-0x7c(%rbp)
call   1040 <syscall@plt>
mov    -0x7c(%rbp),%ecx
mov    -0x78(%rbp),%rax
mov    (%rax),%edi
lea    0xdff(%rip),%rdx
mov    %ecx,%esi
call   1040 <syscall@plt>
fldt   -0x20(%rbp)
flds   0xdeb(%rip)
fmulp  %st,%st(1)
lea    -0x40(%rbp),%rdi
mov    %rsp,%rax
fstpt  (%rax)
call   1050 <itoa@plt>
mov    0x2db4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
lea    -0x40(%rbp),%rax
mov    %rax,-0x68(%rbp)
lea    -0x40(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x6c(%rbp),%edi
mov    -0x68(%rbp),%rdx
mov    %eax,%ecx
mov    $0x1,%esi
call   1040 <syscall@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_time>:
push   %rbp
push   %r14
push   %rbx
sub    $0x60,%rsp
fldt   (%rsi)
fldt   (%rdi)
movsd  0x10(%rsi),%xmm0
subsd  0x10(%rdi),%xmm0
divsd  0xeb2(%rip),%xmm0
fsubrp %st,%st(1)
movsd  %xmm0,0x18(%rsp)
faddl  0x18(%rsp)
fld    %st(0)
fstpt  0x34(%rsp)
fnstcw 0x14(%rsp)
movzwl 0x14(%rsp),%eax
or     $0xc00,%eax
mov    %ax,0x16(%rsp)
fldcw  0x16(%rsp)
fistpll 0x20(%rsp)
fldcw  0x14(%rsp)
mov    0x20(%rsp),%rax
mov    %rax,0x28(%rsp)
fildll 0x28(%rsp)
fstpt  (%rsp)
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <itoa@plt>
mov    0x2e44(%rip),%r14
mov    (%r14),%ebp
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %ebp,%edi
mov    $0x1,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1040 <syscall@plt>
mov    (%r14),%edi
lea    0xe42(%rip),%rdx
mov    $0x1,%esi
mov    $0x1,%ecx
call   1040 <syscall@plt>
fldt   0x34(%rsp)
fmuls  0xe25(%rip)
fstpt  (%rsp)
mov    %rbx,%rdi
call   1050 <itoa@plt>
mov    (%r14),%ebp
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %ebp,%edi
mov    $0x1,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1040 <syscall@plt>
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.timespec = type { x86_fp80, double, [8 x i8] }
@__NR_write = global i32 0
@.str = [2 x i8] c".\00"
define void @print_time(%struct.timespec* %0, %struct.timespec* %1) {
%3 = alloca %struct.timespec*
%4 = alloca %struct.timespec*
%5 = alloca x86_fp80
%6 = alloca [32 x i8]
store %struct.timespec* %0, %struct.timespec** %3
store %struct.timespec* %1, %struct.timespec** %4
%7 = load %struct.timespec*, %struct.timespec** %4
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %7, i32 0, i32 0
%9 = load x86_fp80, x86_fp80* %8
%10 = load %struct.timespec*, %struct.timespec** %3
%11 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 0
%12 = load x86_fp80, x86_fp80* %11
%13 = fsub x86_fp80 %9, %12
store x86_fp80 %13, x86_fp80* %5
%14 = load %struct.timespec*, %struct.timespec** %4
%15 = getelementptr inbounds %struct.timespec, %struct.timespec* %14, i32 0, i32 1
%16 = load double, double* %15
%17 = load %struct.timespec*, %struct.timespec** %3
%18 = getelementptr inbounds %struct.timespec, %struct.timespec* %17, i32 0, i32 1
%19 = load double, double* %18
%20 = fsub double %16, %19
%21 = fdiv double %20, 1.000000e+09
%22 = fpext double %21 to x86_fp80
%23 = load x86_fp80, x86_fp80* %5
%24 = fadd x86_fp80 %23, %22
store x86_fp80 %24, x86_fp80* %5
%25 = load x86_fp80, x86_fp80* %5
%26 = fptosi x86_fp80 %25 to i64
%27 = sitofp i64 %26 to x86_fp80
%28 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%29 = call i32 @itoa(x86_fp80 %27, i8* %28)
%30 = load i32, i32* @__NR_write
%31 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%32 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%33 = call i32 @strlen(i8* %32)
%34 = call i32 @syscall(i32 %30, i32 1, i8* %31, i32 %33)
%35 = load i32, i32* @__NR_write
%36 = call i32 @syscall(i32 %35, i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%37 = load x86_fp80, x86_fp80* %5
%38 = fmul x86_fp80 %37, 0xK401CEE6B280000000000
%39 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%40 = call i32 @itoa(x86_fp80 %38, i8* %39)
%41 = load i32, i32* @__NR_write
%42 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%43 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%44 = call i32 @strlen(i8* %43)
%45 = call i32 @syscall(i32 %41, i32 1, i8* %42, i32 %44)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { x86_fp80, double, [8 x i8] }
@__NR_write = global i32 0
@.str = [2 x i8] c".\00"
define void @print_time(%struct.timespec* nocapture %0, %struct.timespec* nocapture %1) {
%3 = alloca [32 x i8]
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%6 = load x86_fp80, x86_fp80* %5
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%8 = load x86_fp80, x86_fp80* %7
%9 = fsub x86_fp80 %6, %8
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%11 = load double, double* %10
%12 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
%13 = load double, double* %12
%14 = fsub double %11, %13
%15 = fdiv double %14, 1.000000e+09
%16 = fpext double %15 to x86_fp80
%17 = fadd x86_fp80 %9, %16
%18 = fptosi x86_fp80 %17 to i64
%19 = sitofp i64 %18 to x86_fp80
%20 = call i32 @itoa(x86_fp80 %19, i8* %4)
%21 = load i32, i32* @__NR_write
%22 = call i32 @strlen(i8* %4)
%23 = call i32 @syscall(i32 %21, i32 1, i8* %4, i32 %22)
%24 = load i32, i32* @__NR_write
%25 = call i32 @syscall(i32 %24, i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%26 = fmul x86_fp80 %17, 0xK401CEE6B280000000000
%27 = call i32 @itoa(x86_fp80 %26, i8* %4)
%28 = load i32, i32* @__NR_write
%29 = call i32 @strlen(i8* %4)
%30 = call i32 @syscall(i32 %28, i32 1, i8* %4, i32 %29)
ret void
}