#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*/ ERROR(char *, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
void createFullFileName(char *fullFileName, char *dirName, char *fileName) {
  char sLoc[1024];
  if ((strlen(fileName) + strlen(dirName)) > 1022)
    ERROR("FileName will be too long for %s + %s", dirName, fileName);
  sprintf(sLoc, "%s/%s", dirName, fileName);
  strcpy(fullFileName, sLoc);
  return;
}


x86 assembly (clang, -O0):
<createFullFileName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x424(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x424(%rbp),%eax
add    %ecx,%eax
cmp    $0x3fe,%eax
jle    1198 <createFullFileName+0x58>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe6d(%rip),%rdi
call   1050 <ERROR@plt>
lea    -0x420(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe78(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x420(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createFullFileName>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rdx,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <strlen@plt>
add    %ebp,%eax
cmp    $0x3ff,%eax
jl     1183 <createFullFileName+0x43>
lea    0xe88(%rip),%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1050 <ERROR@plt>
lea    0xe9c(%rip),%rsi
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    %rbx,%rdx
mov    %r15,%rcx
call   1060 <sprintf@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1030 <strcpy@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"FileName will be too long for %s + %s\00"
@.str.1 = [6 x i8] c"%s/%s\00"
define void @createFullFileName(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [1024 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %6
%9 = call i32 @strlen(i8* %8)
%10 = load i8*, i8** %5
%11 = call i32 @strlen(i8* %10)
%12 = add nsw i32 %9, %11
%13 = icmp sgt i32 %12, 1022
br i1 %13, label %14, label %18
14: ; preds = %3
%15 = load i8*, i8** %5
%16 = load i8*, i8** %6
%17 = call i32 @ERROR(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %15, i8* %16)
br label %18
18: ; preds = %14, %3
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%20 = load i8*, i8** %5
%21 = load i8*, i8** %6
%22 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %20, i8* %21)
%23 = load i8*, i8** %4
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%25 = call i32 @strcpy(i8* %23, i8* %24)
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"FileName will be too long for %s + %s\00"
@.str.1 = [6 x i8] c"%s/%s\00"
define void @createFullFileName(i8* %0, i8* %1, i8* %2) {
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%6 = tail call i32 @strlen(i8* %2)
%7 = tail call i32 @strlen(i8* %1)
%8 = add nsw i32 %7, %6
%9 = icmp sgt i32 %8, 1022
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = tail call i32 @ERROR(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
br label %12
12: ; preds = %10, %3
%13 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %2)
%14 = call i32 @strcpy(i8* %0, i8* %5)
ret void
}