#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 *);
void _realize_name(char *target, const char *prefix, const char *srcname) {
  if (srcname[0] == '$' && srcname[1] != '$' &&
      !('0' <= srcname[1] && srcname[1] <= '9')) {
    strcpy(target, &srcname[1]);
  } else {
    strcpy(target, prefix);
    strcat(target, srcname);
  }
}


x86 assembly (clang, -O0):
<_realize_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x24,%eax
jne    1191 <_realize_name+0x71>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x24,%eax
je     1191 <_realize_name+0x71>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%ecx
mov    $0x30,%eax
cmp    %ecx,%eax
jg     117b <_realize_name+0x5b>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x39,%eax
jle    1191 <_realize_name+0x71>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
call   1030 <strcpy@plt>
jmp    11ab <_realize_name+0x8b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcat@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_realize_name>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rdi,%r14
cmpb   $0x24,(%rdx)
jne    1152 <_realize_name+0x32>
mov    0x1(%rbx),%al
cmp    $0x24,%al
je     1152 <_realize_name+0x32>
add    $0xd0,%al
cmp    $0xa,%al
jb     1152 <_realize_name+0x32>
add    $0x1,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <strcpy@plt>
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <strcat@plt>

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

LLVM IR (-O2):
define void @_realize_name(i8* %0, i8* %1, i8* %2) {
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 36
br i1 %5, label %6, label %15
6: ; preds = %3
%7 = getelementptr inbounds i8, i8* %2, i64 1
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 36
%10 = add i8 %8, -48
%11 = icmp ult i8 %10, 10
%12 = or i1 %9, %11
br i1 %12, label %15, label %13
13: ; preds = %6
%14 = tail call i32 @strcpy(i8* %0, i8* %7)
br label %18
15: ; preds = %6, %3
%16 = tail call i32 @strcpy(i8* %0, i8* %1)
%17 = tail call i32 @strcat(i8* %0, i8* %2)
br label %18
18: ; preds = %15, %13
ret void
}