// File: 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
subq $0x320, %rsp            # imm = 0x320
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x288(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4590
testb $0x1, %al
jne 0x6acf1
jmp 0x6ad04
leaq 0x25fa8(%rip), %rdi     # 0x90ca0
movb $0x0, %al
callq 0x4080
jmp 0x6b57d
movq -0x288(%rbp), %rax
cmpq $0x0, (%rax)
je 0x6ad6c
movq -0x18(%rbp), %rsi
leaq -0x38(%rbp), %rdi
movq %rdi, -0x290(%rbp)
callq 0x68c30
movq -0x290(%rbp), %rdi
callq 0x4180
movq %rax, %rsi
leaq 0x25fcb(%rip), %rdi     # 0x90d06
xorl %eax, %eax
callq 0x4080
jmp 0x6ad44
leaq -0x38(%rbp), %rdi
callq 0x4688
jmp 0x6b57d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x4688
jmp 0x6b5d2
movq -0x288(%rbp), %rdi
addq $0x10, %rdi
movq -0x10(%rbp), %rsi
callq 0x6cc90
movq -0x288(%rbp), %rdi
movq %rax, -0x50(%rbp)
addq $0x10, %rdi
callq 0x6ccf0
movq %rax, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x6ccc0
testb $0x1, %al
jne 0x6adae
jmp 0x6b4bb
leaq -0x50(%rbp), %rdi
callq 0x6cea0
cmpl $0x1, 0x20(%rax)
je 0x6ae2f
movq -0x10(%rbp), %rdi
callq 0x4180
movq %rax, -0x298(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x78(%rbp), %rdi
movq %rdi, -0x2a0(%rbp)
callq 0x68c30
movq -0x2a0(%rbp), %rdi
callq 0x4180
movq -0x298(%rbp), %rsi
movq %rax, %rdx
leaq 0x25f7c(%rip), %rdi     # 0x90d7a
xorl %eax, %eax
callq 0x4080
jmp 0x6ae07
leaq -0x78(%rbp), %rdi
callq 0x4688
jmp 0x6b57d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x4688
jmp 0x6b5d2
leaq -0x50(%rbp), %rdi
callq 0x6cea0
addq $0x20, %rax
addq $0x8, %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
callq 0x167a0
testb $0x1, %al
jne 0x6ae53
jmp 0x6ae72
movq -0x10(%rbp), %rdi
callq 0x4180
movq %rax, %rsi
leaq 0x25faa(%rip), %rdi     # 0x90e10
movb $0x0, %al
callq 0x4080
jmp 0x6b57d
movq -0x80(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x34060
movq (%rax), %rsi
leaq -0xc0(%rbp), %rdi
movq %rdi, -0x2a8(%rbp)
callq 0x68ac0
movq -0x2a8(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x100(%rbp), %rdi
callq 0x68ac0
jmp 0x6aeb5
leaq -0x100(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x88(%rbp), %rdi
movq -0xc8(%rbp), %rsi
callq 0x57d70
movb %al, -0x2a9(%rbp)
jmp 0x6aede
movb -0x2a9(%rbp), %al
testb $0x1, %al
jne 0x6af14
jmp 0x6aeea
movq -0xc8(%rbp), %rdi
movq -0x88(%rbp), %rsi
callq 0x57d70
movb %al, -0x2aa(%rbp)
jmp 0x6af05
movb -0x2aa(%rbp), %al
testb $0x1, %al
jne 0x6af14
jmp 0x6b18c
leaq -0x121(%rbp), %rdi
movq %rdi, -0x2b8(%rbp)
callq 0x45f0
movq -0x2b8(%rbp), %rdx
leaq 0x25f87(%rip), %rsi     # 0x90ebc
leaq -0x120(%rbp), %rdi
callq 0x4450
jmp 0x6af43
leaq -0x121(%rbp), %rdi
callq 0x4380
movq -0x10(%rbp), %rdx
leaq 0x260c9(%rip), %rsi     # 0x91023
leaq -0x148(%rbp), %rdi
callq 0x16320
jmp 0x6af68
leaq -0x120(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x43f0
jmp 0x6af7d
leaq -0x148(%rbp), %rdi
callq 0x4688
movq -0x88(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x566e0
jmp 0x6af9e
leaq 0x25f5d(%rip), %rsi     # 0x90f02
leaq -0x168(%rbp), %rdi
leaq -0x188(%rbp), %rdx
callq 0x15d60
jmp 0x6afba
leaq -0x120(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x43f0
jmp 0x6afcf
leaq -0x168(%rbp), %rdi
callq 0x4688
leaq -0x188(%rbp), %rdi
callq 0x4688
movq -0xc8(%rbp), %rsi
leaq -0x1c8(%rbp), %rdi
callq 0x566e0
jmp 0x6affc
leaq 0x25f12(%rip), %rsi     # 0x90f15
leaq -0x1a8(%rbp), %rdi
leaq -0x1c8(%rbp), %rdx
callq 0x15d60
jmp 0x6b018
leaq -0x120(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
callq 0x43f0
jmp 0x6b02d
leaq -0x1a8(%rbp), %rdi
callq 0x4688
leaq -0x1c8(%rbp), %rdi
callq 0x4688
movl $0x28, %edi
callq 0x41c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x2c0(%rbp)
movl $0x16, %esi
leaq -0x120(%rbp), %rdx
callq 0x73a90
jmp 0x6b06f
movq -0x2c0(%rbp), %rdi
leaq 0x5acd3(%rip), %rsi     # 0xc5d50
leaq -0x551f4(%rip), %rdx    # 0x15e90
callq 0x45b0
jmp 0x6b5db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6b4aa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6b49e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x121(%rbp), %rdi
callq 0x4380
jmp 0x6b49e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6b17b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x4688
jmp 0x6b17b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6b121
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x4688
leaq -0x188(%rbp), %rdi
callq 0x4688
jmp 0x6b17b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6b155
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x4688
leaq -0x1c8(%rbp), %rdi
callq 0x4688
jmp 0x6b17b
movq -0x2c0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
callq 0x4280
leaq -0x120(%rbp), %rdi
callq 0x4688
jmp 0x6b49e
movq -0x18(%rbp), %rdi
callq 0x68ba0
movq %rax, -0x1d0(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x1d8(%rbp)
movq -0x1d8(%rbp), %rdi
callq 0x34240
movq %rax, -0x1e0(%rbp)
movq -0x1d8(%rbp), %rdi
callq 0x34270
movq %rax, -0x1e8(%rbp)
leaq -0x1e0(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
callq 0x342a0
testb $0x1, %al
jne 0x6b1e9
jmp 0x6b408
leaq -0x1e0(%rbp), %rdi
callq 0x342e0
movq %rax, -0x1f0(%rbp)
movq -0x1f0(%rbp), %rax
movq (%rax), %rdi
callq 0x68ba0
movq %rax, -0x1f8(%rbp)
movq -0x1d0(%rbp), %rdi
callq 0x16590
movq %rax, -0x2c8(%rbp)
movq -0x1f8(%rbp), %rdi
callq 0x16590
movq %rax, %rcx
movq -0x2c8(%rbp), %rax
cmpq %rcx, %rax
jne 0x6b3f5
movb $0x1, -0x1f9(%rbp)
movq $0x0, -0x208(%rbp)
xorl %eax, %eax
testb $0x1, -0x1f9(%rbp)
movb %al, -0x2c9(%rbp)
je 0x6b297
movq -0x208(%rbp), %rax
movq %rax, -0x2d8(%rbp)
movq -0x1d0(%rbp), %rdi
callq 0x16590
movq %rax, %rcx
movq -0x2d8(%rbp), %rax
cmpq %rcx, %rax
setb %al
movb %al, -0x2c9(%rbp)
movb -0x2c9(%rbp), %al
testb $0x1, %al
jne 0x6b2a6
jmp 0x6b366
movq -0x1d0(%rbp), %rdi
movq -0x208(%rbp), %rsi
callq 0x165c0
movq %rax, -0x2e8(%rbp)
movq -0x1f8(%rbp), %rdi
movq -0x208(%rbp), %rsi
callq 0x165c0
movq -0x2e8(%rbp), %rdi
movq %rax, %rsi
callq 0x687d0
movb %al, -0x2d9(%rbp)
jmp 0x6b2ea
movb -0x2d9(%rbp), %al
testb $0x1, %al
jne 0x6b346
jmp 0x6b2f6
movq -0x1f8(%rbp), %rdi
movq -0x208(%rbp), %rsi
callq 0x165c0
movq %rax, -0x2f8(%rbp)
movq -0x1d0(%rbp), %rdi
movq -0x208(%rbp), %rsi
callq 0x165c0
movq -0x2f8(%rbp), %rdi
movq %rax, %rsi
callq 0x687d0
movb %al, -0x2e9(%rbp)
jmp 0x6b33a
movb -0x2e9(%rbp), %al
testb $0x1, %al
jne 0x6b346
jmp 0x6b34d
movb $0x0, -0x1f9(%rbp)
jmp 0x6b34f
movq -0x208(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x208(%rbp)
jmp 0x6b256
testb $0x1, -0x1f9(%rbp)
je 0x6b3f3
movq -0x10(%rbp), %rdi
callq 0x4180
movq %rax, -0x300(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x228(%rbp), %rdi
callq 0x68c30
jmp 0x6b395
leaq -0x228(%rbp), %rdi
callq 0x4180
movq -0x300(%rbp), %rsi
movq %rax, %rdx
leaq 0x25b72(%rip), %rdi     # 0x90f24
xorl %eax, %eax
callq 0x4080
jmp 0x6b3bb
leaq -0x228(%rbp), %rdi
callq 0x4688
movl $0x1, -0x22c(%rbp)
jmp 0x6b481
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x4688
jmp 0x6b49e
jmp 0x6b3f5
jmp 0x6b3f7
leaq -0x1e0(%rbp), %rdi
callq 0x34300
jmp 0x6b1cd
movq -0x80(%rbp), %rax
movq %rax, -0x310(%rbp)
movl $0x78, %edi
callq 0x4310
movq %rax, -0x308(%rbp)
jmp 0x6b426
movq -0x308(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x4d870
jmp 0x6b438
movq -0x310(%rbp), %rdi
movq -0x308(%rbp), %rax
movq %rax, -0x238(%rbp)
leaq -0x238(%rbp), %rsi
callq 0x35a60
jmp 0x6b45b
movl $0x1, -0x22c(%rbp)
jmp 0x6b481
movq -0x308(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
callq 0x42d0
jmp 0x6b49e
leaq -0x100(%rbp), %rdi
callq 0x57350
leaq -0xc0(%rbp), %rdi
callq 0x57350
jmp 0x6b57d
leaq -0x100(%rbp), %rdi
callq 0x57350
leaq -0xc0(%rbp), %rdi
callq 0x57350
jmp 0x6b5d2
leaq -0x250(%rbp), %rdi
callq 0x16700
movl $0x78, %edi
callq 0x4310
movq %rax, -0x318(%rbp)
jmp 0x6b4da
movq -0x318(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x4d870
jmp 0x6b4ec
movq -0x318(%rbp), %rax
movq %rax, -0x258(%rbp)
leaq -0x250(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x35a60
jmp 0x6b50f
movl $0x1, -0x27c(%rbp)
leaq -0x278(%rbp), %rdi
leaq -0x27c(%rbp), %rsi
leaq -0x250(%rbp), %rdx
callq 0x6cd20
jmp 0x6b535
movq -0x288(%rbp), %rdi
addq $0x10, %rdi
movq -0x10(%rbp), %rsi
callq 0x6cd60
movq %rax, -0x320(%rbp)
jmp 0x6b552
movq -0x320(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x6ce40
leaq -0x278(%rbp), %rdi
callq 0x6ce80
leaq -0x250(%rbp), %rdi
callq 0x166a0
addq $0x320, %rsp            # imm = 0x320
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6b5c6
movq -0x318(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
callq 0x42d0
jmp 0x6b5c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x278(%rbp), %rdi
callq 0x6ce80
leaq -0x250(%rbp), %rdi
callq 0x166a0
movq -0x40(%rbp), %rdi
callq 0x45e0
nopl (%rax,%rax)