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

/* Variables and functions */
char *asctime(struct tm *);
struct tm *gmtime(int /*<<< orphan*/ *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void struct_tm_mktime() {
  time_t now;
  struct tm *today;
  time(&now);
  today = localtime(&now);
  printf("The current time with asctime function: %s\n", asctime(today));
  printf("Year: %d, Month: %d\n", 1900 + today->tm_year, 1 + today->tm_mon);
  struct tm *utc_time;
  utc_time = gmtime(&now);
  printf("UTC Time: %s\n", asctime(utc_time));
}


x86 assembly (clang, -O0):
<struct_tm_mktime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x4(%rbp),%rdi
call   1060 <time@plt>
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <asctime@plt>
mov    %rax,%rsi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
add    $0x76c,%esi
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edx
add    $0x1,%edx
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x4(%rbp),%rdi
call   1070 <gmtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <asctime@plt>
mov    %rax,%rsi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<struct_tm_mktime>:
push   %r14
push   %rbx
push   %rax
lea    0x4(%rsp),%r14
mov    %r14,%rdi
call   1060 <time@plt>
mov    %r14,%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <asctime@plt>
lea    0xe85(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x76c,%esi
add    (%rbx),%esi
mov    0x4(%rbx),%edx
add    $0x1,%edx
lea    0xe93(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
call   1070 <gmtime@plt>
mov    %rax,%rdi
call   1040 <asctime@plt>
lea    0xe8a(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32 }
@.str = [44 x i8] c"The current time with asctime function: %s\0A\00"
@.str.1 = [21 x i8] c"Year: %d, Month: %d\0A\00"
@.str.2 = [14 x i8] c"UTC Time: %s\0A\00"
define void @struct_tm_mktime() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = alloca %struct.tm*
%4 = call i32 @time(i32* %1)
%5 = call %struct.tm* @localtime(i32* %1)
store %struct.tm* %5, %struct.tm** %2
%6 = load %struct.tm*, %struct.tm** %2
%7 = call i8* @asctime(%struct.tm* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load %struct.tm*, %struct.tm** %2
%10 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 0
%11 = load i32, i32* %10
%12 = add nsw i32 1900, %11
%13 = load %struct.tm*, %struct.tm** %2
%14 = getelementptr inbounds %struct.tm, %struct.tm* %13, i32 0, i32 1
%15 = load i32, i32* %14
%16 = add nsw i32 1, %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %16)
%18 = call %struct.tm* @gmtime(i32* %1)
store %struct.tm* %18, %struct.tm** %3
%19 = load %struct.tm*, %struct.tm** %3
%20 = call i8* @asctime(%struct.tm* %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %20)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32 }
@.str = [44 x i8] c"The current time with asctime function: %s\0A\00"
@.str.1 = [21 x i8] c"Year: %d, Month: %d\0A\00"
@.str.2 = [14 x i8] c"UTC Time: %s\0A\00"
define void @struct_tm_mktime() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(i32* %1)
%4 = call %struct.tm* @localtime(i32* %1)
%5 = call i8* @asctime(%struct.tm* %4)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%8 = load i32, i32* %7
%9 = add nsw i32 %8, 1900
%10 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%11 = load i32, i32* %10
%12 = add nsw i32 %11, 1
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 %12)
%14 = call %struct.tm* @gmtime(i32* %1)
%15 = call i8* @asctime(%struct.tm* %14)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %15)
ret void
}