#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 tm_hour;
  int tm_min;
  int tm_sec;
  int tm_mday;
  int tm_mon;
  int tm_year;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ snprintf(char *, size_t, char *, int, int, int, int, int,
                            int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void loggerGetTimeString(char *stringTimestamp, size_t stringSize) {
  time_t t = time(NULL);
  struct tm *tme = localtime(&t);
  snprintf((char *)stringTimestamp, (size_t)stringSize,
           "%02d:%02d:%02d %02d/%02d/%02d", tme->tm_hour, tme->tm_min,
           tme->tm_sec, tme->tm_mday, (tme->tm_mon + 1),
           (tme->tm_year + 1900) % 1000);
}


x86 assembly (clang, -O0):
<loggerGetTimeString>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x38,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x1c(%rbp)
lea    -0x1c(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
mov    -0x28(%rbp),%rax
mov    0x4(%rax),%r8d
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%r9d
mov    -0x28(%rbp),%rax
mov    0xc(%rax),%r11d
mov    -0x28(%rbp),%rax
mov    0x10(%rax),%r10d
add    $0x1,%r10d
mov    -0x28(%rbp),%rax
mov    0x14(%rax),%eax
add    $0x76c,%eax
mov    $0x3e8,%ebx
cltd
idiv   %ebx
mov    %edx,%eax
lea    0xe57(%rip),%rdx
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1040 <snprintf@plt>
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<loggerGetTimeString>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%ecx
mov    0x4(%rax),%r8d
mov    0x8(%rax),%r9d
mov    0xc(%rax),%r10d
mov    0x10(%rax),%ebx
add    $0x1,%ebx
mov    0x14(%rax),%eax
mov    %eax,%edx
add    $0x76c,%edx
movslq %edx,%rdx
imul   $0x10624dd3,%rdx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x26,%rdx
add    %esi,%edx
imul   $0x3e8,%edx,%edx
neg    %edx
add    %edx,%eax
add    $0x76c,%eax
sub    $0x8,%rsp
lea    0xe5c(%rip),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
push   %rax
push   %rbx
push   %r10
call   1040 <snprintf@plt>
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [30 x i8] c"%02d:%02d:%02d %02d/%02d/%02d\00"
define void @loggerGetTimeString(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca %struct.tm*
store i8* %0, i8** %3
store i64 %1, i64* %4
%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 = load i8*, i8** %3
%10 = load i64, i64* %4
%11 = load %struct.tm*, %struct.tm** %6
%12 = getelementptr inbounds %struct.tm, %struct.tm* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = load %struct.tm*, %struct.tm** %6
%15 = getelementptr inbounds %struct.tm, %struct.tm* %14, i32 0, i32 1
%16 = load i32, i32* %15
%17 = load %struct.tm*, %struct.tm** %6
%18 = getelementptr inbounds %struct.tm, %struct.tm* %17, i32 0, i32 2
%19 = load i32, i32* %18
%20 = load %struct.tm*, %struct.tm** %6
%21 = getelementptr inbounds %struct.tm, %struct.tm* %20, i32 0, i32 3
%22 = load i32, i32* %21
%23 = load %struct.tm*, %struct.tm** %6
%24 = getelementptr inbounds %struct.tm, %struct.tm* %23, i32 0, i32 4
%25 = load i32, i32* %24
%26 = add nsw i32 %25, 1
%27 = load %struct.tm*, %struct.tm** %6
%28 = getelementptr inbounds %struct.tm, %struct.tm* %27, i32 0, i32 5
%29 = load i32, i32* %28
%30 = add nsw i32 %29, 1900
%31 = srem i32 %30, 1000
%32 = call i32 @snprintf(i8* %9, i64 %10, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %16, i32 %19, i32 %22, i32 %26, i32 %31)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [30 x i8] c"%02d:%02d:%02d %02d/%02d/%02d\00"
define void @loggerGetTimeString(i8* %0, i64 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @time(i32* null)
store i32 %5, i32* %3
%6 = call %struct.tm* @localtime(i32* %3)
%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 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 2
%12 = load i32, i32* %11
%13 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 3
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 4
%16 = load i32, i32* %15
%17 = add nsw i32 %16, 1
%18 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 5
%19 = load i32, i32* %18
%20 = add nsw i32 %19, 1900
%21 = srem i32 %20, 1000
%22 = call i32 @snprintf(i8* %0, i64 %1, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %10, i32 %12, i32 %14, i32 %17, i32 %21)
ret void
}