#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};
struct TYPE_3__ {
  int /*<<< orphan*/ length;
  int /*<<< orphan*/ data;
};
typedef TYPE_1__ ASN1_UTCTIME;

/* Variables and functions */
int ASN1_time_parse(int /*<<< orphan*/, int /*<<< orphan*/, struct tm *,
                    int /*<<< orphan*/);
int ASN1_time_tm_cmp(struct tm *, struct tm *);
int /*<<< orphan*/ V_ASN1_UTCTIME;
int /*<<< orphan*/ *gmtime_r(int /*<<< orphan*/ *, struct tm *);
int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t2) {
  struct tm tm1, tm2;
  if (ASN1_time_parse(s->data, s->length, &tm1, V_ASN1_UTCTIME) == -1)
    return (-2);
  if (gmtime_r(&t2, &tm2) == NULL)
    return (-2);
  return ASN1_time_tm_cmp(&tm1, &tm2);
}


x86 assembly (clang, -O0):
<ASN1_UTCTIME_cmp_time_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    0x2e8d(%rip),%rax
mov    (%rax),%ecx
lea    -0x18(%rbp),%rdx
call   1050 <ASN1_time_parse@plt>
cmp    $0xffffffff,%eax
jne    1173 <ASN1_UTCTIME_cmp_time_t+0x43>
movl   $0xfffffffe,-0x4(%rbp)
jmp    11a6 <ASN1_UTCTIME_cmp_time_t+0x76>
lea    -0x14(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <gmtime_r@plt>
cmp    $0x0,%rax
jne    1196 <ASN1_UTCTIME_cmp_time_t+0x66>
movl   $0xfffffffe,-0x4(%rbp)
jmp    11a6 <ASN1_UTCTIME_cmp_time_t+0x76>
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <ASN1_time_tm_cmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ASN1_UTCTIME_cmp_time_t>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,0xc(%rsp)
mov    (%rdi),%esi
mov    0x4(%rdi),%edi
mov    0x2e9b(%rip),%rax
mov    (%rax),%ecx
lea    0x8(%rsp),%rdx
call   1050 <ASN1_time_parse@plt>
mov    $0xfffffffe,%ebx
cmp    $0xffffffff,%eax
je     117c <ASN1_UTCTIME_cmp_time_t+0x4c>
lea    0xc(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <gmtime_r@plt>
test   %rax,%rax
je     117c <ASN1_UTCTIME_cmp_time_t+0x4c>
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
call   1040 <ASN1_time_tm_cmp@plt>
mov    %eax,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32 }
%struct.tm = type { i32 }
@V_ASN1_UTCTIME = global i32 0
define i32 @ASN1_UTCTIME_cmp_time_t(%struct.TYPE_3__* %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_3__*
%5 = alloca i32
%6 = alloca %struct.tm
%7 = alloca %struct.tm
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %4
store i32 %1, i32* %5
%8 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 1
%10 = load i32, i32* %9
%11 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%12 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = load i32, i32* @V_ASN1_UTCTIME
%15 = call i32 @ASN1_time_parse(i32 %10, i32 %13, %struct.tm* %6, i32 %14)
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 -2, i32* %3
br label %24
18: ; preds = %2
%19 = call i32* @gmtime_r(i32* %5, %struct.tm* %7)
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %22
21: ; preds = %18
store i32 -2, i32* %3
br label %24
22: ; preds = %18
%23 = call i32 @ASN1_time_tm_cmp(%struct.tm* %6, %struct.tm* %7)
store i32 %23, i32* %3
br label %24
24: ; preds = %22, %21, %17
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i32 }
%struct.tm = type { i32 }
@V_ASN1_UTCTIME = global i32 0
define i32 @ASN1_UTCTIME_cmp_time_t(%struct.TYPE_3__* nocapture %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.tm
%5 = alloca %struct.tm
store i32 %1, i32* %3
%6 = bitcast %struct.tm* %4 to i8*
%7 = bitcast %struct.tm* %5 to i8*
%8 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 1
%9 = load i32, i32* %8
%10 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 0
%11 = load i32, i32* %10
%12 = load i32, i32* @V_ASN1_UTCTIME
%13 = call i32 @ASN1_time_parse(i32 %9, i32 %11, %struct.tm* %4, i32 %12)
%14 = icmp eq i32 %13, -1
br i1 %14, label %20, label %15
15: ; preds = %2
%16 = call i32* @gmtime_r(i32* %3, %struct.tm* %5)
%17 = icmp eq i32* %16, null
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = call i32 @ASN1_time_tm_cmp(%struct.tm* %4, %struct.tm* %5)
br label %20
20: ; preds = %15, %2, %18
%21 = phi i32 [ %19, %18 ], [ -2, %2 ], [ -2, %15 ]
ret i32 %21
}