#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 char *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 */
char *asctime(struct tm *);
struct tm *localtime(char **);
char *mktime(struct tm *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strptime(char *, char *, struct tm *);
char *time(int /*<<< orphan*/ *);
int main(void) {
  time_t t1;
  struct tm *tm_ptr;
  char *str;
  struct tm stm;
  time_t t2;
  t1 = time(NULL);
  printf("[UNIXTime]: %ld\n", t1);
  tm_ptr = localtime(&t1);
  printf("[JST]: %d/%d/%d %d:%02d:%02d\n", tm_ptr->tm_year + 1900,
         tm_ptr->tm_mon + 1, tm_ptr->tm_mday, tm_ptr->tm_hour, tm_ptr->tm_min,
         tm_ptr->tm_sec);
  str = asctime(tm_ptr);
  printf("[TimeString]: %s", str);
  strptime(str, "%a %b %d %H:%M:%S %Y", &stm);
  printf("[TimeString To JST]: %4d/%02d/%02d %2d:%02d:%02d\n",
         stm.tm_year + 1900, stm.tm_mon + 1, stm.tm_mday, stm.tm_hour,
         stm.tm_min, stm.tm_sec);
  t2 = mktime(&stm);
  printf("[JST To UNIXTime]: %ld\n", t2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x10(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
add    $0x76c,%esi
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%edx
add    $0x1,%edx
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%r8d
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%r9d
mov    -0x18(%rbp),%rax
mov    0x14(%rax),%eax
lea    0xe3b(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <asctime@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
lea    0xe36(%rip),%rsi
lea    -0x38(%rbp),%rdx
call   1080 <strptime@plt>
mov    -0x38(%rbp),%esi
add    $0x76c,%esi
mov    -0x34(%rbp),%edx
add    $0x1,%edx
mov    -0x30(%rbp),%ecx
mov    -0x2c(%rbp),%r8d
mov    -0x28(%rbp),%r9d
mov    -0x24(%rbp),%eax
lea    0xe1e(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x38(%rbp),%rdi
call   1070 <mktime@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rsi
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %rax,0x28(%rsp)
lea    0xe85(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x28(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
mov    $0x76c,%ebp
mov    (%rax),%esi
add    %ebp,%esi
mov    0x4(%rax),%edx
mov    0x8(%rax),%ecx
add    $0x1,%edx
mov    0xc(%rax),%r8d
mov    0x10(%rax),%r9d
mov    0x14(%rax),%eax
mov    %eax,(%rsp)
lea    0xe58(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <asctime@plt>
mov    %rax,%rbx
lea    0xe5d(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe5d(%rip),%rsi
lea    0x10(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rdx
call   1080 <strptime@plt>
add    0x10(%rsp),%ebp
mov    0x14(%rsp),%edx
mov    0x18(%rsp),%ecx
add    $0x1,%edx
mov    0x1c(%rsp),%r8d
mov    0x20(%rsp),%r9d
mov    0x24(%rsp),%eax
mov    %eax,(%rsp)
lea    0xe3b(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
call   1070 <mktime@plt>
lea    0xe55(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [17 x i8] c"[UNIXTime]: %ld\0A\00"
@.str.1 = [30 x i8] c"[JST]: %d/%d/%d %d:%02d:%02d\0A\00"
@.str.2 = [17 x i8] c"[TimeString]: %s\00"
@.str.3 = [21 x i8] c"%a %b %d %H:%M:%S %Y\00"
@.str.4 = [50 x i8] c"[TimeString To JST]: %4d/%02d/%02d %2d:%02d:%02d\0A\00"
@.str.5 = [24 x i8] c"[JST To UNIXTime]: %ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca %struct.tm*
%4 = alloca i8*
%5 = alloca %struct.tm
%6 = alloca i8*
store i32 0, i32* %1
%7 = call i8* @time(i32* null)
store i8* %7, i8** %2
%8 = load i8*, i8** %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = call %struct.tm* @localtime(i8** %2)
store %struct.tm* %10, %struct.tm** %3
%11 = load %struct.tm*, %struct.tm** %3
%12 = getelementptr inbounds %struct.tm, %struct.tm* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = add nsw i32 %13, 1900
%15 = load %struct.tm*, %struct.tm** %3
%16 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 1
%17 = load i32, i32* %16
%18 = add nsw i32 %17, 1
%19 = load %struct.tm*, %struct.tm** %3
%20 = getelementptr inbounds %struct.tm, %struct.tm* %19, i32 0, i32 2
%21 = load i32, i32* %20
%22 = load %struct.tm*, %struct.tm** %3
%23 = getelementptr inbounds %struct.tm, %struct.tm* %22, i32 0, i32 3
%24 = load i32, i32* %23
%25 = load %struct.tm*, %struct.tm** %3
%26 = getelementptr inbounds %struct.tm, %struct.tm* %25, i32 0, i32 4
%27 = load i32, i32* %26
%28 = load %struct.tm*, %struct.tm** %3
%29 = getelementptr inbounds %struct.tm, %struct.tm* %28, i32 0, i32 5
%30 = load i32, i32* %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %14, i32 %18, i32 %21, i32 %24, i32 %27, i32 %30)
%32 = load %struct.tm*, %struct.tm** %3
%33 = call i8* @asctime(%struct.tm* %32)
store i8* %33, i8** %4
%34 = load i8*, i8** %4
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %34)
%36 = load i8*, i8** %4
%37 = call i32 @strptime(i8* %36, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), %struct.tm* %5)
%38 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 0
%39 = load i32, i32* %38
%40 = add nsw i32 %39, 1900
%41 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 1
%42 = load i32, i32* %41
%43 = add nsw i32 %42, 1
%44 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 2
%45 = load i32, i32* %44
%46 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 3
%47 = load i32, i32* %46
%48 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 4
%49 = load i32, i32* %48
%50 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 5
%51 = load i32, i32* %50
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0), i32 %40, i32 %43, i32 %45, i32 %47, i32 %49, i32 %51)
%53 = call i8* @mktime(%struct.tm* %5)
store i8* %53, i8** %6
%54 = load i8*, i8** %6
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %54)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [17 x i8] c"[UNIXTime]: %ld\0A\00"
@.str.1 = [30 x i8] c"[JST]: %d/%d/%d %d:%02d:%02d\0A\00"
@.str.2 = [17 x i8] c"[TimeString]: %s\00"
@.str.3 = [21 x i8] c"%a %b %d %H:%M:%S %Y\00"
@.str.4 = [50 x i8] c"[TimeString To JST]: %4d/%02d/%02d %2d:%02d:%02d\0A\00"
@.str.5 = [24 x i8] c"[JST To UNIXTime]: %ld\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca %struct.tm
%3 = bitcast i8** %1 to i8*
%4 = bitcast %struct.tm* %2 to i8*
%5 = tail call i8* @time(i32* null)
store i8* %5, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = call %struct.tm* @localtime(i8** %1)
%8 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 0
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 1900
%11 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 1
%12 = load i32, i32* %11
%13 = add nsw i32 %12, 1
%14 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 2
%15 = load i32, i32* %14
%16 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 3
%17 = load i32, i32* %16
%18 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 4
%19 = load i32, i32* %18
%20 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 5
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %13, i32 %15, i32 %17, i32 %19, i32 %21)
%23 = call i8* @asctime(%struct.tm* %7)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %23)
%25 = call i32 @strptime(i8* %23, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), %struct.tm* %2)
%26 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 0
%27 = load i32, i32* %26
%28 = add nsw i32 %27, 1900
%29 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 1
%30 = load i32, i32* %29
%31 = add nsw i32 %30, 1
%32 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 2
%33 = load i32, i32* %32
%34 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 3
%35 = load i32, i32* %34
%36 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 4
%37 = load i32, i32* %36
%38 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 5
%39 = load i32, i32* %38
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0), i32 %28, i32 %31, i32 %33, i32 %35, i32 %37, i32 %39)
%41 = call i8* @mktime(%struct.tm* %2)
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %41)
ret i32 0
}