#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 *bgbdt_mm_rstrdup(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *BS2J2C_CNameMangle(char *pfx, char *cn) {
  char tb[256];
  char *s, *t;
  int i, j, k;
  s = cn;
  t = tb;
  if (pfx) {
    strcpy(t, pfx);
    t = t + strlen(t);
  } else {
    if ((*s >= '0') && (*s <= '9'))
      *t++ = '_';
  }
  while (*s) {
    if ((*s >= '0') && (*s <= '9')) {
      *t++ = *s++;
      continue;
    }
    if ((*s >= 'A') && (*s <= 'Z')) {
      *t++ = *s++;
      continue;
    }
    if ((*s >= 'a') && (*s <= 'z')) {
      *t++ = *s++;
      continue;
    }
    if (*s == '_') {
      s++;
      *t++ = '_';
      *t++ = '1';
      continue;
    }
    if (*s == ';') {
      s++;
      *t++ = '_';
      *t++ = '2';
      continue;
    }
    if (*s == '[') {
      s++;
      *t++ = '_';
      *t++ = '3';
      continue;
    }
    if (*s == '(') {
      s++;
      *t++ = '_';
      *t++ = '4';
      continue;
    }
    if (*s == ')') {
      s++;
      *t++ = '_';
      *t++ = '5';
      continue;
    }
    if (*s == '/') {
      s++;
      *t++ = '_';
      *t++ = '6';
      continue;
    }
    i = *s++;
    if ((i >= 0x00) && (i <= 0xFF)) {
      sprintf(t, "_9%02X", i);
      t += strlen(t);
      continue;
    }
    sprintf(t, "_0%04X", i);
    t += strlen(t);
    continue;
  }
  *t++ = 0;
  return (bgbdt_mm_rstrdup(tb));
}


