#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 scalar_t__ time_t;
struct tm {
  int tm_year;
  size_t tm_wday;
  size_t tm_mon;
  int tm_mday;
};

/* Variables and functions */
struct tm *localtime(scalar_t__ *);
int /*<<< orphan*/ printf(char *, char *, char *, int, int);
int /*<<< orphan*/ time(scalar_t__ *);
void aboutAWeekAgo(void) {
  time_t rawtime;
  struct tm *timeinfo;
  static char *weekdays[] = {"Sunday",   "Monday", "Tuesday", "Wednesday",
                             "Thursday", "Friday", "Saturday"};
  static char *months[] = {"January",   "February", "March",    "April",
                           "May",       "June",     "July",     "August",
                           "September", "October",  "November", "December"};
  time(&rawtime);
  rawtime = rawtime - 604800;
  timeinfo = localtime(&rawtime);
  timeinfo->tm_year += 1900;
  printf("%s %s %d, %d", weekdays[timeinfo->tm_wday], months[timeinfo->tm_mon],
         timeinfo->tm_mday, timeinfo->tm_year);
}


x86 assembly (clang, -O0):
<aboutAWeekAgo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
call   1050 <time@plt>
mov    -0x8(%rbp),%rax
sub    $0x93a80,%rax
mov    %rax,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x76c,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0x2ec7(%rip),%rax
mov    (%rax,%rcx,8),%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
lea    0x2ef4(%rip),%rax
mov    (%rax,%rcx,8),%rdx
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    (%rax),%r8d
lea    0xeea(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aboutAWeekAgo>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <time@plt>
addq   $0xfffffffffff6c580,0x8(%rsp)
f6 ff
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    $0x76c,%r8d
add    (%rax),%r8d
mov    %r8d,(%rax)
lea    0xe9a(%rip),%rcx
mov    0x8(%rax),%rdx
mov    0x10(%rax),%rdi
movslq (%rcx,%rdx,4),%rsi
add    %rcx,%rsi
lea    0xea0(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
mov    0x18(%rax),%ecx
lea    0xf4e(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i64, i64, i32 }
@aboutAWeekAgo.weekdays = internal global [7 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i32 0, i32 0)]
@.str = [7 x i8] c"Sunday\00"
@.str.1 = [7 x i8] c"Monday\00"
@.str.2 = [8 x i8] c"Tuesday\00"
@.str.3 = [10 x i8] c"Wednesday\00"
@.str.4 = [9 x i8] c"Thursday\00"
@.str.5 = [7 x i8] c"Friday\00"
@.str.6 = [9 x i8] c"Saturday\00"
@aboutAWeekAgo.months = internal global [12 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.18, i32 0, i32 0)]
@.str.7 = [8 x i8] c"January\00"
@.str.8 = [9 x i8] c"February\00"
@.str.9 = [6 x i8] c"March\00"
@.str.10 = [6 x i8] c"April\00"
@.str.11 = [4 x i8] c"May\00"
@.str.12 = [5 x i8] c"June\00"
@.str.13 = [5 x i8] c"July\00"
@.str.14 = [7 x i8] c"August\00"
@.str.15 = [10 x i8] c"September\00"
@.str.16 = [8 x i8] c"October\00"
@.str.17 = [9 x i8] c"November\00"
@.str.18 = [9 x i8] c"December\00"
@.str.19 = [13 x i8] c"%s %s %d, %d\00"
define void @aboutAWeekAgo() {
%1 = alloca i64
%2 = alloca %struct.tm*
%3 = call i32 @time(i64* %1)
%4 = load i64, i64* %1
%5 = sub nsw i64 %4, 604800
store i64 %5, i64* %1
%6 = call %struct.tm* @localtime(i64* %1)
store %struct.tm* %6, %struct.tm** %2
%7 = load %struct.tm*, %struct.tm** %2
%8 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 0
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 1900
store i32 %10, i32* %8
%11 = load %struct.tm*, %struct.tm** %2
%12 = getelementptr inbounds %struct.tm, %struct.tm* %11, i32 0, i32 1
%13 = load i64, i64* %12
%14 = getelementptr inbounds [7 x i8*], [7 x i8*]* @aboutAWeekAgo.weekdays, i64 0, i64 %13
%15 = load i8*, i8** %14
%16 = load %struct.tm*, %struct.tm** %2
%17 = getelementptr inbounds %struct.tm, %struct.tm* %16, i32 0, i32 2
%18 = load i64, i64* %17
%19 = getelementptr inbounds [12 x i8*], [12 x i8*]* @aboutAWeekAgo.months, i64 0, i64 %18
%20 = load i8*, i8** %19
%21 = load %struct.tm*, %struct.tm** %2
%22 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 3
%23 = load i32, i32* %22
%24 = load %struct.tm*, %struct.tm** %2
%25 = getelementptr inbounds %struct.tm, %struct.tm* %24, i32 0, i32 0
%26 = load i32, i32* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.19, i64 0, i64 0), i8* %15, i8* %20, i32 %23, i32 %26)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i64, i64, i32 }
@reltable.aboutAWeekAgo = internal unnamed_addr constant [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str to i64), i64 ptrtoint ([7 x i32]* @reltable.aboutAWeekAgo to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.1 to i64), i64 ptrtoint ([7 x i32]* @reltable.aboutAWeekAgo to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.2 to i64), i64 ptrtoint ([7 x i32]* @reltable.aboutAWeekAgo to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.3 to i64), i64 ptrtoint ([7 x i32]* @reltable.aboutAWeekAgo to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.aboutAWeekAgo to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.5 to i64), i64 ptrtoint ([7 x i32]* @reltable.aboutAWeekAgo to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.6 to i64), i64 ptrtoint ([7 x i32]* @reltable.aboutAWeekAgo to i64)) to i32)]
@.str = [7 x i8] c"Sunday\00"
@.str.1 = [7 x i8] c"Monday\00"
@.str.2 = [8 x i8] c"Tuesday\00"
@.str.3 = [10 x i8] c"Wednesday\00"
@.str.4 = [9 x i8] c"Thursday\00"
@.str.5 = [7 x i8] c"Friday\00"
@.str.6 = [9 x i8] c"Saturday\00"
@reltable.aboutAWeekAgo.20 = internal unnamed_addr constant [12 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.7 to i64), i64 ptrtoint ([12 x i32]* @reltable.aboutAWeekAgo.20 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.8 to i64), i64 ptrtoint ([12 x i32]* @reltable.aboutAWeekAgo.20 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.9 to i64), i64 ptrtoint ([12 x i32]* @reltable.aboutAWeekAgo.20 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.10 to i64), i64 ptrtoint ([12 x i32]* @reltable.aboutAWeekAgo.20 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.11 to i64), i64 ptrtoint ([12 x i32]* @reltable.aboutAWeekAgo.20 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.12 to i64), i64 ptrtoint ([12 x i32]* @reltable.aboutAWeekAgo.20 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.13 to i64), i64 ptrtoint ([12 x i32]* @reltable.aboutAWeekAgo.20 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.14 to i64), i64 ptrtoint ([12 x i32]* @reltable.aboutAWeekAgo.20 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.15 to i64), i64 ptrtoint ([12 x i32]* @reltable.aboutAWeekAgo.20 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.16 to i64), i64 ptrtoint ([12 x i32]* @reltable.aboutAWeekAgo.20 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.17 to i64), i64 ptrtoint ([12 x i32]* @reltable.aboutAWeekAgo.20 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.18 to i64), i64 ptrtoint ([12 x i32]* @reltable.aboutAWeekAgo.20 to i64)) to i32)]
@.str.7 = [8 x i8] c"January\00"
@.str.8 = [9 x i8] c"February\00"
@.str.9 = [6 x i8] c"March\00"
@.str.10 = [6 x i8] c"April\00"
@.str.11 = [4 x i8] c"May\00"
@.str.12 = [5 x i8] c"June\00"
@.str.13 = [5 x i8] c"July\00"
@.str.14 = [7 x i8] c"August\00"
@.str.15 = [10 x i8] c"September\00"
@.str.16 = [8 x i8] c"October\00"
@.str.17 = [9 x i8] c"November\00"
@.str.18 = [9 x i8] c"December\00"
@.str.19 = [13 x i8] c"%s %s %d, %d\00"
define void @aboutAWeekAgo() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i32 @time(i64* %1)
%4 = load i64, i64* %1
%5 = add nsw i64 %4, -604800
store i64 %5, i64* %1
%6 = call %struct.tm* @localtime(i64* %1)
%7 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 0
%8 = load i32, i32* %7
%9 = add nsw i32 %8, 1900
store i32 %9, i32* %7
%10 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 1
%11 = load i64, i64* %10
%12 = shl i64 %11, 2
%13 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.aboutAWeekAgo to i8*), i64 %12)
%14 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 2
%15 = load i64, i64* %14
%16 = shl i64 %15, 2
%17 = call i8* @llvm.load.relative.i64(i8* bitcast ([12 x i32]* @reltable.aboutAWeekAgo.20 to i8*), i64 %16)
%18 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 3
%19 = load i32, i32* %18
%20 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.19, i64 0, i64 0), i8* %13, i8* %17, i32 %19, i32 %9)
ret void
}