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

/* Variables and functions */
int /*<<< orphan*/ normalize_time(struct timespec *);
void sub_time(struct timespec *result, struct timespec *x, struct timespec *y) {
  result->tv_sec = x->tv_sec - y->tv_sec;
  result->tv_nsec = x->tv_nsec - y->tv_nsec;
  normalize_time(result);
}


x86 assembly (clang, -O0):
<sub_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
mov    -0x18(%rbp),%rax
sub    0x8(%rax),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
sub    (%rax),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <normalize_time@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub_time>:
movdqu (%rsi),%xmm0
movdqu (%rdx),%xmm1
psubq  %xmm1,%xmm0
movdqu %xmm0,(%rdi)
jmp    1030 <normalize_time@plt>

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
define void @sub_time(%struct.timespec* %0, %struct.timespec* %1, %struct.timespec* %2) {
%4 = alloca %struct.timespec*
%5 = alloca %struct.timespec*
%6 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %4
store %struct.timespec* %1, %struct.timespec** %5
store %struct.timespec* %2, %struct.timespec** %6
%7 = load %struct.timespec*, %struct.timespec** %5
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %7, i32 0, i32 1
%9 = load i64, i64* %8
%10 = load %struct.timespec*, %struct.timespec** %6
%11 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 1
%12 = load i64, i64* %11
%13 = sub nsw i64 %9, %12
%14 = load %struct.timespec*, %struct.timespec** %4
%15 = getelementptr inbounds %struct.timespec, %struct.timespec* %14, i32 0, i32 1
store i64 %13, i64* %15
%16 = load %struct.timespec*, %struct.timespec** %5
%17 = getelementptr inbounds %struct.timespec, %struct.timespec* %16, i32 0, i32 0
%18 = load i64, i64* %17
%19 = load %struct.timespec*, %struct.timespec** %6
%20 = getelementptr inbounds %struct.timespec, %struct.timespec* %19, i32 0, i32 0
%21 = load i64, i64* %20
%22 = sub nsw i64 %18, %21
%23 = load %struct.timespec*, %struct.timespec** %4
%24 = getelementptr inbounds %struct.timespec, %struct.timespec* %23, i32 0, i32 0
store i64 %22, i64* %24
%25 = load %struct.timespec*, %struct.timespec** %4
%26 = call i32 @normalize_time(%struct.timespec* %25)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
define void @sub_time(%struct.timespec* %0, %struct.timespec* nocapture %1, %struct.timespec* nocapture %2) {
%4 = bitcast %struct.timespec* %1 to <2 x i64>*
%5 = load <2 x i64>, <2 x i64>* %4
%6 = bitcast %struct.timespec* %2 to <2 x i64>*
%7 = load <2 x i64>, <2 x i64>* %6
%8 = sub nsw <2 x i64> %5, %7
%9 = bitcast %struct.timespec* %0 to <2 x i64>*
store <2 x i64> %8, <2 x i64>* %9
%10 = tail call i32 @normalize_time(%struct.timespec* %0)
ret void
}