#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*/ time_t;
struct tm {
  int tm_isdst;
  void *tm_sec;
  void *tm_min;
  void *tm_hour;
  void *tm_mday;
  void *tm_mon;
  void *tm_year;
};
typedef int /*<<< orphan*/ caYear;
typedef int /*<<< orphan*/ caSec;
typedef int /*<<< orphan*/ caMonth;
typedef int /*<<< orphan*/ caMin;
typedef int /*<<< orphan*/ caHour;
typedef int /*<<< orphan*/ caDay;

/* Variables and functions */
void *atoi(char *);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ mktime(struct tm *);
time_t kr_time_to_ttime(char *pcaTime) {
  char caYear[5], caMonth[3], caDay[3], caHour[3], caMin[3], caSec[3];
  struct tm tTime;
  memset(caYear, 0, sizeof(caYear));
  memset(caMonth, 0, sizeof(caMonth));
  memset(caDay, 0, sizeof(caDay));
  memset(caHour, 0, sizeof(caHour));
  memset(caMin, 0, sizeof(caMin));
  memset(caSec, 0, sizeof(caSec));
  memcpy(caYear, pcaTime, 4);
  memcpy(caMonth, pcaTime + 4, 2);
  memcpy(caDay, pcaTime + 6, 2);
  memcpy(caHour, pcaTime + 8, 2);
  memcpy(caMin, pcaTime + 10, 2);
  memcpy(caSec, pcaTime + 12, 2);
  tTime.tm_year = atoi(caYear) - 1900;
  tTime.tm_mon = atoi(caMonth) - 1;
  tTime.tm_mday = atoi(caDay);
  tTime.tm_hour = atoi(caHour);
  tTime.tm_min = atoi(caMin);
  tTime.tm_sec = atoi(caSec);
  tTime.tm_isdst = -1;
  return mktime(&tTime);
}


