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

/* Variables and functions */
bool time_less_than(const struct timespec *left, const struct timespec *right) {
  if (left->tv_sec < right->tv_sec) {
    return true;
  }
  if (right->tv_sec < left->tv_sec) {
    return false;
  }
  return left->tv_nsec < right->tv_nsec;
}


x86 assembly (clang, -O0):
<time_less_than>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%rax
jge    112c <time_less_than+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    1167 <time_less_than+0x67>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%rax
jge    114c <time_less_than+0x4c>
movl   $0x0,-0x4(%rbp)
jmp    1167 <time_less_than+0x67>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    0x8(%rcx),%rax
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_less_than>:
mov    (%rdi),%rcx
mov    (%rsi),%rdx
mov    $0x1,%eax
cmp    %rdx,%rcx
jl     1124 <time_less_than+0x24>
xor    %eax,%eax
cmp    %rcx,%rdx
jl     1124 <time_less_than+0x24>
mov    0x8(%rdi),%rcx
xor    %eax,%eax
cmp    0x8(%rsi),%rcx
setl   %al
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
define i32 @time_less_than(%struct.timespec* %0, %struct.timespec* %1) {
%3 = alloca i32
%4 = alloca %struct.timespec*
%5 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %4
store %struct.timespec* %1, %struct.timespec** %5
%6 = load %struct.timespec*, %struct.timespec** %4
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i32 0, i32 0
%8 = load i64, i64* %7
%9 = load %struct.timespec*, %struct.timespec** %5
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i32 0, i32 0
%11 = load i64, i64* %10
%12 = icmp slt i64 %8, %11
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 1, i32* %3
br label %32
14: ; preds = %2
%15 = load %struct.timespec*, %struct.timespec** %5
%16 = getelementptr inbounds %struct.timespec, %struct.timespec* %15, i32 0, i32 0
%17 = load i64, i64* %16
%18 = load %struct.timespec*, %struct.timespec** %4
%19 = getelementptr inbounds %struct.timespec, %struct.timespec* %18, i32 0, i32 0
%20 = load i64, i64* %19
%21 = icmp slt i64 %17, %20
br i1 %21, label %22, label %23
22: ; preds = %14
store i32 0, i32* %3
br label %32
23: ; preds = %14
%24 = load %struct.timespec*, %struct.timespec** %4
%25 = getelementptr inbounds %struct.timespec, %struct.timespec* %24, i32 0, i32 1
%26 = load i64, i64* %25
%27 = load %struct.timespec*, %struct.timespec** %5
%28 = getelementptr inbounds %struct.timespec, %struct.timespec* %27, i32 0, i32 1
%29 = load i64, i64* %28
%30 = icmp slt i64 %26, %29
%31 = zext i1 %30 to i32
store i32 %31, i32* %3
br label %32
32: ; preds = %23, %22, %13
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
define i32 @time_less_than(%struct.timespec* nocapture %0, %struct.timespec* nocapture %1) {
%3 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%4 = load i64, i64* %3
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%6 = load i64, i64* %5
%7 = icmp slt i64 %4, %6
br i1 %7, label %17, label %8
8: ; preds = %2
%9 = icmp slt i64 %6, %4
br i1 %9, label %17, label %10
10: ; preds = %8
%11 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
%12 = load i64, i64* %11
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%14 = load i64, i64* %13
%15 = icmp slt i64 %12, %14
%16 = zext i1 %15 to i32
br label %17
17: ; preds = %8, %2, %10
%18 = phi i32 [ %16, %10 ], [ 1, %2 ], [ 0, %8 ]
ret i32 %18
}