#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*/ strcpy(char *, char *);
int strlen(char *);
char *mkFlNm(char *fullFileName, char *dirName, char *fileName) {
  int dirLen;
  strcpy(fullFileName, dirName);
  dirLen = strlen(dirName);
  if (dirName[dirLen - 1] == '/') {
    strcpy(fullFileName + dirLen, fileName);
  } else {
    dirName[dirLen] = '/';
    strcpy(fullFileName + dirLen + 1, fileName);
  }
  return fullFileName;
}


x86 assembly (clang, -O0):
<mkFlNm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
jne    1180 <mkFlNm+0x60>
mov    -0x8(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    11a4 <mkFlNm+0x84>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x2f,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
add    $0x1,%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkFlNm>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
movslq %eax,%rdi
cmpb   $0x2f,-0x1(%rdi,%rbx,1)
jne    114a <mkFlNm+0x2a>
add    %r15,%rdi
jmp    1155 <mkFlNm+0x35>
movb   $0x2f,(%rbx,%rdi,1)
add    %r15,%rdi
add    $0x1,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @mkFlNm(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = call i32 @strcpy(i8* %8, i8* %9)
%11 = load i8*, i8** %5
%12 = call i32 @strlen(i8* %11)
store i32 %12, i32* %7
%13 = load i8*, i8** %5
%14 = load i32, i32* %7
%15 = sub nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %13, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 47
br i1 %20, label %21, label %28
21: ; preds = %3
%22 = load i8*, i8** %4
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8*, i8** %6
%27 = call i32 @strcpy(i8* %25, i8* %26)
br label %40
28: ; preds = %3
%29 = load i8*, i8** %5
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
store i8 47, i8* %32
%33 = load i8*, i8** %4
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
%37 = getelementptr inbounds i8, i8* %36, i64 1
%38 = load i8*, i8** %6
%39 = call i32 @strcpy(i8* %37, i8* %38)
br label %40
40: ; preds = %28, %21
%41 = load i8*, i8** %4
ret i8* %41
}

LLVM IR (-O2):
define i8* @mkFlNm(i8* returned %0, i8* %1, i8* %2) {
%4 = tail call i32 @strcpy(i8* %0, i8* %1)
%5 = tail call i32 @strlen(i8* %1)
%6 = add nsw i32 %5, -1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %1, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 47
%11 = sext i32 %5 to i64
br i1 %10, label %12, label %15
12: ; preds = %3
%13 = getelementptr inbounds i8, i8* %0, i64 %11
%14 = tail call i32 @strcpy(i8* %13, i8* %2)
br label %20
15: ; preds = %3
%16 = getelementptr inbounds i8, i8* %1, i64 %11
store i8 47, i8* %16
%17 = getelementptr inbounds i8, i8* %0, i64 %11
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = tail call i32 @strcpy(i8* %18, i8* %2)
br label %20
20: ; preds = %15, %12
ret i8* %0
}