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

/* Variables and functions */
int /*<<< orphan*/ localtime_r(int /*<<< orphan*/ *, struct tm *);
int /*<<< orphan*/ sprintf(char *, char *, char const *, int, int, int, char *,
                           int /*<<< orphan*/, char const *);
char *minute_filename(time_t curr_min, const char *prefix, const char *suffix,
                      char *buff) {
  struct tm curr_tm;
  localtime_r(&curr_min, &curr_tm);
  sprintf(buff, "%s%4d-%02d-%02d/%02d%02d%s", prefix, 1900 + curr_tm.tm_year,
          1 + curr_tm.tm_mon, curr_tm.tm_mday, curr_tm.tm_hour, curr_tm.tm_min,
          suffix);
  return buff;
}


x86 assembly (clang, -O0):
<minute_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x4(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1030 <localtime_r@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x40(%rbp),%ecx
add    $0x76c,%ecx
mov    -0x3c(%rbp),%r8d
add    $0x1,%r8d
mov    -0x38(%rbp),%r9d
mov    -0x30(%rbp),%r11
mov    -0x28(%rbp),%r10d
mov    -0x18(%rbp),%rax
lea    0xe8c(%rip),%rsi
mov    %r11,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1040 <sprintf@plt>
mov    -0x20(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<minute_filename>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %edi,0xc(%rsp)
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1030 <localtime_r@plt>
mov    $0x76c,%ecx
add    0x10(%rsp),%ecx
mov    0x14(%rsp),%r8d
mov    0x18(%rsp),%r9d
add    $0x1,%r8d
mov    0x28(%rsp),%eax
sub    $0x8,%rsp
lea    0xe95(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
push   %r14
push   %rax
push   0x38(%rsp)
call   1040 <sprintf@plt>
add    $0x20,%rsp
mov    %rbx,%rax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i8*, i32 }
@.str = [27 x i8] c"%s%4d-%02d-%02d/%02d%02d%s\00"
define i8* @minute_filename(i32 %0, i8* %1, i8* %2, i8* returned writeonly %3) {
%5 = alloca i32
%6 = alloca %struct.tm
store i32 %0, i32* %5
%7 = bitcast %struct.tm* %6 to i8*
%8 = call i32 @localtime_r(i32* %5, %struct.tm* %6)
%9 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 0
%10 = load i32, i32* %9
%11 = add nsw i32 %10, 1900
%12 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 1
%13 = load i32, i32* %12
%14 = add nsw i32 %13, 1
%15 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 2
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 3
%18 = load i8*, i8** %17
%19 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 4
%20 = load i32, i32* %19
%21 = call i32 @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %11, i32 %14, i32 %16, i8* %18, i32 %20, i8* %2)
ret i8* %3
}