#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 */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ *mbs_duplicate_as_wcs(char const *);
scalar_t__ streq(char const *, char *);
int /*<<< orphan*/ *wcsdup(char *);
wchar_t *config_resolve_character_set(const char *value) {
  wchar_t *character_set = NULL;
  if (value[0] == '$') {
    if (streq(value, "$DIGITS")) {
      character_set = wcsdup(L"1234567890");
    } else if (streq(value, "$LOWERCASE")) {
      character_set = wcsdup(L"abcdefghijklmnopqrstuvwxyz");
    } else if (streq(value, "$UPPERCASE")) {
      character_set = wcsdup(L"ABCDEFGHIJKLMNOPQRSTUVWXYZ");
    } else if (streq(value, "$ALPHA")) {
      character_set = wcsdup(L"abcdefghijklmnopqrstuvwxyz"
                             L"ABCDEFGHIJKLMNOPQRSTUVWXYZ");
    } else if (streq(value, "$ALPHANUMERIC")) {
      character_set = wcsdup(L"abcdefghijklmnopqrstuvwxyz"
                             L"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
                             L"1234567890");
    } else if (streq(value, "$SYMBOLS")) {
      character_set = wcsdup(L"~`!@#$%^&*()_+-=[]\\{}|;':\",./<>?");
    } else if (streq(value, "$PRINTABLE")) {
      character_set = wcsdup(L"abcdefghijklmnopqrstuvwxyz"
                             L"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
                             L"1234567890"
                             L"~`!@#$%^&*()_+-=[]\\{}|;':\",./<>?");
    }
  }
  if (character_set == NULL) {
    character_set = mbs_duplicate_as_wcs(value);
  }
  return (character_set);
}


