#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 */
unsigned int *append_to_unicode_string(unsigned int *, unsigned int *);
char *dotless_copy(char const *);
int /*<<< orphan*/ free(char *);
unsigned int *match_agl(char *);
unsigned int *match_u(char *);
unsigned int *match_uni(char *);
char *strchr(char *, char);
unsigned int *glyph_name_to_unicode(const char *name) {
  unsigned int *unicode_string;
  unicode_string = NULL;
  if (name != NULL) {
    char *dotless_name;
    char *p;
    char *q;
    dotless_name = dotless_copy(name);
    if (dotless_name != NULL) {
      p = dotless_name;
      while (p[0] != '\0') {
        q = strchr(p, '_');
        if (q != NULL) {
          unsigned int *uni;
          *q = '\0';
          uni = glyph_name_to_unicode(p);
          if (uni != NULL)
            unicode_string = append_to_unicode_string(unicode_string, uni);
          p = q + 1;
        } else {
          unsigned int *uni;
          uni = match_agl(p);
          if (uni == NULL)
            uni = match_uni(p);
          if (uni == NULL)
            uni = match_u(p);
          if (uni != NULL)
            unicode_string = append_to_unicode_string(unicode_string, uni);
          p = "";
        }
      }
      free(dotless_name);
    }
  }
  return unicode_string;
}


