// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]re2graph/algorithms.cpp
// Function: readDfaData(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
DFA readDfaData(string input_file) {
    /*
    各行的含义注解:
    3           // 字符集中的字符个数 (以下两行也可合并成一行)
    / * ^       // 以空格分隔的字符集。^代表任意非/和*的字符
    5           // 状态个数 (以下两行也可合并成一行)
    1 2 3 4 5   // 状态编号。若约定总是用从1开始的连续数字表示，则此行可省略
    1           // 开始状态的编号。若约定为1，则此行可省略
    1           // 结束状态个数。若约定为1，则此行可省略
    5           // 结束状态的编号
    7           // 转移函数的个数
    1 / 2       // 转移函数
    2 * 3
    3 * 4
    3 ^ 3
    4 ^ 3
    4 * 4
    4 / 5
    */
    DFA dfa;
    ifstream readfile;
    readfile.open(input_file.c_str(), ios::in);
    readfile >> dfa.char_cnt;
    string str;
    int num;
    for (int i = 0; i < dfa.char_cnt; ++i) {
        readfile >> str;
        str = parse_range(str);  // 进行范围解析, 返回解析出的字符组成的字符串
        for (auto s : str) {
            dfa.chars.push_back(s);
        }
    }
    readfile >> dfa.state_cnt;
    int min_state = INT_MAX;
    for (int i = 0; i < dfa.state_cnt; ++i) {
        readfile >> num;
        min_state = min(min_state, num);
        dfa.states.push_back(num);
    }
    for (auto &s : dfa.states) {
        s -= min_state;
    }
    readfile >> dfa.start_state >> dfa.end_state_cnt;
    for (int i = 0; i < dfa.end_state_cnt; ++i) {
        readfile >> num;
        dfa.end_states.push_back(num);
    }
    for (auto &s : dfa.end_states) {
        s -= min_state;
    }
    readfile >> num;
    for (int i = 0; i < dfa.state_cnt; ++i) {  // 先把空hash添加到vector
        map<char, int> tmp;
        dfa.jump_map.push_back(tmp);
    }
    for (int i = 0; i < num; ++i) {
        int x, y;
        readfile >> x >> str >> y;
        x -= min_state;
        y -= min_state;
        str = parse_range(str);
        for (auto c : str) {
            // if (dfa.jump_map[x].count(c)) {
            //     correct       = false;
            //     wrong_message = "一个状态输入同一个字符有多个下一状态";
            // }
            dfa.jump_map[x][c] = y;
        }
    }
    // cout << "DFA read over! " << endl;
    return dfa;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2b8, %rsp            # imm = 0x2B8
movq %rsi, %rbx
movq %rdi, %rbp
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%rdi)
movups %xmm0, 0x50(%rdi)
movups %xmm0, 0x40(%rdi)
movups %xmm0, 0x30(%rdi)
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
leaq 0xb0(%rsp), %rdi
callq 0x2240
movq (%rbx), %rsi
leaq 0xb0(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x2150
leaq 0xb0(%rsp), %rdi
movq %rbp, %rsi
callq 0x2140
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rbp, (%rsp)
leaq 0x10(%rbp), %rbx
movb $0x0, (%rax)
xorl %ebp, %ebp
leaq 0x18(%rsp), %r14
leaq 0x90(%rsp), %r15
leaq 0x40(%rsp), %r13
movq (%rsp), %rax
cmpl (%rax), %ebp
jge 0x81da
leaq 0xb0(%rsp), %rdi
movq %r14, %rsi
callq 0x22b0
movq %r15, %rdi
movq %r14, %rsi
callq 0x22d0
movq %r13, %rdi
movq %r15, %rsi
callq 0x4009
movq %r14, %rdi
movq %r13, %rsi
callq 0x2290
movq %r13, %rdi
callq 0x20d0
movq %r15, %rdi
callq 0x20d0
movq 0x18(%rsp), %r14
movq 0x20(%rsp), %r15
xorl %r12d, %r12d
cmpq %r12, %r15
je 0x81c6
movb (%r14,%r12), %al
movb %al, 0x40(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x8b80
incq %r12
jmp 0x81a9
incl %ebp
leaq 0x18(%rsp), %r14
leaq 0x90(%rsp), %r15
jmp 0x8153
movq (%rsp), %rbp
leaq 0x4(%rbp), %r14
leaq 0xb0(%rsp), %rdi
movq %r14, %rsi
callq 0x2140
leaq 0x28(%rbp), %rbx
xorl %r13d, %r13d
movl $0x7fffffff, 0x8(%rsp)  # imm = 0x7FFFFFFF
leaq 0xb0(%rsp), %r15
leaq 0xc(%rsp), %r12
cmpl (%r14), %r13d
jge 0x8243
movq %r15, %rdi
movq %r12, %rsi
callq 0x2140
movl 0xc(%rsp), %ebp
movq %rbx, %rdi
movq %r12, %rsi
callq 0x8b9a
movl 0x8(%rsp), %eax
cmpl %eax, %ebp
cmovll %ebp, %eax
movl %eax, 0x8(%rsp)
incl %r13d
movq (%rsp), %rbp
jmp 0x820e
movq 0x28(%rbp), %rax
movq 0x30(%rbp), %rcx
movl 0x8(%rsp), %edx
cmpq %rcx, %rax
je 0x825c
subl %edx, (%rax)
addq $0x4, %rax
jmp 0x824f
leaq 0x8(%rbp), %rsi
leaq 0xb0(%rsp), %rdi
callq 0x2140
leaq 0xc(%rbp), %rbx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2140
leaq 0x40(%rbp), %r15
xorl %r12d, %r12d
leaq 0xc(%rsp), %r13
cmpl (%rbx), %r12d
jge 0x82ad
leaq 0xb0(%rsp), %rdi
movq %r13, %rsi
callq 0x2140
movq %r15, %rdi
movq %r13, %rsi
callq 0x8b9a
incl %r12d
jmp 0x8288
movq 0x40(%rbp), %rax
movq 0x48(%rbp), %rcx
movl 0x8(%rsp), %edx
cmpq %rcx, %rax
je 0x82c6
subl %edx, (%rax)
addq $0x4, %rax
jmp 0x82b9
leaq 0xb0(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0x2140
leaq 0x48(%rsp), %r12
leaq 0x58(%rbp), %r15
xorl %r13d, %r13d
leaq 0x40(%rsp), %rbx
cmpl (%r14), %r13d
jge 0x8321
andl $0x0, 0x48(%rsp)
andq $0x0, 0x50(%rsp)
movq %r12, 0x58(%rsp)
movq %r12, 0x60(%rsp)
andq $0x0, 0x68(%rsp)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x960c
movq %rbx, %rdi
callq 0x3af6
incl %r13d
jmp 0x82e9
xorl %ebx, %ebx
leaq 0x18(%rsp), %r12
leaq 0x70(%rsp), %r13
leaq 0x40(%rsp), %r14
cmpl 0xc(%rsp), %ebx
jge 0x83fc
leaq 0xb0(%rsp), %rdi
leaq 0x14(%rsp), %rsi
callq 0x2140
movq %rax, %rdi
movq %r12, %rsi
callq 0x22b0
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x2140
movl 0x8(%rsp), %eax
subl %eax, 0x14(%rsp)
subl %eax, 0x10(%rsp)
movq %r13, %rdi
movq %r12, %rsi
callq 0x22d0
movq %rbx, 0x38(%rsp)
movq %r14, %rdi
movq %r13, %rsi
callq 0x4009
movq %r12, %rdi
movq %r14, %rsi
callq 0x2290
movq %r14, %rdi
callq 0x20d0
movq %r13, %rdi
callq 0x20d0
movq 0x18(%rsp), %r13
movq 0x20(%rsp), %rbx
xorl %r12d, %r12d
cmpq %r12, %rbx
je 0x83e2
movb (%r13,%r12), %al
movb %al, 0x40(%rsp)
movl 0x10(%rsp), %ebp
movslq 0x14(%rsp), %rax
imulq $0x30, %rax, %rdi
addq (%r15), %rdi
movq %r14, %rsi
callq 0x8f5a
movl %ebp, (%rax)
incq %r12
jmp 0x83b5
movq 0x38(%rsp), %rbx
incl %ebx
movq (%rsp), %rbp
leaq 0x18(%rsp), %r12
leaq 0x70(%rsp), %r13
jmp 0x8332
leaq 0x18(%rsp), %rdi
callq 0x20d0
leaq 0xb0(%rsp), %rdi
callq 0x2070
movq %rbp, %rax
addq $0x2b8, %rsp            # imm = 0x2B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x846b
movq %rax, %rbx
jmp 0x8490
movq %rax, %rbx
jmp 0x8483
jmp 0x846b
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
jmp 0x845c
jmp 0x846b
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x3af6
jmp 0x8479
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x20d0
jmp 0x8475
jmp 0x8472
jmp 0x8472
jmp 0x846b
jmp 0x8472
movq %rax, %rbx
jmp 0x8479
jmp 0x8472
movq %rax, %rbx
movq (%rsp), %rbp
leaq 0x18(%rsp), %rdi
callq 0x20d0
leaq 0xb0(%rsp), %rdi
callq 0x2070
movq %rbp, %rdi
callq 0x30fc
movq %rbx, %rdi
callq 0x2370