// File: /workspace/github_cpp_makefile_star2_O1/acliusBackHome[P]kamaya/dist/ParseExpression.cpp
// Function: ParseExpression::get_ret_type() const
const ParseType &ParseExpression::get_ret_type() const {
    if (ret_type_id != (size_t) -1) {
        return ParseType::get_type(ret_type_id);
    }
    // -1表示未经过计算
    switch (expr_type) {
        case E_ADD:
        case E_SUB:
        case E_MUL:
        case E_DIV:
        case E_MOD:
        case E_POW: {
            size_t &ret_cache = (((ParseExpression *) this)->ret_type_id);
            try {
                ret_cache = ParseType::convert(expr_type,
                                               get_expression(child[0]).get_ret_type(),
                                               get_expression(child[1]).get_ret_type()
                );
            } catch (ParseException &exc) {
                string info = "in ParseExpression::get_ret_type()";
                info += " expr=" + to_string(get_id());
                exc.push_trace(info);
                throw exc;
            }
            return ParseType::get_type(ret_cache);
        }
        case E_CONST: {
            size_t &ret_cache = (((ParseExpression *) this)->ret_type_id);
            ret_cache = ParseType(*((ParseConstant *) child[0])).get_id();
            return ParseType::get_type(ret_cache);
        }
        case E_VAR: {
            size_t &ret_cache = (((ParseExpression *) this)->ret_type_id);
            ret_cache = ((ParseVariable *) child[0])->get_type().get_id();
            return ParseType::get_type(ret_cache);
        }
        case E_ADR:
        case E_PTR:
        case E_NEG:
        case E_POS:
        case E_BIT_NOT:
        case E_NOT: {
            size_t &ret_cache = (((ParseExpression *) this)->ret_type_id);
            ret_cache = get_expression(child[0]).get_ret_type().get_id();
            return ParseType::get_type(ret_cache);
        }
        case E_GET_ITEM : {
            size_t &ret_cache = (((ParseExpression *) this)->ret_type_id);
            ret_cache = get_expression(child[0]).get_ret_type().get_lower_type().get_id();
            break;
        }
        case E_LOGIC_OR:
        case E_LOGIC_AND:
        case E_G:
        case E_GE:
        case E_EQUAL:
        case E_NE:
        case E_L:
        case E_LE: {
            size_t &ret_cache = (((ParseExpression *) this)->ret_type_id);
            ret_cache = T_BOOL;
            return ParseType::get_type(ret_cache);
        }
        case E_ASSIGN: {
            size_t &ret_cache = (((ParseExpression *) this)->ret_type_id);
            ret_cache = ParseType::convert(E_ASSIGN,
                                           get_expression(child[0]).get_ret_type(),
                                           get_expression(child[1]).get_ret_type());
            return ParseType::get_type(ret_cache);
        }
        case E_UNDEFINED:
            break;
        case E_FUN: {
            size_t &ret_cache = (((ParseExpression *) this)->ret_type_id);
            const DecFuncPtrList &fun_ptrs = *(DecFuncPtrList *)(child[0]);
            ret_cache = (fun_ptrs[0])->get_ret_type().get_id();
            return ParseType::get_type(ret_cache);
        }
    }
    ((ParseExpression *) this)->ret_type_id = 0;
    return ParseType::get_type(T_UNKNOWN);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
movq 0x20(%rdi), %rdi
cmpq $-0x1, %rdi
jne 0x2bc6d
movl 0x28(%rbx), %r14d
leal -0x1(%r14), %eax
cmpl $0x18, %eax
ja 0x2bd00
leaq 0x1b532(%rip), %rcx     # 0x47134
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq $0x1, 0x20(%rbx)
movl $0x1, %edi
jmp 0x2bc6d
movq (%rbx), %rdi
callq 0x2b8a6
movq %rax, %rdi
callq 0x2bbcc
movq %rax, %r15
movq 0x8(%rbx), %rdi
callq 0x2b8a6
movq %rax, %rdi
callq 0x2bbcc
movl %r14d, %edi
movq %r15, %rsi
movq %rax, %rdx
callq 0x28dd2
jmp 0x2bc66
movq (%rbx), %rdi
callq 0x2b8a6
movq %rax, %rdi
callq 0x2bbcc
movq %rax, %rdi
callq 0x2770a
movq %rax, %rdi
movq %rax, 0x20(%rbx)
callq 0x28004
addq $0x78, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rdi
callq 0x2b8a6
movq %rax, %rdi
callq 0x2bbcc
movq %rax, %r14
movq 0x8(%rbx), %rdi
callq 0x2b8a6
movq %rax, %rdi
callq 0x2bbcc
movl $0x19, %edi
movq %r14, %rsi
movq %rax, %rdx
callq 0x28dd2
jmp 0x2bc66
movq (%rbx), %rsi
leaq -0x50(%rbp), %r14
movq %r14, %rdi
callq 0x2772e
movq %r14, %rdi
callq 0x2770a
jmp 0x2bd39
movq (%rbx), %rdi
callq 0x2b8a6
movq %rax, %rdi
callq 0x2bbcc
leaq -0x50(%rbp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x293c6
movq %r14, %rdi
callq 0x2770a
movq %rax, 0x20(%rbx)
leaq -0x50(%rbp), %rdi
callq 0x28344
movq $0x0, 0x20(%rbx)
xorl %edi, %edi
jmp 0x2bc6d
movq (%rbx), %rdi
callq 0x2efec
jmp 0x2bc5e
movq (%rbx), %rax
movq (%rax), %rax
movq (%rax), %rsi
leaq -0x50(%rbp), %r14
movq %r14, %rdi
callq 0x2f18e
movq %r14, %rdi
callq 0x2770a
movq %rax, 0x20(%rbx)
leaq -0x50(%rbp), %rdi
callq 0x28344
movq 0x20(%rbx), %rdi
jmp 0x2bc6d
jmp 0x2bd53
jmp 0x2bd53
movq %rax, %r14
leaq -0x50(%rbp), %rdi
callq 0x28344
jmp 0x2be8c
movq %rax, %r14
cmpl $0x1, %edx
jne 0x2be8c
movq %r14, %rdi
callq 0x4160
movq %rax, %r14
leaq -0x40(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x1b867(%rip), %rsi     # 0x475f1
leaq 0x1b882(%rip), %rdx     # 0x47613
leaq -0x50(%rbp), %rdi
callq 0xf65c
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
jne 0x2bdaf
movq %rbx, %rdi
callq 0x2b7a0
movq 0x10(%rbx), %rsi
leaq -0x90(%rbp), %rdi
callq 0xe329
leaq 0x1b723(%rip), %rsi     # 0x474e5
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rdx
callq 0xe2af
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
leaq -0x50(%rbp), %rdi
callq 0x4110
leaq -0x60(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2bdf5
callq 0x42b0
leaq -0x80(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2be07
callq 0x42b0
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x34162
movl $0x28, %edi
callq 0x4190
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq 0x3420a
leaq 0x2ff3e(%rip), %rsi     # 0x5bd70
leaq -0x1da7f(%rip), %rdx    # 0xe3ba
movq %rbx, %rdi
callq 0x4540
jmp 0x2be71
movq %rax, %r14
leaq -0x60(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2be5d
callq 0x42b0
jmp 0x2be5d
movq %rax, %r14
leaq -0x80(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2be74
callq 0x42b0
jmp 0x2be74
movq %rax, %r14
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0x2be87
callq 0x42b0
jmp 0x2be87
movq %rax, %r14
callq 0x4500
movq %r14, %rdi
callq 0x4560
movq %rax, %rdi
callq 0xe590