#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*/ strcat(char *, char *);
int strlen(char *);
void rtl_catPathNames(char *left, char *right) {
  char *pt;
  if (*left) {
    pt = left + strlen(left) - 1;
    if (!(((*pt) == '/') || ((*pt) == '\\'))) {
      pt[1] = '/';
      pt[2] = 0;
    }
  }
  strcat(left, right);
}


x86 assembly (clang, -O0):
<rtl_catPathNames>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1197 <rtl_catPathNames+0x77>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     1192 <rtl_catPathNames+0x72>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
je     1192 <rtl_catPathNames+0x72>
mov    -0x18(%rbp),%rax
movb   $0x2f,0x1(%rax)
mov    -0x18(%rbp),%rax
movb   $0x0,0x2(%rax)
jmp    1197 <rtl_catPathNames+0x77>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcat@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtl_catPathNames>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
je     114d <rtl_catPathNames+0x2d>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
mov    -0x1(%rbx,%rax,1),%cl
cmp    $0x2f,%cl
je     114d <rtl_catPathNames+0x2d>
cmp    $0x5c,%cl
je     114d <rtl_catPathNames+0x2d>
movw   $0x2f,(%rbx,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <strcat@plt>

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

LLVM IR (-O2):
define void @rtl_catPathNames(i8* %0, i8* %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2
%6 = tail call i32 @strlen(i8* %0)
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = getelementptr inbounds i8, i8* %8, i64 -1
%10 = load i8, i8* %9
switch i8 %10, label %11 [
i8 47, label %14
i8 92, label %14
]
11: ; preds = %5
%12 = getelementptr inbounds i8, i8* %9, i64 1
store i8 47, i8* %12
%13 = getelementptr inbounds i8, i8* %9, i64 2
store i8 0, i8* %13
br label %14
14: ; preds = %5, %5, %11, %2
%15 = tail call i32 @strcat(i8* %0, i8* %1)
ret void
}