#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*/ strcmp(char const *, char const *);
scalar_t__ strstr(char const *, char const *);
const char *norm_charmap(char *name) {
  static const char *correct[] = {"UTF-8", "US-ASCII", NULL}, **cor;
  static struct {
    const char *alias;
    const char *name;
  } * ali, aliases[] = {{"ANSI_X3.4-1968", "US-ASCII"},
                        {"ASCII", "US-ASCII"},
                        {"646", "US-ASCII"},
                        {"ISO646", "US-ASCII"},
                        {"ISO_646.IRV", "US-ASCII"},
                        {"BIG5", "Big5"},
                        {"BIG5HKSCS", "Big5HKSCS"},
                        {"TIS-620", "ISO-8859-11"},
                        {"TIS620.2533", "ISO-8859-11"},
                        {NULL, NULL}};
  static struct {
    const char *substr;
    const char *name;
  } * sub, substrs[] = {{"8859-1", "ISO-8859-1"},
                        {"8859-2", "ISO-8859-2"},
                        {"8859-3", "ISO-8859-3"},
                        {"8859-4", "ISO-8859-4"},
                        {"8859-5", "ISO-8859-5"},
                        {"8859-6", "ISO-8859-6"},
                        {"8859-7", "ISO-8859-7"},
                        {"8859-8", "ISO-8859-8"},
                        {"8859-9", "ISO-8859-9"},
                        {"8859-10", "ISO-8859-10"},
                        {"8859-11", "ISO-8859-11"},
                        {"8859-13", "ISO-8859-13"},
                        {"8859-14", "ISO-8859-14"},
                        {"8859-15", "ISO-8859-15"},
                        {"8859-16", "ISO-8859-16"},
                        {"CP1200", "WINDOWS-1200"},
                        {"CP1201", "WINDOWS-1201"},
                        {"CP1250", "WINDOWS-1250"},
                        {"CP1251", "WINDOWS-1251"},
                        {"CP1252", "WINDOWS-1252"},
                        {"CP1253", "WINDOWS-1253"},
                        {"CP1254", "WINDOWS-1254"},
                        {"CP1255", "WINDOWS-1255"},
                        {"CP1256", "WINDOWS-1256"},
                        {"CP1257", "WINDOWS-1257"},
                        {"CP1258", "WINDOWS-1258"},
                        {NULL, NULL}};
  if (!name)
    return name;
  for (cor = correct; *cor; cor++)
    if (!strcmp(name, *cor))
      return name;
  for (ali = aliases; ali->alias; ali++)
    if (!strcmp(name, ali->alias))
      return ali->name;
  for (sub = substrs; sub->substr; sub++)
    if (strstr(name, sub->substr))
      return sub->name;
  return name;
}


