#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 */
struct tm {
  int tm_mday;
  int tm_mon;
  int tm_year;
  int tm_min;
  int tm_hour;
};
struct timeval {
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int, int, int);
void LOGdate_string(char *str) {
  struct timeval timeCalc;
  struct tm *T;
  int d, m, y, h, mins;
  gettimeofday(&timeCalc, NULL);
  T = localtime(&timeCalc.tv_sec);
  d = T->tm_mday;
  m = T->tm_mon + 1;
  y = T->tm_year - 100;
  mins = T->tm_min;
  h = T->tm_hour;
  sprintf(str, "%.2d%.2d%.2d%.2d%.2d", y, m, d, h, mins);
}


x86 assembly (clang, -O0):
<LOGdate_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
lea    -0x10(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%eax
sub    $0x64,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x28(%rbp),%r9d
mov    -0x2c(%rbp),%eax
lea    0xe57(%rip),%rsi
mov    %eax,(%rsp)
call   1050 <sprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LOGdate_string>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    (%rax),%r8d
mov    0x4(%rax),%ecx
add    $0x1,%ecx
mov    0x8(%rax),%edx
add    $0xffffff9c,%edx
mov    0xc(%rax),%esi
mov    0x10(%rax),%r9d
mov    %esi,(%rsp)
lea    0xe8f(%rip),%rsi
mov    %r14,%rdi
call   1050 <sprintf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
%struct.tm = type { i32, i32, i32, i32, i32 }
@.str = [21 x i8] c"%.2d%.2d%.2d%.2d%.2d\00"
define void @LOGdate_string(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.timeval
%4 = alloca %struct.tm*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %2
%10 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%12 = call %struct.tm* @localtime(i32* %11)
store %struct.tm* %12, %struct.tm** %4
%13 = load %struct.tm*, %struct.tm** %4
%14 = getelementptr inbounds %struct.tm, %struct.tm* %13, i32 0, i32 0
%15 = load i32, i32* %14
store i32 %15, i32* %5
%16 = load %struct.tm*, %struct.tm** %4
%17 = getelementptr inbounds %struct.tm, %struct.tm* %16, i32 0, i32 1
%18 = load i32, i32* %17
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
%20 = load %struct.tm*, %struct.tm** %4
%21 = getelementptr inbounds %struct.tm, %struct.tm* %20, i32 0, i32 2
%22 = load i32, i32* %21
%23 = sub nsw i32 %22, 100
store i32 %23, i32* %7
%24 = load %struct.tm*, %struct.tm** %4
%25 = getelementptr inbounds %struct.tm, %struct.tm* %24, i32 0, i32 3
%26 = load i32, i32* %25
store i32 %26, i32* %9
%27 = load %struct.tm*, %struct.tm** %4
%28 = getelementptr inbounds %struct.tm, %struct.tm* %27, i32 0, i32 4
%29 = load i32, i32* %28
store i32 %29, i32* %8
%30 = load i8*, i8** %2
%31 = load i32, i32* %7
%32 = load i32, i32* %6
%33 = load i32, i32* %5
%34 = load i32, i32* %8
%35 = load i32, i32* %9
%36 = call i32 @sprintf(i8* %30, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %31, i32 %32, i32 %33, i32 %34, i32 %35)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
%struct.tm = type { i32, i32, i32, i32, i32 }
@.str = [21 x i8] c"%.2d%.2d%.2d%.2d%.2d\00"
define void @LOGdate_string(i8* nocapture writeonly %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%6 = call %struct.tm* @localtime(i32* %5)
%7 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 0
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 1
%10 = load i32, i32* %9
%11 = add nsw i32 %10, 1
%12 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 2
%13 = load i32, i32* %12
%14 = add nsw i32 %13, -100
%15 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 3
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 4
%18 = load i32, i32* %17
%19 = call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %11, i32 %8, i32 %18, i32 %16)
ret void
}