char *path_join_file(const char *path, const char *f) {
  char *path_file;
  int len;
  len = (strlen(path) + strlen(f) + 1);
  if (len > 220) {
    fatal_error("In path_join_file function, len variable is more than "
                "MAX_PATH_FILE_NAME. Please check it. \n");
  }
  path_file = (char *)malloc((len) * sizeof(char));
  strcpy(path_file, path);
  strcat(path_file, f);
  return path_file;
}


x86 assembly (clang, -O0):
<path_join_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
add    %rcx,%rax
add    $0x1,%rax
mov    %eax,-0x1c(%rbp)
cmpl   $0xdc,-0x1c(%rbp)
jle    11a2 <path_join_file+0x52>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1050 <fatal_error@plt>
movslq -0x1c(%rbp),%rdi
shl    $0x0,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <strcat@plt>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<path_join_file>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1040 <strlen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1040 <strlen@plt>
add    %eax,%ebx
add    $0x1,%ebx
cmp    $0xdd,%ebx
jl     1186 <path_join_file+0x36>
lea    0xe81(%rip),%rdi
xor    %eax,%eax
call   1050 <fatal_error@plt>
movslq %ebx,%rdi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1070 <strcat@plt>

LLVM IR (-O0):
@.str = [93 x i8] c"In path_join_file function, len variable is more than MAX_PATH_FILE_NAME. Please check it. \0A\00"
define i8* @path_join_file(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call i64 @strlen(i8* %7)
%9 = load i8*, i8** %4
%10 = call i64 @strlen(i8* %9)
%11 = add i64 %8, %10
%12 = add i64 %11, 1
%13 = trunc i64 %12 to i32
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = icmp sgt i32 %14, 220
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = call i32 (i8*, ...) bitcast (i32 (...)* @fatal_error to i32 (i8*, ...)*)(i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %2
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = mul i64 %20, 1
%22 = call i8* @malloc(i64 %21)
store i8* %22, i8** %5
%23 = load i8*, i8** %5
%24 = load i8*, i8** %3
%25 = call i8* @strcpy(i8* %23, i8* %24)
%26 = load i8*, i8** %5
%27 = load i8*, i8** %4
%28 = call i8* @strcat(i8* %26, i8* %27)
%29 = load i8*, i8** %5
ret i8* %29
}

LLVM IR (-O2):
@.str = [93 x i8] c"In path_join_file function, len variable is more than MAX_PATH_FILE_NAME. Please check it. \0A\00"
define i8* @path_join_file(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add i64 %4, %3
%6 = trunc i64 %5 to i32
%7 = add i32 %6, 1
%8 = icmp sgt i32 %7, 220
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 (i8*, ...) bitcast (i32 (...)* @fatal_error to i32 (i8*, ...)*)(i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
%12 = sext i32 %7 to i64
%13 = tail call i8* @malloc(i64 %12)
%14 = tail call i8* @strcpy(i8* dereferenceable(1) %13, i8* dereferenceable(1) %0)
%15 = tail call i8* @strcat(i8* dereferenceable(1) %13, i8* dereferenceable(1) %1)
ret i8* %13
}