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

/* Variables and functions */
char *ctime(int /*<<< orphan*/ *);
scalar_t__ isspace(char);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
char *get_today() {
  static char buffer[32];
  static int flag = 0;
  time_t now;
  char *s;
  if (!flag) {
    now = time(NULL);
    s = ctime(&now);
    buffer[0] = (isspace(s[8]) ? '0' : s[8]);
    buffer[1] = s[9];
    buffer[2] = '-';
    buffer[3] = s[4];
    buffer[4] = s[5];
    buffer[5] = s[6];
    buffer[6] = '-';
    buffer[7] = s[20];
    buffer[8] = s[21];
    buffer[9] = s[22];
    buffer[10] = s[23];
    buffer[11] = '\0';
    buffer[12] = s[11];
    buffer[13] = s[12];
    buffer[14] = s[13];
    buffer[15] = s[14];
    buffer[16] = s[15];
    buffer[17] = '\0';
  }
  return buffer;
}


x86 assembly (clang, -O0):
<get_today>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
cmpl   $0x0,0x2f31(%rip)
jne    125b <get_today+0x12b>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <ctime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x8(%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     1182 <get_today+0x52>
mov    $0x30,%eax
mov    %eax,-0x14(%rbp)
jmp    118d <get_today+0x5d>
mov    -0x10(%rbp),%rax
movsbl 0x8(%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %al,0x2eba(%rip)
mov    -0x10(%rbp),%rax
mov    0x9(%rax),%al
mov    %al,0x2eae(%rip)
movb   $0x2d,0x2ea8(%rip)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%al
mov    %al,0x2e9c(%rip)
mov    -0x10(%rbp),%rax
mov    0x5(%rax),%al
mov    %al,0x2e90(%rip)
mov    -0x10(%rbp),%rax
mov    0x6(%rax),%al
mov    %al,0x2e84(%rip)
movb   $0x2d,0x2e7e(%rip)
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%al
mov    %al,0x2e72(%rip)
mov    -0x10(%rbp),%rax
mov    0x15(%rax),%al
mov    %al,0x2e66(%rip)
mov    -0x10(%rbp),%rax
mov    0x16(%rax),%al
mov    %al,0x2e5a(%rip)
mov    -0x10(%rbp),%rax
mov    0x17(%rax),%al
mov    %al,0x2e4e(%rip)
movb   $0x0,0x2e48(%rip)
mov    -0x10(%rbp),%rax
mov    0xb(%rax),%al
mov    %al,0x2e3c(%rip)
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%al
mov    %al,0x2e30(%rip)
mov    -0x10(%rbp),%rax
mov    0xd(%rax),%al
mov    %al,0x2e24(%rip)
mov    -0x10(%rbp),%rax
mov    0xe(%rax),%al
mov    %al,0x2e18(%rip)
mov    -0x10(%rbp),%rax
mov    0xf(%rax),%al
mov    %al,0x2e0c(%rip)
movb   $0x0,0x2e06(%rip)
lea    0x2dee(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_today>:
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <ctime@plt>
mov    %rax,%rbx
movsbl 0x8(%rax),%edi
call   1040 <isspace@plt>
mov    $0x30,%cl
test   %rax,%rax
jne    1160 <get_today+0x30>
mov    0x8(%rbx),%cl
mov    %cl,0x2eea(%rip)
lea    0x2ee3(%rip),%rax
mov    0x9(%rbx),%cl
mov    %cl,0x2edb(%rip)
movb   $0x2d,0x2ed5(%rip)
mov    0x4(%rbx),%cl
mov    %cl,0x2ecd(%rip)
mov    0x5(%rbx),%cl
mov    %cl,0x2ec5(%rip)
mov    0x6(%rbx),%cl
mov    %cl,0x2ebd(%rip)
movb   $0x2d,0x2eb7(%rip)
mov    0x14(%rbx),%cl
mov    %cl,0x2eaf(%rip)
mov    0x15(%rbx),%cl
mov    %cl,0x2ea7(%rip)
mov    0x16(%rbx),%cl
mov    %cl,0x2e9f(%rip)
mov    0x17(%rbx),%cl
mov    %cl,0x2e97(%rip)
movb   $0x0,0x2e91(%rip)
mov    0xb(%rbx),%cl
mov    %cl,0x2e89(%rip)
mov    0xc(%rbx),%cl
mov    %cl,0x2e81(%rip)
mov    0xd(%rbx),%cl
mov    %cl,0x2e79(%rip)
mov    0xe(%rbx),%cl
mov    %cl,0x2e71(%rip)
mov    0xf(%rbx),%cl
mov    %cl,0x2e69(%rip)
movb   $0x0,0x2e63(%rip)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@get_today.buffer = internal global [32 x i8] zeroinitializer
@get_today.flag = internal global i32 0
define i8* @get_today() {
%1 = alloca i32
%2 = alloca i8*
%3 = load i32, i32* @get_today.flag
%4 = icmp ne i32 %3, 0
br i1 %4, label %61, label %5
5: ; preds = %0
%6 = call i32 @time(i32* null)
store i32 %6, i32* %1
%7 = call i8* @ctime(i32* %1)
store i8* %7, i8** %2
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 8
%10 = load i8, i8* %9
%11 = call i64 @isspace(i8 signext %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %5
br label %19
14: ; preds = %5
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 8
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
br label %19
19: ; preds = %14, %13
%20 = phi i32 [ 48, %13 ], [ %18, %14 ]
%21 = trunc i32 %20 to i8
store i8 %21, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 0)
%22 = load i8*, i8** %2
%23 = getelementptr inbounds i8, i8* %22, i64 9
%24 = load i8, i8* %23
store i8 %24, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 1)
store i8 45, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 2)
%25 = load i8*, i8** %2
%26 = getelementptr inbounds i8, i8* %25, i64 4
%27 = load i8, i8* %26
store i8 %27, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 3)
%28 = load i8*, i8** %2
%29 = getelementptr inbounds i8, i8* %28, i64 5
%30 = load i8, i8* %29
store i8 %30, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 4)
%31 = load i8*, i8** %2
%32 = getelementptr inbounds i8, i8* %31, i64 6
%33 = load i8, i8* %32
store i8 %33, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 5)
store i8 45, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 6)
%34 = load i8*, i8** %2
%35 = getelementptr inbounds i8, i8* %34, i64 20
%36 = load i8, i8* %35
store i8 %36, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 7)
%37 = load i8*, i8** %2
%38 = getelementptr inbounds i8, i8* %37, i64 21
%39 = load i8, i8* %38
store i8 %39, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 8)
%40 = load i8*, i8** %2
%41 = getelementptr inbounds i8, i8* %40, i64 22
%42 = load i8, i8* %41
store i8 %42, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 9)
%43 = load i8*, i8** %2
%44 = getelementptr inbounds i8, i8* %43, i64 23
%45 = load i8, i8* %44
store i8 %45, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 10)
store i8 0, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 11)
%46 = load i8*, i8** %2
%47 = getelementptr inbounds i8, i8* %46, i64 11
%48 = load i8, i8* %47
store i8 %48, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 12)
%49 = load i8*, i8** %2
%50 = getelementptr inbounds i8, i8* %49, i64 12
%51 = load i8, i8* %50
store i8 %51, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 13)
%52 = load i8*, i8** %2
%53 = getelementptr inbounds i8, i8* %52, i64 13
%54 = load i8, i8* %53
store i8 %54, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 14)
%55 = load i8*, i8** %2
%56 = getelementptr inbounds i8, i8* %55, i64 14
%57 = load i8, i8* %56
store i8 %57, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 15)
%58 = load i8*, i8** %2
%59 = getelementptr inbounds i8, i8* %58, i64 15
%60 = load i8, i8* %59
store i8 %60, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 16)
store i8 0, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 17)
br label %61
61: ; preds = %19, %0
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 0)
}

