#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 scalar_t__ time_t;
typedef int int32_t;
typedef int /*<<< orphan*/ X509_VERIFY_PARAM;
typedef int /*<<< orphan*/ X509_STORE_CTX;

/* Variables and functions */
scalar_t__ MakeTimeT(int, int, int, int, int, int, int);
int /*<<< orphan*/ *X509_STORE_CTX_get0_param(int /*<<< orphan*/ *);
int /*<<< orphan*/ X509_VERIFY_PARAM_set_time(int /*<<< orphan*/ *, scalar_t__);
int32_t SetX509ChainVerifyTime(X509_STORE_CTX *ctx, int32_t year, int32_t month,
                               int32_t day, int32_t hour, int32_t minute,
                               int32_t second, int32_t isDst) {
  if (!ctx) {
    return 0;
  }
  time_t verifyTime = MakeTimeT(year, month, day, hour, minute, second, isDst);
  if (verifyTime == (time_t)-1) {
    return 0;
  }
  X509_VERIFY_PARAM *verifyParams = X509_STORE_CTX_get0_param(ctx);
  if (!verifyParams) {
    return 0;
  }
  X509_VERIFY_PARAM_set_time(verifyParams, verifyTime);
  return 1;
}


x86 assembly (clang, -O0):
<SetX509ChainVerifyTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116a <SetX509ChainVerifyTime+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    11dc <SetX509ChainVerifyTime+0xac>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x24(%rbp),%r8d
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <MakeTimeT@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0xffffffffffffffff,-0x30(%rbp)
jne    11a4 <SetX509ChainVerifyTime+0x74>
movl   $0x0,-0x4(%rbp)
jmp    11dc <SetX509ChainVerifyTime+0xac>
mov    -0x10(%rbp),%rdi
call   1040 <X509_STORE_CTX_get0_param@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    11c8 <SetX509ChainVerifyTime+0x98>
movl   $0x0,-0x4(%rbp)
jmp    11dc <SetX509ChainVerifyTime+0xac>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1050 <X509_VERIFY_PARAM_set_time@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetX509ChainVerifyTime>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %ebp,%ebp
test   %rdi,%rdi
je     1187 <SetX509ChainVerifyTime+0x57>
mov    %rdi,%rbx
mov    0x38(%rsp),%edi
mov    0x30(%rsp),%eax
mov    %edi,(%rsp)
mov    %esi,%edi
mov    %edx,%esi
mov    %ecx,%edx
mov    %r8d,%ecx
mov    %r9d,%r8d
mov    %eax,%r9d
call   1030 <MakeTimeT@plt>
cmp    $0xffffffffffffffff,%rax
je     1187 <SetX509ChainVerifyTime+0x57>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <X509_STORE_CTX_get0_param@plt>
test   %rax,%rax
je     1187 <SetX509ChainVerifyTime+0x57>
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <X509_VERIFY_PARAM_set_time@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @SetX509ChainVerifyTime(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i64
%19 = alloca i32*
store i32* %0, i32** %10
store i32 %1, i32* %11
store i32 %2, i32* %12
store i32 %3, i32* %13
store i32 %4, i32* %14
store i32 %5, i32* %15
store i32 %6, i32* %16
store i32 %7, i32* %17
%20 = load i32*, i32** %10
%21 = icmp ne i32* %20, null
br i1 %21, label %23, label %22
22: ; preds = %8
store i32 0, i32* %9
br label %45
23: ; preds = %8
%24 = load i32, i32* %11
%25 = load i32, i32* %12
%26 = load i32, i32* %13
%27 = load i32, i32* %14
%28 = load i32, i32* %15
%29 = load i32, i32* %16
%30 = load i32, i32* %17
%31 = call i64 @MakeTimeT(i32 %24, i32 %25, i32 %26, i32 %27, i32 %28, i32 %29, i32 %30)
store i64 %31, i64* %18
%32 = load i64, i64* %18
%33 = icmp eq i64 %32, -1
br i1 %33, label %34, label %35
34: ; preds = %23
store i32 0, i32* %9
br label %45
35: ; preds = %23
%36 = load i32*, i32** %10
%37 = call i32* @X509_STORE_CTX_get0_param(i32* %36)
store i32* %37, i32** %19
%38 = load i32*, i32** %19
%39 = icmp ne i32* %38, null
br i1 %39, label %41, label %40
40: ; preds = %35
store i32 0, i32* %9
br label %45
41: ; preds = %35
%42 = load i32*, i32** %19
%43 = load i64, i64* %18
%44 = call i32 @X509_VERIFY_PARAM_set_time(i32* %42, i64 %43)
store i32 1, i32* %9
br label %45
45: ; preds = %41, %40, %34, %22
%46 = load i32, i32* %9
ret i32 %46
}

LLVM IR (-O2):
define i32 @SetX509ChainVerifyTime(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = icmp eq i32* %0, null
br i1 %9, label %18, label %10
10: ; preds = %8
%11 = tail call i64 @MakeTimeT(i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7)
%12 = icmp eq i64 %11, -1
br i1 %12, label %18, label %13
13: ; preds = %10
%14 = tail call i32* @X509_STORE_CTX_get0_param(i32* %0)
%15 = icmp eq i32* %14, null
br i1 %15, label %18, label %16
16: ; preds = %13
%17 = tail call i32 @X509_VERIFY_PARAM_set_time(i32* %14, i64 %11)
br label %18
18: ; preds = %10, %13, %16, %8
%19 = phi i32 [ 0, %8 ], [ 0, %10 ], [ 1, %16 ], [ 0, %13 ]
ret i32 %19
}