x86 assembly (clang, -O0):
<norm_charmap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1144 <norm_charmap+0x24>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1287 <norm_charmap+0x167>
lea    0x2ef5(%rip),%rax
mov    %rax,0x3166(%rip)
mov    0x315f(%rip),%rax
cmpq   $0x0,(%rax)
je     11a8 <norm_charmap+0x88>
mov    -0x10(%rbp),%rdi
mov    0x314a(%rip),%rax
mov    (%rax),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    118c <norm_charmap+0x6c>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1287 <norm_charmap+0x167>
jmp    1191 <norm_charmap+0x71>
mov    0x3120(%rip),%rax
add    $0x8,%rax
mov    %rax,0x3115(%rip)
jmp    1152 <norm_charmap+0x32>
lea    0x2eb1(%rip),%rax
mov    %rax,0x310a(%rip)
mov    0x3103(%rip),%rax
cmpq   $0x0,(%rax)
je     1213 <norm_charmap+0xf3>
mov    -0x10(%rbp),%rdi
mov    0x30ee(%rip),%rax
mov    (%rax),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11f7 <norm_charmap+0xd7>
mov    0x30d6(%rip),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    1287 <norm_charmap+0x167>
jmp    11fc <norm_charmap+0xdc>
mov    0x30bd(%rip),%rax
add    $0x10,%rax
mov    %rax,0x30b2(%rip)
jmp    11b6 <norm_charmap+0x96>
lea    0x2ee6(%rip),%rax
mov    %rax,0x30a7(%rip)
mov    0x30a0(%rip),%rax
cmpq   $0x0,(%rax)
je     127f <norm_charmap+0x15f>
mov    -0x10(%rbp),%rdi
mov    0x308b(%rip),%rax
mov    (%rax),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
je     1263 <norm_charmap+0x143>
mov    0x3072(%rip),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    1287 <norm_charmap+0x167>
jmp    1268 <norm_charmap+0x148>
mov    0x3059(%rip),%rax
add    $0x10,%rax
mov    %rax,0x304e(%rip)
jmp    1221 <norm_charmap+0x101>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<norm_charmap>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     11fa <norm_charmap+0xda>
mov    %rdi,%r14
mov    0x2f09(%rip),%rsi
lea    0x2f02(%rip),%rbx
test   %rsi,%rsi
je     116d <norm_charmap+0x4d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11ff <norm_charmap+0xdf>
mov    0x8(%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1150 <norm_charmap+0x30>
mov    %rbx,0x3144(%rip)
mov    0x2ee5(%rip),%rsi
lea    0x2ede(%rip),%rbx
test   %rsi,%rsi
je     11a9 <norm_charmap+0x89>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1208 <norm_charmap+0xe8>
mov    0x10(%rbx),%rsi
add    $0x10,%rbx
test   %rsi,%rsi
jne    1190 <norm_charmap+0x70>
mov    %rbx,0x3110(%rip)
lea    0x2f49(%rip),%rax
mov    %rax,0x310a(%rip)
mov    0x2f3b(%rip),%rsi
test   %rsi,%rsi
je     1219 <norm_charmap+0xf9>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <strstr@plt>
mov    0x30e9(%rip),%rcx
test   %rax,%rax
jne    1215 <norm_charmap+0xf5>
lea    0x10(%rcx),%rax
mov    %rax,0x30d9(%rip)
mov    0x10(%rcx),%rsi
test   %rsi,%rsi
jne    11d0 <norm_charmap+0xb0>
jmp    1219 <norm_charmap+0xf9>
xor    %r14d,%r14d
jmp    1219 <norm_charmap+0xf9>
mov    %rbx,0x30b2(%rip)
jmp    1219 <norm_charmap+0xf9>
mov    %rbx,0x30b1(%rip)
mov    0x8(%rbx),%r14
jmp    1219 <norm_charmap+0xf9>
mov    0x8(%rcx),%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.anon = type { i8*, i8* }
%struct.anon.0 = type { i8*, i8* }
@norm_charmap.correct = internal global [3 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0), i8* null]
@.str = [6 x i8] c"UTF-8\00"
@.str.1 = [9 x i8] c"US-ASCII\00"
@norm_charmap.cor = internal global i8** null
@norm_charmap.ali = internal global %struct.anon* null
@norm_charmap.aliases = internal global [10 x %struct.anon] [%struct.anon { i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0) }, %struct.anon { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0) }, %struct.anon { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0) }, %struct.anon { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0) }, %struct.anon { i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0) }, %struct.anon { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i32 0, i32 0) }, %struct.anon { i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i32 0, i32 0) }, %struct.anon { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i32 0, i32 0) }, %struct.anon { i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i32 0, i32 0) }, %struct.anon zeroinitializer]
@.str.2 = [15 x i8] c"ANSI_X3.4-1968\00"
@.str.3 = [6 x i8] c"ASCII\00"
@.str.4 = [4 x i8] c"646\00"
@.str.5 = [7 x i8] c"ISO646\00"
@.str.6 = [12 x i8] c"ISO_646.IRV\00"
@.str.7 = [5 x i8] c"BIG5\00"
@.str.8 = [5 x i8] c"Big5\00"
@.str.9 = [10 x i8] c"BIG5HKSCS\00"
@.str.10 = [10 x i8] c"Big5HKSCS\00"
@.str.11 = [8 x i8] c"TIS-620\00"
@.str.12 = [12 x i8] c"ISO-8859-11\00"
@.str.13 = [12 x i8] c"TIS620.2533\00"
@norm_charmap.sub = internal global %struct.anon.0* null
@norm_charmap.substrs = internal global [27 x %struct.anon.0] [%struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.19, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.21, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.23, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.25, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.27, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.28, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.29, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.30, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.31, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.32, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.33, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.34, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.35, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.36, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.37, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.38, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.39, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.40, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.41, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.42, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.43, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.44, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.45, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.46, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.47, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.48, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.49, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.50, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.51, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.52, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.53, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.54, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.55, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.56, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.57, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.58, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.59, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.60, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.61, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.62, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.63, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.64, i32 0, i32 0) }, %struct.anon.0 zeroinitializer]
@.str.14 = [7 x i8] c"8859-1\00"
@.str.15 = [11 x i8] c"ISO-8859-1\00"
@.str.16 = [7 x i8] c"8859-2\00"
@.str.17 = [11 x i8] c"ISO-8859-2\00"
@.str.18 = [7 x i8] c"8859-3\00"
@.str.19 = [11 x i8] c"ISO-8859-3\00"
@.str.20 = [7 x i8] c"8859-4\00"
@.str.21 = [11 x i8] c"ISO-8859-4\00"
@.str.22 = [7 x i8] c"8859-5\00"
@.str.23 = [11 x i8] c"ISO-8859-5\00"
@.str.24 = [7 x i8] c"8859-6\00"
@.str.25 = [11 x i8] c"ISO-8859-6\00"
@.str.26 = [7 x i8] c"8859-7\00"
@.str.27 = [11 x i8] c"ISO-8859-7\00"
@.str.28 = [7 x i8] c"8859-8\00"
@.str.29 = [11 x i8] c"ISO-8859-8\00"
@.str.30 = [7 x i8] c"8859-9\00"
@.str.31 = [11 x i8] c"ISO-8859-9\00"
@.str.32 = [8 x i8] c"8859-10\00"
@.str.33 = [12 x i8] c"ISO-8859-10\00"
@.str.34 = [8 x i8] c"8859-11\00"
@.str.35 = [8 x i8] c"8859-13\00"
@.str.36 = [12 x i8] c"ISO-8859-13\00"
@.str.37 = [8 x i8] c"8859-14\00"
@.str.38 = [12 x i8] c"ISO-8859-14\00"
@.str.39 = [8 x i8] c"8859-15\00"
@.str.40 = [12 x i8] c"ISO-8859-15\00"
@.str.41 = [8 x i8] c"8859-16\00"
@.str.42 = [12 x i8] c"ISO-8859-16\00"
@.str.43 = [7 x i8] c"CP1200\00"
@.str.44 = [13 x i8] c"WINDOWS-1200\00"
@.str.45 = [7 x i8] c"CP1201\00"
@.str.46 = [13 x i8] c"WINDOWS-1201\00"
@.str.47 = [7 x i8] c"CP1250\00"
@.str.48 = [13 x i8] c"WINDOWS-1250\00"
@.str.49 = [7 x i8] c"CP1251\00"
@.str.50 = [13 x i8] c"WINDOWS-1251\00"
@.str.51 = [7 x i8] c"CP1252\00"
@.str.52 = [13 x i8] c"WINDOWS-1252\00"
@.str.53 = [7 x i8] c"CP1253\00"
@.str.54 = [13 x i8] c"WINDOWS-1253\00"
@.str.55 = [7 x i8] c"CP1254\00"
@.str.56 = [13 x i8] c"WINDOWS-1254\00"
@.str.57 = [7 x i8] c"CP1255\00"
@.str.58 = [13 x i8] c"WINDOWS-1255\00"
@.str.59 = [7 x i8] c"CP1256\00"
@.str.60 = [13 x i8] c"WINDOWS-1256\00"
@.str.61 = [7 x i8] c"CP1257\00"
@.str.62 = [13 x i8] c"WINDOWS-1257\00"
@.str.63 = [7 x i8] c"CP1258\00"
@.str.64 = [13 x i8] c"WINDOWS-1258\00"
define i8* @norm_charmap(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = load i8*, i8** %3
store i8* %7, i8** %2
br label %69
8: ; preds = %1
store i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @norm_charmap.correct, i64 0, i64 0), i8*** @norm_charmap.cor
br label %9
9: ; preds = %22, %8
%10 = load i8**, i8*** @norm_charmap.cor
%11 = load i8*, i8** %10
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %25
13: ; preds = %9
%14 = load i8*, i8** %3
%15 = load i8**, i8*** @norm_charmap.cor
%16 = load i8*, i8** %15
%17 = call i32 @strcmp(i8* %14, i8* %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %13
%20 = load i8*, i8** %3
store i8* %20, i8** %2
br label %69
21: ; preds = %13
br label %22
22: ; preds = %21
%23 = load i8**, i8*** @norm_charmap.cor
%24 = getelementptr inbounds i8*, i8** %23, i32 1
store i8** %24, i8*** @norm_charmap.cor
br label %9
25: ; preds = %9
store %struct.anon* getelementptr inbounds ([10 x %struct.anon], [10 x %struct.anon]* @norm_charmap.aliases, i64 0, i64 0), %struct.anon** @norm_charmap.ali
br label %26
26: ; preds = %43, %25
%27 = load %struct.anon*, %struct.anon** @norm_charmap.ali
%28 = getelementptr inbounds %struct.anon, %struct.anon* %27, i32 0, i32 0
%29 = load i8*, i8** %28
%30 = icmp ne i8* %29, null
br i1 %30, label %31, label %46
31: ; preds = %26
%32 = load i8*, i8** %3
%33 = load %struct.anon*, %struct.anon** @norm_charmap.ali
%34 = getelementptr inbounds %struct.anon, %struct.anon* %33, i32 0, i32 0
%35 = load i8*, i8** %34
%36 = call i32 @strcmp(i8* %32, i8* %35)
%37 = icmp ne i32 %36, 0
br i1 %37, label %42, label %38
38: ; preds = %31
%39 = load %struct.anon*, %struct.anon** @norm_charmap.ali
%40 = getelementptr inbounds %struct.anon, %struct.anon* %39, i32 0, i32 1
%41 = load i8*, i8** %40
store i8* %41, i8** %2
br label %69
42: ; preds = %31
br label %43
43: ; preds = %42
%44 = load %struct.anon*, %struct.anon** @norm_charmap.ali
%45 = getelementptr inbounds %struct.anon, %struct.anon* %44, i32 1
store %struct.anon* %45, %struct.anon** @norm_charmap.ali
br label %26
46: ; preds = %26
store %struct.anon.0* getelementptr inbounds ([27 x %struct.anon.0], [27 x %struct.anon.0]* @norm_charmap.substrs, i64 0, i64 0), %struct.anon.0** @norm_charmap.sub
br label %47
47: ; preds = %64, %46
%48 = load %struct.anon.0*, %struct.anon.0** @norm_charmap.sub
%49 = getelementptr inbounds %struct.anon.0, %struct.anon.0* %48, i32 0, i32 0
%50 = load i8*, i8** %49
%51 = icmp ne i8* %50, null
br i1 %51, label %52, label %67
52: ; preds = %47
%53 = load i8*, i8** %3
%54 = load %struct.anon.0*, %struct.anon.0** @norm_charmap.sub
%55 = getelementptr inbounds %struct.anon.0, %struct.anon.0* %54, i32 0, i32 0
%56 = load i8*, i8** %55
%57 = call i64 @strstr(i8* %53, i8* %56)
%58 = icmp ne i64 %57, 0
br i1 %58, label %59, label %63
59: ; preds = %52
%60 = load %struct.anon.0*, %struct.anon.0** @norm_charmap.sub
%61 = getelementptr inbounds %struct.anon.0, %struct.anon.0* %60, i32 0, i32 1
%62 = load i8*, i8** %61
store i8* %62, i8** %2
br label %69
63: ; preds = %52
br label %64
64: ; preds = %63
%65 = load %struct.anon.0*, %struct.anon.0** @norm_charmap.sub
%66 = getelementptr inbounds %struct.anon.0, %struct.anon.0* %65, i32 1
store %struct.anon.0* %66, %struct.anon.0** @norm_charmap.sub
br label %47
67: ; preds = %47
%68 = load i8*, i8** %3
store i8* %68, i8** %2
br label %69
69: ; preds = %67, %59, %38, %19, %6
%70 = load i8*, i8** %2
ret i8* %70
}

