#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 char time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime(char *);
int /*<<< orphan*/ memset(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(char *);
void printTimestamp() {
  char tbuf[80];
  time_t timer;
  struct tm *tm_info;
  memset(tbuf, 80, 0);
  memset(&timer, sizeof(time_t), 0);
  time(&timer);
  tm_info = localtime(&timer);
  strftime(tbuf, 80, "%Y-%m-%d %H:%M:%S", tm_info);
  printf("%s ", tbuf);
}


x86 assembly (clang, -O0):
<printTimestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x50(%rbp),%rdi
mov    $0x50,%esi
xor    %edx,%edx
call   1050 <memset@plt>
lea    -0x51(%rbp),%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1050 <memset@plt>
lea    -0x51(%rbp),%rdi
call   1060 <time@plt>
lea    -0x51(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x60(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x60(%rbp),%rcx
mov    $0x50,%esi
lea    0xe5e(%rip),%rdx
call   1070 <strftime@plt>
lea    -0x50(%rbp),%rsi
lea    0xe60(%rip),%rdi
call   1040 <printf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printTimestamp>:
push   %r14
push   %rbx
sub    $0x68,%rsp
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x50,%esi
xor    %edx,%edx
call   1050 <memset@plt>
lea    0xf(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1050 <memset@plt>
mov    %rbx,%rdi
call   1060 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
lea    0xe6a(%rip),%rdx
mov    %r14,%rdi
mov    $0x50,%esi
mov    %rax,%rcx
call   1070 <strftime@plt>
lea    0xe65(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [18 x i8] c"%Y-%m-%d %H:%M:%S\00"
@.str.1 = [4 x i8] c"%s \00"
define void @printTimestamp() {
%1 = alloca [80 x i8]
%2 = alloca i8
%3 = alloca %struct.tm*
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i32 80, i32 0)
%6 = call i32 @memset(i8* %2, i32 1, i32 0)
%7 = call i32 @time(i8* %2)
%8 = call %struct.tm* @localtime(i8* %2)
store %struct.tm* %8, %struct.tm** %3
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%10 = load %struct.tm*, %struct.tm** %3
%11 = call i32 @strftime(i8* %9, i32 80, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.tm* %10)
%12 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %12)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [18 x i8] c"%Y-%m-%d %H:%M:%S\00"
@.str.1 = [4 x i8] c"%s \00"
define void @printTimestamp() {
%1 = alloca [80 x i8]
%2 = alloca i8
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%4 = call i32 @memset(i8* %3, i32 80, i32 0)
%5 = call i32 @memset(i8* %2, i32 1, i32 0)
%6 = call i32 @time(i8* %2)
%7 = call %struct.tm* @localtime(i8* %2)
%8 = call i32 @strftime(i8* %3, i32 80, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.tm* %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret void
}