#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 casn {
  int dummy;
};
typedef scalar_t__ int64_t;

/* Variables and functions */
scalar_t__ read_casn_time(struct casn *, scalar_t__ *);
int diff_casn_time(struct casn *casnp1, struct casn *casnp2) {
  int64_t t1, t2;
  if (read_casn_time(casnp1, &t1) <= 0 || read_casn_time(casnp2, &t2) <= 0)
    return -2;
  if (t1 > t2)
    return 1;
  if (t1 < t2)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<diff_casn_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <read_casn_time@plt>
cmp    $0x0,%rax
jle    114e <diff_casn_time+0x3e>
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <read_casn_time@plt>
cmp    $0x0,%rax
jg     115a <diff_casn_time+0x4a>
movl   $0xfffffffe,-0x4(%rbp)
jmp    1195 <diff_casn_time+0x85>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jle    1174 <diff_casn_time+0x64>
movl   $0x1,-0x4(%rbp)
jmp    1195 <diff_casn_time+0x85>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    118e <diff_casn_time+0x7e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1195 <diff_casn_time+0x85>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<diff_casn_time>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
lea    0x10(%rsp),%rsi
call   1030 <read_casn_time@plt>
mov    $0xfffffffe,%ebx
test   %rax,%rax
jle    1159 <diff_casn_time+0x49>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1030 <read_casn_time@plt>
test   %rax,%rax
jle    1159 <diff_casn_time+0x49>
mov    0x8(%rsp),%rax
mov    $0x1,%ebx
cmp    %rax,0x10(%rsp)
jg     1159 <diff_casn_time+0x49>
setl   %al
movzbl %al,%ebx
neg    %ebx
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
%struct.casn = type { i32 }
define i32 @diff_casn_time(%struct.casn* %0, %struct.casn* %1) {
%3 = alloca i64
%4 = alloca i64
%5 = bitcast i64* %3 to i8*
%6 = bitcast i64* %4 to i8*
%7 = call i64 @read_casn_time(%struct.casn* %0, i64* %3)
%8 = icmp slt i64 %7, 1
br i1 %8, label %19, label %9
9: ; preds = %2
%10 = call i64 @read_casn_time(%struct.casn* %1, i64* %4)
%11 = icmp slt i64 %10, 1
br i1 %11, label %19, label %12
12: ; preds = %9
%13 = load i64, i64* %3
%14 = load i64, i64* %4
%15 = icmp sgt i64 %13, %14
br i1 %15, label %19, label %16
16: ; preds = %12
%17 = icmp slt i64 %13, %14
%18 = sext i1 %17 to i32
br label %19
19: ; preds = %16, %12, %2, %9
%20 = phi i32 [ -2, %9 ], [ -2, %2 ], [ 1, %12 ], [ %18, %16 ]
ret i32 %20
}