#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 {
  size_t tm_mon;
  scalar_t__ tm_year;
  int /*<<< orphan*/ tm_mday;
};

/* Variables and functions */
int /*<<< orphan*/ add_word_args(char *, int /*<<< orphan*/, char *,
                                 scalar_t__);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(int /*<<< orphan*/);
void cm_today(int arg) {
  static char *months[12] = {"January",   "February", "March",    "April",
                             "May",       "June",     "July",     "August",
                             "September", "October",  "November", "December"};
  if (arg == 0) {
    time_t timer = time(0);
    struct tm *ts = localtime(&timer);
    add_word_args("%d %s %d", ts->tm_mday, months[ts->tm_mon],
                  ts->tm_year + 1900);
  }
}


x86 assembly (clang, -O0):
<cm_today>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1190 <cm_today+0x60>
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0x2ecf(%rip),%rax
mov    (%rax,%rcx,8),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
add    $0x76c,%rcx
lea    0xecb(%rip),%rdi
call   1040 <add_word_args@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cm_today>:
test   %edi,%edi
je     1135 <cm_today+0x5>
ret
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
mov    0x10(%rax),%esi
mov    (%rax),%rcx
lea    0xea8(%rip),%rdi
movslq (%rdi,%rcx,4),%rdx
add    %rdi,%rdx
mov    $0x76c,%ecx
add    0x8(%rax),%rcx
lea    0xf17(%rip),%rdi
call   1040 <add_word_args@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
%struct.tm = type { i64, i64, i32 }
@cm_today.months = internal global [12 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i32 0, i32 0)]
@.str = [8 x i8] c"January\00"
@.str.1 = [9 x i8] c"February\00"
@.str.2 = [6 x i8] c"March\00"
@.str.3 = [6 x i8] c"April\00"
@.str.4 = [4 x i8] c"May\00"
@.str.5 = [5 x i8] c"June\00"
@.str.6 = [5 x i8] c"July\00"
@.str.7 = [7 x i8] c"August\00"
@.str.8 = [10 x i8] c"September\00"
@.str.9 = [8 x i8] c"October\00"
@.str.10 = [9 x i8] c"November\00"
@.str.11 = [9 x i8] c"December\00"
@.str.12 = [9 x i8] c"%d %s %d\00"
define void @cm_today(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.tm*
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %23
7: ; preds = %1
%8 = call i32 @time(i32 0)
store i32 %8, i32* %3
%9 = call %struct.tm* @localtime(i32* %3)
store %struct.tm* %9, %struct.tm** %4
%10 = load %struct.tm*, %struct.tm** %4
%11 = getelementptr inbounds %struct.tm, %struct.tm* %10, i32 0, i32 2
%12 = load i32, i32* %11
%13 = load %struct.tm*, %struct.tm** %4
%14 = getelementptr inbounds %struct.tm, %struct.tm* %13, i32 0, i32 0
%15 = load i64, i64* %14
%16 = getelementptr inbounds [12 x i8*], [12 x i8*]* @cm_today.months, i64 0, i64 %15
%17 = load i8*, i8** %16
%18 = load %struct.tm*, %struct.tm** %4
%19 = getelementptr inbounds %struct.tm, %struct.tm* %18, i32 0, i32 1
%20 = load i64, i64* %19
%21 = add nsw i64 %20, 1900
%22 = call i32 @add_word_args(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), i32 %12, i8* %17, i64 %21)
br label %23
23: ; preds = %7, %1
ret void
}

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