#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 */
struct tm {
  int tm_year;
  int tm_mon;
  int tm_mday;
};

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, size_t, char *, char const *, int, int,
                            int);
int logger_get_rotatelogger_filename(char *filename, size_t filename_len,
                                     const char *prefix, struct tm *m_tm) {
  snprintf(filename, filename_len, "%s.%04d-%02d-%02d", prefix,
           (m_tm->tm_year + 1900), (m_tm->tm_mon + 1), (m_tm->tm_mday));
  return 0;
}


x86 assembly (clang, -O0):
<logger_get_rotatelogger_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    (%rax),%r8d
add    $0x76c,%r8d
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%r9d
add    $0x1,%r9d
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%eax
lea    0xea4(%rip),%rdx
mov    %eax,(%rsp)
call   1030 <snprintf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logger_get_rotatelogger_filename>:
push   %rax
mov    $0x76c,%r8d
add    (%rcx),%r8d
mov    %rdx,%rax
mov    0x4(%rcx),%r9d
mov    0x8(%rcx),%ecx
add    $0x1,%r9d
mov    %ecx,(%rsp)
lea    0xece(%rip),%rdx
mov    %rax,%rcx
call   1030 <snprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32 }
@.str = [18 x i8] c"%s.%04d-%02d-%02d\00"
define i32 @logger_get_rotatelogger_filename(i8* %0, i64 %1, i8* %2, %struct.tm* nocapture %3) {
%5 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 0
%6 = load i32, i32* %5
%7 = add nsw i32 %6, 1900
%8 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 1
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 1
%11 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 2
%12 = load i32, i32* %11
%13 = tail call i32 @snprintf(i8* %0, i64 %1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %7, i32 %10, i32 %12)
ret i32 0
}