#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 time_t;
struct tm {
  int dummy;
};
struct TYPE_3__ {
  int /*<<< orphan*/ length;
  int /*<<< orphan*/ data;
};
typedef TYPE_1__ ASN1_GENERALIZEDTIME;

/* Variables and functions */
int ASN1_time_parse(int /*<<< orphan*/, int /*<<< orphan*/, struct tm *,
                    int /*<<< orphan*/);
int /*<<< orphan*/ V_ASN1_GENERALIZEDTIME;
int timegm(struct tm *);
time_t parse_ocsp_time(ASN1_GENERALIZEDTIME *gt) {
  struct tm tm;
  time_t rv = -1;
  if (gt == NULL)
    return -1;
  if (ASN1_time_parse(gt->data, gt->length, &tm, V_ASN1_GENERALIZEDTIME) == -1)
    return -1;
  if ((rv = timegm(&tm)) == -1)
    return -1;
  return rv;
}


x86 assembly (clang, -O0):
<parse_ocsp_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114a <parse_ocsp_time+0x2a>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a5 <parse_ocsp_time+0x85>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    0x2e8a(%rip),%rax
mov    (%rax),%ecx
lea    -0x18(%rbp),%rdx
call   1030 <ASN1_time_parse@plt>
cmp    $0xffffffff,%eax
jne    117e <parse_ocsp_time+0x5e>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a5 <parse_ocsp_time+0x85>
lea    -0x18(%rbp),%rdi
call   1040 <timegm@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
jne    119f <parse_ocsp_time+0x7f>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a5 <parse_ocsp_time+0x85>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_ocsp_time>:
push   %rbx
sub    $0x10,%rsp
mov    $0xffffffff,%ebx
test   %rdi,%rdi
je     1158 <parse_ocsp_time+0x38>
mov    (%rdi),%esi
mov    0x4(%rdi),%edi
mov    0x2ead(%rip),%rax
mov    (%rax),%ecx
lea    0x8(%rsp),%rdx
call   1030 <ASN1_time_parse@plt>
cmp    $0xffffffff,%eax
je     1158 <parse_ocsp_time+0x38>
lea    0x8(%rsp),%rdi
call   1040 <timegm@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_GENERALIZEDTIME = global i32 0
define i32 @parse_ocsp_time(%struct.TYPE_3__* %0) {
%2 = alloca i32
%3 = alloca %struct.TYPE_3__*
%4 = alloca %struct.tm
%5 = alloca i32
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %3
store i32 -1, i32* %5
%6 = load %struct.TYPE_3__*, %struct.TYPE_3__** %3
%7 = icmp eq %struct.TYPE_3__* %6, null
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 -1, i32* %2
br label %26
9: ; preds = %1
%10 = load %struct.TYPE_3__*, %struct.TYPE_3__** %3
%11 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i32 0, i32 1
%12 = load i32, i32* %11
%13 = load %struct.TYPE_3__*, %struct.TYPE_3__** %3
%14 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %13, i32 0, i32 0
%15 = load i32, i32* %14
%16 = load i32, i32* @V_ASN1_GENERALIZEDTIME
%17 = call i32 @ASN1_time_parse(i32 %12, i32 %15, %struct.tm* %4, i32 %16)
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %20
19: ; preds = %9
store i32 -1, i32* %2
br label %26
20: ; preds = %9
%21 = call i32 @timegm(%struct.tm* %4)
store i32 %21, i32* %5
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %24
23: ; preds = %20
store i32 -1, i32* %2
br label %26
24: ; preds = %20
%25 = load i32, i32* %5
store i32 %25, i32* %2
br label %26
26: ; preds = %24, %23, %19, %8
%27 = load i32, i32* %2
ret i32 %27
}

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