#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*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void get_datetime_str(char *date_time_str) {
  char time_str[15];
  char date_str[15];
  time_t t = time(NULL);
  struct tm *timeinfo;
  timeinfo = localtime(&t);
  strftime(date_str, 15, "%F", timeinfo);
  strftime(time_str, 15, "%T", timeinfo);
  strcpy(date_time_str, date_str);
  strcat(date_time_str, " ");
  strcat(date_time_str, time_str);
}


x86 assembly (clang, -O0):
<get_datetime_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x2c(%rbp)
lea    -0x2c(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x38(%rbp)
lea    -0x26(%rbp),%rdi
mov    -0x38(%rbp),%rcx
mov    $0xf,%esi
lea    0xe77(%rip),%rdx
call   1060 <strftime@plt>
lea    -0x17(%rbp),%rdi
mov    -0x38(%rbp),%rcx
mov    $0xf,%esi
lea    0xe61(%rip),%rdx
call   1060 <strftime@plt>
mov    -0x8(%rbp),%rdi
lea    -0x26(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    0xe47(%rip),%rsi
call   1070 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    -0x17(%rbp),%rsi
call   1070 <strcat@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_datetime_str>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdi,%r14
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
lea    0xe83(%rip),%rdx
lea    0xa(%rsp),%r15
mov    %r15,%rdi
mov    $0xf,%esi
mov    %rax,%rcx
call   1060 <strftime@plt>
lea    0xe6a(%rip),%rdx
lea    0x19(%rsp),%r12
mov    %r12,%rdi
mov    $0xf,%esi
mov    %rbx,%rcx
call   1060 <strftime@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
lea    0xe46(%rip),%rsi
mov    %r14,%rdi
call   1070 <strcat@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   1070 <strcat@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [3 x i8] c"%F\00"
@.str.1 = [3 x i8] c"%T\00"
@.str.2 = [2 x i8] c" \00"
define void @get_datetime_str(i8* %0) {
%2 = alloca i8*
%3 = alloca [15 x i8]
%4 = alloca [15 x i8]
%5 = alloca i32
%6 = alloca %struct.tm*
store i8* %0, i8** %2
%7 = call i32 @time(i32* null)
store i32 %7, i32* %5
%8 = call %struct.tm* @localtime(i32* %5)
store %struct.tm* %8, %struct.tm** %6
%9 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%10 = load %struct.tm*, %struct.tm** %6
%11 = call i32 @strftime(i8* %9, i32 15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %struct.tm* %10)
%12 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%13 = load %struct.tm*, %struct.tm** %6
%14 = call i32 @strftime(i8* %12, i32 15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %13)
%15 = load i8*, i8** %2
%16 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%17 = call i32 @strcpy(i8* %15, i8* %16)
%18 = load i8*, i8** %2
%19 = call i32 @strcat(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%20 = load i8*, i8** %2
%21 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%22 = call i32 @strcat(i8* %20, i8* %21)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [3 x i8] c"%F\00"
@.str.1 = [3 x i8] c"%T\00"
@.str.2 = [2 x i8] c" \00"
define void @get_datetime_str(i8* %0) {
%2 = alloca [15 x i8]
%3 = alloca [15 x i8]
%4 = alloca i32
%5 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%7 = bitcast i32* %4 to i8*
%8 = tail call i32 @time(i32* null)
store i32 %8, i32* %4
%9 = call %struct.tm* @localtime(i32* %4)
%10 = call i32 @strftime(i8* %6, i32 15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %struct.tm* %9)
%11 = call i32 @strftime(i8* %5, i32 15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %9)
%12 = call i32 @strcpy(i8* %0, i8* %6)
%13 = call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @strcat(i8* %0, i8* %5)
ret void
}