#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 dummy;
};
typedef int /*<<< orphan*/ datebuff;

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char const *, char const *,
                           char const *, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
char *rh4nLoggingCreateLogfilepath(const char *library, const char *program,
                                   const char *logpath, struct tm *time) {
  static char logfilepath[3000];
  char datebuff[11];
  strftime(datebuff, sizeof(datebuff), "%d.%m.%Y", time);
  sprintf(logfilepath, "%s/rh4n_%s_%s_%s.log", logpath, library, program,
          datebuff);
  return (logfilepath);
}


x86 assembly (clang, -O0):
<rh4nLoggingCreateLogfilepath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x2b(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0xb,%esi
lea    0xeb4(%rip),%rdx
call   1030 <strftime@plt>
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    -0x2b(%rbp),%r9
lea    0x2ed8(%rip),%rdi
lea    0xe9a(%rip),%rsi
call   1040 <sprintf@plt>
lea    0x2ec5(%rip),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rh4nLoggingCreateLogfilepath>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xec3(%rip),%rdx
lea    0x5(%rsp),%r12
mov    %r12,%rdi
mov    $0xb,%esi
call   1030 <strftime@plt>
lea    0x2eea(%rip),%r13
lea    0xeac(%rip),%rsi
mov    %r13,%rdi
mov    %r15,%rdx
mov    %rbx,%rcx
mov    %r14,%r8
mov    %r12,%r9
call   1040 <sprintf@plt>
mov    %r13,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@rh4nLoggingCreateLogfilepath.logfilepath = internal global [3000 x i8] zeroinitializer
@.str = [9 x i8] c"%d.%m.%Y\00"
@.str.1 = [21 x i8] c"%s/rh4n_%s_%s_%s.log\00"
define i8* @rh4nLoggingCreateLogfilepath(i8* %0, i8* %1, i8* %2, %struct.tm* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca %struct.tm*
%9 = alloca [11 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store %struct.tm* %3, %struct.tm** %8
%10 = getelementptr inbounds [11 x i8], [11 x i8]* %9, i64 0, i64 0
%11 = load %struct.tm*, %struct.tm** %8
%12 = call i32 @strftime(i8* %10, i32 11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.tm* %11)
%13 = load i8*, i8** %7
%14 = load i8*, i8** %5
%15 = load i8*, i8** %6
%16 = getelementptr inbounds [11 x i8], [11 x i8]* %9, i64 0, i64 0
%17 = call i32 @sprintf(i8* getelementptr inbounds ([3000 x i8], [3000 x i8]* @rh4nLoggingCreateLogfilepath.logfilepath, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* %14, i8* %15, i8* %16)
ret i8* getelementptr inbounds ([3000 x i8], [3000 x i8]* @rh4nLoggingCreateLogfilepath.logfilepath, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@rh4nLoggingCreateLogfilepath.logfilepath = internal global [3000 x i8] zeroinitializer
@.str = [9 x i8] c"%d.%m.%Y\00"
@.str.1 = [21 x i8] c"%s/rh4n_%s_%s_%s.log\00"
define i8* @rh4nLoggingCreateLogfilepath(i8* %0, i8* %1, i8* %2, %struct.tm* %3) {
%5 = alloca [11 x i8]
%6 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%7 = call i32 @strftime(i8* %6, i32 11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.tm* %3)
%8 = call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([3000 x i8], [3000 x i8]* @rh4nLoggingCreateLogfilepath.logfilepath, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* %0, i8* %1, i8* %6)
ret i8* getelementptr inbounds ([3000 x i8], [3000 x i8]* @rh4nLoggingCreateLogfilepath.logfilepath, i64 0, i64 0)
}