#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 *malloc(int);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *RB_Function_Name(char *header_name) {
  char *cur_char;
  char c;
  char *name;
  name = NULL;
  if ((cur_char = header_name) != NULL) {
    for (; (c = *cur_char) != '\0'; ++cur_char) {
      if ('/' == *cur_char) {
        ++cur_char;
        if (*cur_char)
          name = cur_char;
      }
    }
  }
  if (name) {
    char *temp;
    temp = malloc((strlen(name) + 1) * sizeof(char));
    strcpy(temp, name);
    return temp;
  } else {
    return (name);
  }
}


x86 assembly (clang, -O0):
<RB_Function_Name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     11c5 <RB_Function_Name+0x95>
jmp    115b <RB_Function_Name+0x2b>
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     11c0 <RB_Function_Name+0x90>
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x2f,%eax
cmp    %ecx,%eax
jne    11aa <RB_Function_Name+0x7a>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     11a5 <RB_Function_Name+0x75>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    11aa <RB_Function_Name+0x7a>
jmp    11af <RB_Function_Name+0x7f>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    115b <RB_Function_Name+0x2b>
jmp    11c5 <RB_Function_Name+0x95>
cmpq   $0x0,-0x28(%rbp)
je     1207 <RB_Function_Name+0xd7>
mov    -0x28(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    120f <RB_Function_Name+0xdf>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RB_Function_Name>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     1180 <RB_Function_Name+0x50>
xor    %ebx,%ebx
jmp    1150 <RB_Function_Name+0x20>
nopl   (%rax)
cmpb   $0x0,0x1(%rdi)
lea    0x1(%rdi),%rdi
cmovne %rdi,%rbx
add    $0x1,%rdi
movzbl (%rdi),%eax
cmp    $0x2f,%al
je     1140 <RB_Function_Name+0x10>
test   %al,%al
jne    114c <RB_Function_Name+0x1c>
test   %rbx,%rbx
je     1180 <RB_Function_Name+0x50>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
jmp    1183 <RB_Function_Name+0x53>
xor    %r14d,%r14d
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @RB_Function_Name(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %23, label %3
3: ; preds = %1, %12
%4 = phi i8* [ %15, %12 ], [ %0, %1 ]
%5 = phi i8* [ %14, %12 ], [ null, %1 ]
%6 = load i8, i8* %4
switch i8 %6, label %12 [
i8 0, label %16
i8 47, label %7
]
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %4, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
%11 = select i1 %10, i8* %5, i8* %8
br label %12
12: ; preds = %7, %3
%13 = phi i8* [ %4, %3 ], [ %8, %7 ]
%14 = phi i8* [ %5, %3 ], [ %11, %7 ]
%15 = getelementptr inbounds i8, i8* %13, i64 1
br label %3
16: ; preds = %3
%17 = icmp eq i8* %5, null
br i1 %17, label %23, label %18
18: ; preds = %16
%19 = tail call i32 @strlen(i8* %5)
%20 = add nsw i32 %19, 1
%21 = tail call i8* @malloc(i32 %20)
%22 = tail call i32 @strcpy(i8* %21, i8* %5)
br label %23
23: ; preds = %1, %16, %18
%24 = phi i8* [ %21, %18 ], [ null, %16 ], [ null, %1 ]
ret i8* %24
}