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

/* Variables and functions */
struct tm *gmtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int, int,
                           int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void get_cur_time(char s[]) {
  struct tm *mytime;
  time_t now;
  time(&now);
  mytime = gmtime(&now);
  sprintf(s, "backup%d%0.2d%0.2d-%0.2d:%0.2d", mytime->tm_year + 1900,
          mytime->tm_mon + 1, mytime->tm_mday, mytime->tm_hour, mytime->tm_min);
}


x86 assembly (clang, -O0):
<get_cur_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <time@plt>
lea    -0x14(%rbp),%rdi
call   1040 <gmtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
add    $0x76c,%edx
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%r8d
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%r9d
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%eax
lea    0xe76(%rip),%rsi
mov    %eax,(%rsp)
call   1050 <sprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_cur_time>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
lea    0x14(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <time@plt>
mov    %rbx,%rdi
call   1040 <gmtime@plt>
mov    $0x76c,%edx
add    (%rax),%edx
mov    0x4(%rax),%ecx
mov    0x8(%rax),%r8d
add    $0x1,%ecx
mov    0xc(%rax),%r9d
mov    0x10(%rax),%eax
mov    %eax,(%rsp)
lea    0xe8f(%rip),%rsi
mov    %r14,%rdi
call   1050 <sprintf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32 }
@.str = [31 x i8] c"backup%d%0.2d%0.2d-%0.2d:%0.2d\00"
define void @get_cur_time(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.tm*
%4 = alloca i32
store i8* %0, i8** %2
%5 = call i32 @time(i32* %4)
%6 = call %struct.tm* @gmtime(i32* %4)
store %struct.tm* %6, %struct.tm** %3
%7 = load i8*, i8** %2
%8 = load %struct.tm*, %struct.tm** %3
%9 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 0
%10 = load i32, i32* %9
%11 = add nsw i32 %10, 1900
%12 = load %struct.tm*, %struct.tm** %3
%13 = getelementptr inbounds %struct.tm, %struct.tm* %12, i32 0, i32 1
%14 = load i32, i32* %13
%15 = add nsw i32 %14, 1
%16 = load %struct.tm*, %struct.tm** %3
%17 = getelementptr inbounds %struct.tm, %struct.tm* %16, i32 0, i32 2
%18 = load i32, i32* %17
%19 = load %struct.tm*, %struct.tm** %3
%20 = getelementptr inbounds %struct.tm, %struct.tm* %19, i32 0, i32 3
%21 = load i32, i32* %20
%22 = load %struct.tm*, %struct.tm** %3
%23 = getelementptr inbounds %struct.tm, %struct.tm* %22, i32 0, i32 4
%24 = load i32, i32* %23
%25 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %15, i32 %18, i32 %21, i32 %24)
ret void
}

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