#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 timeCmp(struct timeval *t1, struct timeval *t2) {
  if (t1->tv_sec == t2->tv_sec && t1->tv_usec == t2->tv_usec)
    return 0;
  if (t1->tv_sec > t2->tv_sec ||
      (t1->tv_sec == t2->tv_sec && t1->tv_usec > t2->tv_usec))
    return 1;
  return -1;
}


x86 assembly (clang, -O0):
<timeCmp>:
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
jne    1142 <timeCmp+0x42>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    0x8(%rcx),%rax
jne    1142 <timeCmp+0x42>
movl   $0x0,-0x4(%rbp)
jmp    1193 <timeCmp+0x93>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%rax
jg     1180 <timeCmp+0x80>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%rax
jne    118c <timeCmp+0x8c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x18(%rbp),%rcx
cmp    0x8(%rcx),%rax
jle    118c <timeCmp+0x8c>
movl   $0x1,-0x4(%rbp)
jmp    1193 <timeCmp+0x93>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeCmp>:
mov    (%rsi),%rax
cmp    %rax,(%rdi)
jne    1114 <timeCmp+0x14>
mov    0x8(%rsi),%rcx
xor    %eax,%eax
cmp    %rcx,0x8(%rdi)
je     1120 <timeCmp+0x20>
mov    $0x1,%eax
jg     1120 <timeCmp+0x20>
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define i32 @timeCmp(%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 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
%8 = load i64, i64* %7
%9 = load %struct.timeval*, %struct.timeval** %5
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i32 0, i32 0
%11 = load i64, i64* %10
%12 = icmp eq i64 %8, %11
br i1 %12, label %13, label %22
13: ; preds = %2
%14 = load %struct.timeval*, %struct.timeval** %4
%15 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 1
%16 = load i64, i64* %15
%17 = load %struct.timeval*, %struct.timeval** %5
%18 = getelementptr inbounds %struct.timeval, %struct.timeval* %17, i32 0, i32 1
%19 = load i64, i64* %18
%20 = icmp eq i64 %16, %19
br i1 %20, label %21, label %22
21: ; preds = %13
store i32 0, i32* %3
br label %48
22: ; preds = %13, %2
%23 = load %struct.timeval*, %struct.timeval** %4
%24 = getelementptr inbounds %struct.timeval, %struct.timeval* %23, i32 0, i32 0
%25 = load i64, i64* %24
%26 = load %struct.timeval*, %struct.timeval** %5
%27 = getelementptr inbounds %struct.timeval, %struct.timeval* %26, i32 0, i32 0
%28 = load i64, i64* %27
%29 = icmp sgt i64 %25, %28
br i1 %29, label %46, label %30
30: ; preds = %22
%31 = load %struct.timeval*, %struct.timeval** %4
%32 = getelementptr inbounds %struct.timeval, %struct.timeval* %31, i32 0, i32 0
%33 = load i64, i64* %32
%34 = load %struct.timeval*, %struct.timeval** %5
%35 = getelementptr inbounds %struct.timeval, %struct.timeval* %34, i32 0, i32 0
%36 = load i64, i64* %35
%37 = icmp eq i64 %33, %36
br i1 %37, label %38, label %47
38: ; preds = %30
%39 = load %struct.timeval*, %struct.timeval** %4
%40 = getelementptr inbounds %struct.timeval, %struct.timeval* %39, i32 0, i32 1
%41 = load i64, i64* %40
%42 = load %struct.timeval*, %struct.timeval** %5
%43 = getelementptr inbounds %struct.timeval, %struct.timeval* %42, i32 0, i32 1
%44 = load i64, i64* %43
%45 = icmp sgt i64 %41, %44
br i1 %45, label %46, label %47
46: ; preds = %38, %22
store i32 1, i32* %3
br label %48
47: ; preds = %38, %30
store i32 -1, i32* %3
br label %48
48: ; preds = %47, %46, %21
%49 = load i32, i32* %3
ret i32 %49
}

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