#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_year;
  int tm_mon;
  int tm_mday;
  int /*<<< orphan*/ tm_sec;
  int /*<<< orphan*/ tm_min;
  int /*<<< orphan*/ tm_hour;
};

/* Variables and functions */
int /*<<< orphan*/ csc_strlcat(char *, char *, int);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int, int /*<<< orphan*/,
                           int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int slog_csoup_trans_date(int cw, char *buf, int blen) {
  struct tm *lctm;
  time_t sec;
  char tmp[64];
  (void)cw;
  time(&sec);
  lctm = localtime(&sec);
  sprintf(tmp, "[%d%02d%02d%02d%02d%02d]", lctm->tm_year + 1900, lctm->tm_mon,
          lctm->tm_mday, lctm->tm_hour, lctm->tm_min, lctm->tm_sec);
  csc_strlcat(buf, tmp, blen);
  return 0;
}


x86 assembly (clang, -O0):
<slog_csoup_trans_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    -0x24(%rbp),%rdi
call   1040 <time@plt>
lea    -0x24(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
add    $0x76c,%edx
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%r8d
mov    -0x20(%rbp),%rax
mov    0x14(%rax),%r9d
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%r10d
mov    -0x20(%rbp),%rax
mov    0xc(%rax),%eax
lea    0xe58(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1060 <sprintf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <csc_strlcat@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slog_csoup_trans_date>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    %edx,%r14d
mov    %rsi,%r15
lea    0xc(%rsp),%rbp
mov    %rbp,%rdi
call   1040 <time@plt>
mov    %rbp,%rdi
call   1030 <localtime@plt>
mov    $0x76c,%edx
add    (%rax),%edx
mov    0x4(%rax),%ecx
mov    0x8(%rax),%r8d
mov    0x14(%rax),%r9d
mov    0x10(%rax),%ebx
mov    0xc(%rax),%eax
lea    0xe7c(%rip),%rsi
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
push   %rax
push   %rbx
call   1060 <sprintf@plt>
add    $0x10,%rsp
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
call   1050 <csc_strlcat@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [25 x i8] c"[%d%02d%02d%02d%02d%02d]\00"
define i32 @slog_csoup_trans_date(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca [64 x i8]
%6 = bitcast i32* %4 to i8*
%7 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%8 = call i32 @time(i32* %4)
%9 = call %struct.tm* @localtime(i32* %4)
%10 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 0
%11 = load i32, i32* %10
%12 = add nsw i32 %11, 1900
%13 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 1
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 2
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 5
%18 = load i32, i32* %17
%19 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 4
%20 = load i32, i32* %19
%21 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 3
%22 = load i32, i32* %21
%23 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %14, i32 %16, i32 %18, i32 %20, i32 %22)
%24 = call i32 @csc_strlcat(i8* %1, i8* %7, i32 %2)
ret i32 0
}