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

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strftime(char *, size_t const, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  time_t current_time = time(NULL);
  struct tm *tm;
  tm = localtime(&current_time);
  const size_t BUFFER_SIZE = 256;
  char buffer[BUFFER_SIZE];
  strftime(buffer, BUFFER_SIZE, "%a %b %d %H:%M:%S %Y", tm);
  printf("%s\n", buffer);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%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)
movq   $0x100,-0x18(%rbp)
mov    %rsp,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rcx
lea    -0x120(%rbp),%rdi
mov    $0x100,%esi
lea    0xe6f(%rip),%rdx
call   1060 <strftime@plt>
lea    0xe78(%rip),%rdi
lea    -0x120(%rbp),%rsi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x118,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rsp,%rbx
lea    0xe97(%rip),%rdx
lea    0x10(%rsp),%r14
mov    $0x100,%esi
mov    %r14,%rdi
mov    %rax,%rcx
call   1060 <strftime@plt>
lea    0xe90(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
mov    %rbx,%rsp
xor    %eax,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [21 x i8] c"%a %b %d %H:%M:%S %Y\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.tm*
%4 = alloca i64
%5 = alloca i8*
store i32 0, i32* %1
%6 = call i32 @time(i32* null)
store i32 %6, i32* %2
%7 = call %struct.tm* @localtime(i32* %2)
store %struct.tm* %7, %struct.tm** %3
store i64 256, i64* %4
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %5
%9 = alloca i8, i64 256
%10 = load %struct.tm*, %struct.tm** %3
%11 = call i32 @strftime(i8* %9, i64 256, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), %struct.tm* %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %9)
store i32 0, i32* %1
%13 = load i8*, i8** %5
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [21 x i8] c"%a %b %d %H:%M:%S %Y\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32* null)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
%5 = call i8* @llvm.stacksave()
%6 = alloca [256 x i8]
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%8 = call i32 @strftime(i8* %7, i64 256, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), %struct.tm* %4)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %7)
ret i32 0
}