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


x86 assembly (clang, -O0):
<buildDirectory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe8d(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
add    %rcx,%rax
add    $0x1,%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    0xe4f(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
shl    $0x0,%rax
mov    %eax,%edx
lea    0xe39(%rip),%rsi
call   1060 <memcpy@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xe25(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1080 <strcat@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <system@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buildDirectory>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x13(%rax),%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
lea    0xe82(%rip),%rsi
mov    %rax,%rdi
mov    $0x12,%edx
call   1060 <memcpy@plt>
movb   $0x0,0x12(%rbx)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <strcat@plt>
mov    %rbx,%rdi
call   1050 <system@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

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

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