x86 assembly (clang, -O0):
<glyph_name_to_unicode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     12a4 <glyph_name_to_unicode+0x124>
mov    -0x8(%rbp),%rdi
call   1050 <dotless_copy@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     129f <glyph_name_to_unicode+0x11f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1296 <glyph_name_to_unicode+0x116>
mov    -0x20(%rbp),%rdi
mov    $0x5f,%esi
call   1040 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     122d <glyph_name_to_unicode+0xad>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rdi
call   1060 <glyph_name_to_unicode@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     121c <glyph_name_to_unicode+0x9c>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1090 <append_to_unicode_string@plt>
mov    %rax,-0x10(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1291 <glyph_name_to_unicode+0x111>
mov    -0x20(%rbp),%rdi
call   10a0 <match_agl@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1252 <glyph_name_to_unicode+0xd2>
mov    -0x20(%rbp),%rdi
call   1070 <match_uni@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    126a <glyph_name_to_unicode+0xea>
mov    -0x20(%rbp),%rdi
call   1080 <match_u@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     1286 <glyph_name_to_unicode+0x106>
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1090 <append_to_unicode_string@plt>
mov    %rax,-0x10(%rbp)
lea    0xd73(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11bf <glyph_name_to_unicode+0x3f>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
jmp    12a4 <glyph_name_to_unicode+0x124>
mov    -0x10(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glyph_name_to_unicode>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %rdi,%rdi
je     125e <glyph_name_to_unicode+0xde>
call   1050 <dotless_copy@plt>
test   %rax,%rax
je     125e <glyph_name_to_unicode+0xde>
mov    %rax,%r14
cmpb   $0x0,(%rax)
je     1263 <glyph_name_to_unicode+0xe3>
xor    %r15d,%r15d
lea    0xe4a(%rip),%r13
mov    %r14,%r12
jmp    11d2 <glyph_name_to_unicode+0x52>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
mov    %rbx,%r12
cmpb   $0x0,(%r12)
je     1266 <glyph_name_to_unicode+0xe6>
mov    %r12,%rdi
mov    $0x5f,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1210 <glyph_name_to_unicode+0x90>
mov    %rax,%rbx
movb   $0x0,(%rax)
mov    %r12,%rdi
call   1060 <glyph_name_to_unicode@plt>
test   %rax,%rax
je     11c0 <glyph_name_to_unicode+0x40>
mov    %r15,%rdi
mov    %rax,%rsi
call   1090 <append_to_unicode_string@plt>
mov    %rax,%r15
jmp    11c0 <glyph_name_to_unicode+0x40>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   10a0 <match_agl@plt>
test   %rax,%rax
jne    1240 <glyph_name_to_unicode+0xc0>
mov    %r12,%rdi
call   1070 <match_uni@plt>
test   %rax,%rax
jne    1240 <glyph_name_to_unicode+0xc0>
mov    %r12,%rdi
call   1080 <match_u@plt>
test   %rax,%rax
je     124e <glyph_name_to_unicode+0xce>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rax,%rsi
call   1090 <append_to_unicode_string@plt>
mov    %rax,%r15
mov    %r13,%r12
cmpb   $0x0,(%r12)
jne    11d2 <glyph_name_to_unicode+0x52>
jmp    1266 <glyph_name_to_unicode+0xe6>
xor    %r15d,%r15d
jmp    126e <glyph_name_to_unicode+0xee>
xor    %r15d,%r15d
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32* @glyph_name_to_unicode(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32*
store i8* %0, i8** %2
store i32* null, i32** %3
%9 = load i8*, i8** %2
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %69
11: ; preds = %1
%12 = load i8*, i8** %2
%13 = call i8* @dotless_copy(i8* %12)
store i8* %13, i8** %4
%14 = load i8*, i8** %4
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %68
16: ; preds = %11
%17 = load i8*, i8** %4
store i8* %17, i8** %5
br label %18
18: ; preds = %64, %16
%19 = load i8*, i8** %5
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %65
24: ; preds = %18
%25 = load i8*, i8** %5
%26 = call i8* @strchr(i8* %25, i8 signext 95)
store i8* %26, i8** %6
%27 = load i8*, i8** %6
%28 = icmp ne i8* %27, null
br i1 %28, label %29, label %42
29: ; preds = %24
%30 = load i8*, i8** %6
store i8 0, i8* %30
%31 = load i8*, i8** %5
%32 = call i32* @glyph_name_to_unicode(i8* %31)
store i32* %32, i32** %7
%33 = load i32*, i32** %7
%34 = icmp ne i32* %33, null
br i1 %34, label %35, label %39
35: ; preds = %29
%36 = load i32*, i32** %3
%37 = load i32*, i32** %7
%38 = call i32* @append_to_unicode_string(i32* %36, i32* %37)
store i32* %38, i32** %3
br label %39
39: ; preds = %35, %29
%40 = load i8*, i8** %6
%41 = getelementptr inbounds i8, i8* %40, i64 1
store i8* %41, i8** %5
br label %64
42: ; preds = %24
%43 = load i8*, i8** %5
%44 = call i32* @match_agl(i8* %43)
store i32* %44, i32** %8
%45 = load i32*, i32** %8
%46 = icmp eq i32* %45, null
br i1 %46, label %47, label %50
47: ; preds = %42
%48 = load i8*, i8** %5
%49 = call i32* @match_uni(i8* %48)
store i32* %49, i32** %8
br label %50
50: ; preds = %47, %42
%51 = load i32*, i32** %8
%52 = icmp eq i32* %51, null
br i1 %52, label %53, label %56
53: ; preds = %50
%54 = load i8*, i8** %5
%55 = call i32* @match_u(i8* %54)
store i32* %55, i32** %8
br label %56
56: ; preds = %53, %50
%57 = load i32*, i32** %8
%58 = icmp ne i32* %57, null
br i1 %58, label %59, label %63
59: ; preds = %56
%60 = load i32*, i32** %3
%61 = load i32*, i32** %8
%62 = call i32* @append_to_unicode_string(i32* %60, i32* %61)
store i32* %62, i32** %3
br label %63
63: ; preds = %59, %56
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %5
br label %64
64: ; preds = %63, %39
br label %18
65: ; preds = %18
%66 = load i8*, i8** %4
%67 = call i32 @free(i8* %66)
br label %68
68: ; preds = %65, %11
br label %69
69: ; preds = %68, %1
%70 = load i32*, i32** %3
ret i32* %70
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i32* @glyph_name_to_unicode(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %42, label %3
3: ; preds = %1
%4 = tail call i8* @dotless_copy(i8* %0)
%5 = icmp eq i8* %4, null
br i1 %5, label %42, label %6
6: ; preds = %3
%7 = load i8, i8* %4
%8 = icmp eq i8 %7, 0
br i1 %8, label %39, label %9
9: ; preds = %6, %34
%10 = phi i32* [ %36, %34 ], [ null, %6 ]
%11 = phi i8* [ %35, %34 ], [ %4, %6 ]
%12 = tail call i8* @strchr(i8* %11, i8 signext 95)
%13 = icmp eq i8* %12, null
br i1 %13, label %22, label %14
14: ; preds = %9
store i8 0, i8* %12
%15 = tail call i32* @glyph_name_to_unicode(i8* %11)
%16 = icmp eq i32* %15, null
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = tail call i32* @append_to_unicode_string(i32* %10, i32* %15)
br label %19
19: ; preds = %17, %14
%20 = phi i32* [ %18, %17 ], [ %10, %14 ]
%21 = getelementptr inbounds i8, i8* %12, i64 1
br label %34
22: ; preds = %9
%23 = tail call i32* @match_agl(i8* %11)
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %31
25: ; preds = %22
%26 = tail call i32* @match_uni(i8* %11)
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = tail call i32* @match_u(i8* %11)
%30 = icmp eq i32* %29, null
br i1 %30, label %34, label %31
31: ; preds = %22, %25, %28
%32 = phi i32* [ %29, %28 ], [ %26, %25 ], [ %23, %22 ]
%33 = tail call i32* @append_to_unicode_string(i32* %10, i32* %32)
br label %34
34: ; preds = %28, %31, %19
%35 = phi i8* [ %21, %19 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %31 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %28 ]
%36 = phi i32* [ %20, %19 ], [ %33, %31 ], [ %10, %28 ]
%37 = load i8, i8* %35
%38 = icmp eq i8 %37, 0
br i1 %38, label %39, label %9
39: ; preds = %34, %6
%40 = phi i32* [ null, %6 ], [ %36, %34 ]
%41 = tail call i32 @free(i8* %4)
br label %42
42: ; preds = %3, %39, %1
%43 = phi i32* [ null, %1 ], [ %40, %39 ], [ null, %3 ]
ret i32* %43
}