#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*/ filename;

/* Variables and functions */
int /*<<< orphan*/ Q_strncatz(char *, char *, int);
int /*<<< orphan*/ Q_strncpyz(char *, char *, int);
int /*<<< orphan*/ _Mem_Free(char *, int /*<<< orphan*/, int /*<<< orphan*/,
                             char *, int);
scalar_t__ base64_encode(unsigned char *, int /*<<< orphan*/, void *);
int /*<<< orphan*/ strlen(char const *);
const char *mm_passwordFilename(const char *user) {
  static char filename[1024];
  char *user64;
  user64 =
      (char *)base64_encode((unsigned char *)user, strlen(user), ((void *)0));
  Q_strncpyz(filename, user64, sizeof(filename) - 1);
  Q_strncatz(filename, ".profile", sizeof(filename) - 1);
  _Mem_Free(user64, 0, 0,
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/ptitSeb/warsow-pandora/refs/heads/"
            "master/matchmaker/mm_common.c",
            46);
  return filename;
}


x86 assembly (clang, -O0):
<mm_passwordFilename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1060 <base64_encode@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0x2ed5(%rip),%rdi
mov    $0x3ff,%edx
call   1070 <Q_strncpyz@plt>
lea    0x2ec4(%rip),%rdi
lea    0xe5d(%rip),%rsi
mov    $0x3ff,%edx
call   1040 <Q_strncatz@plt>
mov    -0x10(%rbp),%rdi
xor    %edx,%edx
lea    0xe4f(%rip),%rcx
mov    $0x2e,%r8d
mov    %edx,%esi
call   1050 <_Mem_Free@plt>
lea    0x2e92(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mm_passwordFilename>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %edx,%edx
call   1060 <base64_encode@plt>
mov    %rax,%rbx
lea    0x2eee(%rip),%r14
mov    %r14,%rdi
mov    %rax,%rsi
mov    $0x3ff,%edx
call   1070 <Q_strncpyz@plt>
lea    0xe77(%rip),%rsi
mov    %r14,%rdi
mov    $0x3ff,%edx
call   1040 <Q_strncatz@plt>
lea    0xe6c(%rip),%rcx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x2e,%r8d
call   1050 <_Mem_Free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@mm_passwordFilename.filename = internal global [1024 x i8] zeroinitializer
@.str = [9 x i8] c".profile\00"
@.str.1 = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ptitSeb/warsow-pandora/refs/heads/master/matchmaker/mm_common.c\00"
define i8* @mm_passwordFilename(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = call i64 @base64_encode(i8* %4, i32 %6, i8* null)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = call i32 @Q_strncpyz(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @mm_passwordFilename.filename, i64 0, i64 0), i8* %9, i32 1023)
%11 = call i32 @Q_strncatz(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @mm_passwordFilename.filename, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1023)
%12 = load i8*, i8** %3
%13 = call i32 @_Mem_Free(i8* %12, i32 0, i32 0, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 46)
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @mm_passwordFilename.filename, i64 0, i64 0)
}

LLVM IR (-O2):
@mm_passwordFilename.filename = internal global [1024 x i8] zeroinitializer
@.str = [9 x i8] c".profile\00"
@.str.1 = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ptitSeb/warsow-pandora/refs/heads/master/matchmaker/mm_common.c\00"
define i8* @mm_passwordFilename(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i64 @base64_encode(i8* %0, i32 %2, i8* null)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 @Q_strncpyz(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @mm_passwordFilename.filename, i64 0, i64 0), i8* %4, i32 1023)
%6 = tail call i32 @Q_strncatz(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @mm_passwordFilename.filename, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1023)
%7 = tail call i32 @_Mem_Free(i8* %4, i32 0, i32 0, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 46)
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @mm_passwordFilename.filename, i64 0, i64 0)
}