#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 const *);
char *strrchr(char const *, char);
char *getLastName(char *aoDestination, char const *aSource) {
  char const *lTmp;
  if (aSource) {
    lTmp = strrchr(aSource, '/');
    if (!lTmp) {
      lTmp = strrchr(aSource, '\\');
    }
    if (lTmp) {
      strcpy(aoDestination, lTmp + 1);
    } else {
      strcpy(aoDestination, aSource);
    }
  } else {
    *aoDestination = '\0';
  }
  return aoDestination;
}


x86 assembly (clang, -O0):
<getLastName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     119d <getLastName+0x7d>
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1040 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    116a <getLastName+0x4a>
mov    -0x10(%rbp),%rdi
mov    $0x5c,%esi
call   1040 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     118b <getLastName+0x6b>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
call   1030 <strcpy@plt>
jmp    1198 <getLastName+0x78>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    11a4 <getLastName+0x84>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getLastName>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
test   %rsi,%rsi
je     1164 <getLastName+0x44>
mov    %rsi,%rbx
mov    %rsi,%rdi
mov    $0x2f,%esi
call   1040 <strrchr@plt>
test   %rax,%rax
jne    1153 <getLastName+0x33>
mov    %rbx,%rdi
mov    $0x5c,%esi
call   1040 <strrchr@plt>
test   %rax,%rax
je     1173 <getLastName+0x53>
add    $0x1,%rax
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
jmp    1168 <getLastName+0x48>
movb   $0x0,(%r14)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %r14,%rdi
mov    %rbx,%rsi
jmp    115d <getLastName+0x3d>

LLVM IR (-O0):
define i8* @getLastName(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** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %29
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = call i8* @strrchr(i8* %9, i8 signext 47)
store i8* %10, i8** %5
%11 = load i8*, i8** %5
%12 = icmp ne i8* %11, null
br i1 %12, label %16, label %13
13: ; preds = %8
%14 = load i8*, i8** %4
%15 = call i8* @strrchr(i8* %14, i8 signext 92)
store i8* %15, i8** %5
br label %16
16: ; preds = %13, %8
%17 = load i8*, i8** %5
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = load i8*, i8** %3
%21 = load i8*, i8** %5
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = call i32 @strcpy(i8* %20, i8* %22)
br label %28
24: ; preds = %16
%25 = load i8*, i8** %3
%26 = load i8*, i8** %4
%27 = call i32 @strcpy(i8* %25, i8* %26)
br label %28
28: ; preds = %24, %19
br label %31
29: ; preds = %2
%30 = load i8*, i8** %3
store i8 0, i8* %30
br label %31
31: ; preds = %29, %28
%32 = load i8*, i8** %3
ret i8* %32
}

LLVM IR (-O2):
define i8* @getLastName(i8* returned %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %16, label %4
4: ; preds = %2
%5 = tail call i8* @strrchr(i8* %1, i8 signext 47)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = tail call i8* @strrchr(i8* %1, i8 signext 92)
%9 = icmp eq i8* %8, null
br i1 %9, label %14, label %10
10: ; preds = %4, %7
%11 = phi i8* [ %8, %7 ], [ %5, %4 ]
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = tail call i32 @strcpy(i8* %0, i8* %12)
br label %17
14: ; preds = %7
%15 = tail call i32 @strcpy(i8* %0, i8* %1)
br label %17
16: ; preds = %2
store i8 0, i8* %0
br label %17
17: ; preds = %10, %14, %16
ret i8* %0
}