#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;
};
typedef int /*<<< orphan*/ datastring;

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ const *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
void gettime(const time_t timep) {
  struct tm *tm;
  char datastring[256];
  char *time_fmt = NULL;
  if (time_fmt == NULL) {
    time_fmt = "%b  %e %R";
  }
  tm = localtime(&timep);
  strftime(datastring, sizeof(datastring), time_fmt, tm);
  printf("%s ", datastring);
}


x86 assembly (clang, -O0):
<gettime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x118(%rbp)
cmpq   $0x0,-0x118(%rbp)
jne    1165 <gettime+0x35>
lea    0xea2(%rip),%rax
mov    %rax,-0x118(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x118(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    $0x100,%esi
call   1050 <strftime@plt>
lea    -0x110(%rbp),%rsi
lea    0xe6e(%rip),%rdi
call   1040 <printf@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gettime>:
push   %rbx
sub    $0x110,%rsp
mov    %edi,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
lea    0xeb3(%rip),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %rax,%rcx
call   1050 <strftime@plt>
lea    0xea1(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
add    $0x110,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [10 x i8] c"%b %e %R\00"
@.str.1 = [4 x i8] c"%s \00"
define void @gettime(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.tm*
%4 = alloca [256 x i8]
%5 = alloca i8*
store i32 %0, i32* %2
store i8* null, i8** %5
%6 = load i8*, i8** %5
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %9
8: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %5
br label %9
9: ; preds = %8, %1
%10 = call %struct.tm* @localtime(i32* %2)
store %struct.tm* %10, %struct.tm** %3
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%12 = load i8*, i8** %5
%13 = load %struct.tm*, %struct.tm** %3
%14 = call i32 @strftime(i8* %11, i32 256, i8* %12, %struct.tm* %13)
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %15)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [10 x i8] c"%b %e %R\00"
@.str.1 = [4 x i8] c"%s \00"
define void @gettime(i32 %0) {
%2 = alloca i32
%3 = alloca [256 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = call %struct.tm* @localtime(i32* %2)
%6 = call i32 @strftime(i8* %4, i32 256, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %struct.tm* %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret void
}