char *cleanup_base_class_name(name)
char *name;
{
  unsigned long i = 0;
  for (; '[' == name[i]; i++) {
  }
  if (0 != i) {
    if ('L' == name[i]) {
      strcpy(name, name + i + 1);
      name[strlen(name) - 1] = '\0';
    }
  }
  return (name);
}


x86 assembly (clang, -O0):
<cleanup_base_class_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x5b,%eax
cmp    %ecx,%eax
jne    1163 <cleanup_base_class_name+0x43>
jmp    1152 <cleanup_base_class_name+0x32>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1134 <cleanup_base_class_name+0x14>
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
je     11c2 <cleanup_base_class_name+0xa2>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x4c,%eax
cmp    %ecx,%eax
jne    11bd <cleanup_base_class_name+0x9d>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    -0x10(%rbp),%rsi
add    $0x1,%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    11c2 <cleanup_base_class_name+0xa2>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cleanup_base_class_name>:
push   %rbx
mov    %rdi,%rbx
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
movzbl (%rbx,%rsi,1),%eax
add    $0x1,%rsi
cmp    $0x5b,%al
je     1130 <cleanup_base_class_name+0x10>
cmp    $0x1,%rsi
je     115e <cleanup_base_class_name+0x3e>
cmp    $0x4c,%al
jne    115e <cleanup_base_class_name+0x3e>
add    %rbx,%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @cleanup_base_class_name(i8* returned %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %7, %2 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 91
%7 = add i64 %3, 1
br i1 %6, label %2, label %8
8: ; preds = %2
%9 = icmp ne i64 %3, 0
%10 = icmp eq i8 %5, 76
%11 = select i1 %9, i1 %10, i1 false
br i1 %11, label %12, label %19
12: ; preds = %8
%13 = getelementptr inbounds i8, i8* %0, i64 %3
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = tail call i8* @strcpy(i8* dereferenceable(1) %0, i8* %14)
%16 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%17 = add i64 %16, -1
%18 = getelementptr inbounds i8, i8* %0, i64 %17
store i8 0, i8* %18
br label %19
19: ; preds = %12, %8
ret i8* %0
}