#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*/ X509;
typedef int /*<<< orphan*/ ASN1_TIME;

/* Variables and functions */
scalar_t__ X509_cmp_current_time(int /*<<< orphan*/ *);
int /*<<< orphan*/ *X509_get_notAfter(int /*<<< orphan*/ *);
int /*<<< orphan*/ *X509_get_notBefore(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, scalar_t__);
int /*<<< orphan*/ stderr;
int abac_still_valid(X509 *cert) {
  ASN1_TIME *notAfter = X509_get_notAfter(cert);
  ASN1_TIME *notBefore = X509_get_notBefore(cert);
  if (0) {
    fprintf(stderr, "((X509_cmp_current_time(notBefore) is %d\n",
            X509_cmp_current_time(notBefore));
    fprintf(stderr, "((X509_cmp_current_time(notAfter) is %d\n",
            X509_cmp_current_time(notAfter));
  }
  if ((X509_cmp_current_time(notBefore) >= 0) ||
      (X509_cmp_current_time(notAfter) <= 0))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<abac_still_valid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <X509_get_notAfter@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <X509_get_notBefore@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <X509_cmp_current_time@plt>
cmp    $0x0,%rax
jge    117c <abac_still_valid+0x4c>
mov    -0x18(%rbp),%rdi
call   1050 <X509_cmp_current_time@plt>
cmp    $0x0,%rax
jg     1188 <abac_still_valid+0x58>
movl   $0x0,-0x4(%rbp)
jmp    118f <abac_still_valid+0x5f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<abac_still_valid>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <X509_get_notAfter@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <X509_get_notBefore@plt>
mov    %rax,%rdi
call   1050 <X509_cmp_current_time@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jns    116c <abac_still_valid+0x3c>
mov    %r14,%rdi
call   1050 <X509_cmp_current_time@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setg   %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
define i32 @abac_still_valid(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
store i32* %0, i32** %3
%6 = load i32*, i32** %3
%7 = call i32* @X509_get_notAfter(i32* %6)
store i32* %7, i32** %4
%8 = load i32*, i32** %3
%9 = call i32* @X509_get_notBefore(i32* %8)
store i32* %9, i32** %5
%10 = load i32*, i32** %5
%11 = call i64 @X509_cmp_current_time(i32* %10)
%12 = icmp sge i64 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %1
%14 = load i32*, i32** %4
%15 = call i64 @X509_cmp_current_time(i32* %14)
%16 = icmp sle i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13, %1
store i32 0, i32* %2
br label %19
18: ; preds = %13
store i32 1, i32* %2
br label %19
19: ; preds = %18, %17
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
@stderr = global i32 0
define i32 @abac_still_valid(i32* %0) {
%2 = tail call i32* @X509_get_notAfter(i32* %0)
%3 = tail call i32* @X509_get_notBefore(i32* %0)
%4 = tail call i64 @X509_cmp_current_time(i32* %3)
%5 = icmp sgt i64 %4, -1
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = tail call i64 @X509_cmp_current_time(i32* %2)
%8 = icmp sgt i64 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %1
%11 = phi i32 [ 0, %1 ], [ %9, %6 ]
ret i32 %11
}