#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 */
unsigned char timeval_isgreaterthan(struct timeval *t1, struct timeval *t2) {
  return (t1->tv_sec > t2->tv_sec)
             ? 1
             : ((t1->tv_sec == t2->tv_sec) ? (t1->tv_usec > t2->tv_usec) : 0);
}


x86 assembly (clang, -O0):
<timeval_isgreaterthan>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%rax
jle    112d <timeval_isgreaterthan+0x2d>
mov    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1171 <timeval_isgreaterthan+0x71>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%rax
jne    1161 <timeval_isgreaterthan+0x61>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x10(%rbp),%rcx
cmp    0x8(%rcx),%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x18(%rbp)
jmp    116b <timeval_isgreaterthan+0x6b>
xor    %eax,%eax
mov    %eax,-0x18(%rbp)
jmp    116b <timeval_isgreaterthan+0x6b>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeval_isgreaterthan>:
mov    (%rdi),%rcx
mov    (%rsi),%rdx
mov    $0x1,%al
cmp    %rdx,%rcx
jg     111a <timeval_isgreaterthan+0x1a>
jne    111b <timeval_isgreaterthan+0x1b>
mov    0x8(%rdi),%rax
cmp    0x8(%rsi),%rax
setg   %al
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define zeroext i8 @timeval_isgreaterthan(%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 sgt i64 %7, %10
br i1 %11, label %12, label %13
12: ; preds = %2
br label %33
13: ; preds = %2
%14 = load %struct.timeval*, %struct.timeval** %3
%15 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 0
%16 = load i64, i64* %15
%17 = load %struct.timeval*, %struct.timeval** %4
%18 = getelementptr inbounds %struct.timeval, %struct.timeval* %17, i32 0, i32 0
%19 = load i64, i64* %18
%20 = icmp eq i64 %16, %19
br i1 %20, label %21, label %30
21: ; preds = %13
%22 = load %struct.timeval*, %struct.timeval** %3
%23 = getelementptr inbounds %struct.timeval, %struct.timeval* %22, i32 0, i32 1
%24 = load i64, i64* %23
%25 = load %struct.timeval*, %struct.timeval** %4
%26 = getelementptr inbounds %struct.timeval, %struct.timeval* %25, i32 0, i32 1
%27 = load i64, i64* %26
%28 = icmp sgt i64 %24, %27
%29 = zext i1 %28 to i32
br label %31
30: ; preds = %13
br label %31
31: ; preds = %30, %21
%32 = phi i32 [ %29, %21 ], [ 0, %30 ]
br label %33
33: ; preds = %31, %12
%34 = phi i32 [ 1, %12 ], [ %32, %31 ]
%35 = trunc i32 %34 to i8
ret i8 %35
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define zeroext i8 @timeval_isgreaterthan(%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 sgt 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 sgt i64 %12, %14
%16 = zext i1 %15 to i8
br label %17
17: ; preds = %10, %8, %2
%18 = phi i8 [ 1, %2 ], [ %16, %10 ], [ 0, %8 ]
ret i8 %18
}