#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 /*<<< orphan*/ assert(struct timeval *);
int timeval_gt(struct timeval *a, struct timeval *b) {
  assert(a);
  assert(b);
  if (a->tv_sec == b->tv_sec)
    return (a->tv_usec > b->tv_usec);
  return (a->tv_sec > b->tv_sec);
}


x86 assembly (clang, -O0):
<timeval_gt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x18(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%rax
jne    1166 <timeval_gt+0x56>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    0x8(%rcx),%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    117f <timeval_gt+0x6f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeval_gt>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <assert@plt>
mov    %r14,%rdi
call   1030 <assert@plt>
mov    (%r14),%rax
cmp    %rax,(%rbx)
jne    1137 <timeval_gt+0x27>
mov    0x8(%rbx),%rax
cmp    0x8(%r14),%rax
setg   %al
movzbl %al,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define i32 @timeval_gt(%struct.timeval* %0, %struct.timeval* %1) {
%3 = tail call i32 @assert(%struct.timeval* %0)
%4 = tail call i32 @assert(%struct.timeval* %1)
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%6 = load i64, i64* %5
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%8 = load i64, i64* %7
%9 = icmp eq i64 %6, %8
br i1 %9, label %10, label %16
10: ; preds = %2
%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
br label %18
16: ; preds = %2
%17 = icmp sgt i64 %6, %8
br label %18
18: ; preds = %16, %10
%19 = phi i1 [ %15, %10 ], [ %17, %16 ]
%20 = zext i1 %19 to i32
ret i32 %20
}