#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*/ tbuf;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime(long *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
long time(int /*<<< orphan*/ *);
void get_now_time(char *ntm) {
  long t = time(NULL);
  struct tm *nt = localtime(&t);
  char tbuf[128] = {'\0'};
  strftime(tbuf, sizeof(tbuf), "%Y-%m-%d-%H:%M:%S", nt);
  strcpy(ntm, tbuf);
  return;
}


x86 assembly (clang, -O0):
<get_now_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %rax,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1050 <memset@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x80,%esi
lea    0xe5d(%rip),%rdx
call   1070 <strftime@plt>
mov    -0x8(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   1040 <strcpy@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_now_time>:
push   %r14
push   %rbx
sub    $0x98,%rsp
mov    %rdi,%r14
xor    %edi,%edi
call   1050 <time@plt>
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <localtime@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
lea    0xe68(%rip),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x80,%esi
mov    %rax,%rcx
call   1060 <strftime@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
add    $0x98,%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"
define void @get_now_time(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca %struct.tm*
%5 = alloca [128 x i8]
store i8* %0, i8** %2
%6 = call i64 @time(i32* null)
store i64 %6, i64* %3
%7 = call %struct.tm* @localtime(i64* %3)
store %struct.tm* %7, %struct.tm** %4
%8 = bitcast [128 x i8]* %5 to i8*
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%10 = load %struct.tm*, %struct.tm** %4
%11 = call i32 @strftime(i8* %9, i32 128, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.tm* %10)
%12 = load i8*, i8** %2
%13 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%14 = call i32 @strcpy(i8* %12, i8* %13)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [18 x i8] c"%Y-%m-%d-%H:%M:%S\00"
define void @get_now_time(i8* %0) {
%2 = alloca i64
%3 = alloca [128 x i8]
%4 = bitcast i64* %2 to i8*
%5 = tail call i64 @time(i32* null)
store i64 %5, i64* %2
%6 = call %struct.tm* @localtime(i64* %2)
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%8 = call i32 @strftime(i8* %7, i32 128, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.tm* %6)
%9 = call i32 @strcpy(i8* %0, i8* %7)
ret void
}