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

/* Variables and functions */
int /*<<< orphan*/ memset(struct tm *, int /*<<< orphan*/, int);
int /*<<< orphan*/ mktime(struct tm *);
int /*<<< orphan*/ sscanf(char *, char *, int *, int *, int *);
time_t get_time(char *time_details) {
  struct tm tm;
  memset(&tm, 0, sizeof(struct tm));
  int year, month, day, hour, minute, second;
  sscanf(time_details, "%d-%d-%d", &year, &month, &day);
  tm.tm_isdst = -1;
  tm.tm_year = year - 1900;
  tm.tm_mon = month - 1;
  tm.tm_mday = day;
  tm.tm_hour = hour;
  tm.tm_min = minute;
  tm.tm_sec = second;
  return mktime(&tm);
}


x86 assembly (clang, -O0):
<get_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0x1c,%edx
call   1030 <memset@plt>
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
lea    -0x2c(%rbp),%rdx
lea    -0x30(%rbp),%rcx
lea    -0x34(%rbp),%r8
call   1040 <sscanf@plt>
movl   $0xffffffff,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
sub    $0x76c,%eax
mov    %eax,-0x24(%rbp)
mov    -0x30(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x10(%rbp)
lea    -0x28(%rbp),%rdi
call   1050 <mktime@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rdi,%rbx
lea    0x18(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x1c,%edx
call   1030 <memset@plt>
lea    0xeab(%rip),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
mov    %rbx,%rdi
call   1040 <sscanf@plt>
movl   $0xffffffff,0x18(%rsp)
ff
mov    $0xfffff894,%eax
add    0x14(%rsp),%eax
mov    %eax,0x1c(%rsp)
mov    0x10(%rsp),%eax
add    $0xffffffff,%eax
mov    %eax,0x20(%rsp)
mov    0xc(%rsp),%eax
mov    %eax,0x24(%rsp)
mov    %r14,%rdi
call   1050 <mktime@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32 }
@.str = [9 x i8] c"%d-%d-%d\00"
define i32 @get_time(i8* nocapture %0) {
%2 = alloca %struct.tm
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast %struct.tm* %2 to i8*
%7 = call i32 @memset(%struct.tm* %2, i32 0, i32 28)
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4, i32* %5)
%12 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 0
store i32 -1, i32* %12
%13 = load i32, i32* %3
%14 = add nsw i32 %13, -1900
%15 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 1
store i32 %14, i32* %15
%16 = load i32, i32* %4
%17 = add nsw i32 %16, -1
%18 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 2
store i32 %17, i32* %18
%19 = load i32, i32* %5
%20 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 3
store i32 %19, i32* %20
%21 = call i32 @mktime(%struct.tm* %2)
ret i32 %21
}