#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 */
char *strrchr(char *, char);
char *nopath(char *full_filename) {
  char *p;
  if ((p = strrchr(full_filename, '/')) != NULL)
    return p + 1;
  if ((p = strrchr(full_filename, ']')) != NULL)
    return p + 1;
  if ((p = strrchr(full_filename, ':')) != NULL)
    return p + 1;
  if ((p = strrchr(full_filename, '\\')) != NULL)
    return p + 1;
  return full_filename;
}


x86 assembly (clang, -O0):
<nopath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1149 <nopath+0x39>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    11d8 <nopath+0xc8>
mov    -0x10(%rbp),%rdi
mov    $0x5d,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1176 <nopath+0x66>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    11d8 <nopath+0xc8>
mov    -0x10(%rbp),%rdi
mov    $0x3a,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     11a3 <nopath+0x93>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    11d8 <nopath+0xc8>
mov    -0x10(%rbp),%rdi
mov    $0x5c,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     11d0 <nopath+0xc0>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    11d8 <nopath+0xc8>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nopath>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
jne    1147 <nopath+0x37>
mov    %rbx,%rdi
mov    $0x5d,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
jne    1147 <nopath+0x37>
mov    %rbx,%rdi
mov    $0x3a,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     114d <nopath+0x3d>
add    $0x1,%rax
pop    %rbx
ret
mov    %rbx,%rdi
mov    $0x5c,%esi
call   1030 <strrchr@plt>
mov    %rax,%rcx
add    $0x1,%rax
test   %rcx,%rcx
cmove  %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @nopath(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %2, i64 1
br label %21
6: ; preds = %1
%7 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 93)
%8 = icmp eq i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = getelementptr inbounds i8, i8* %7, i64 1
br label %21
11: ; preds = %6
%12 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 58)
%13 = icmp eq i8* %12, null
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = getelementptr inbounds i8, i8* %12, i64 1
br label %21
16: ; preds = %11
%17 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 92)
%18 = icmp eq i8* %17, null
%19 = getelementptr inbounds i8, i8* %17, i64 1
%20 = select i1 %18, i8* %0, i8* %19
br label %21
21: ; preds = %16, %14, %9, %4
%22 = phi i8* [ %5, %4 ], [ %10, %9 ], [ %15, %14 ], [ %20, %16 ]
ret i8* %22
}