#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
char *strcat(char *, char *);
size_t strlen(char *);
char *buildDabataseName(char *fileName) {
  char *string = (char *)malloc(
      sizeof(char) * (strlen("files/") + strlen(fileName) + strlen("/") + 1));
  memcpy(string, "files/", sizeof(char) * (strlen("files/")));
  string[strlen("files/")] = '\0';
  string = strcat(string, fileName);
  string = strcat(string, "/");
  return string;
}


x86 assembly (clang, -O0):
<buildDabataseName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xead(%rip),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
lea    0xe8b(%rip),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
add    %rcx,%rax
add    $0x1,%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    0xe55(%rip),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
shl    $0x0,%rax
mov    %eax,%edx
lea    0xe3f(%rip),%rsi
call   1040 <memcpy@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xe2b(%rip),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcat@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe04(%rip),%rsi
call   1060 <strcat@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buildDabataseName>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
lea    0x8(%rax),%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xea2(%rip),%rsi
mov    %rax,%rdi
mov    $0x6,%edx
call   1040 <memcpy@plt>
movb   $0x0,0x6(%rbx)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
movw   $0x2f,(%rbx,%rax,1)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"files/\00"
@.str.1 = [2 x i8] c"/\00"
define i8* @buildDabataseName(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = call i64 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
%7 = add i64 %4, %6
%8 = call i64 @strlen(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = add i64 %7, %8
%10 = add i64 %9, 1
%11 = mul i64 1, %10
%12 = trunc i64 %11 to i32
%13 = call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to i8*
store i8* %14, i8** %3
%15 = load i8*, i8** %3
%16 = call i64 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%17 = mul i64 1, %16
%18 = trunc i64 %17 to i32
%19 = call i32 @memcpy(i8* %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = load i8*, i8** %3
%21 = call i64 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%22 = getelementptr inbounds i8, i8* %20, i64 %21
store i8 0, i8* %22
%23 = load i8*, i8** %3
%24 = load i8*, i8** %2
%25 = call i8* @strcat(i8* %23, i8* %24)
store i8* %25, i8** %3
%26 = load i8*, i8** %3
%27 = call i8* @strcat(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %27, i8** %3
%28 = load i8*, i8** %3
ret i8* %28
}

LLVM IR (-O2):
@.str = [7 x i8] c"files/\00"
define i8* @buildDabataseName(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = trunc i64 %2 to i32
%4 = add i32 %3, 8
%5 = tail call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to i8*
%7 = tail call i32 @memcpy(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
%8 = getelementptr inbounds i8, i8* %6, i64 6
store i8 0, i8* %8
%9 = tail call i8* @strcat(i8* dereferenceable(1) %6, i8* dereferenceable(1) %0)
%10 = tail call i64 @strlen(i8* dereferenceable(1) %6)
%11 = getelementptr i8, i8* %6, i64 %10
%12 = bitcast i8* %11 to i16*
store i16 47, i16* %12
ret i8* %6
}