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

/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *GetFileName(void) {
  char *FileName = malloc(sizeof(char) * 64);
  char Buffer[16];
  printf("\nEnter the name of the level: ");
  scanf("%s", Buffer);
  strcpy(FileName, "../assets/levels/");
  strcat(FileName, Buffer);
  strcat(FileName, ".lvl");
  return FileName;
}


x86 assembly (clang, -O0):
<GetFileName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x40,%edi
call   1050 <malloc@plt>
mov    %rax,-0x8(%rbp)
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xea2(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1070 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    0xe8a(%rip),%rsi
call   1070 <strcat@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetFileName>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    $0x40,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xe95(%rip),%rdi
call   1040 <printf@plt>
lea    0xea8(%rip),%rdi
mov    %rsp,%r14
mov    %r14,%rsi
call   1060 <scanf@plt>
lea    0xe99(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <strcat@plt>
lea    0xe91(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcat@plt>
mov    %rbx,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [31 x i8] c"\0AEnter the name of the level: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [18 x i8] c"../assets/levels/\00"
@.str.3 = [5 x i8] c".lvl\00"
define i8* @GetFileName() {
%1 = alloca i8*
%2 = alloca [16 x i8]
%3 = call i8* @malloc(i32 64)
store i8* %3, i8** %1
%4 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = load i8*, i8** %1
%8 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%9 = load i8*, i8** %1
%10 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%11 = call i32 @strcat(i8* %9, i8* %10)
%12 = load i8*, i8** %1
%13 = call i32 @strcat(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%14 = load i8*, i8** %1
ret i8* %14
}

LLVM IR (-O2):
@.str = [31 x i8] c"\0AEnter the name of the level: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [18 x i8] c"../assets/levels/\00"
@.str.3 = [5 x i8] c".lvl\00"
define i8* @GetFileName() {
%1 = alloca [16 x i8]
%2 = tail call dereferenceable_or_null(64) i8* @malloc(i32 64)
%3 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%6 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @strcat(i8* %2, i8* %3)
%8 = call i32 @strcat(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
ret i8* %2
}