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

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ mktime(struct tm *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  time_t stamp;
  struct tm *tm;
  char timestr[1024];
  stamp = time(NULL);
  tm = localtime(&stamp);
  strftime(timestr, 1024, "Now:%Y-%m-%d", tm);
  puts(timestr);
  tm->tm_mday += 100;
  mktime(tm);
  strftime(timestr, 1024, "100 days later:%Y-%m-%d", tm);
  puts(timestr);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x400,%esi
lea    0xe5e(%rip),%rdx
call   1070 <strftime@plt>
lea    -0x410(%rbp),%rdi
call   1040 <puts@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x64,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
call   1060 <mktime@plt>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x400,%esi
lea    0xe2f(%rip),%rdx
call   1070 <strftime@plt>
lea    -0x410(%rbp),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x418,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
lea    0xe77(%rip),%rdx
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x400,%esi
mov    %rax,%rcx
call   1070 <strftime@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
addl   $0x64,(%rbx)
mov    %rbx,%rdi
call   1060 <mktime@plt>
lea    0xe55(%rip),%rdx
mov    %r14,%rdi
mov    $0x400,%esi
mov    %rbx,%rcx
call   1070 <strftime@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [13 x i8] c"Now:%Y-%m-%d\00"
@.str.1 = [24 x i8] c"100 days later:%Y-%m-%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.tm*
%4 = alloca [1024 x i8]
store i32 0, i32* %1
%5 = call i32 @time(i32* null)
store i32 %5, i32* %2
%6 = call %struct.tm* @localtime(i32* %2)
store %struct.tm* %6, %struct.tm** %3
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%8 = load %struct.tm*, %struct.tm** %3
%9 = call i32 @strftime(i8* %7, i32 1024, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), %struct.tm* %8)
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%11 = call i32 @puts(i8* %10)
%12 = load %struct.tm*, %struct.tm** %3
%13 = getelementptr inbounds %struct.tm, %struct.tm* %12, i32 0, i32 0
%14 = load i32, i32* %13
%15 = add nsw i32 %14, 100
store i32 %15, i32* %13
%16 = load %struct.tm*, %struct.tm** %3
%17 = call i32 @mktime(%struct.tm* %16)
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%19 = load %struct.tm*, %struct.tm** %3
%20 = call i32 @strftime(i8* %18, i32 1024, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %19)
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%22 = call i32 @puts(i8* %21)
%23 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [13 x i8] c"Now:%Y-%m-%d\00"
@.str.1 = [24 x i8] c"100 days later:%Y-%m-%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @time(i32* null)
store i32 %5, i32* %1
%6 = call %struct.tm* @localtime(i32* %1)
%7 = call i32 @strftime(i8* %4, i32 1024, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), %struct.tm* %6)
%8 = call i32 @puts(i8* %4)
%9 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 0
%10 = load i32, i32* %9
%11 = add nsw i32 %10, 100
store i32 %11, i32* %9
%12 = call i32 @mktime(%struct.tm* %6)
%13 = call i32 @strftime(i8* %4, i32 1024, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %6)
%14 = call i32 @puts(i8* %4)
%15 = call i32 @exit(i32 0)
unreachable
}