#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 int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};
typedef int /*<<< orphan*/ ASN1_UTCTIME;

/* Variables and functions */
int /*<<< orphan*/ OPENSSL_gmtime(int /*<<< orphan*/ *, struct tm *);
int /*<<< orphan*/ OPENSSL_gmtime_diff(int *, int *, struct tm *, struct tm *);
int /*<<< orphan*/ asn1_utctime_to_tm(struct tm *, int /*<<< orphan*/ const *);
int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t) {
  struct tm stm, ttm;
  int day, sec;
  if (!asn1_utctime_to_tm(&stm, s))
    return -2;
  if (!OPENSSL_gmtime(&t, &ttm))
    return -2;
  if (!OPENSSL_gmtime_diff(&day, &sec, &ttm, &stm))
    return -2;
  if (day > 0)
    return 1;
  if (day < 0)
    return -1;
  if (sec > 0)
    return 1;
  if (sec < 0)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<ASN1_UTCTIME_cmp_time_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdi
call   1050 <asn1_utctime_to_tm@plt>
cmp    $0x0,%eax
jne    1161 <ASN1_UTCTIME_cmp_time_t+0x31>
movl   $0xfffffffe,-0x4(%rbp)
jmp    120c <ASN1_UTCTIME_cmp_time_t+0xdc>
lea    -0x14(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <OPENSSL_gmtime@plt>
cmp    $0x0,%eax
jne    1183 <ASN1_UTCTIME_cmp_time_t+0x53>
movl   $0xfffffffe,-0x4(%rbp)
jmp    120c <ASN1_UTCTIME_cmp_time_t+0xdc>
lea    -0x24(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1030 <OPENSSL_gmtime_diff@plt>
cmp    $0x0,%eax
jne    11ad <ASN1_UTCTIME_cmp_time_t+0x7d>
movl   $0xfffffffe,-0x4(%rbp)
jmp    120c <ASN1_UTCTIME_cmp_time_t+0xdc>
cmpl   $0x0,-0x24(%rbp)
jle    11c3 <ASN1_UTCTIME_cmp_time_t+0x93>
movl   $0x1,-0x4(%rbp)
jmp    120c <ASN1_UTCTIME_cmp_time_t+0xdc>
cmpl   $0x0,-0x24(%rbp)
jge    11d9 <ASN1_UTCTIME_cmp_time_t+0xa9>
movl   $0xffffffff,-0x4(%rbp)
jmp    120c <ASN1_UTCTIME_cmp_time_t+0xdc>
cmpl   $0x0,-0x28(%rbp)
jle    11ef <ASN1_UTCTIME_cmp_time_t+0xbf>
movl   $0x1,-0x4(%rbp)
jmp    120c <ASN1_UTCTIME_cmp_time_t+0xdc>
cmpl   $0x0,-0x28(%rbp)
jge    1205 <ASN1_UTCTIME_cmp_time_t+0xd5>
movl   $0xffffffff,-0x4(%rbp)
jmp    120c <ASN1_UTCTIME_cmp_time_t+0xdc>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ASN1_UTCTIME_cmp_time_t>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rax
mov    %esi,0x1c(%rsp)
lea    0x10(%rsp),%rdi
mov    %rax,%rsi
call   1050 <asn1_utctime_to_tm@plt>
mov    $0xfffffffe,%ebx
test   %eax,%eax
je     118e <ASN1_UTCTIME_cmp_time_t+0x5e>
lea    0x1c(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1040 <OPENSSL_gmtime@plt>
test   %eax,%eax
je     118e <ASN1_UTCTIME_cmp_time_t+0x5e>
lea    0x18(%rsp),%rdi
lea    0x14(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1030 <OPENSSL_gmtime_diff@plt>
test   %eax,%eax
je     118e <ASN1_UTCTIME_cmp_time_t+0x5e>
mov    $0x1,%ebx
cmpl   $0x0,0x18(%rsp)
jle    1196 <ASN1_UTCTIME_cmp_time_t+0x66>
mov    %ebx,%eax
add    $0x20,%rsp
pop    %rbx
ret
js     11a6 <ASN1_UTCTIME_cmp_time_t+0x76>
mov    0x14(%rsp),%eax
test   %eax,%eax
jg     118e <ASN1_UTCTIME_cmp_time_t+0x5e>
neg    %eax
sbb    %ebx,%ebx
jmp    118e <ASN1_UTCTIME_cmp_time_t+0x5e>
mov    $0xffffffff,%ebx
jmp    118e <ASN1_UTCTIME_cmp_time_t+0x5e>

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

LLVM IR (-O2):
%struct.tm = type { i32 }
define i32 @ASN1_UTCTIME_cmp_time_t(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.tm
%5 = alloca %struct.tm
%6 = alloca i32
%7 = alloca i32
store i32 %1, i32* %3
%8 = bitcast %struct.tm* %4 to i8*
%9 = bitcast %struct.tm* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = bitcast i32* %7 to i8*
%12 = call i32 @asn1_utctime_to_tm(%struct.tm* %4, i32* %0)
%13 = icmp eq i32 %12, 0
br i1 %13, label %31, label %14
14: ; preds = %2
%15 = call i32 @OPENSSL_gmtime(i32* %3, %struct.tm* %5)
%16 = icmp eq i32 %15, 0
br i1 %16, label %31, label %17
17: ; preds = %14
%18 = call i32 @OPENSSL_gmtime_diff(i32* %6, i32* %7, %struct.tm* %5, %struct.tm* %4)
%19 = icmp eq i32 %18, 0
br i1 %19, label %31, label %20
20: ; preds = %17
%21 = load i32, i32* %6
%22 = icmp sgt i32 %21, 0
br i1 %22, label %31, label %23
23: ; preds = %20
%24 = icmp slt i32 %21, 0
br i1 %24, label %31, label %25
25: ; preds = %23
%26 = load i32, i32* %7
%27 = icmp sgt i32 %26, 0
br i1 %27, label %31, label %28
28: ; preds = %25
%29 = icmp ne i32 %26, 0
%30 = sext i1 %29 to i32
br label %31
31: ; preds = %28, %25, %23, %20, %17, %14, %2
%32 = phi i32 [ -2, %2 ], [ -2, %14 ], [ -2, %17 ], [ 1, %20 ], [ -1, %23 ], [ 1, %25 ], [ %30, %28 ]
ret i32 %32
}