#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 dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct tm *);
scalar_t__ malloc(int);
int /*<<< orphan*/ mktime(struct tm *);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strptime(char *, char *, struct tm *);
int main(int argc, const char *argv[]) {
  struct tm *tmp_time = (struct tm *)malloc(sizeof(struct tm));
  strptime("2013-11-20", "%Y-%m-%d", tmp_time);
  time_t t = mktime(tmp_time);
  printf("%ld\n", t);
  free(tmp_time);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdx
lea    0xe81(%rip),%rdi
lea    0xe85(%rip),%rsi
call   1070 <strptime@plt>
mov    -0x18(%rbp),%rdi
call   1060 <mktime@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xe9b(%rip),%rdi
lea    0xe9f(%rip),%rsi
mov    %rax,%rdx
call   1070 <strptime@plt>
mov    %rbx,%rdi
call   1060 <mktime@plt>
lea    0xe91(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [11 x i8] c"2013-11-20\00"
@.str.1 = [9 x i8] c"%Y-%m-%d\00"
@.str.2 = [5 x i8] c"%ld\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.tm*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i64 @malloc(i32 4)
%9 = inttoptr i64 %8 to %struct.tm*
store %struct.tm* %9, %struct.tm** %6
%10 = load %struct.tm*, %struct.tm** %6
%11 = call i32 @strptime(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %10)
%12 = load %struct.tm*, %struct.tm** %6
%13 = call i32 @mktime(%struct.tm* %12)
store i32 %13, i32* %7
%14 = load i32, i32* %7
%15 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = load %struct.tm*, %struct.tm** %6
%17 = call i32 @free(%struct.tm* %16)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [11 x i8] c"2013-11-20\00"
@.str.1 = [9 x i8] c"%Y-%m-%d\00"
@.str.2 = [5 x i8] c"%ld\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @malloc(i32 4)
%4 = inttoptr i64 %3 to %struct.tm*
%5 = tail call i32 @strptime(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %4)
%6 = tail call i32 @mktime(%struct.tm* %4)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = tail call i32 @free(%struct.tm* %4)
ret i32 0
}