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

/* Variables and functions */
int time_is_lesser(struct timeval *left, struct timeval *right) {
  return (left->tv_sec < right->tv_sec ||
          (left->tv_sec == right->tv_sec && left->tv_usec < right->tv_usec));
}


x86 assembly (clang, -O0):
<time_is_lesser>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
mov    -0x10(%rbp),%rdx
mov    $0x1,%al
cmp    (%rdx),%rcx
mov    %al,-0x11(%rbp)
jl     115a <time_is_lesser+0x5a>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
mov    -0x10(%rbp),%rdx
xor    %eax,%eax
cmp    (%rdx),%rcx
mov    %al,-0x12(%rbp)
jne    1154 <time_is_lesser+0x54>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x10(%rbp),%rcx
cmp    0x8(%rcx),%rax
setl   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define i32 @time_is_lesser(%struct.timeval* nocapture %0, %struct.timeval* nocapture %1) {
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%4 = load i64, i64* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %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 eq i64 %4, %6
br i1 %9, label %10, label %17
10: ; preds = %8
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%12 = load i64, i64* %11
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %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, %10, %2
%18 = phi i32 [ 1, %2 ], [ 0, %8 ], [ %16, %10 ]
ret i32 %18
}