// File: /workspace/github_cpp_makefile_star2_O3/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 $0xe8, %rsp
cmpq $0x0, 0x8(%rsi)
je 0x2fd32
movq %rdx, %r14
movq %rdi, %r13
cmpq $0x0, (%rdi)
je 0x2fd4f
leaq -0xa0(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2e9b6
movq (%rbx), %rsi
leaq 0x16d59(%rip), %rdi     # 0x46a5e
xorl %eax, %eax
callq 0x4070
movq (%rbx), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x2fd20
callq 0x42b0
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x172e2(%rip), %rdi     # 0x4701b
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4480
movq %rsi, %rbx
leaq 0x10(%r13), %r12
movq %r12, %rdi
callq 0x31702
addq $0x18, %r13
cmpq %r13, %rax
je 0x2fedd
movq %rax, %r15
cmpl $0x1, 0x40(%rax)
jne 0x2ffb7
movq 0x48(%r15), %rax
cmpq 0x50(%r15), %rax
je 0x2ffe8
movq (%rax), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x26e80
leaq -0x110(%rbp), %rdi
movq %r14, %rsi
callq 0x26e80
leaq -0xa0(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x28244
testb %al, %al
jne 0x3006c
leaq -0x110(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x28244
testb %al, %al
jne 0x3006c
movq 0x48(%r15), %rax
movq %r15, -0xa8(%rbp)
movq 0x50(%r15), %rcx
movq %rcx, -0xb0(%rbp)
cmpq %rcx, %rax
je 0x2fe9c
movq %rax, -0xb8(%rbp)
movq (%rax), %r13
movq 0x60(%r14), %rax
subq 0x58(%r14), %rax
movq 0x60(%r13), %rcx
subq 0x58(%r13), %rcx
cmpq %rcx, %rax
jne 0x2fe84
movq 0x58(%r14), %rdi
cmpq %rdi, 0x60(%r14)
je 0x3000a
xorl %r15d, %r15d
xorl %r12d, %r12d
addq %r15, %rdi
movq 0x58(%r13), %rsi
addq %r15, %rsi
callq 0x2e77c
testb %al, %al
jne 0x2fe84
movq 0x58(%r13), %rdi
addq %r15, %rdi
movq 0x58(%r14), %rsi
addq %r15, %rsi
callq 0x2e77c
testb %al, %al
jne 0x2fe84
incq %r12
movq 0x58(%r14), %rdi
movq 0x60(%r14), %rax
subq %rdi, %rax
sarq $0x3, %rax
movabsq $0x4ec4ec4ec4ec4ec5, %rcx # imm = 0x4EC4EC4EC4EC4EC5
imulq %rcx, %rax
addq $0x68, %r15
cmpq %rax, %r12
jb 0x2fe2c
jmp 0x3000a
movq -0xb8(%rbp), %rax
addq $0x8, %rax
cmpq -0xb0(%rbp), %rax
jne 0x2fdf9
movl $0x78, %edi
callq 0x42e0
movq %rax, %r12
movq %rax, %rdi
movq %r14, %rsi
callq 0x254f0
movq -0xa8(%rbp), %rdi
movq %r12, -0x68(%rbp)
movq 0x50(%rdi), %rsi
cmpq 0x58(%rdi), %rsi
je 0x30042
movq %r12, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x50(%rdi)
jmp 0x3004f
xorps %xmm0, %xmm0
movaps %xmm0, -0x110(%rbp)
movq $0x0, -0x100(%rbp)
movl $0x78, %edi
callq 0x42e0
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0x254f0
leaq -0xa0(%rbp), %rdx
movq %r15, (%rdx)
leaq -0x110(%rbp), %rdi
xorl %esi, %esi
callq 0x19328
leaq -0x98(%rbp), %r14
movl $0x1, -0x8(%r14)
leaq -0x110(%rbp), %rsi
movq %r14, %rdi
callq 0x25a6a
movq %r12, %rdi
movq %rbx, %rsi
callq 0x3106c
movl -0xa0(%rbp), %ecx
movl %ecx, (%rax)
movq 0x8(%rax), %rdi
movq -0x98(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x90(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x88(%rbp), %rcx
movq %rcx, 0x18(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq $0x0, 0x10(%r14)
testq %rdi, %rdi
je 0x2ffa2
callq 0x42b0
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
je 0x2ffa2
callq 0x42b0
movq -0x110(%rbp), %rdi
testq %rdi, %rdi
jne 0x2fd1b
jmp 0x2fd20
movq (%rbx), %rbx
leaq -0xa0(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x2e9b6
movq (%r15), %rdx
leaq 0x16afc(%rip), %rdi     # 0x46ad2
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4070
movq (%r15), %rdi
jmp 0x2fd0f
movq (%rbx), %rsi
leaq 0x16b76(%rip), %rdi     # 0x46b68
xorl %eax, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4070
movq (%rbx), %rbx
leaq -0x68(%rbp), %rdi
movq %r14, %rsi
callq 0x2e9b6
leaq -0x58(%rbp), %r14
movq -0x10(%r14), %rdx
leaq 0x16c54(%rip), %rdi     # 0x46c7c
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4070
movq -0x10(%r14), %rdi
cmpq %r14, %rdi
je 0x3004f
callq 0x42b0
jmp 0x3004f
addq $0x48, %rdi
leaq -0x68(%rbp), %rdx
callq 0x19328
leaq -0x110(%rbp), %rdi
callq 0x27ca8
leaq -0xa0(%rbp), %rdi
callq 0x27ca8
jmp 0x2fd20
leaq -0x58(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x16b99(%rip), %rsi     # 0x46c14
leaq 0x16bd7(%rip), %rdx     # 0x46c59
leaq -0x68(%rbp), %rdi
callq 0xf868
leaq 0x16ce9(%rip), %rsi     # 0x46d7b
leaq -0x48(%rbp), %rdi
movq %rbx, %rdx
callq 0xe95b
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
leaq -0x68(%rbp), %rdi
callq 0x4110
leaq -0x38(%rbp), %r14
movq -0x10(%r14), %rdi
cmpq %r14, %rdi
je 0x300c1
callq 0x42b0
leaq -0xd8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x273f2
leaq 0x16b7f(%rip), %rsi     # 0x46c5a
leaq -0x48(%rbp), %rdi
leaq -0xd8(%rbp), %rdx
callq 0xe495
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
leaq -0x68(%rbp), %rdi
callq 0x4110
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x3010a
callq 0x42b0
leaq -0xc8(%rbp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x30120
callq 0x42b0
leaq -0xd8(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x273f2
leaq 0x16b33(%rip), %rsi     # 0x46c6d
leaq -0x48(%rbp), %rdi
leaq -0xd8(%rbp), %rdx
callq 0xe495
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
leaq -0x68(%rbp), %rdi
callq 0x4110
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x30169
callq 0x42b0
movq -0xd8(%rbp), %rdi
cmpq %r12, %rdi
je 0x3017a
callq 0x42b0
movl $0x28, %edi
callq 0x4190
movq %rax, %r14
leaq -0x68(%rbp), %rdx
movq %rax, %rdi
movl $0x16, %esi
callq 0x333ee
leaq 0x2abd1(%rip), %rsi     # 0x5ad70
leaq -0x21c06(%rip), %rdx    # 0xe5a0
movq %r14, %rdi
callq 0x4540
jmp 0x30223
movq %rax, %rbx
movq %r14, %rdi
callq 0x4250
jmp 0x30226
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x301d3
callq 0x42b0
jmp 0x301d3
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r12, %rdi
jne 0x30214
jmp 0x30226
jmp 0x30223
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x301f9
callq 0x42b0
jmp 0x301f9
movq %rax, %rbx
leaq -0xc8(%rbp), %rax
jmp 0x3020b
jmp 0x30223
movq %rax, %rbx
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x30226
callq 0x42b0
jmp 0x30226
movq %rax, %rbx
movq %r12, %rdi
jmp 0x3022f
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r15, %rdi
je 0x3027c
callq 0x42b0
jmp 0x3027c
jmp 0x30279
jmp 0x30279
jmp 0x30279
movq %rax, %rbx
jmp 0x30288
movq %rax, %rbx
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
jne 0x3025a
jmp 0x30266
jmp 0x30263
movq %rax, %rbx
movq %r15, %rdi
callq 0x42b0
jmp 0x30266
jmp 0x30279
movq %rax, %rbx
movq -0x110(%rbp), %rdi
testq %rdi, %rdi
je 0x30294
callq 0x42b0
jmp 0x30294
movq %rax, %rbx
leaq -0x110(%rbp), %rdi
callq 0x27ca8
leaq -0xa0(%rbp), %rdi
callq 0x27ca8
movq %rbx, %rdi
callq 0x4560