#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 */
typedef scalar_t__ uint16_t;
typedef scalar_t__ time_t;

/* Variables and functions */
int TimeMsec_CMP(time_t t1, uint16_t offset1, time_t t2, uint16_t offset2) {
  if (t1 > t2)
    return 1;
  if (t2 > t1)
    return 2;
  if (offset1 > offset2)
    return 1;
  if (offset2 > offset1)
    return 2;
  else
    return 0;
}


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

x86 assembly (clang, -O2):
<TimeMsec_CMP>:
mov    $0x1,%eax
cmp    %rdx,%rdi
jg     1123 <TimeMsec_CMP+0x23>
mov    $0x2,%eax
jl     1123 <TimeMsec_CMP+0x23>
mov    $0x1,%eax
cmp    %rcx,%rsi
jg     1123 <TimeMsec_CMP+0x23>
setl   %al
movzbl %al,%eax
add    %eax,%eax
ret

LLVM IR (-O0):
define i32 @TimeMsec_CMP(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i32
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
store i64 %0, i64* %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
%10 = load i64, i64* %6
%11 = load i64, i64* %8
%12 = icmp sgt i64 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %4
store i32 1, i32* %5
br label %30
14: ; preds = %4
%15 = load i64, i64* %8
%16 = load i64, i64* %6
%17 = icmp sgt i64 %15, %16
br i1 %17, label %18, label %19
18: ; preds = %14
store i32 2, i32* %5
br label %30
19: ; preds = %14
%20 = load i64, i64* %7
%21 = load i64, i64* %9
%22 = icmp sgt i64 %20, %21
br i1 %22, label %23, label %24
23: ; preds = %19
store i32 1, i32* %5
br label %30
24: ; preds = %19
%25 = load i64, i64* %9
%26 = load i64, i64* %7
%27 = icmp sgt i64 %25, %26
br i1 %27, label %28, label %29
28: ; preds = %24
store i32 2, i32* %5
br label %30
29: ; preds = %24
store i32 0, i32* %5
br label %30
30: ; preds = %29, %28, %23, %18, %13
%31 = load i32, i32* %5
ret i32 %31
}

LLVM IR (-O2):
define i32 @TimeMsec_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 sgt i64 %2, %0
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 sgt i64 %3, %1
%12 = select i1 %11, i32 2, i32 0
br label %13
13: ; preds = %10, %8, %6, %4
%14 = phi i32 [ 1, %4 ], [ 2, %6 ], [ 1, %8 ], [ %12, %10 ]
ret i32 %14
}