#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_10__ TYPE_1__;

/* Type definitions */
typedef long time_t;
struct TYPE_10__ {
  int type;
};
typedef TYPE_1__ ASN1_TIME;

/* Variables and functions */
TYPE_1__ *ASN1_GENERALIZEDTIME_set(TYPE_1__ *, long);
TYPE_1__ *ASN1_TIME_set(TYPE_1__ *, long);
TYPE_1__ *ASN1_UTCTIME_set(TYPE_1__ *, long);
int V_ASN1_GENERALIZEDTIME;
int V_ASN1_UTCTIME;
int /*<<< orphan*/ time(long *);
ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *in_tm) {
  time_t t;
  int type = -1;
  if (in_tm)
    t = *in_tm;
  else
    time(&t);
  t += adj;
  if (s)
    type = s->type;
  if (type == V_ASN1_UTCTIME)
    return ASN1_UTCTIME_set(s, t);
  if (type == V_ASN1_GENERALIZEDTIME)
    return ASN1_GENERALIZEDTIME_set(s, t);
  return ASN1_TIME_set(s, t);
}


x86 assembly (clang, -O0):
<X509_time_adj>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0xffffffff,-0x2c(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1176 <X509_time_adj+0x36>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    117f <X509_time_adj+0x3f>
lea    -0x28(%rbp),%rdi
call   1050 <time@plt>
mov    -0x18(%rbp),%rax
add    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     119f <X509_time_adj+0x5f>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    0x2e2f(%rip),%rcx
cmp    (%rcx),%eax
jne    11c7 <X509_time_adj+0x87>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <ASN1_UTCTIME_set@plt>
mov    %rax,-0x8(%rbp)
jmp    1200 <X509_time_adj+0xc0>
mov    -0x2c(%rbp),%eax
mov    0x2e17(%rip),%rcx
cmp    (%rcx),%eax
jne    11ef <X509_time_adj+0xaf>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <ASN1_GENERALIZEDTIME_set@plt>
mov    %rax,-0x8(%rbp)
jmp    1200 <X509_time_adj+0xc0>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <ASN1_TIME_set@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<X509_time_adj>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r14
test   %rdx,%rdx
jne    1164 <X509_time_adj+0x24>
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <time@plt>
add    (%rbx),%r15
mov    %r15,0x8(%rsp)
test   %r14,%r14
je     1176 <X509_time_adj+0x36>
mov    (%r14),%eax
jmp    117b <X509_time_adj+0x3b>
mov    $0xffffffff,%eax
mov    0x2e56(%rip),%rcx
cmp    (%rcx),%eax
jne    1193 <X509_time_adj+0x53>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <ASN1_UTCTIME_set@plt>
jmp    11b6 <X509_time_adj+0x76>
mov    0x2e4e(%rip),%rcx
cmp    (%rcx),%eax
jne    11ab <X509_time_adj+0x6b>
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <ASN1_GENERALIZEDTIME_set@plt>
jmp    11b6 <X509_time_adj+0x76>
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <ASN1_TIME_set@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TYPE_10__ = type { i32 }
@V_ASN1_UTCTIME = global i32 0
@V_ASN1_GENERALIZEDTIME = global i32 0
define %struct.TYPE_10__* @X509_time_adj(%struct.TYPE_10__* %0, i64 %1, i64* %2) {
%4 = alloca %struct.TYPE_10__*
%5 = alloca %struct.TYPE_10__*
%6 = alloca i64
%7 = alloca i64*
%8 = alloca i64
%9 = alloca i32
store %struct.TYPE_10__* %0, %struct.TYPE_10__** %5
store i64 %1, i64* %6
store i64* %2, i64** %7
store i32 -1, i32* %9
%10 = load i64*, i64** %7
%11 = icmp ne i64* %10, null
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = load i64*, i64** %7
%14 = load i64, i64* %13
store i64 %14, i64* %8
br label %17
15: ; preds = %3
%16 = call i32 @time(i64* %8)
br label %17
17: ; preds = %15, %12
%18 = load i64, i64* %6
%19 = load i64, i64* %8
%20 = add nsw i64 %19, %18
store i64 %20, i64* %8
%21 = load %struct.TYPE_10__*, %struct.TYPE_10__** %5
%22 = icmp ne %struct.TYPE_10__* %21, null
br i1 %22, label %23, label %27
23: ; preds = %17
%24 = load %struct.TYPE_10__*, %struct.TYPE_10__** %5
%25 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %24, i32 0, i32 0
%26 = load i32, i32* %25
store i32 %26, i32* %9
br label %27
27: ; preds = %23, %17
%28 = load i32, i32* %9
%29 = load i32, i32* @V_ASN1_UTCTIME
%30 = icmp eq i32 %28, %29
br i1 %30, label %31, label %35
31: ; preds = %27
%32 = load %struct.TYPE_10__*, %struct.TYPE_10__** %5
%33 = load i64, i64* %8
%34 = call %struct.TYPE_10__* @ASN1_UTCTIME_set(%struct.TYPE_10__* %32, i64 %33)
store %struct.TYPE_10__* %34, %struct.TYPE_10__** %4
br label %47
35: ; preds = %27
%36 = load i32, i32* %9
%37 = load i32, i32* @V_ASN1_GENERALIZEDTIME
%38 = icmp eq i32 %36, %37
br i1 %38, label %39, label %43
39: ; preds = %35
%40 = load %struct.TYPE_10__*, %struct.TYPE_10__** %5
%41 = load i64, i64* %8
%42 = call %struct.TYPE_10__* @ASN1_GENERALIZEDTIME_set(%struct.TYPE_10__* %40, i64 %41)
store %struct.TYPE_10__* %42, %struct.TYPE_10__** %4
br label %47
43: ; preds = %35
%44 = load %struct.TYPE_10__*, %struct.TYPE_10__** %5
%45 = load i64, i64* %8
%46 = call %struct.TYPE_10__* @ASN1_TIME_set(%struct.TYPE_10__* %44, i64 %45)
store %struct.TYPE_10__* %46, %struct.TYPE_10__** %4
br label %47
47: ; preds = %43, %39, %31
%48 = load %struct.TYPE_10__*, %struct.TYPE_10__** %4
ret %struct.TYPE_10__* %48
}

LLVM IR (-O2):
%struct.TYPE_10__ = type { i32 }
@V_ASN1_UTCTIME = global i32 0
@V_ASN1_GENERALIZEDTIME = global i32 0
define %struct.TYPE_10__* @X509_time_adj(%struct.TYPE_10__* %0, i64 %1, i64* %2) {
%4 = alloca i64
%5 = bitcast i64* %4 to i8*
%6 = icmp eq i64* %2, null
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = call i32 @time(i64* %4)
br label %9
9: ; preds = %3, %7
%10 = phi i64* [ %4, %7 ], [ %2, %3 ]
%11 = load i64, i64* %10
%12 = add nsw i64 %11, %1
store i64 %12, i64* %4
%13 = icmp eq %struct.TYPE_10__* %0, null
br i1 %13, label %17, label %14
14: ; preds = %9
%15 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %0, i64 0, i32 0
%16 = load i32, i32* %15
br label %17
17: ; preds = %14, %9
%18 = phi i32 [ %16, %14 ], [ -1, %9 ]
%19 = load i32, i32* @V_ASN1_UTCTIME
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = call %struct.TYPE_10__* @ASN1_UTCTIME_set(%struct.TYPE_10__* %0, i64 %12)
br label %30
23: ; preds = %17
%24 = load i32, i32* @V_ASN1_GENERALIZEDTIME
%25 = icmp eq i32 %18, %24
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call %struct.TYPE_10__* @ASN1_GENERALIZEDTIME_set(%struct.TYPE_10__* %0, i64 %12)
br label %30
28: ; preds = %23
%29 = call %struct.TYPE_10__* @ASN1_TIME_set(%struct.TYPE_10__* %0, i64 %12)
br label %30
30: ; preds = %28, %26, %21
%31 = phi %struct.TYPE_10__* [ %22, %21 ], [ %27, %26 ], [ %29, %28 ]
ret %struct.TYPE_10__* %31
}