#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 */
struct tm {
  int dummy;
};
typedef int /*<<< orphan*/ ASN1_TIME;

/* Variables and functions */
int /*<<< orphan*/ convertAsn1ToString(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ memset(struct tm *, int /*<<< orphan*/, int);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ strptime(char *, char *, struct tm *);
int convertAsn1ToTimestamp(ASN1_TIME *notAfter, char buffer[]) {
  convertAsn1ToString(notAfter, buffer);
  struct tm timestruct;
  memset(&timestruct, 0, sizeof(struct tm));
  strptime(buffer, "%b %d %H:%M:%S %Y", &timestruct);
  strftime(buffer, 128, "%s", &timestruct);
  return 0;
}


x86 assembly (clang, -O0):
<convertAsn1ToTimestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <convertAsn1ToString@plt>
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
mov    -0x10(%rbp),%rdi
lea    0xe88(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1060 <strptime@plt>
mov    -0x10(%rbp),%rdi
mov    $0x80,%esi
lea    0xe81(%rip),%rdx
lea    -0x18(%rbp),%rcx
call   1040 <strftime@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convertAsn1ToTimestamp>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1050 <convertAsn1ToString@plt>
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
lea    0xe9b(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1060 <strptime@plt>
lea    0xe9b(%rip),%rdx
mov    %rbx,%rdi
mov    $0x80,%esi
mov    %r14,%rcx
call   1040 <strftime@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [18 x i8] c"%b %d %H:%M:%S %Y\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @convertAsn1ToTimestamp(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca %struct.tm
store i32* %0, i32** %3
store i8* %1, i8** %4
%6 = load i32*, i32** %3
%7 = load i8*, i8** %4
%8 = call i32 @convertAsn1ToString(i32* %6, i8* %7)
%9 = call i32 @memset(%struct.tm* %5, i32 0, i32 4)
%10 = load i8*, i8** %4
%11 = call i32 @strptime(i8* %10, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.tm* %5)
%12 = load i8*, i8** %4
%13 = call i32 @strftime(i8* %12, i32 128, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %5)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [18 x i8] c"%b %d %H:%M:%S %Y\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @convertAsn1ToTimestamp(i32* %0, i8* %1) {
%3 = alloca %struct.tm
%4 = tail call i32 @convertAsn1ToString(i32* %0, i8* %1)
%5 = bitcast %struct.tm* %3 to i8*
%6 = call i32 @memset(%struct.tm* %3, i32 0, i32 4)
%7 = call i32 @strptime(i8* %1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.tm* %3)
%8 = call i32 @strftime(i8* %1, i32 128, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %3)
ret i32 0
}