#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 */
struct TYPE_3__ {
  unsigned char *data;
  int /*<<< orphan*/ type;
  int /*<<< orphan*/ length;
};
typedef TYPE_1__ ASN1_TIME;

/* Variables and functions */
int ASN1_TIME_check(TYPE_1__ *);
int /*<<< orphan*/ V_ASN1_GENERALIZEDTIME;
int /*<<< orphan*/ V_ASN1_UTCTIME;
int /*<<< orphan*/ strlen(char const *);
int check_time_format(const char *str) {
  ASN1_TIME tm;
  tm.data = (unsigned char *)str;
  tm.length = strlen(str);
  tm.type = V_ASN1_UTCTIME;
  if (ASN1_TIME_check(&tm))
    return 1;
  tm.type = V_ASN1_GENERALIZEDTIME;
  return ASN1_TIME_check(&tm);
}


x86 assembly (clang, -O0):
<check_time_format>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e91(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <ASN1_TIME_check@plt>
cmp    $0x0,%eax
je     116a <check_time_format+0x4a>
movl   $0x1,-0x4(%rbp)
jmp    1182 <check_time_format+0x62>
mov    0x2e77(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <ASN1_TIME_check@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_time_format>:
sub    $0x18,%rsp
mov    %rdi,0x8(%rsp)
call   1030 <strlen@plt>
mov    %eax,0x14(%rsp)
mov    0x2e9f(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
lea    0x8(%rsp),%rdi
call   1040 <ASN1_TIME_check@plt>
mov    %eax,%ecx
mov    $0x1,%eax
test   %ecx,%ecx
je     1159 <check_time_format+0x39>
add    $0x18,%rsp
ret
mov    0x2e88(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
lea    0x8(%rsp),%rdi
call   1040 <ASN1_TIME_check@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i8*, i32, i32 }
@V_ASN1_UTCTIME = global i32 0
@V_ASN1_GENERALIZEDTIME = global i32 0
define i32 @check_time_format(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.TYPE_3__
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %4, i32 0, i32 0
store i8* %5, i8** %6
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %4, i32 0, i32 2
store i32 %8, i32* %9
%10 = load i32, i32* @V_ASN1_UTCTIME
%11 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %4, i32 0, i32 1
store i32 %10, i32* %11
%12 = call i32 @ASN1_TIME_check(%struct.TYPE_3__* %4)
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %1
store i32 1, i32* %2
br label %19
15: ; preds = %1
%16 = load i32, i32* @V_ASN1_GENERALIZEDTIME
%17 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %4, i32 0, i32 1
store i32 %16, i32* %17
%18 = call i32 @ASN1_TIME_check(%struct.TYPE_3__* %4)
store i32 %18, i32* %2
br label %19
19: ; preds = %15, %14
%20 = load i32, i32* %2
ret i32 %20
}

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