// File: /workspace/github_cpp_makefile_star2_O2/acliusBackHome[P]kamaya/dist/ParseDeclaration.cpp
// Function: ParseScope::declaration(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, ParseFunction const&)
void ParseScope::declaration(const string &symbol, const ParseFunction &function) {
    if (symbol.empty()) {
        printf("ParseDeclaration(const string &symbol, const ParseFunction &function): 警告: 试图声明空符号\n");
        return;
    }
    if (parent_scope) {
        // TODO: 加入结构体后需要判断当前语句块是否是结构体声明里的
        printf("ParseDeclaration(const string &symbol, const ParseFunction &function): 警告: 试图在非静态区声明函数%s\n",
               function.get_info().c_str());
        return;
    }
    auto it = symbol2dec_ptr.find(symbol);
    if (it != symbol2dec_ptr.end()) {
        if (it->second.first != D_FUNCTION) {
            printf("ParseDeclaration(const string &symbol, const ParseFunction &function): 警告: "
                   "符号%s已被声明但不是函数声明, 试图重声明为函数%s\n", symbol.c_str(),
                   function.get_info().c_str());
            return;
        }
        vector<size_t> &dec_ptr = it->second.second;
        if (dec_ptr.empty()) {
            printf("ParseDeclaration(const string &symbol, const ParseFunction &function): 警告: 发现异常:"
                   "符号%s被声明为函数, 但是找不到其记录, 请检查实现和调用\n", symbol.c_str());
            return;
        }
        const ParseType &ret_type = ((ParseFunction *) dec_ptr[0])->get_ret_type(),
                &this_ret_type = function.get_ret_type();
        if (ret_type < this_ret_type || this_ret_type < ret_type) {
            string info = "ParseDeclaration(const string &symbol, const ParseFunction &function)";
            info += " symbol=" + symbol;
            info += " previous_ret_type" + ret_type.get_info();
            info += " this_ret_type" + this_ret_type.get_info();
            throw ParseException(EX_INVALID_FUNC_OVERRIDE, info);
        }
        const auto &this_args = function.get_args();
        for (const auto &func_ptr : dec_ptr) {
            const auto &args = ((ParseFunction *) func_ptr)->get_args();
            if (this_args.size() == args.size()) {
                bool is_the_same = true;
                for (size_t i = 0; is_the_same && i < this_args.size(); ++i) {
                    if (this_args[i] < args[i] || args[i] < this_args[i]) {
                        is_the_same = false;
                    }
                }
                if (is_the_same) {
                    printf("ParseDeclaration(const string &symbol, const ParseFunction &function): 警告:"
                           "试图处重复定义函数%s: %s, 跳过此操作\n", symbol.c_str(), function.get_info().c_str());
                    return;
                }
            }
        }
        dec_ptr.emplace_back((size_t) new ParseFunction(function));
        return;
    }
    vector<size_t> func_ptr;
    func_ptr.emplace_back((size_t) new ParseFunction(function));
    symbol2dec_ptr[symbol] = pair<DeclarationType, vector<size_t> >(D_FUNCTION, func_ptr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
cmpq $0x0, 0x8(%rsi)
je 0x28660
movq %rdx, %r14
movq %rdi, %r13
cmpq $0x0, (%rdi)
je 0x2867d
leaq -0x118(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x27726
movq (%rbx), %rsi
leaq 0x133b7(%rip), %rdi     # 0x3b9f6
xorl %eax, %eax
callq 0x4060
movq %rbx, %rdi
callq 0x4598
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1394c(%rip), %rdi     # 0x3bfb3
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4430
movq %rsi, %rbx
leaq 0x10(%r13), %r15
movq %r15, %rdi
callq 0x29b18
addq $0x18, %r13
cmpq %r13, %rax
je 0x287ba
movq %rax, %r12
cmpl $0x1, 0x40(%rax)
jne 0x28849
movq 0x48(%r12), %rax
cmpq 0x50(%r12), %rax
je 0x288c6
movq (%rax), %rsi
leaq -0x118(%rbp), %rdi
callq 0x210f4
leaq -0xe0(%rbp), %rdi
movq %r14, %rsi
callq 0x210f4
leaq -0x118(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x2214a
testb %al, %al
jne 0x28910
leaq -0xe0(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x2214a
testb %al, %al
jne 0x28910
movq %r12, %rax
addq $0x48, %rax
movq %rax, -0x70(%rbp)
movq 0x48(%r12), %rax
movq 0x50(%r12), %rcx
movq %rcx, -0x78(%rbp)
cmpq -0x78(%rbp), %rax
je 0x288e8
movq %rax, -0x80(%rbp)
movq (%rax), %r12
movq 0x60(%r14), %rax
subq 0x58(%r14), %rax
movq 0x60(%r12), %rcx
subq 0x58(%r12), %rcx
cmpq %rcx, %rax
jne 0x287ad
movb $0x1, %cl
xorl %r13d, %r13d
xorl %r15d, %r15d
testb $0x1, %cl
je 0x287ad
movq 0x58(%r14), %rdi
movq 0x60(%r14), %rax
subq %rdi, %rax
cqto
pushq $0x68
popq %rcx
idivq %rcx
cmpq %rax, %r15
jae 0x2887a
addq %r13, %rdi
movq 0x58(%r12), %rsi
addq %r13, %rsi
callq 0x2753a
testb %al, %al
jne 0x287a2
movq 0x58(%r12), %rdi
addq %r13, %rdi
movq 0x58(%r14), %rsi
addq %r13, %rsi
callq 0x2753a
movb $0x1, %cl
testb %al, %al
je 0x287a4
xorl %ecx, %ecx
incq %r15
addq $0x68, %r13
jmp 0x28753
movq -0x80(%rbp), %rax
addq $0x8, %rax
jmp 0x28723
xorps %xmm0, %xmm0
movaps %xmm0, -0xe0(%rbp)
andq $0x0, -0xd0(%rbp)
pushq $0x78
popq %rdi
callq 0x42a0
movq %rax, %r12
movq %rax, %rdi
movq %r14, %rsi
callq 0x1f2ba
leaq -0x118(%rbp), %rsi
movq %r12, (%rsi)
leaq -0xe0(%rbp), %rdi
callq 0x1679a
leaq -0x110(%rbp), %r14
movl $0x1, -0x8(%r14)
leaq -0xe0(%rbp), %rsi
movq %r14, %rdi
callq 0x1fa14
movq %r15, %rdi
movq %rbx, %rsi
callq 0x29554
leaq -0x118(%rbp), %rsi
movq %rax, %rdi
callq 0x295be
movq %r14, %rdi
callq 0xd238
leaq -0xe0(%rbp), %rdi
callq 0xd238
jmp 0x2864e
movq (%rbx), %rbx
leaq -0x118(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x27726
movq (%r15), %rdx
leaq 0x13202(%rip), %rdi     # 0x3ba6a
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4060
movq %r15, %rdi
jmp 0x28649
movq (%rbx), %rbx
leaq -0x68(%rbp), %rdi
movq %r14, %rsi
callq 0x27726
leaq -0x68(%rbp), %r14
movq (%r14), %rdx
leaq 0x1337d(%rip), %rdi     # 0x3bc14
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4060
movq %r14, %rdi
callq 0x4598
leaq -0xe0(%rbp), %rdi
callq 0x21c36
leaq -0x118(%rbp), %rdi
callq 0x21c36
jmp 0x2864e
movq (%rbx), %rsi
leaq 0x13230(%rip), %rdi     # 0x3bb00
xorl %eax, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4060
pushq $0x78
popq %rdi
callq 0x42a0
movq %rax, %r12
movq %rax, %rdi
movq %r14, %rsi
callq 0x1f2ba
leaq -0x68(%rbp), %rsi
movq %r12, (%rsi)
movq -0x70(%rbp), %rdi
callq 0x1679a
jmp 0x288a9
leaq 0x13295(%rip), %rsi     # 0x3bbac
leaq -0x68(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x4130
leaq 0x133e8(%rip), %rsi     # 0x3bd13
leaq -0x48(%rbp), %rdi
movq %rbx, %rdx
callq 0xcad6
leaq -0x68(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x4580
leaq -0x48(%rbp), %rdi
callq 0x4598
leaq -0xa0(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x215a0
leaq 0x1328b(%rip), %rsi     # 0x3bbf2
leaq -0x48(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq 0xc837
leaq -0x68(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x4580
leaq -0x48(%rbp), %rdi
callq 0x4598
leaq -0xa0(%rbp), %rdi
callq 0x4598
leaq -0xa0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x215a0
leaq 0x13252(%rip), %rsi     # 0x3bc05
leaq -0x48(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq 0xc837
leaq -0x68(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x4580
leaq -0x48(%rbp), %rdi
callq 0x4598
leaq -0xa0(%rbp), %rdi
callq 0x4598
pushq $0x28
popq %rdi
callq 0x4180
movq %rax, %r14
pushq $0x16
popq %rsi
leaq -0x68(%rbp), %rdx
movq %rax, %rdi
callq 0x2b53c
leaq 0x2a36a(%rip), %rsi     # 0x52d70
leaq -0x1c165(%rip), %rdx    # 0xc8a8
movq %r14, %rdi
callq 0x44e0
jmp 0x28a63
movq %rax, %rbx
movq %r14, %rdi
callq 0x4220
jmp 0x28a66
jmp 0x28a2a
jmp 0x28a38
jmp 0x28a63
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x4598
jmp 0x28a3b
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
jmp 0x28a5c
movq %rax, %rbx
movq %r12, %rdi
callq 0x4270
jmp 0x28aac
jmp 0x28a63
jmp 0x28aa9
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x4598
jmp 0x28a66
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x4598
jmp 0x28aac
jmp 0x28aa9
jmp 0x28aa9
movq %rax, %rbx
jmp 0x28ab8
movq %rax, %rbx
movq %r14, %rdi
callq 0xd238
jmp 0x28a9b
jmp 0x28a98
movq %rax, %rbx
movq %r12, %rdi
callq 0x4270
jmp 0x28a9b
jmp 0x28aa9
movq %rax, %rbx
leaq -0xe0(%rbp), %rdi
callq 0xd238
jmp 0x28ac4
movq %rax, %rbx
leaq -0xe0(%rbp), %rdi
callq 0x21c36
leaq -0x118(%rbp), %rdi
callq 0x21c36
movq %rbx, %rdi
callq 0x4500