#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 timer_cmp(struct timeval time_a, struct timeval time_b) {
  if (time_a.tv_sec > time_b.tv_sec)
    return 1;
  if (time_a.tv_sec < time_b.tv_sec)
    return 0;
  if (time_a.tv_usec > time_b.tv_usec)
    return 1;
  if (time_a.tv_usec < time_b.tv_usec)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<timer_cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
jle    112e <timer_cmp+0x2e>
movl   $0x1,-0x4(%rbp)
jmp    1183 <timer_cmp+0x83>
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    1148 <timer_cmp+0x48>
movl   $0x0,-0x4(%rbp)
jmp    1183 <timer_cmp+0x83>
mov    -0x10(%rbp),%rax
cmp    -0x20(%rbp),%rax
jle    1162 <timer_cmp+0x62>
movl   $0x1,-0x4(%rbp)
jmp    1183 <timer_cmp+0x83>
mov    -0x10(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    117c <timer_cmp+0x7c>
movl   $0x0,-0x4(%rbp)
jmp    1183 <timer_cmp+0x83>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<timer_cmp>:
mov    $0x1,%eax
cmp    %rdx,%rdi
jg     1121 <timer_cmp+0x21>
xor    %eax,%eax
cmp    %rdx,%rdi
jl     1121 <timer_cmp+0x21>
mov    $0x1,%eax
cmp    %rcx,%rsi
jg     1121 <timer_cmp+0x21>
setge  %al
movzbl %al,%eax
ret

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

LLVM IR (-O2):
define i32 @timer_cmp(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = icmp sgt i64 %0, %2
br i1 %5, label %13, label %6
6: ; preds = %4
%7 = icmp slt i64 %0, %2
br i1 %7, label %13, label %8
8: ; preds = %6
%9 = icmp sgt i64 %1, %3
br i1 %9, label %13, label %10
10: ; preds = %8
%11 = icmp sge i64 %1, %3
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %10, %8, %6, %4
%14 = phi i32 [ 1, %4 ], [ 0, %6 ], [ 1, %8 ], [ %12, %10 ]
ret i32 %14
}