#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_year;
  int tm_mon;
  int tm_mday;
  int tm_hour;
  int tm_min;
  int tm_sec;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ mktime(struct tm *);
int /*<<< orphan*/ sscanf(char const *, char *, int *, int *, int *, int *,
                          int *, int *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
time_t convert_strtime_to_timet(const char *strtime) {
  int yy, mm, dd, hour, min, sec;
  struct tm timem;
  time_t tme;
  sscanf(strtime, "%d-%d-%dT%d:%d:%d", &yy, &mm, &dd, &hour, &min, &sec);
  time(&tme);
  timem = *localtime(&tme);
  timem.tm_year = yy - 1900;
  timem.tm_mon = mm - 1;
  timem.tm_mday = dd;
  timem.tm_hour = hour;
  timem.tm_min = min;
  timem.tm_sec = sec;
  return (mktime(&timem));
}


x86 assembly (clang, -O0):
<convert_strtime_to_timet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
lea    -0x18(%rbp),%r9
lea    -0x1c(%rbp),%r10
lea    -0x20(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1050 <sscanf@plt>
lea    -0x3c(%rbp),%rdi
call   1040 <time@plt>
lea    -0x3c(%rbp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%rcx
mov    %rcx,-0x38(%rbp)
mov    0x8(%rax),%rcx
mov    %rcx,-0x30(%rbp)
mov    0x10(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x76c,%eax
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
lea    -0x38(%rbp),%rdi
call   1060 <mktime@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_strtime_to_timet>:
push   %rbx
sub    $0x40,%rsp
lea    0x8(%rsp),%rax
lea    0xc(%rsp),%rbx
lea    0xeaa(%rip),%rsi
lea    0x1c(%rsp),%rdx
lea    0x18(%rsp),%rcx
lea    0x14(%rsp),%r8
lea    0x10(%rsp),%r9
push   %rax
push   %rbx
call   1050 <sscanf@plt>
add    $0x10,%rsp
lea    0x3c(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    $0xfffff894,%eax
add    0x1c(%rsp),%eax
mov    %eax,0x20(%rsp)
mov    0x18(%rsp),%eax
add    $0xffffffff,%eax
mov    %eax,0x24(%rsp)
mov    0x14(%rsp),%eax
mov    %eax,0x28(%rsp)
mov    0x10(%rsp),%eax
mov    %eax,0x2c(%rsp)
mov    0xc(%rsp),%eax
mov    %eax,0x30(%rsp)
mov    0x8(%rsp),%eax
mov    %eax,0x34(%rsp)
lea    0x20(%rsp),%rdi
call   1060 <mktime@plt>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [18 x i8] c"%d-%d-%dT%d:%d:%d\00"
define i32 @convert_strtime_to_timet(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.tm
%10 = alloca i32
store i8* %0, i8** %2
%11 = load i8*, i8** %2
%12 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8)
%13 = call i32 @time(i32* %10)
%14 = call %struct.tm* @localtime(i32* %10)
%15 = bitcast %struct.tm* %9 to i8*
%16 = bitcast %struct.tm* %14 to i8*
%17 = load i32, i32* %3
%18 = sub nsw i32 %17, 1900
%19 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 0
store i32 %18, i32* %19
%20 = load i32, i32* %4
%21 = sub nsw i32 %20, 1
%22 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 1
store i32 %21, i32* %22
%23 = load i32, i32* %5
%24 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 2
store i32 %23, i32* %24
%25 = load i32, i32* %6
%26 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 3
store i32 %25, i32* %26
%27 = load i32, i32* %7
%28 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 4
store i32 %27, i32* %28
%29 = load i32, i32* %8
%30 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 5
store i32 %29, i32* %30
%31 = call i32 @mktime(%struct.tm* %9)
ret i32 %31
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [18 x i8] c"%d-%d-%dT%d:%d:%d\00"
define i32 @convert_strtime_to_timet(i8* nocapture %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.tm
%9 = alloca i32
%10 = bitcast i32* %2 to i8*
%11 = bitcast i32* %3 to i8*
%12 = bitcast i32* %4 to i8*
%13 = bitcast i32* %5 to i8*
%14 = bitcast i32* %6 to i8*
%15 = bitcast i32* %7 to i8*
%16 = bitcast %struct.tm* %8 to i8*
%17 = bitcast i32* %9 to i8*
%18 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7)
%19 = call i32 @time(i32* %9)
%20 = call %struct.tm* @localtime(i32* %9)
%21 = load i32, i32* %2
%22 = add nsw i32 %21, -1900
%23 = getelementptr inbounds %struct.tm, %struct.tm* %8, i64 0, i32 0
store i32 %22, i32* %23
%24 = load i32, i32* %3
%25 = add nsw i32 %24, -1
%26 = getelementptr inbounds %struct.tm, %struct.tm* %8, i64 0, i32 1
store i32 %25, i32* %26
%27 = load i32, i32* %4
%28 = getelementptr inbounds %struct.tm, %struct.tm* %8, i64 0, i32 2
store i32 %27, i32* %28
%29 = load i32, i32* %5
%30 = getelementptr inbounds %struct.tm, %struct.tm* %8, i64 0, i32 3
store i32 %29, i32* %30
%31 = load i32, i32* %6
%32 = getelementptr inbounds %struct.tm, %struct.tm* %8, i64 0, i32 4
store i32 %31, i32* %32
%33 = load i32, i32* %7
%34 = getelementptr inbounds %struct.tm, %struct.tm* %8, i64 0, i32 5
store i32 %33, i32* %34
%35 = call i32 @mktime(%struct.tm* %8)
ret i32 %35
}