// File: /workspace/github_cpp_makefile_star2_O1/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, %r14
movq %rdi, %rbx
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 0x2230
movq (%r14), %rsi
leaq 0xb0(%rsp), %rdi
movl $0x8, %edx
callq 0x2130
leaq 0xb0(%rsp), %rdi
movq %rbx, %rsi
callq 0x2120
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
cmpl $0x0, (%rbx)
jle 0xbf03
leaq 0x10(%rbx), %r14
leaq 0xa0(%rsp), %r12
movq $0x0, 0x8(%rsp)
leaq 0x18(%rsp), %r13
leaq 0x90(%rsp), %rbp
leaq 0xb0(%rsp), %rdi
movq %r13, %rsi
callq 0x22a0
movq %r12, 0x90(%rsp)
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
callq 0x44e2
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movq %rbp, %rsi
callq 0x4b9c
movq %r13, %rdi
movq %r15, %rsi
callq 0x2290
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xbe7c
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x90(%rsp), %rdi
cmpq %r12, %rdi
je 0xbe99
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x20(%rsp), %r12
testq %r12, %r12
je 0xbeda
movq 0x18(%rsp), %r13
xorl %ebp, %ebp
movb (%r13,%rbp), %al
movb %al, 0x40(%rsp)
movq 0x18(%rbx), %rsi
cmpq 0x20(%rbx), %rsi
je 0xbec5
movb %al, (%rsi)
incq 0x18(%rbx)
jmp 0xbed2
movq %r14, %rdi
leaq 0x40(%rsp), %rdx
callq 0xee8c
incq %rbp
cmpq %rbp, %r12
jne 0xbeaa
movq 0x8(%rsp), %rax
incl %eax
movq %rax, 0x8(%rsp)
cmpl (%rbx), %eax
leaq 0xa0(%rsp), %r12
leaq 0x18(%rsp), %r13
leaq 0x90(%rsp), %rbp
jl 0xbe18
leaq 0x4(%rbx), %r13
leaq 0xb0(%rsp), %rdi
movq %r13, %rsi
callq 0x2120
cmpl $0x0, (%r13)
jle 0xbf81
leaq 0x28(%rbx), %rax
movq %rax, 0x8(%rsp)
movl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
xorl %r15d, %r15d
leaq 0xb0(%rsp), %r12
leaq 0x4(%rsp), %rbp
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2120
movl 0x4(%rsp), %eax
cmpl %r14d, %eax
cmovll %eax, %r14d
movq 0x30(%rbx), %rsi
cmpq 0x38(%rbx), %rsi
je 0xbf69
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x30(%rbx)
jmp 0xbf76
movq 0x8(%rsp), %rdi
movq %rbp, %rdx
callq 0xef7e
incl %r15d
cmpl (%r13), %r15d
jl 0xbf3d
jmp 0xbf87
movl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rcx
cmpq %rcx, %rax
je 0xbf9d
subl %r14d, (%rax)
addq $0x4, %rax
jmp 0xbf8f
leaq 0x8(%rbx), %rsi
leaq 0xb0(%rsp), %rdi
callq 0x2120
leaq 0xc(%rbx), %r15
movq %rax, %rdi
movq %r15, %rsi
callq 0x2120
cmpl $0x0, (%r15)
jle 0xc013
leaq 0x40(%rbx), %rax
movq %rax, 0x8(%rsp)
xorl %r12d, %r12d
leaq 0x4(%rsp), %rbp
leaq 0xb0(%rsp), %rdi
movq %rbp, %rsi
callq 0x2120
movq 0x48(%rbx), %rsi
cmpq 0x50(%rbx), %rsi
je 0xbffe
movl 0x4(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x48(%rbx)
jmp 0xc00b
movq 0x8(%rsp), %rdi
movq %rbp, %rdx
callq 0xef7e
incl %r12d
cmpl (%r15), %r12d
jl 0xbfd4
movq 0x40(%rbx), %rax
movq 0x48(%rbx), %rcx
cmpq %rcx, %rax
je 0xc029
subl %r14d, (%rax)
addq $0x4, %rax
jmp 0xc01b
leaq 0xb0(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x2120
movl %r14d, 0x3c(%rsp)
movq %r13, 0x8(%rsp)
cmpl $0x0, (%r13)
jle 0xc09c
leaq 0x48(%rsp), %rbp
leaq 0x58(%rbx), %r15
xorl %r14d, %r14d
leaq 0x40(%rsp), %r12
xorl %r13d, %r13d
movl $0x0, 0x48(%rsp)
movq %r14, 0x50(%rsp)
movq %rbp, 0x58(%rsp)
movq %rbp, 0x60(%rsp)
movq %r14, 0x68(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0xdf6a
movq %r12, %rdi
callq 0x448c
incl %r13d
movq 0x8(%rsp), %rax
cmpl (%rax), %r13d
jl 0xc060
cmpl $0x0, 0x4(%rsp)
jle 0xc1cb
leaq 0x80(%rsp), %r15
xorl %r12d, %r12d
leaq 0x18(%rsp), %r13
leaq 0x70(%rsp), %rbp
leaq 0x40(%rsp), %r14
leaq 0xb0(%rsp), %rdi
leaq 0x14(%rsp), %rsi
callq 0x2120
movq %rax, %rdi
movq %r13, %rsi
callq 0x22a0
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x2120
movl 0x3c(%rsp), %eax
subl %eax, 0x14(%rsp)
subl %eax, 0x10(%rsp)
movq %r15, 0x70(%rsp)
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
callq 0x44e2
movq %r14, %rdi
movq %rbp, %rsi
callq 0x4b9c
movq %r13, %rdi
movq %r14, %rsi
callq 0x2290
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xc143
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x2200
movq %r12, 0x8(%rsp)
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0xc162
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x20(%rsp), %r12
testq %r12, %r12
je 0xc1a6
movq 0x18(%rsp), %rbp
xorl %r13d, %r13d
movb (%rbp,%r13), %al
movb %al, 0x40(%rsp)
movl 0x10(%rsp), %r15d
movslq 0x14(%rsp), %rax
leaq (%rax,%rax,2), %rdi
shlq $0x4, %rdi
addq 0x58(%rbx), %rdi
movq %r14, %rsi
callq 0xd87a
movl %r15d, (%rax)
incq %r13
cmpq %r13, %r12
jne 0xc174
movq 0x8(%rsp), %r12
incl %r12d
cmpl 0x4(%rsp), %r12d
leaq 0x80(%rsp), %r15
leaq 0x18(%rsp), %r13
leaq 0x70(%rsp), %rbp
jl 0xc0c1
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0xc1e7
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x2200
leaq 0xb0(%rsp), %rdi
callq 0x2070
movq %rbx, %rax
addq $0x2b8, %rsp            # imm = 0x2B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xc270
movq %rax, %r14
jmp 0xc29c
movq %rax, %r14
jmp 0xc28f
jmp 0xc270
jmp 0xc270
movq %rax, %r14
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0xc273
movq 0x80(%rsp), %rsi
jmp 0xc24f
jmp 0xc270
jmp 0xc270
movq %rax, %r14
movq 0x90(%rsp), %rdi
cmpq %r12, %rdi
je 0xc273
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xc273
movq %rax, %r14
leaq 0x40(%rsp), %rdi
callq 0x448c
jmp 0xc273
jmp 0xc270
jmp 0xc270
jmp 0xc270
jmp 0xc270
movq %rax, %r14
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0xc28f
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x2200
leaq 0xb0(%rsp), %rdi
callq 0x2070
movq %rbx, %rdi
callq 0x3bea
movq %r14, %rdi
callq 0x2350