LLVM IR (-O2):
%struct.anon = type { i8*, i8* }
%struct.anon.0 = type { i8*, i8* }
@norm_charmap.correct = internal global [3 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0), i8* null]
@.str = [6 x i8] c"UTF-8\00"
@.str.1 = [9 x i8] c"US-ASCII\00"
@norm_charmap.cor = internal unnamed_addr global i8** null
@norm_charmap.ali = internal unnamed_addr global %struct.anon* null
@norm_charmap.aliases = internal global [10 x %struct.anon] [%struct.anon { i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0) }, %struct.anon { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0) }, %struct.anon { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0) }, %struct.anon { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0) }, %struct.anon { i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0) }, %struct.anon { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i32 0, i32 0) }, %struct.anon { i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i32 0, i32 0) }, %struct.anon { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i32 0, i32 0) }, %struct.anon { i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i32 0, i32 0) }, %struct.anon zeroinitializer]
@.str.2 = [15 x i8] c"ANSI_X3.4-1968\00"
@.str.3 = [6 x i8] c"ASCII\00"
@.str.4 = [4 x i8] c"646\00"
@.str.5 = [7 x i8] c"ISO646\00"
@.str.6 = [12 x i8] c"ISO_646.IRV\00"
@.str.7 = [5 x i8] c"BIG5\00"
@.str.8 = [5 x i8] c"Big5\00"
@.str.9 = [10 x i8] c"BIG5HKSCS\00"
@.str.10 = [10 x i8] c"Big5HKSCS\00"
@.str.11 = [8 x i8] c"TIS-620\00"
@.str.12 = [12 x i8] c"ISO-8859-11\00"
@.str.13 = [12 x i8] c"TIS620.2533\00"
@norm_charmap.sub = internal unnamed_addr global %struct.anon.0* null
@norm_charmap.substrs = internal global [27 x %struct.anon.0] [%struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.19, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.21, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.23, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.25, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.27, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.28, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.29, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.30, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.31, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.32, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.33, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.34, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.35, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.36, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.37, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.38, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.39, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.40, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.41, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.42, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.43, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.44, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.45, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.46, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.47, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.48, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.49, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.50, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.51, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.52, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.53, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.54, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.55, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.56, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.57, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.58, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.59, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.60, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.61, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.62, i32 0, i32 0) }, %struct.anon.0 { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.63, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.64, i32 0, i32 0) }, %struct.anon.0 zeroinitializer]
@.str.14 = [7 x i8] c"8859-1\00"
@.str.15 = [11 x i8] c"ISO-8859-1\00"
@.str.16 = [7 x i8] c"8859-2\00"
@.str.17 = [11 x i8] c"ISO-8859-2\00"
@.str.18 = [7 x i8] c"8859-3\00"
@.str.19 = [11 x i8] c"ISO-8859-3\00"
@.str.20 = [7 x i8] c"8859-4\00"
@.str.21 = [11 x i8] c"ISO-8859-4\00"
@.str.22 = [7 x i8] c"8859-5\00"
@.str.23 = [11 x i8] c"ISO-8859-5\00"
@.str.24 = [7 x i8] c"8859-6\00"
@.str.25 = [11 x i8] c"ISO-8859-6\00"
@.str.26 = [7 x i8] c"8859-7\00"
@.str.27 = [11 x i8] c"ISO-8859-7\00"
@.str.28 = [7 x i8] c"8859-8\00"
@.str.29 = [11 x i8] c"ISO-8859-8\00"
@.str.30 = [7 x i8] c"8859-9\00"
@.str.31 = [11 x i8] c"ISO-8859-9\00"
@.str.32 = [8 x i8] c"8859-10\00"
@.str.33 = [12 x i8] c"ISO-8859-10\00"
@.str.34 = [8 x i8] c"8859-11\00"
@.str.35 = [8 x i8] c"8859-13\00"
@.str.36 = [12 x i8] c"ISO-8859-13\00"
@.str.37 = [8 x i8] c"8859-14\00"
@.str.38 = [12 x i8] c"ISO-8859-14\00"
@.str.39 = [8 x i8] c"8859-15\00"
@.str.40 = [12 x i8] c"ISO-8859-15\00"
@.str.41 = [8 x i8] c"8859-16\00"
@.str.42 = [12 x i8] c"ISO-8859-16\00"
@.str.43 = [7 x i8] c"CP1200\00"
@.str.44 = [13 x i8] c"WINDOWS-1200\00"
@.str.45 = [7 x i8] c"CP1201\00"
@.str.46 = [13 x i8] c"WINDOWS-1201\00"
@.str.47 = [7 x i8] c"CP1250\00"
@.str.48 = [13 x i8] c"WINDOWS-1250\00"
@.str.49 = [7 x i8] c"CP1251\00"
@.str.50 = [13 x i8] c"WINDOWS-1251\00"
@.str.51 = [7 x i8] c"CP1252\00"
@.str.52 = [13 x i8] c"WINDOWS-1252\00"
@.str.53 = [7 x i8] c"CP1253\00"
@.str.54 = [13 x i8] c"WINDOWS-1253\00"
@.str.55 = [7 x i8] c"CP1254\00"
@.str.56 = [13 x i8] c"WINDOWS-1254\00"
@.str.57 = [7 x i8] c"CP1255\00"
@.str.58 = [13 x i8] c"WINDOWS-1255\00"
@.str.59 = [7 x i8] c"CP1256\00"
@.str.60 = [13 x i8] c"WINDOWS-1256\00"
@.str.61 = [7 x i8] c"CP1257\00"
@.str.62 = [13 x i8] c"WINDOWS-1257\00"
@.str.63 = [7 x i8] c"CP1258\00"
@.str.64 = [13 x i8] c"WINDOWS-1258\00"
define i8* @norm_charmap(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %50, label %3
3: ; preds = %1
%4 = load i8*, i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @norm_charmap.correct, i64 0, i64 0)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %10
6: ; preds = %15, %3
%7 = phi i8** [ getelementptr inbounds ([3 x i8*], [3 x i8*]* @norm_charmap.correct, i64 0, i64 0), %3 ], [ %16, %15 ]
store i8** %7, i8*** @norm_charmap.cor
%8 = load i8*, i8** getelementptr inbounds ([10 x %struct.anon], [10 x %struct.anon]* @norm_charmap.aliases, i64 0, i64 0, i32 0)
%9 = icmp eq i8* %8, null
br i1 %9, label %19, label %23
10: ; preds = %3, %15
%11 = phi i8* [ %17, %15 ], [ %4, %3 ]
%12 = phi i8** [ %16, %15 ], [ getelementptr inbounds ([3 x i8*], [3 x i8*]* @norm_charmap.correct, i64 0, i64 0), %3 ]
%13 = tail call i32 @strcmp(i8* %0, i8* %11)
%14 = icmp eq i32 %13, 0
br i1 %14, label %49, label %15
15: ; preds = %10
%16 = getelementptr inbounds i8*, i8** %12, i64 1
%17 = load i8*, i8** %16
%18 = icmp eq i8* %17, null
br i1 %18, label %6, label %10
19: ; preds = %31, %6
%20 = phi %struct.anon* [ getelementptr inbounds ([10 x %struct.anon], [10 x %struct.anon]* @norm_charmap.aliases, i64 0, i64 0), %6 ], [ %32, %31 ]
store %struct.anon* %20, %struct.anon** @norm_charmap.ali
store %struct.anon.0* getelementptr inbounds ([27 x %struct.anon.0], [27 x %struct.anon.0]* @norm_charmap.substrs, i64 0, i64 0), %struct.anon.0** @norm_charmap.sub
%21 = load i8*, i8** getelementptr inbounds ([27 x %struct.anon.0], [27 x %struct.anon.0]* @norm_charmap.substrs, i64 0, i64 0, i32 0)
%22 = icmp eq i8* %21, null
br i1 %22, label %50, label %36
23: ; preds = %6, %31
%24 = phi i8* [ %34, %31 ], [ %8, %6 ]
%25 = phi %struct.anon* [ %32, %31 ], [ getelementptr inbounds ([10 x %struct.anon], [10 x %struct.anon]* @norm_charmap.aliases, i64 0, i64 0), %6 ]
%26 = tail call i32 @strcmp(i8* %0, i8* %24)
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %23
store %struct.anon* %25, %struct.anon** @norm_charmap.ali
%29 = getelementptr inbounds %struct.anon, %struct.anon* %25, i64 0, i32 1
%30 = load i8*, i8** %29
br label %50
31: ; preds = %23
%32 = getelementptr inbounds %struct.anon, %struct.anon* %25, i64 1
%33 = getelementptr inbounds %struct.anon, %struct.anon* %32, i64 0, i32 0
%34 = load i8*, i8** %33
%35 = icmp eq i8* %34, null
br i1 %35, label %19, label %23
36: ; preds = %19, %44
%37 = phi i8* [ %47, %44 ], [ %21, %19 ]
%38 = tail call i64 @strstr(i8* %0, i8* %37)
%39 = icmp eq i64 %38, 0
%40 = load %struct.anon.0*, %struct.anon.0** @norm_charmap.sub
br i1 %39, label %44, label %41
41: ; preds = %36
%42 = getelementptr inbounds %struct.anon.0, %struct.anon.0* %40, i64 0, i32 1
%43 = load i8*, i8** %42
br label %50
44: ; preds = %36
%45 = getelementptr inbounds %struct.anon.0, %struct.anon.0* %40, i64 1
store %struct.anon.0* %45, %struct.anon.0** @norm_charmap.sub
%46 = getelementptr inbounds %struct.anon.0, %struct.anon.0* %45, i64 0, i32 0
%47 = load i8*, i8** %46
%48 = icmp eq i8* %47, null
br i1 %48, label %50, label %36
49: ; preds = %10
store i8** %12, i8*** @norm_charmap.cor
br label %50
50: ; preds = %44, %19, %49, %1, %41, %28
%51 = phi i8* [ %30, %28 ], [ %43, %41 ], [ null, %1 ], [ %0, %49 ], [ %0, %19 ], [ %0, %44 ]
ret i8* %51
}