#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;
  scalar_t__ tm_sec;
  scalar_t__ tm_min;
  scalar_t__ tm_hour;
};

/* 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;
  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 = 0;
  tm.tm_min = 0;
  tm.tm_sec = 0;
  return mktime(&tm);
}


x86 assembly (clang, -O0):
<get_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
lea    -0x34(%rbp),%rdx
lea    -0x38(%rbp),%rcx
lea    -0x3c(%rbp),%r8
call   1040 <sscanf@plt>
movl   $0xffffffff,-0x30(%rbp)
mov    -0x34(%rbp),%eax
sub    $0x76c,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x38(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x24(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    -0x30(%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    0x10(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
lea    0xeab(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
mov    %rbx,%rdi
call   1040 <sscanf@plt>
movl   $0xffffffff,0x10(%rsp)
ff
mov    $0xfffff894,%eax
add    0xc(%rsp),%eax
mov    %eax,0x14(%rsp)
mov    0x8(%rsp),%eax
add    $0xffffffff,%eax
mov    %eax,0x18(%rsp)
mov    0x4(%rsp),%eax
mov    %eax,0x1c(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x20(%rsp)
movq   $0x0,0x30(%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, i64, i64, i64 }
@.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
store i8* %0, i8** %2
%7 = call i32 @memset(%struct.tm* %3, i32 0, i32 40)
%8 = load i8*, i8** %2
%9 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %4, i32* %5, i32* %6)
%10 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 0
store i32 -1, i32* %10
%11 = load i32, i32* %4
%12 = sub nsw i32 %11, 1900
%13 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 1
store i32 %12, i32* %13
%14 = load i32, i32* %5
%15 = sub nsw i32 %14, 1
%16 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 2
store i32 %15, i32* %16
%17 = load i32, i32* %6
%18 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 3
store i32 %17, i32* %18
%19 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 6
store i64 0, i64* %19
%20 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 5
store i64 0, i64* %20
%21 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 4
store i64 0, i64* %21
%22 = call i32 @mktime(%struct.tm* %3)
ret i32 %22
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i64, i64, i64 }
@.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 40)
%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 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 4
%22 = bitcast i64* %21 to i8*
%23 = call i32 @mktime(%struct.tm* %2)
ret i32 %23
}