x86 assembly (clang, -O0):
<config_resolve_character_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x24,%eax
jne    12bb <config_resolve_character_set+0x18b>
mov    -0x8(%rbp),%rdi
lea    0xea1(%rip),%rsi
call   1030 <streq@plt>
cmp    $0x0,%rax
je     1183 <config_resolve_character_set+0x53>
lea    0x10e3(%rip),%rdi
call   1050 <wcsdup@plt>
mov    %rax,-0x10(%rbp)
jmp    12b6 <config_resolve_character_set+0x186>
mov    -0x8(%rbp),%rdi
lea    0xe7a(%rip),%rsi
call   1030 <streq@plt>
cmp    $0x0,%rax
je     11b2 <config_resolve_character_set+0x82>
lea    0xea4(%rip),%rdi
call   1050 <wcsdup@plt>
mov    %rax,-0x10(%rbp)
jmp    12b1 <config_resolve_character_set+0x181>
mov    -0x8(%rbp),%rdi
lea    0xe56(%rip),%rsi
call   1030 <streq@plt>
cmp    $0x0,%rax
je     11e1 <config_resolve_character_set+0xb1>
lea    0xf49(%rip),%rdi
call   1050 <wcsdup@plt>
mov    %rax,-0x10(%rbp)
jmp    12ac <config_resolve_character_set+0x17c>
mov    -0x8(%rbp),%rdi
lea    0xe32(%rip),%rsi
call   1030 <streq@plt>
cmp    $0x0,%rax
je     1210 <config_resolve_character_set+0xe0>
lea    0xeb2(%rip),%rdi
call   1050 <wcsdup@plt>
mov    %rax,-0x10(%rbp)
jmp    12a7 <config_resolve_character_set+0x177>
mov    -0x8(%rbp),%rdi
lea    0xe0a(%rip),%rsi
call   1030 <streq@plt>
cmp    $0x0,%rax
je     123f <config_resolve_character_set+0x10f>
lea    0xf57(%rip),%rdi
call   1050 <wcsdup@plt>
mov    %rax,-0x10(%rbp)
jmp    12a2 <config_resolve_character_set+0x172>
mov    -0x8(%rbp),%rdi
lea    0xde9(%rip),%rsi
call   1030 <streq@plt>
cmp    $0x0,%rax
je     126e <config_resolve_character_set+0x13e>
lea    0x111c(%rip),%rdi
call   1050 <wcsdup@plt>
mov    %rax,-0x10(%rbp)
jmp    129d <config_resolve_character_set+0x16d>
mov    -0x8(%rbp),%rdi
lea    0xdc3(%rip),%rsi
call   1030 <streq@plt>
cmp    $0x0,%rax
je     1298 <config_resolve_character_set+0x168>
lea    0xff5(%rip),%rdi
call   1050 <wcsdup@plt>
mov    %rax,-0x10(%rbp)
jmp    129d <config_resolve_character_set+0x16d>
jmp    12a2 <config_resolve_character_set+0x172>
jmp    12a7 <config_resolve_character_set+0x177>
jmp    12ac <config_resolve_character_set+0x17c>
jmp    12b1 <config_resolve_character_set+0x181>
jmp    12b6 <config_resolve_character_set+0x186>
jmp    12bb <config_resolve_character_set+0x18b>
cmpq   $0x0,-0x10(%rbp)
jne    12d3 <config_resolve_character_set+0x1a3>
mov    -0x8(%rbp),%rdi
call   1040 <mbs_duplicate_as_wcs@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_resolve_character_set>:
push   %rbx
mov    %rdi,%rbx
cmpb   $0x24,(%rdi)
jne    1218 <config_resolve_character_set+0xe8>
lea    0xebc(%rip),%rsi
mov    %rbx,%rdi
call   1030 <streq@plt>
test   %rax,%rax
je     115d <config_resolve_character_set+0x2d>
lea    0x1100(%rip),%rdi
jmp    120c <config_resolve_character_set+0xdc>
lea    0xea4(%rip),%rsi
mov    %rbx,%rdi
call   1030 <streq@plt>
test   %rax,%rax
je     117d <config_resolve_character_set+0x4d>
lea    0xed0(%rip),%rdi
jmp    120c <config_resolve_character_set+0xdc>
lea    0xe8f(%rip),%rsi
mov    %rbx,%rdi
call   1030 <streq@plt>
test   %rax,%rax
je     119a <config_resolve_character_set+0x6a>
lea    0xf84(%rip),%rdi
jmp    120c <config_resolve_character_set+0xdc>
lea    0xe7d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <streq@plt>
test   %rax,%rax
je     11b7 <config_resolve_character_set+0x87>
lea    0xeff(%rip),%rdi
jmp    120c <config_resolve_character_set+0xdc>
lea    0xe67(%rip),%rsi
mov    %rbx,%rdi
call   1030 <streq@plt>
test   %rax,%rax
je     11d4 <config_resolve_character_set+0xa4>
lea    0xfb6(%rip),%rdi
jmp    120c <config_resolve_character_set+0xdc>
lea    0xe58(%rip),%rsi
mov    %rbx,%rdi
call   1030 <streq@plt>
test   %rax,%rax
je     11f1 <config_resolve_character_set+0xc1>
lea    0x118d(%rip),%rdi
jmp    120c <config_resolve_character_set+0xdc>
lea    0xe44(%rip),%rsi
mov    %rbx,%rdi
call   1030 <streq@plt>
test   %rax,%rax
je     1218 <config_resolve_character_set+0xe8>
lea    0x1078(%rip),%rdi
call   1050 <wcsdup@plt>
test   %rax,%rax
je     1218 <config_resolve_character_set+0xe8>
pop    %rbx
ret
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <mbs_duplicate_as_wcs@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"$DIGITS\00"
@.str.1 = [11 x i32] [i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 48, i32 0]
@.str.2 = [11 x i8] c"$LOWERCASE\00"
@.str.3 = [27 x i32] [i32 97, i32 98, i32 99, i32 100, i32 101, i32 102, i32 103, i32 104, i32 105, i32 106, i32 107, i32 108, i32 109, i32 110, i32 111, i32 112, i32 113, i32 114, i32 115, i32 116, i32 117, i32 118, i32 119, i32 120, i32 121, i32 122, i32 0]
@.str.4 = [11 x i8] c"$UPPERCASE\00"
@.str.5 = [27 x i32] [i32 65, i32 66, i32 67, i32 68, i32 69, i32 70, i32 71, i32 72, i32 73, i32 74, i32 75, i32 76, i32 77, i32 78, i32 79, i32 80, i32 81, i32 82, i32 83, i32 84, i32 85, i32 86, i32 87, i32 88, i32 89, i32 90, i32 0]
@.str.6 = [7 x i8] c"$ALPHA\00"
@.str.7 = [53 x i32] [i32 97, i32 98, i32 99, i32 100, i32 101, i32 102, i32 103, i32 104, i32 105, i32 106, i32 107, i32 108, i32 109, i32 110, i32 111, i32 112, i32 113, i32 114, i32 115, i32 116, i32 117, i32 118, i32 119, i32 120, i32 121, i32 122, i32 65, i32 66, i32 67, i32 68, i32 69, i32 70, i32 71, i32 72, i32 73, i32 74, i32 75, i32 76, i32 77, i32 78, i32 79, i32 80, i32 81, i32 82, i32 83, i32 84, i32 85, i32 86, i32 87, i32 88, i32 89, i32 90, i32 0]
@.str.8 = [14 x i8] c"$ALPHANUMERIC\00"
@.str.9 = [63 x i32] [i32 97, i32 98, i32 99, i32 100, i32 101, i32 102, i32 103, i32 104, i32 105, i32 106, i32 107, i32 108, i32 109, i32 110, i32 111, i32 112, i32 113, i32 114, i32 115, i32 116, i32 117, i32 118, i32 119, i32 120, i32 121, i32 122, i32 65, i32 66, i32 67, i32 68, i32 69, i32 70, i32 71, i32 72, i32 73, i32 74, i32 75, i32 76, i32 77, i32 78, i32 79, i32 80, i32 81, i32 82, i32 83, i32 84, i32 85, i32 86, i32 87, i32 88, i32 89, i32 90, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 48, i32 0]
@.str.10 = [9 x i8] c"$SYMBOLS\00"
@.str.11 = [33 x i32] [i32 126, i32 96, i32 33, i32 64, i32 35, i32 36, i32 37, i32 94, i32 38, i32 42, i32 40, i32 41, i32 95, i32 43, i32 45, i32 61, i32 91, i32 93, i32 92, i32 123, i32 125, i32 124, i32 59, i32 39, i32 58, i32 34, i32 44, i32 46, i32 47, i32 60, i32 62, i32 63, i32 0]
@.str.12 = [11 x i8] c"$PRINTABLE\00"
@.str.13 = [95 x i32] [i32 97, i32 98, i32 99, i32 100, i32 101, i32 102, i32 103, i32 104, i32 105, i32 106, i32 107, i32 108, i32 109, i32 110, i32 111, i32 112, i32 113, i32 114, i32 115, i32 116, i32 117, i32 118, i32 119, i32 120, i32 121, i32 122, i32 65, i32 66, i32 67, i32 68, i32 69, i32 70, i32 71, i32 72, i32 73, i32 74, i32 75, i32 76, i32 77, i32 78, i32 79, i32 80, i32 81, i32 82, i32 83, i32 84, i32 85, i32 86, i32 87, i32 88, i32 89, i32 90, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 48, i32 126, i32 96, i32 33, i32 64, i32 35, i32 36, i32 37, i32 94, i32 38, i32 42, i32 40, i32 41, i32 95, i32 43, i32 45, i32 61, i32 91, i32 93, i32 92, i32 123, i32 125, i32 124, i32 59, i32 39, i32 58, i32 34, i32 44, i32 46, i32 47, i32 60, i32 62, i32 63, i32 0]
define i32* @config_resolve_character_set(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
store i32* null, i32** %3
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 36
br i1 %8, label %9, label %58
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i64 @streq(i8* %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32* @wcsdup(i8* bitcast ([11 x i32]* @.str.1 to i8*))
store i32* %14, i32** %3
br label %57
15: ; preds = %9
%16 = load i8*, i8** %2
%17 = call i64 @streq(i8* %16, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32* @wcsdup(i8* bitcast ([27 x i32]* @.str.3 to i8*))
store i32* %20, i32** %3
br label %56
21: ; preds = %15
%22 = load i8*, i8** %2
%23 = call i64 @streq(i8* %22, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32* @wcsdup(i8* bitcast ([27 x i32]* @.str.5 to i8*))
store i32* %26, i32** %3
br label %55
27: ; preds = %21
%28 = load i8*, i8** %2
%29 = call i64 @streq(i8* %28, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32* @wcsdup(i8* bitcast ([53 x i32]* @.str.7 to i8*))
store i32* %32, i32** %3
br label %54
33: ; preds = %27
%34 = load i8*, i8** %2
%35 = call i64 @streq(i8* %34, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = call i32* @wcsdup(i8* bitcast ([63 x i32]* @.str.9 to i8*))
store i32* %38, i32** %3
br label %53
39: ; preds = %33
%40 = load i8*, i8** %2
%41 = call i64 @streq(i8* %40, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0))
%42 = icmp ne i64 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %39
%44 = call i32* @wcsdup(i8* bitcast ([33 x i32]* @.str.11 to i8*))
store i32* %44, i32** %3
br label %52
45: ; preds = %39
%46 = load i8*, i8** %2
%47 = call i64 @streq(i8* %46, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0))
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %45
%50 = call i32* @wcsdup(i8* bitcast ([95 x i32]* @.str.13 to i8*))
store i32* %50, i32** %3
br label %51
51: ; preds = %49, %45
br label %52
52: ; preds = %51, %43
br label %53
53: ; preds = %52, %37
br label %54
54: ; preds = %53, %31
br label %55
55: ; preds = %54, %25
br label %56
56: ; preds = %55, %19
br label %57
57: ; preds = %56, %13
br label %58
58: ; preds = %57, %1
%59 = load i32*, i32** %3
%60 = icmp eq i32* %59, null
br i1 %60, label %61, label %64
61: ; preds = %58
%62 = load i8*, i8** %2
%63 = call i32* @mbs_duplicate_as_wcs(i8* %62)
store i32* %63, i32** %3
br label %64
64: ; preds = %61, %58
%65 = load i32*, i32** %3
ret i32* %65
}

LLVM IR (-O2):
@.str = [8 x i8] c"$DIGITS\00"
@.str.1 = [11 x i32] [i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 48, i32 0]
@.str.2 = [11 x i8] c"$LOWERCASE\00"
@.str.3 = [27 x i32] [i32 97, i32 98, i32 99, i32 100, i32 101, i32 102, i32 103, i32 104, i32 105, i32 106, i32 107, i32 108, i32 109, i32 110, i32 111, i32 112, i32 113, i32 114, i32 115, i32 116, i32 117, i32 118, i32 119, i32 120, i32 121, i32 122, i32 0]
@.str.4 = [11 x i8] c"$UPPERCASE\00"
@.str.5 = [27 x i32] [i32 65, i32 66, i32 67, i32 68, i32 69, i32 70, i32 71, i32 72, i32 73, i32 74, i32 75, i32 76, i32 77, i32 78, i32 79, i32 80, i32 81, i32 82, i32 83, i32 84, i32 85, i32 86, i32 87, i32 88, i32 89, i32 90, i32 0]
@.str.6 = [7 x i8] c"$ALPHA\00"
@.str.7 = [53 x i32] [i32 97, i32 98, i32 99, i32 100, i32 101, i32 102, i32 103, i32 104, i32 105, i32 106, i32 107, i32 108, i32 109, i32 110, i32 111, i32 112, i32 113, i32 114, i32 115, i32 116, i32 117, i32 118, i32 119, i32 120, i32 121, i32 122, i32 65, i32 66, i32 67, i32 68, i32 69, i32 70, i32 71, i32 72, i32 73, i32 74, i32 75, i32 76, i32 77, i32 78, i32 79, i32 80, i32 81, i32 82, i32 83, i32 84, i32 85, i32 86, i32 87, i32 88, i32 89, i32 90, i32 0]
@.str.8 = [14 x i8] c"$ALPHANUMERIC\00"
@.str.9 = [63 x i32] [i32 97, i32 98, i32 99, i32 100, i32 101, i32 102, i32 103, i32 104, i32 105, i32 106, i32 107, i32 108, i32 109, i32 110, i32 111, i32 112, i32 113, i32 114, i32 115, i32 116, i32 117, i32 118, i32 119, i32 120, i32 121, i32 122, i32 65, i32 66, i32 67, i32 68, i32 69, i32 70, i32 71, i32 72, i32 73, i32 74, i32 75, i32 76, i32 77, i32 78, i32 79, i32 80, i32 81, i32 82, i32 83, i32 84, i32 85, i32 86, i32 87, i32 88, i32 89, i32 90, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 48, i32 0]
@.str.10 = [9 x i8] c"$SYMBOLS\00"
@.str.11 = [33 x i32] [i32 126, i32 96, i32 33, i32 64, i32 35, i32 36, i32 37, i32 94, i32 38, i32 42, i32 40, i32 41, i32 95, i32 43, i32 45, i32 61, i32 91, i32 93, i32 92, i32 123, i32 125, i32 124, i32 59, i32 39, i32 58, i32 34, i32 44, i32 46, i32 47, i32 60, i32 62, i32 63, i32 0]
@.str.12 = [11 x i8] c"$PRINTABLE\00"
@.str.13 = [95 x i32] [i32 97, i32 98, i32 99, i32 100, i32 101, i32 102, i32 103, i32 104, i32 105, i32 106, i32 107, i32 108, i32 109, i32 110, i32 111, i32 112, i32 113, i32 114, i32 115, i32 116, i32 117, i32 118, i32 119, i32 120, i32 121, i32 122, i32 65, i32 66, i32 67, i32 68, i32 69, i32 70, i32 71, i32 72, i32 73, i32 74, i32 75, i32 76, i32 77, i32 78, i32 79, i32 80, i32 81, i32 82, i32 83, i32 84, i32 85, i32 86, i32 87, i32 88, i32 89, i32 90, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 48, i32 126, i32 96, i32 33, i32 64, i32 35, i32 36, i32 37, i32 94, i32 38, i32 42, i32 40, i32 41, i32 95, i32 43, i32 45, i32 61, i32 91, i32 93, i32 92, i32 123, i32 125, i32 124, i32 59, i32 39, i32 58, i32 34, i32 44, i32 46, i32 47, i32 60, i32 62, i32 63, i32 0]
define i32* @config_resolve_character_set(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 36
br i1 %3, label %4, label %29
4: ; preds = %1
%5 = tail call i64 @streq(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %25
7: ; preds = %4
%8 = tail call i64 @streq(i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %25
10: ; preds = %7
%11 = tail call i64 @streq(i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %25
13: ; preds = %10
%14 = tail call i64 @streq(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %25
16: ; preds = %13
%17 = tail call i64 @streq(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = tail call i64 @streq(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = tail call i64 @streq(i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %22, %19, %16, %13, %10, %7, %4
%26 = phi i8* [ bitcast ([11 x i32]* @.str.1 to i8*), %4 ], [ bitcast ([27 x i32]* @.str.3 to i8*), %7 ], [ bitcast ([27 x i32]* @.str.5 to i8*), %10 ], [ bitcast ([53 x i32]* @.str.7 to i8*), %13 ], [ bitcast ([63 x i32]* @.str.9 to i8*), %16 ], [ bitcast ([33 x i32]* @.str.11 to i8*), %19 ], [ bitcast ([95 x i32]* @.str.13 to i8*), %22 ]
%27 = tail call i32* @wcsdup(i8* %26)
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %31
29: ; preds = %1, %22, %25
%30 = tail call i32* @mbs_duplicate_as_wcs(i8* %0)
br label %31
31: ; preds = %29, %25
%32 = phi i32* [ %30, %29 ], [ %27, %25 ]
ret i32* %32
}