LLVM IR (-O2):
@get_today.buffer = internal global [32 x i8] zeroinitializer
define i8* @get_today() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32* null)
store i32 %3, i32* %1
%4 = call i8* @ctime(i32* %1)
%5 = getelementptr inbounds i8, i8* %4, i64 8
%6 = load i8, i8* %5
%7 = call i64 @isspace(i8 signext %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = load i8, i8* %5
br label %11
11: ; preds = %0, %9
%12 = phi i8 [ %10, %9 ], [ 48, %0 ]
store i8 %12, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 0)
%13 = getelementptr inbounds i8, i8* %4, i64 9
%14 = load i8, i8* %13
store i8 %14, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 1)
store i8 45, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 2)
%15 = getelementptr inbounds i8, i8* %4, i64 4
%16 = load i8, i8* %15
store i8 %16, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 3)
%17 = getelementptr inbounds i8, i8* %4, i64 5
%18 = load i8, i8* %17
store i8 %18, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 4)
%19 = getelementptr inbounds i8, i8* %4, i64 6
%20 = load i8, i8* %19
store i8 %20, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 5)
store i8 45, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 6)
%21 = getelementptr inbounds i8, i8* %4, i64 20
%22 = load i8, i8* %21
store i8 %22, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 7)
%23 = getelementptr inbounds i8, i8* %4, i64 21
%24 = load i8, i8* %23
store i8 %24, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 8)
%25 = getelementptr inbounds i8, i8* %4, i64 22
%26 = load i8, i8* %25
store i8 %26, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 9)
%27 = getelementptr inbounds i8, i8* %4, i64 23
%28 = load i8, i8* %27
store i8 %28, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 10)
store i8 0, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 11)
%29 = getelementptr inbounds i8, i8* %4, i64 11
%30 = load i8, i8* %29
store i8 %30, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 12)
%31 = getelementptr inbounds i8, i8* %4, i64 12
%32 = load i8, i8* %31
store i8 %32, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 13)
%33 = getelementptr inbounds i8, i8* %4, i64 13
%34 = load i8, i8* %33
store i8 %34, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 14)
%35 = getelementptr inbounds i8, i8* %4, i64 14
%36 = load i8, i8* %35
store i8 %36, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 15)
%37 = getelementptr inbounds i8, i8* %4, i64 15
%38 = load i8, i8* %37
store i8 %38, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 16)
store i8 0, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 17)
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @get_today.buffer, i64 0, i64 0)
}