#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 */
scalar_t__ strcasecmp(char *, char const *);
const char *filter_code(const char *code) {
  if (strcasecmp("UTF8", code) == 0)
    return "UTF-8";
  if (strcasecmp("GB2312", code) == 0 || strcasecmp("GBK", code) == 0)
    return "GB18030";
  if (strcasecmp("UTF8-CN", code) == 0 || strcasecmp("UTF-8-CN", code) == 0)
    return "UTF8-HANS";
  if (strcasecmp("UTF8-TW", code) == 0 || strcasecmp("UTF-8-TW", code) == 0 ||
      strcasecmp("UTF8-HK", code) == 0 || strcasecmp("UTF-8-HK", code) == 0)
    return "UTF8-HANT";
  if (strcasecmp("BIG5-2003", code) == 0 || strcasecmp("BIG-5", code) == 0 ||
      strcasecmp("CN-BIG5", code) == 0 || strcasecmp("BIG5HKSCS", code) == 0 ||
      strcasecmp("BIG-FIVE", code) == 0 || strcasecmp("BIGFIVE", code) == 0)
    return "BIG5";
  return code;
}


x86 assembly (clang, -O0):
<filter_code>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1146 <filter_code+0x36>
lea    0xec8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12fa <filter_code+0x1ea>
mov    -0x10(%rbp),%rsi
lea    0xeba(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     117a <filter_code+0x6a>
mov    -0x10(%rbp),%rsi
lea    0xea7(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    118a <filter_code+0x7a>
lea    0xe95(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12fa <filter_code+0x1ea>
mov    -0x10(%rbp),%rsi
lea    0xe89(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     11be <filter_code+0xae>
mov    -0x10(%rbp),%rsi
lea    0xe77(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11ce <filter_code+0xbe>
lea    0xe6a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12fa <filter_code+0x1ea>
mov    -0x10(%rbp),%rsi
lea    0xe60(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     1236 <filter_code+0x126>
mov    -0x10(%rbp),%rsi
lea    0xe4e(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     1236 <filter_code+0x126>
mov    -0x10(%rbp),%rsi
lea    0xe3d(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     1236 <filter_code+0x126>
mov    -0x10(%rbp),%rsi
lea    0xe2b(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1246 <filter_code+0x136>
lea    0xe1e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12fa <filter_code+0x1ea>
mov    -0x10(%rbp),%rsi
lea    0xe14(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     12e2 <filter_code+0x1d2>
mov    -0x10(%rbp),%rsi
lea    0xe04(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     12e2 <filter_code+0x1d2>
mov    -0x10(%rbp),%rsi
lea    0xdf0(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     12e2 <filter_code+0x1d2>
mov    -0x10(%rbp),%rsi
lea    0xdde(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     12e2 <filter_code+0x1d2>
mov    -0x10(%rbp),%rsi
lea    0xdce(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     12e2 <filter_code+0x1d2>
mov    -0x10(%rbp),%rsi
lea    0xdbd(%rip),%rdi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    12f2 <filter_code+0x1e2>
lea    0xd8f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    12fa <filter_code+0x1ea>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filter_code>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xee2(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     128e <filter_code+0x17e>
lea    0xed5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
lea    0xed1(%rip),%r14
test   %rax,%rax
je     1295 <filter_code+0x185>
lea    0xebd(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1295 <filter_code+0x185>
lea    0xeb1(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
lea    0xeb3(%rip),%r14
test   %rax,%rax
je     1295 <filter_code+0x185>
lea    0xe9a(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1295 <filter_code+0x185>
lea    0xe95(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
lea    0xea8(%rip),%r14
test   %rax,%rax
je     1295 <filter_code+0x185>
lea    0xe7e(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1295 <filter_code+0x185>
lea    0xe6f(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1295 <filter_code+0x185>
lea    0xe5f(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1295 <filter_code+0x185>
lea    0xe5a(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
lea    0xe5e(%rip),%r14
test   %rax,%rax
je     1295 <filter_code+0x185>
lea    0xe49(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1295 <filter_code+0x185>
lea    0xe3b(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1295 <filter_code+0x185>
lea    0xe2f(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1295 <filter_code+0x185>
lea    0xe25(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1295 <filter_code+0x185>
lea    0xe1a(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
lea    0xdf0(%rip),%r14
cmovne %rbx,%r14
jmp    1295 <filter_code+0x185>
lea    0xd70(%rip),%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"UTF8\00"
@.str.1 = [6 x i8] c"UTF-8\00"
@.str.2 = [7 x i8] c"GB2312\00"
@.str.3 = [4 x i8] c"GBK\00"
@.str.4 = [8 x i8] c"GB18030\00"
@.str.5 = [8 x i8] c"UTF8-CN\00"
@.str.6 = [9 x i8] c"UTF-8-CN\00"
@.str.7 = [10 x i8] c"UTF8-HANS\00"
@.str.8 = [8 x i8] c"UTF8-TW\00"
@.str.9 = [9 x i8] c"UTF-8-TW\00"
@.str.10 = [8 x i8] c"UTF8-HK\00"
@.str.11 = [9 x i8] c"UTF-8-HK\00"
@.str.12 = [10 x i8] c"UTF8-HANT\00"
@.str.13 = [10 x i8] c"BIG5-2003\00"
@.str.14 = [6 x i8] c"BIG-5\00"
@.str.15 = [8 x i8] c"CN-BIG5\00"
@.str.16 = [10 x i8] c"BIG5HKSCS\00"
@.str.17 = [9 x i8] c"BIG-FIVE\00"
@.str.18 = [8 x i8] c"BIGFIVE\00"
@.str.19 = [5 x i8] c"BIG5\00"
define i8* @filter_code(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @strcasecmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %70
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i64 @strcasecmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %8
%13 = load i8*, i8** %3
%14 = call i64 @strcasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %12, %8
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %70
17: ; preds = %12
%18 = load i8*, i8** %3
%19 = call i64 @strcasecmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %25, label %21
21: ; preds = %17
%22 = load i8*, i8** %3
%23 = call i64 @strcasecmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %21, %17
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %70
26: ; preds = %21
%27 = load i8*, i8** %3
%28 = call i64 @strcasecmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8* %27)
%29 = icmp eq i64 %28, 0
br i1 %29, label %42, label %30
30: ; preds = %26
%31 = load i8*, i8** %3
%32 = call i64 @strcasecmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i8* %31)
%33 = icmp eq i64 %32, 0
br i1 %33, label %42, label %34
34: ; preds = %30
%35 = load i8*, i8** %3
%36 = call i64 @strcasecmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8* %35)
%37 = icmp eq i64 %36, 0
br i1 %37, label %42, label %38
38: ; preds = %34
%39 = load i8*, i8** %3
%40 = call i64 @strcasecmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i8* %39)
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %38, %34, %30, %26
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %70
43: ; preds = %38
%44 = load i8*, i8** %3
%45 = call i64 @strcasecmp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i8* %44)
%46 = icmp eq i64 %45, 0
br i1 %46, label %67, label %47
47: ; preds = %43
%48 = load i8*, i8** %3
%49 = call i64 @strcasecmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i8* %48)
%50 = icmp eq i64 %49, 0
br i1 %50, label %67, label %51
51: ; preds = %47
%52 = load i8*, i8** %3
%53 = call i64 @strcasecmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), i8* %52)
%54 = icmp eq i64 %53, 0
br i1 %54, label %67, label %55
55: ; preds = %51
%56 = load i8*, i8** %3
%57 = call i64 @strcasecmp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.16, i64 0, i64 0), i8* %56)
%58 = icmp eq i64 %57, 0
br i1 %58, label %67, label %59
59: ; preds = %55
%60 = load i8*, i8** %3
%61 = call i64 @strcasecmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.17, i64 0, i64 0), i8* %60)
%62 = icmp eq i64 %61, 0
br i1 %62, label %67, label %63
63: ; preds = %59
%64 = load i8*, i8** %3
%65 = call i64 @strcasecmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0), i8* %64)
%66 = icmp eq i64 %65, 0
br i1 %66, label %67, label %68
67: ; preds = %63, %59, %55, %51, %47, %43
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i8** %2
br label %70
68: ; preds = %63
%69 = load i8*, i8** %3
store i8* %69, i8** %2
br label %70
70: ; preds = %68, %67, %42, %25, %16, %7
%71 = load i8*, i8** %2
ret i8* %71
}

LLVM IR (-O2):
@.str = [5 x i8] c"UTF8\00"
@.str.1 = [6 x i8] c"UTF-8\00"
@.str.2 = [7 x i8] c"GB2312\00"
@.str.3 = [4 x i8] c"GBK\00"
@.str.4 = [8 x i8] c"GB18030\00"
@.str.5 = [8 x i8] c"UTF8-CN\00"
@.str.6 = [9 x i8] c"UTF-8-CN\00"
@.str.7 = [10 x i8] c"UTF8-HANS\00"
@.str.8 = [8 x i8] c"UTF8-TW\00"
@.str.9 = [9 x i8] c"UTF-8-TW\00"
@.str.10 = [8 x i8] c"UTF8-HK\00"
@.str.11 = [9 x i8] c"UTF-8-HK\00"
@.str.12 = [10 x i8] c"UTF8-HANT\00"
@.str.13 = [10 x i8] c"BIG5-2003\00"
@.str.14 = [6 x i8] c"BIG-5\00"
@.str.15 = [8 x i8] c"CN-BIG5\00"
@.str.16 = [10 x i8] c"BIG5HKSCS\00"
@.str.17 = [9 x i8] c"BIG-FIVE\00"
@.str.18 = [8 x i8] c"BIGFIVE\00"
@.str.19 = [5 x i8] c"BIG5\00"
define i8* @filter_code(i8* %0) {
%2 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %47, label %4
4: ; preds = %1
%5 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %47, label %7
7: ; preds = %4
%8 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %47, label %10
10: ; preds = %7
%11 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* %0)
%12 = icmp eq i64 %11, 0
br i1 %12, label %47, label %13
13: ; preds = %10
%14 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* %0)
%15 = icmp eq i64 %14, 0
br i1 %15, label %47, label %16
16: ; preds = %13
%17 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8* %0)
%18 = icmp eq i64 %17, 0
br i1 %18, label %47, label %19
19: ; preds = %16
%20 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i8* %0)
%21 = icmp eq i64 %20, 0
br i1 %21, label %47, label %22
22: ; preds = %19
%23 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8* %0)
%24 = icmp eq i64 %23, 0
br i1 %24, label %47, label %25
25: ; preds = %22
%26 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i8* %0)
%27 = icmp eq i64 %26, 0
br i1 %27, label %47, label %28
28: ; preds = %25
%29 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i8* %0)
%30 = icmp eq i64 %29, 0
br i1 %30, label %47, label %31
31: ; preds = %28
%32 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i8* %0)
%33 = icmp eq i64 %32, 0
br i1 %33, label %47, label %34
34: ; preds = %31
%35 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0), i8* %0)
%36 = icmp eq i64 %35, 0
br i1 %36, label %47, label %37
37: ; preds = %34
%38 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.16, i64 0, i64 0), i8* %0)
%39 = icmp eq i64 %38, 0
br i1 %39, label %47, label %40
40: ; preds = %37
%41 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.17, i64 0, i64 0), i8* %0)
%42 = icmp eq i64 %41, 0
br i1 %42, label %47, label %43
43: ; preds = %40
%44 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0), i8* %0)
%45 = icmp eq i64 %44, 0
%46 = select i1 %45, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i8* %0
br label %47
47: ; preds = %43, %28, %31, %34, %37, %40, %16, %19, %22, %25, %10, %13, %4, %7, %1
%48 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %1 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), %7 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), %4 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), %13 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), %10 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), %25 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), %22 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), %19 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), %16 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), %40 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), %37 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), %34 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), %31 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), %28 ], [ %46, %43 ]
ret i8* %48
}