#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 const *);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strncmp(char const *, char *, int);
void _unrealize_name(char *target, const char *srcname) {
  if (strncmp(srcname, "struct ", 7) == 0) {
    strcpy(target, &srcname[7]);
  } else if (strncmp(srcname, "union ", 6) == 0) {
    strcpy(target, &srcname[6]);
  } else if (strncmp(srcname, "enum ", 5) == 0) {
    strcpy(target, &srcname[5]);
  } else {
    strcpy(target, "$");
    strcat(target, srcname);
  }
}


x86 assembly (clang, -O0):
<_unrealize_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb5(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1175 <_unrealize_name+0x45>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x7,%rsi
call   1040 <strcpy@plt>
jmp    1206 <_unrealize_name+0xd6>
mov    -0x10(%rbp),%rdi
lea    0xe88(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11aa <_unrealize_name+0x7a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x6,%rsi
call   1040 <strcpy@plt>
jmp    1201 <_unrealize_name+0xd1>
mov    -0x10(%rbp),%rdi
lea    0xe5a(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11df <_unrealize_name+0xaf>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x5,%rsi
call   1040 <strcpy@plt>
jmp    11fc <_unrealize_name+0xcc>
mov    -0x8(%rbp),%rdi
lea    0xe2b(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strcat@plt>
jmp    1201 <_unrealize_name+0xd1>
jmp    1206 <_unrealize_name+0xd6>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_unrealize_name>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xebf(%rip),%rsi
mov    %rbx,%rdi
mov    $0x7,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11a6 <_unrealize_name+0x76>
lea    0xeae(%rip),%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11ac <_unrealize_name+0x7c>
lea    0xe9c(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11b2 <_unrealize_name+0x82>
lea    0xe89(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcpy@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <strcat@plt>
add    $0x7,%rbx
jmp    11b6 <_unrealize_name+0x86>
add    $0x6,%rbx
jmp    11b6 <_unrealize_name+0x86>
add    $0x5,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <strcpy@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"struct \00"
@.str.1 = [7 x i8] c"union \00"
@.str.2 = [6 x i8] c"enum \00"
@.str.3 = [2 x i8] c"$\00"
define void @_unrealize_name(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i64 @strncmp(i8* %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i64 7
%12 = call i32 @strcpy(i8* %9, i8* %11)
br label %39
13: ; preds = %2
%14 = load i8*, i8** %4
%15 = call i64 @strncmp(i8* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = load i8*, i8** %3
%19 = load i8*, i8** %4
%20 = getelementptr inbounds i8, i8* %19, i64 6
%21 = call i32 @strcpy(i8* %18, i8* %20)
br label %38
22: ; preds = %13
%23 = load i8*, i8** %4
%24 = call i64 @strncmp(i8* %23, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 5)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %31
26: ; preds = %22
%27 = load i8*, i8** %3
%28 = load i8*, i8** %4
%29 = getelementptr inbounds i8, i8* %28, i64 5
%30 = call i32 @strcpy(i8* %27, i8* %29)
br label %37
31: ; preds = %22
%32 = load i8*, i8** %3
%33 = call i32 @strcpy(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%34 = load i8*, i8** %3
%35 = load i8*, i8** %4
%36 = call i32 @strcat(i8* %34, i8* %35)
br label %37
37: ; preds = %31, %26
br label %38
38: ; preds = %37, %17
br label %39
39: ; preds = %38, %8
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"struct \00"
@.str.1 = [7 x i8] c"union \00"
@.str.2 = [6 x i8] c"enum \00"
@.str.3 = [2 x i8] c"$\00"
define void @_unrealize_name(i8* %0, i8* %1) {
%3 = tail call i64 @strncmp(i8* %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %1, i64 7
%7 = tail call i32 @strcpy(i8* %0, i8* %6)
br label %23
8: ; preds = %2
%9 = tail call i64 @strncmp(i8* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = getelementptr inbounds i8, i8* %1, i64 6
%13 = tail call i32 @strcpy(i8* %0, i8* %12)
br label %23
14: ; preds = %8
%15 = tail call i64 @strncmp(i8* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 5)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = getelementptr inbounds i8, i8* %1, i64 5
%19 = tail call i32 @strcpy(i8* %0, i8* %18)
br label %23
20: ; preds = %14
%21 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%22 = tail call i32 @strcat(i8* %0, i8* %1)
br label %23
23: ; preds = %11, %20, %17, %5
ret void
}