x86 assembly (clang, -O0):
<kr_time_to_ttime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xd(%rbp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1030 <memset@plt>
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1030 <memset@plt>
lea    -0x13(%rbp),%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1030 <memset@plt>
lea    -0x16(%rbp),%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1030 <memset@plt>
lea    -0x19(%rbp),%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1030 <memset@plt>
lea    -0x1c(%rbp),%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1030 <memset@plt>
lea    -0xd(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
lea    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x4,%rsi
mov    $0x2,%edx
call   1040 <memcpy@plt>
lea    -0x13(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x6,%rsi
mov    $0x2,%edx
call   1040 <memcpy@plt>
lea    -0x16(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x8,%rsi
mov    $0x2,%edx
call   1040 <memcpy@plt>
lea    -0x19(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0xa,%rsi
mov    $0x2,%edx
call   1040 <memcpy@plt>
lea    -0x1c(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0xc,%rsi
mov    $0x2,%edx
call   1040 <memcpy@plt>
lea    -0xd(%rbp),%rdi
call   1060 <atoi@plt>
add    $0xfffffffffffff894,%rax
mov    %rax,-0x28(%rbp)
lea    -0x10(%rbp),%rdi
call   1060 <atoi@plt>
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
lea    -0x13(%rbp),%rdi
call   1060 <atoi@plt>
mov    %rax,-0x38(%rbp)
lea    -0x16(%rbp),%rdi
call   1060 <atoi@plt>
mov    %rax,-0x40(%rbp)
lea    -0x19(%rbp),%rdi
call   1060 <atoi@plt>
mov    %rax,-0x48(%rbp)
lea    -0x1c(%rbp),%rdi
call   1060 <atoi@plt>
mov    %rax,-0x50(%rbp)
movl   $0xffffffff,-0x58(%rbp)
lea    -0x58(%rbp),%rdi
call   1050 <mktime@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kr_time_to_ttime>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rdi,%rbp
lea    0x1b(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1030 <memset@plt>
lea    0x18(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1030 <memset@plt>
lea    0xf(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1030 <memset@plt>
lea    0x15(%rsp),%r13
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1030 <memset@plt>
lea    0x12(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1030 <memset@plt>
lea    0xc(%rsp),%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1030 <memset@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
lea    0x4(%rbp),%rsi
mov    %r14,%rdi
mov    $0x2,%edx
call   1040 <memcpy@plt>
lea    0x6(%rbp),%rsi
mov    %r15,%rdi
mov    $0x2,%edx
call   1040 <memcpy@plt>
lea    0x8(%rbp),%rsi
mov    %r13,%rdi
mov    $0x2,%edx
call   1040 <memcpy@plt>
lea    0xa(%rbp),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
call   1040 <memcpy@plt>
add    $0xc,%rbp
lea    0xc(%rsp),%rdi
mov    %rbp,%rsi
mov    $0x2,%edx
call   1040 <memcpy@plt>
mov    %r12,%rdi
call   1060 <atoi@plt>
mov    %rax,%rbp
mov    %r14,%rdi
call   1060 <atoi@plt>
movq   %rbp,%xmm0
movq   %rax,%xmm1
punpcklqdq %xmm0,%xmm1
paddq  0xda7(%rip),%xmm1
movdqu %xmm1,0x48(%rsp)
lea    0xf(%rsp),%rdi
call   1060 <atoi@plt>
mov    %rax,0x40(%rsp)
mov    %r13,%rdi
call   1060 <atoi@plt>
mov    %rax,0x38(%rsp)
mov    %rbx,%rdi
call   1060 <atoi@plt>
mov    %rax,0x30(%rsp)
lea    0xc(%rsp),%rdi
call   1060 <atoi@plt>
mov    %rax,0x28(%rsp)
movl   $0xffffffff,0x20(%rsp)
ff
lea    0x20(%rsp),%rdi
call   1050 <mktime@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i8*, i8*, i8*, i8*, i8*, i8* }
define i32 @kr_time_to_ttime(i8* %0) {
%2 = alloca i8*
%3 = alloca [5 x i8]
%4 = alloca [3 x i8]
%5 = alloca [3 x i8]
%6 = alloca [3 x i8]
%7 = alloca [3 x i8]
%8 = alloca [3 x i8]
%9 = alloca %struct.tm
store i8* %0, i8** %2
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%11 = call i32 @memset(i8* %10, i32 0, i32 5)
%12 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%13 = call i32 @memset(i8* %12, i32 0, i32 3)
%14 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%15 = call i32 @memset(i8* %14, i32 0, i32 3)
%16 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%17 = call i32 @memset(i8* %16, i32 0, i32 3)
%18 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 0
%19 = call i32 @memset(i8* %18, i32 0, i32 3)
%20 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%21 = call i32 @memset(i8* %20, i32 0, i32 3)
%22 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%23 = load i8*, i8** %2
%24 = call i32 @memcpy(i8* %22, i8* %23, i32 4)
%25 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%26 = load i8*, i8** %2
%27 = getelementptr inbounds i8, i8* %26, i64 4
%28 = call i32 @memcpy(i8* %25, i8* %27, i32 2)
%29 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%30 = load i8*, i8** %2
%31 = getelementptr inbounds i8, i8* %30, i64 6
%32 = call i32 @memcpy(i8* %29, i8* %31, i32 2)
%33 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%34 = load i8*, i8** %2
%35 = getelementptr inbounds i8, i8* %34, i64 8
%36 = call i32 @memcpy(i8* %33, i8* %35, i32 2)
%37 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 0
%38 = load i8*, i8** %2
%39 = getelementptr inbounds i8, i8* %38, i64 10
%40 = call i32 @memcpy(i8* %37, i8* %39, i32 2)
%41 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%42 = load i8*, i8** %2
%43 = getelementptr inbounds i8, i8* %42, i64 12
%44 = call i32 @memcpy(i8* %41, i8* %43, i32 2)
%45 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%46 = call i8* @atoi(i8* %45)
%47 = getelementptr i8, i8* %46, i64 -1900
%48 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 6
store i8* %47, i8** %48
%49 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%50 = call i8* @atoi(i8* %49)
%51 = getelementptr i8, i8* %50, i64 -1
%52 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 5
store i8* %51, i8** %52
%53 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%54 = call i8* @atoi(i8* %53)
%55 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 4
store i8* %54, i8** %55
%56 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%57 = call i8* @atoi(i8* %56)
%58 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 3
store i8* %57, i8** %58
%59 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 0
%60 = call i8* @atoi(i8* %59)
%61 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 2
store i8* %60, i8** %61
%62 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%63 = call i8* @atoi(i8* %62)
%64 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 1
store i8* %63, i8** %64
%65 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 0
store i32 -1, i32* %65
%66 = call i32 @mktime(%struct.tm* %9)
ret i32 %66
}

LLVM IR (-O2):
%struct.tm = type { i32, i8*, i8*, i8*, i8*, i8*, i8* }
define i32 @kr_time_to_ttime(i8* %0) {
%2 = alloca [5 x i8]
%3 = alloca [3 x i8]
%4 = alloca [3 x i8]
%5 = alloca [3 x i8]
%6 = alloca [3 x i8]
%7 = alloca [3 x i8]
%8 = alloca %struct.tm
%9 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%10 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%12 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%13 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%14 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 0
%15 = bitcast %struct.tm* %8 to i8*
%16 = call i32 @memset(i8* %9, i32 0, i32 5)
%17 = call i32 @memset(i8* %10, i32 0, i32 3)
%18 = call i32 @memset(i8* %11, i32 0, i32 3)
%19 = call i32 @memset(i8* %12, i32 0, i32 3)
%20 = call i32 @memset(i8* %13, i32 0, i32 3)
%21 = call i32 @memset(i8* %14, i32 0, i32 3)
%22 = call i32 @memcpy(i8* %9, i8* %0, i32 4)
%23 = getelementptr inbounds i8, i8* %0, i64 4
%24 = call i32 @memcpy(i8* %10, i8* %23, i32 2)
%25 = getelementptr inbounds i8, i8* %0, i64 6
%26 = call i32 @memcpy(i8* %11, i8* %25, i32 2)
%27 = getelementptr inbounds i8, i8* %0, i64 8
%28 = call i32 @memcpy(i8* %12, i8* %27, i32 2)
%29 = getelementptr inbounds i8, i8* %0, i64 10
%30 = call i32 @memcpy(i8* %13, i8* %29, i32 2)
%31 = getelementptr inbounds i8, i8* %0, i64 12
%32 = call i32 @memcpy(i8* %14, i8* %31, i32 2)
%33 = call i8* @atoi(i8* %9)
%34 = call i8* @atoi(i8* %10)
%35 = insertelement <2 x i8*> poison, i8* %34, i64 0
%36 = insertelement <2 x i8*> %35, i8* %33, i64 1
%37 = getelementptr i8, <2 x i8*> %36, <2 x i64> <i64 -1, i64 -1900>
%38 = getelementptr inbounds %struct.tm, %struct.tm* %8, i64 0, i32 5
%39 = bitcast i8** %38 to <2 x i8*>*
store <2 x i8*> %37, <2 x i8*>* %39
%40 = call i8* @atoi(i8* %11)
%41 = getelementptr inbounds %struct.tm, %struct.tm* %8, i64 0, i32 4
store i8* %40, i8** %41
%42 = call i8* @atoi(i8* %12)
%43 = getelementptr inbounds %struct.tm, %struct.tm* %8, i64 0, i32 3
store i8* %42, i8** %43
%44 = call i8* @atoi(i8* %13)
%45 = getelementptr inbounds %struct.tm, %struct.tm* %8, i64 0, i32 2
store i8* %44, i8** %45
%46 = call i8* @atoi(i8* %14)
%47 = getelementptr inbounds %struct.tm, %struct.tm* %8, i64 0, i32 1
store i8* %46, i8** %47
%48 = getelementptr inbounds %struct.tm, %struct.tm* %8, i64 0, i32 0
store i32 -1, i32* %48
%49 = call i32 @mktime(%struct.tm* %8)
ret i32 %49
}