x86 assembly (clang, -O0):
<BS2J2C_CNameMangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x118(%rbp)
lea    -0x110(%rbp),%rax
mov    %rax,-0x120(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11bc <BS2J2C_CNameMangle+0x7c>
mov    -0x120(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x120(%rbp),%rax
mov    %rax,-0x138(%rbp)
mov    -0x120(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x138(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x120(%rbp)
jmp    11ff <BS2J2C_CNameMangle+0xbf>
mov    -0x118(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     11fa <BS2J2C_CNameMangle+0xba>
mov    -0x118(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jg     11fa <BS2J2C_CNameMangle+0xba>
mov    -0x120(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x120(%rbp)
movb   $0x5f,(%rax)
jmp    11ff <BS2J2C_CNameMangle+0xbf>
jmp    1204 <BS2J2C_CNameMangle+0xc4>
mov    -0x118(%rbp),%rax
cmpb   $0x0,(%rax)
je     15f6 <BS2J2C_CNameMangle+0x4b6>
mov    -0x118(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     126d <BS2J2C_CNameMangle+0x12d>
mov    -0x118(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jg     126d <BS2J2C_CNameMangle+0x12d>
mov    -0x118(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x118(%rbp)
mov    (%rax),%cl
mov    -0x120(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x120(%rbp)
mov    %cl,(%rax)
jmp    1204 <BS2J2C_CNameMangle+0xc4>
mov    -0x118(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jl     12c6 <BS2J2C_CNameMangle+0x186>
mov    -0x118(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
jg     12c6 <BS2J2C_CNameMangle+0x186>
mov    -0x118(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x118(%rbp)
mov    (%rax),%cl
mov    -0x120(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x120(%rbp)
mov    %cl,(%rax)
jmp    1204 <BS2J2C_CNameMangle+0xc4>
mov    -0x118(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jl     131f <BS2J2C_CNameMangle+0x1df>
mov    -0x118(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7a,%eax
jg     131f <BS2J2C_CNameMangle+0x1df>
mov    -0x118(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x118(%rbp)
mov    (%rax),%cl
mov    -0x120(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x120(%rbp)
mov    %cl,(%rax)
jmp    1204 <BS2J2C_CNameMangle+0xc4>
mov    -0x118(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
jne    1379 <BS2J2C_CNameMangle+0x239>
mov    -0x118(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x118(%rbp)
mov    -0x120(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x120(%rbp)
movb   $0x5f,(%rax)
mov    -0x120(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x120(%rbp)
movb   $0x31,(%rax)
jmp    1204 <BS2J2C_CNameMangle+0xc4>
mov    -0x118(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3b,%eax
jne    13d3 <BS2J2C_CNameMangle+0x293>
mov    -0x118(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x118(%rbp)
mov    -0x120(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x120(%rbp)
movb   $0x5f,(%rax)
mov    -0x120(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x120(%rbp)
movb   $0x32,(%rax)
jmp    1204 <BS2J2C_CNameMangle+0xc4>
mov    -0x118(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5b,%eax
jne    142d <BS2J2C_CNameMangle+0x2ed>
mov    -0x118(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x118(%rbp)
mov    -0x120(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x120(%rbp)
movb   $0x5f,(%rax)
mov    -0x120(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x120(%rbp)
movb   $0x33,(%rax)
jmp    1204 <BS2J2C_CNameMangle+0xc4>
mov    -0x118(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x28,%eax
jne    1487 <BS2J2C_CNameMangle+0x347>
mov    -0x118(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x118(%rbp)
mov    -0x120(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x120(%rbp)
movb   $0x5f,(%rax)
mov    -0x120(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x120(%rbp)
movb   $0x34,(%rax)
jmp    1204 <BS2J2C_CNameMangle+0xc4>
mov    -0x118(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x29,%eax
jne    14e1 <BS2J2C_CNameMangle+0x3a1>
mov    -0x118(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x118(%rbp)
mov    -0x120(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x120(%rbp)
movb   $0x5f,(%rax)
mov    -0x120(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x120(%rbp)
movb   $0x35,(%rax)
jmp    1204 <BS2J2C_CNameMangle+0xc4>
mov    -0x118(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    153b <BS2J2C_CNameMangle+0x3fb>
mov    -0x118(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x118(%rbp)
mov    -0x120(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x120(%rbp)
movb   $0x5f,(%rax)
mov    -0x120(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x120(%rbp)
movb   $0x36,(%rax)
jmp    1204 <BS2J2C_CNameMangle+0xc4>
mov    -0x118(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x118(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x124(%rbp)
cmpl   $0x0,-0x124(%rbp)
jl     15b6 <BS2J2C_CNameMangle+0x476>
cmpl   $0xff,-0x124(%rbp)
jg     15b6 <BS2J2C_CNameMangle+0x476>
mov    -0x120(%rbp),%rdi
mov    -0x124(%rbp),%edx
lea    0xa76(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x120(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x120(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x120(%rbp)
jmp    1204 <BS2J2C_CNameMangle+0xc4>
mov    -0x120(%rbp),%rdi
mov    -0x124(%rbp),%edx
lea    0xa3d(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x120(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x120(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x120(%rbp)
jmp    1204 <BS2J2C_CNameMangle+0xc4>
mov    -0x120(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x120(%rbp)
movb   $0x0,(%rax)
lea    -0x110(%rbp),%rdi
call   1050 <bgbdt_mm_rstrdup@plt>
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BS2J2C_CNameMangle>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x100,%rsp
mov    %rsi,%rbx
test   %rdi,%rdi
je     117f <BS2J2C_CNameMangle+0x3f>
mov    %rdi,%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%r14
mov    (%rbx),%al
test   %al,%al
jne    119f <BS2J2C_CNameMangle+0x5f>
jmp    127a <BS2J2C_CNameMangle+0x13a>
mov    (%rbx),%al
lea    -0x30(%rax),%ecx
cmp    $0x9,%cl
ja     1194 <BS2J2C_CNameMangle+0x54>
lea    0x1(%rsp),%r14
movb   $0x5f,(%rsp)
jmp    119f <BS2J2C_CNameMangle+0x5f>
mov    %rsp,%r14
test   %al,%al
je     127a <BS2J2C_CNameMangle+0x13a>
add    $0x1,%rbx
lea    0xf36(%rip),%r15
lea    0xf36(%rip),%r12
lea    0xe48(%rip),%r13
jmp    11d6 <BS2J2C_CNameMangle+0x96>
nopw   0x0(%rax,%rax,1)
mov    %al,(%r14)
add    $0x1,%r14
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     127a <BS2J2C_CNameMangle+0x13a>
lea    -0x30(%rax),%ecx
cmp    $0x9,%cl
jbe    11c0 <BS2J2C_CNameMangle+0x80>
lea    -0x41(%rax),%ecx
cmp    $0x19,%cl
jbe    11c0 <BS2J2C_CNameMangle+0x80>
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
jbe    11c0 <BS2J2C_CNameMangle+0x80>
lea    -0x28(%rax),%ecx
cmp    $0x37,%cl
ja     121b <BS2J2C_CNameMangle+0xdb>
movzbl %cl,%ecx
movslq 0x0(%r13,%rcx,4),%rcx
add    %r13,%rcx
jmp    *%rcx
movw   $0x345f,(%r14)
add    $0x2,%r14
jmp    11c7 <BS2J2C_CNameMangle+0x87>
movw   $0x355f,(%r14)
add    $0x2,%r14
jmp    11c7 <BS2J2C_CNameMangle+0x87>
movsbl %al,%edx
mov    %r14,%rdi
test   %al,%al
js     1260 <BS2J2C_CNameMangle+0x120>
mov    %r15,%rsi
jmp    1263 <BS2J2C_CNameMangle+0x123>
movw   $0x365f,(%r14)
add    $0x2,%r14
jmp    11c7 <BS2J2C_CNameMangle+0x87>
movw   $0x325f,(%r14)
add    $0x2,%r14
jmp    11c7 <BS2J2C_CNameMangle+0x87>
movw   $0x335f,(%r14)
add    $0x2,%r14
jmp    11c7 <BS2J2C_CNameMangle+0x87>
movw   $0x315f,(%r14)
add    $0x2,%r14
jmp    11c7 <BS2J2C_CNameMangle+0x87>
mov    %r12,%rsi
call   1060 <sprintf@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
add    %rax,%r14
jmp    11c7 <BS2J2C_CNameMangle+0x87>
movb   $0x0,(%r14)
mov    %rsp,%rdi
call   1050 <bgbdt_mm_rstrdup@plt>
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"_9%02X\00"
@.str.1 = [7 x i8] c"_0%04X\00"
define i8* @BS2J2C_CNameMangle(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [256 x i8]
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%11 = load i8*, i8** %4
store i8* %11, i8** %6
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
store i8* %12, i8** %7
%13 = load i8*, i8** %3
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %24
15: ; preds = %2
%16 = load i8*, i8** %7
%17 = load i8*, i8** %3
%18 = call i32 @strcpy(i8* %16, i8* %17)
%19 = load i8*, i8** %7
%20 = load i8*, i8** %7
%21 = call i32 @strlen(i8* %20)
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %19, i64 %22
store i8* %23, i8** %7
br label %38
24: ; preds = %2
%25 = load i8*, i8** %6
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp sge i32 %27, 48
br i1 %28, label %29, label %37
29: ; preds = %24
%30 = load i8*, i8** %6
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp sle i32 %32, 57
br i1 %33, label %34, label %37
34: ; preds = %29
%35 = load i8*, i8** %7
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %7
store i8 95, i8* %35
br label %37
37: ; preds = %34, %29, %24
br label %38
38: ; preds = %37, %15
br label %39
39: ; preds = %182, %173, %156, %144, %132, %120, %108, %96, %85, %69, %53, %38
%40 = load i8*, i8** %6
%41 = load i8, i8* %40
%42 = icmp ne i8 %41, 0
br i1 %42, label %43, label %191
43: ; preds = %39
%44 = load i8*, i8** %6
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = icmp sge i32 %46, 48
br i1 %47, label %48, label %59
48: ; preds = %43
%49 = load i8*, i8** %6
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = icmp sle i32 %51, 57
br i1 %52, label %53, label %59
53: ; preds = %48
%54 = load i8*, i8** %6
%55 = getelementptr inbounds i8, i8* %54, i32 1
store i8* %55, i8** %6
%56 = load i8, i8* %54
%57 = load i8*, i8** %7
%58 = getelementptr inbounds i8, i8* %57, i32 1
store i8* %58, i8** %7
store i8 %56, i8* %57
br label %39
59: ; preds = %48, %43
%60 = load i8*, i8** %6
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = icmp sge i32 %62, 65
br i1 %63, label %64, label %75
64: ; preds = %59
%65 = load i8*, i8** %6
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
%68 = icmp sle i32 %67, 90
br i1 %68, label %69, label %75
69: ; preds = %64
%70 = load i8*, i8** %6
%71 = getelementptr inbounds i8, i8* %70, i32 1
store i8* %71, i8** %6
%72 = load i8, i8* %70
%73 = load i8*, i8** %7
%74 = getelementptr inbounds i8, i8* %73, i32 1
store i8* %74, i8** %7
store i8 %72, i8* %73
br label %39
75: ; preds = %64, %59
%76 = load i8*, i8** %6
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
%79 = icmp sge i32 %78, 97
br i1 %79, label %80, label %91
80: ; preds = %75
%81 = load i8*, i8** %6
%82 = load i8, i8* %81
%83 = sext i8 %82 to i32
%84 = icmp sle i32 %83, 122
br i1 %84, label %85, label %91
85: ; preds = %80
%86 = load i8*, i8** %6
%87 = getelementptr inbounds i8, i8* %86, i32 1
store i8* %87, i8** %6
%88 = load i8, i8* %86
%89 = load i8*, i8** %7
%90 = getelementptr inbounds i8, i8* %89, i32 1
store i8* %90, i8** %7
store i8 %88, i8* %89
br label %39
91: ; preds = %80, %75
%92 = load i8*, i8** %6
%93 = load i8, i8* %92
%94 = sext i8 %93 to i32
%95 = icmp eq i32 %94, 95
br i1 %95, label %96, label %103
96: ; preds = %91
%97 = load i8*, i8** %6
%98 = getelementptr inbounds i8, i8* %97, i32 1
store i8* %98, i8** %6
%99 = load i8*, i8** %7
%100 = getelementptr inbounds i8, i8* %99, i32 1
store i8* %100, i8** %7
store i8 95, i8* %99
%101 = load i8*, i8** %7
%102 = getelementptr inbounds i8, i8* %101, i32 1
store i8* %102, i8** %7
store i8 49, i8* %101
br label %39
103: ; preds = %91
%104 = load i8*, i8** %6
%105 = load i8, i8* %104
%106 = sext i8 %105 to i32
%107 = icmp eq i32 %106, 59
br i1 %107, label %108, label %115
108: ; preds = %103
%109 = load i8*, i8** %6
%110 = getelementptr inbounds i8, i8* %109, i32 1
store i8* %110, i8** %6
%111 = load i8*, i8** %7
%112 = getelementptr inbounds i8, i8* %111, i32 1
store i8* %112, i8** %7
store i8 95, i8* %111
%113 = load i8*, i8** %7
%114 = getelementptr inbounds i8, i8* %113, i32 1
store i8* %114, i8** %7
store i8 50, i8* %113
br label %39
115: ; preds = %103
%116 = load i8*, i8** %6
%117 = load i8, i8* %116
%118 = sext i8 %117 to i32
%119 = icmp eq i32 %118, 91
br i1 %119, label %120, label %127
120: ; preds = %115
%121 = load i8*, i8** %6
%122 = getelementptr inbounds i8, i8* %121, i32 1
store i8* %122, i8** %6
%123 = load i8*, i8** %7
%124 = getelementptr inbounds i8, i8* %123, i32 1
store i8* %124, i8** %7
store i8 95, i8* %123
%125 = load i8*, i8** %7
%126 = getelementptr inbounds i8, i8* %125, i32 1
store i8* %126, i8** %7
store i8 51, i8* %125
br label %39
127: ; preds = %115
%128 = load i8*, i8** %6
%129 = load i8, i8* %128
%130 = sext i8 %129 to i32
%131 = icmp eq i32 %130, 40
br i1 %131, label %132, label %139
132: ; preds = %127
%133 = load i8*, i8** %6
%134 = getelementptr inbounds i8, i8* %133, i32 1
store i8* %134, i8** %6
%135 = load i8*, i8** %7
%136 = getelementptr inbounds i8, i8* %135, i32 1
store i8* %136, i8** %7
store i8 95, i8* %135
%137 = load i8*, i8** %7
%138 = getelementptr inbounds i8, i8* %137, i32 1
store i8* %138, i8** %7
store i8 52, i8* %137
br label %39
139: ; preds = %127
%140 = load i8*, i8** %6
%141 = load i8, i8* %140
%142 = sext i8 %141 to i32
%143 = icmp eq i32 %142, 41
br i1 %143, label %144, label %151
144: ; preds = %139
%145 = load i8*, i8** %6
%146 = getelementptr inbounds i8, i8* %145, i32 1
store i8* %146, i8** %6
%147 = load i8*, i8** %7
%148 = getelementptr inbounds i8, i8* %147, i32 1
store i8* %148, i8** %7
store i8 95, i8* %147
%149 = load i8*, i8** %7
%150 = getelementptr inbounds i8, i8* %149, i32 1
store i8* %150, i8** %7
store i8 53, i8* %149
br label %39
151: ; preds = %139
%152 = load i8*, i8** %6
%153 = load i8, i8* %152
%154 = sext i8 %153 to i32
%155 = icmp eq i32 %154, 47
br i1 %155, label %156, label %163
156: ; preds = %151
%157 = load i8*, i8** %6
%158 = getelementptr inbounds i8, i8* %157, i32 1
store i8* %158, i8** %6
%159 = load i8*, i8** %7
%160 = getelementptr inbounds i8, i8* %159, i32 1
store i8* %160, i8** %7
store i8 95, i8* %159
%161 = load i8*, i8** %7
%162 = getelementptr inbounds i8, i8* %161, i32 1
store i8* %162, i8** %7
store i8 54, i8* %161
br label %39
163: ; preds = %151
%164 = load i8*, i8** %6
%165 = getelementptr inbounds i8, i8* %164, i32 1
store i8* %165, i8** %6
%166 = load i8, i8* %164
%167 = sext i8 %166 to i32
store i32 %167, i32* %8
%168 = load i32, i32* %8
%169 = icmp sge i32 %168, 0
br i1 %169, label %170, label %182
170: ; preds = %163
%171 = load i32, i32* %8
%172 = icmp sle i32 %171, 255
br i1 %172, label %173, label %182
173: ; preds = %170
%174 = load i8*, i8** %7
%175 = load i32, i32* %8
%176 = call i32 @sprintf(i8* %174, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %175)
%177 = load i8*, i8** %7
%178 = call i32 @strlen(i8* %177)
%179 = load i8*, i8** %7
%180 = sext i32 %178 to i64
%181 = getelementptr inbounds i8, i8* %179, i64 %180
store i8* %181, i8** %7
br label %39
182: ; preds = %170, %163
%183 = load i8*, i8** %7
%184 = load i32, i32* %8
%185 = call i32 @sprintf(i8* %183, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %184)
%186 = load i8*, i8** %7
%187 = call i32 @strlen(i8* %186)
%188 = load i8*, i8** %7
%189 = sext i32 %187 to i64
%190 = getelementptr inbounds i8, i8* %188, i64 %189
store i8* %190, i8** %7
br label %39
191: ; preds = %39
%192 = load i8*, i8** %7
%193 = getelementptr inbounds i8, i8* %192, i32 1
store i8* %193, i8** %7
store i8 0, i8* %192
%194 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%195 = call i8* @bgbdt_mm_rstrdup(i8* %194)
ret i8* %195
}

LLVM IR (-O2):
@.str = [7 x i8] c"_9%02X\00"
@.str.1 = [7 x i8] c"_0%04X\00"
define i8* @BS2J2C_CNameMangle(i8* %0, i8* nocapture %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = icmp eq i8* %0, null
br i1 %5, label %12, label %6
6: ; preds = %2
%7 = call i32 @strcpy(i8* %4, i8* %0)
%8 = call i32 @strlen(i8* %4)
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %9
%11 = load i8, i8* %1
br label %18
12: ; preds = %2
%13 = load i8, i8* %1
%14 = add i8 %13, -48
%15 = icmp ult i8 %14, 10
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 1
store i8 95, i8* %4
br label %22
18: ; preds = %12, %6
%19 = phi i8 [ %11, %6 ], [ %13, %12 ]
%20 = phi i8* [ %10, %6 ], [ %4, %12 ]
%21 = icmp eq i8 %19, 0
br i1 %21, label %80, label %22
22: ; preds = %16, %18
%23 = phi i8 [ %19, %18 ], [ %13, %16 ]
%24 = phi i8* [ %20, %18 ], [ %17, %16 ]
br label %25
25: ; preds = %22, %33
%26 = phi i8 [ %36, %33 ], [ %23, %22 ]
%27 = phi i8* [ %35, %33 ], [ %1, %22 ]
%28 = phi i8* [ %34, %33 ], [ %24, %22 ]
%29 = add i8 %26, -48
%30 = icmp ult i8 %29, 10
br i1 %30, label %31, label %38
31: ; preds = %25
%32 = getelementptr inbounds i8, i8* %28, i64 1
store i8 %26, i8* %28
br label %33
33: ; preds = %31, %41, %46, %50, %53, %56, %59, %62, %65, %70, %75
%34 = phi i8* [ %32, %31 ], [ %42, %41 ], [ %47, %46 ], [ %52, %50 ], [ %55, %53 ], [ %58, %56 ], [ %61, %59 ], [ %64, %62 ], [ %67, %65 ], [ %74, %70 ], [ %79, %75 ]
%35 = getelementptr inbounds i8, i8* %27, i64 1
%36 = load i8, i8* %35
%37 = icmp eq i8 %36, 0
br i1 %37, label %80, label %25
38: ; preds = %25
%39 = add i8 %26, -65
%40 = icmp ult i8 %39, 26
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = getelementptr inbounds i8, i8* %28, i64 1
store i8 %26, i8* %28
br label %33
43: ; preds = %38
%44 = add i8 %26, -97
%45 = icmp ult i8 %44, 26
br i1 %45, label %46, label %48
46: ; preds = %43
%47 = getelementptr inbounds i8, i8* %28, i64 1
store i8 %26, i8* %28
br label %33
48: ; preds = %43
%49 = sext i8 %26 to i32
switch i8 %26, label %68 [
i8 95, label %50
i8 59, label %53
i8 91, label %56
i8 40, label %59
i8 41, label %62
i8 47, label %65
]
50: ; preds = %48
%51 = getelementptr inbounds i8, i8* %28, i64 1
store i8 95, i8* %28
%52 = getelementptr inbounds i8, i8* %28, i64 2
store i8 49, i8* %51
br label %33
53: ; preds = %48
%54 = getelementptr inbounds i8, i8* %28, i64 1
store i8 95, i8* %28
%55 = getelementptr inbounds i8, i8* %28, i64 2
store i8 50, i8* %54
br label %33
56: ; preds = %48
%57 = getelementptr inbounds i8, i8* %28, i64 1
store i8 95, i8* %28
%58 = getelementptr inbounds i8, i8* %28, i64 2
store i8 51, i8* %57
br label %33
59: ; preds = %48
%60 = getelementptr inbounds i8, i8* %28, i64 1
store i8 95, i8* %28
%61 = getelementptr inbounds i8, i8* %28, i64 2
store i8 52, i8* %60
br label %33
62: ; preds = %48
%63 = getelementptr inbounds i8, i8* %28, i64 1
store i8 95, i8* %28
%64 = getelementptr inbounds i8, i8* %28, i64 2
store i8 53, i8* %63
br label %33
65: ; preds = %48
%66 = getelementptr inbounds i8, i8* %28, i64 1
store i8 95, i8* %28
%67 = getelementptr inbounds i8, i8* %28, i64 2
store i8 54, i8* %66
br label %33
68: ; preds = %48
%69 = icmp sgt i8 %26, -1
br i1 %69, label %70, label %75
70: ; preds = %68
%71 = call i32 @sprintf(i8* dereferenceable(1) %28, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %49)
%72 = call i32 @strlen(i8* %28)
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i8, i8* %28, i64 %73
br label %33
75: ; preds = %68
%76 = call i32 @sprintf(i8* dereferenceable(1) %28, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %49)
%77 = call i32 @strlen(i8* %28)
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8, i8* %28, i64 %78
br label %33
80: ; preds = %33, %18
%81 = phi i8* [ %20, %18 ], [ %34, %33 ]
store i8 0, i8* %81
%82 = call i8* @bgbdt_mm_rstrdup(i8* %4)
ret i8* %82
}