#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_isdst;
  int /*<<< orphan*/ tm_mon;
  int /*<<< orphan*/ tm_sec;
  int /*<<< orphan*/ tm_min;
  int /*<<< orphan*/ tm_hour;
  int /*<<< orphan*/ tm_mday;
};

/* Variables and functions */
char *ctime(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ mktime(struct tm *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int /*<<< orphan*/ *,
                         int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                         int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int main(void) {
  struct tm tm;
  time_t then;
  printf("Enter a Date/time as YYYY/MM/DD HH:MM:SS : ");
  scanf("%d/%d/%d %d:%d:%d", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour,
        &tm.tm_min, &tm.tm_sec);
  tm.tm_year -= 1900;
  tm.tm_mon--;
  tm.tm_isdst = -1;
  then = mktime(&tm);
  printf("Got: %s", ctime(&then));
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    -0x20(%rbp),%rdx
add    $0x8,%rdx
lea    -0x20(%rbp),%rcx
add    $0x18,%rcx
lea    -0x20(%rbp),%r8
add    $0x14,%r8
lea    -0x20(%rbp),%r9
add    $0x10,%r9
lea    -0x20(%rbp),%rax
add    $0xc,%rax
lea    0xe8c(%rip),%rdi
mov    %rax,(%rsp)
call   1060 <scanf@plt>
mov    -0x20(%rbp),%eax
sub    $0x76c,%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
lea    -0x20(%rbp),%rdi
call   1050 <mktime@plt>
mov    %eax,-0x24(%rbp)
lea    -0x24(%rbp),%rdi
call   1030 <ctime@plt>
mov    %rax,%rsi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x18(%rsp),%rdx
lea    0x28(%rsp),%rcx
lea    0x24(%rsp),%r8
lea    0x20(%rsp),%r9
lea    0x1c(%rsp),%rax
mov    %rax,(%rsp)
lea    0xea5(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
addl   $0xfffff894,0x10(%rsp)
ff
addl   $0xffffffff,0x18(%rsp)
movl   $0xffffffff,0x14(%rsp)
ff
mov    %rbx,%rdi
call   1050 <mktime@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <ctime@plt>
lea    0xe78(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32 }
@.str = [44 x i8] c"Enter a Date/time as YYYY/MM/DD HH:MM:SS : \00"
@.str.1 = [18 x i8] c"%d/%d/%d %d:%d:%d\00"
@.str.2 = [8 x i8] c"Got: %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.tm
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 0
%6 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 2
%7 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 6
%8 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 5
%9 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 4
%10 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 3
%11 = call i32 @scanf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10)
%12 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 0
%13 = load i32, i32* %12
%14 = sub nsw i32 %13, 1900
store i32 %14, i32* %12
%15 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 2
%16 = load i32, i32* %15
%17 = add nsw i32 %16, -1
store i32 %17, i32* %15
%18 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 1
store i32 -1, i32* %18
%19 = call i32 @mktime(%struct.tm* %2)
store i32 %19, i32* %3
%20 = call i8* @ctime(i32* %3)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %20)
%22 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32 }
@.str = [44 x i8] c"Enter a Date/time as YYYY/MM/DD HH:MM:SS : \00"
@.str.1 = [18 x i8] c"%d/%d/%d %d:%d:%d\00"
@.str.2 = [8 x i8] c"Got: %s\00"
define i32 @main() {
%1 = alloca %struct.tm
%2 = alloca i32
%3 = bitcast %struct.tm* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 0
%7 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 2
%8 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 6
%9 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 5
%10 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 4
%11 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 3
%12 = call i32 @scanf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11)
%13 = load i32, i32* %6
%14 = add nsw i32 %13, -1900
store i32 %14, i32* %6
%15 = load i32, i32* %7
%16 = add nsw i32 %15, -1
store i32 %16, i32* %7
%17 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 1
store i32 -1, i32* %17
%18 = call i32 @mktime(%struct.tm* %1)
store i32 %18, i32* %2
%19 = call i8* @ctime(i32* %2)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %19)
%21 = call i32 @exit(i32 0)
unreachable
}