// File: /workspace/github_cpp_makefile_star2_O3/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 0x2b3d3
movl 0x28(%rbx), %r14d
leal -0x1(%r14), %eax
cmpl $0x18, %eax
ja 0x2b465
leaq 0x1adcc(%rip), %rcx     # 0x46134
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq $0x1, 0x20(%rbx)
movl $0x1, %edi
jmp 0x2b3d3
movq (%rbx), %rdi
callq 0x2b006
movq %rax, %rdi
callq 0x2b332
movq %rax, %r15
movq 0x8(%rbx), %rdi
callq 0x2b006
movq %rax, %rdi
callq 0x2b332
movl %r14d, %edi
movq %r15, %rsi
movq %rax, %rdx
callq 0x28620
jmp 0x2b3cc
movq (%rbx), %rdi
callq 0x2b006
movq %rax, %rdi
callq 0x2b332
movq %rax, %rdi
callq 0x270b4
movq %rax, 0x20(%rbx)
movq %rax, %rdi
addq $0x78, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2796c
movq (%rbx), %rdi
callq 0x2b006
movq %rax, %rdi
callq 0x2b332
movq %rax, %r14
movq 0x8(%rbx), %rdi
callq 0x2b006
movq %rax, %rdi
callq 0x2b332
movl $0x19, %edi
movq %r14, %rsi
movq %rax, %rdx
callq 0x28620
jmp 0x2b3cc
movq (%rbx), %rsi
leaq -0x50(%rbp), %r14
movq %r14, %rdi
callq 0x270d8
movq %r14, %rdi
callq 0x270b4
jmp 0x2b49b
movq (%rbx), %rdi
callq 0x2b006
movq %rax, %rdi
callq 0x2b332
leaq -0x50(%rbp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x28ba2
movq %r14, %rdi
callq 0x270b4
movq %rax, 0x20(%rbx)
leaq -0x50(%rbp), %rdi
callq 0x27ca8
movq $0x0, 0x20(%rbx)
xorl %edi, %edi
jmp 0x2b4ac
movq (%rbx), %rdi
callq 0x2e726
jmp 0x2b3c4
movq (%rbx), %rax
movq (%rax), %rax
movq (%rax), %rsi
leaq -0x50(%rbp), %r14
movq %r14, %rdi
callq 0x2e8ca
movq %r14, %rdi
callq 0x270b4
movq %rax, 0x20(%rbx)
leaq -0x50(%rbp), %rdi
callq 0x27ca8
movq 0x20(%rbx), %rdi
callq 0x2796c
addq $0x78, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2b4c0
jmp 0x2b4c0
movq %rax, %r14
leaq -0x50(%rbp), %rdi
callq 0x27ca8
jmp 0x2b5f9
movq %rax, %r14
cmpl $0x1, %edx
jne 0x2b5f9
movq %r14, %rdi
callq 0x4160
movq %rax, %r14
leaq -0x40(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x1b0fa(%rip), %rsi     # 0x465f1
leaq 0x1b115(%rip), %rdx     # 0x46613
leaq -0x50(%rbp), %rdi
callq 0xf868
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
jne 0x2b51c
movq %rbx, %rdi
callq 0x2af00
movq 0x10(%rbx), %rsi
leaq -0x90(%rbp), %rdi
callq 0xe50f
leaq 0x1afb6(%rip), %rsi     # 0x464e5
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rdx
callq 0xe495
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 0x2b562
callq 0x42b0
leaq -0x80(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b574
callq 0x42b0
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x3383e
movl $0x28, %edi
callq 0x4190
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq 0x338e6
leaq 0x2f7d1(%rip), %rsi     # 0x5ad70
leaq -0x1d006(%rip), %rdx    # 0xe5a0
movq %rbx, %rdi
callq 0x4540
jmp 0x2b5de
movq %rax, %r14
leaq -0x60(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b5ca
callq 0x42b0
jmp 0x2b5ca
movq %rax, %r14
leaq -0x80(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b5e1
callq 0x42b0
jmp 0x2b5e1
movq %rax, %r14
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0x2b5f4
callq 0x42b0
jmp 0x2b5f4
movq %rax, %r14
callq 0x4500
movq %r14, %rdi
callq 0x4560
movq %rax, %rdi
callq 0xe776
nop