// File: /workspace/github_cpp_makefile_star2_O3/acliusBackHome[P]kamaya/dist/ParseNode.cpp
// Function: ParseNode::action_variable_declaration_code_generate(IR&, ParseExpression const&, ParseType const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long const&) const
size_t ParseNode::action_variable_declaration_code_generate(
        IR &ir, const ParseExpression &init_expr, const ParseType &this_type,
        const string &symbol, const size_t &scope_id) const {
    if (generating_code) {
        size_t addr;
        if (scope_id != 0) {
            addr = ir.allocEmit(scope_id, symbol, this_type.get_size(), node_id);
            ir.varDecEmit(addr, init_expr, node_id, scope_id);
        } else {
            if (init_expr.get_expr_type() == E_UNDEFINED) {
                addr = ir.dataUndefinedEmit(symbol, this_type.get_size(), node_id);
            } else {
                if (init_expr.is_const()) {
                    addr = ir.dataEmit(symbol, this_type.get_size(), IR::getConstValueStr(init_expr), node_id);
                } else {
                    // TODO: 支持静态区非常量初始化表达式
                    string info = "ParseNode::action_variable_declaration_code_generate";
                    info += " node_id=" + to_string(node_id);
                    throw ParseException(EX_NOT_IMPLEMENTED, info);
                }
            }
        }
        if (symbol == "input") {
            ir.readEmit(addr, node_id);
        }
        // init_expr.set_address(addr); 没有任何作用
        return addr;
    }
    return (size_t) -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
leaq 0x3d5c6(%rip), %rax     # 0x5b32c
movq $-0x1, %r12
cmpb $0x1, (%rax)
jne 0x1de04
movq %r9, %r14
movq %r8, %r15
movq %rcx, %rbx
movq %rdx, %r13
movq %rsi, -0x38(%rbp)
movq %rdi, -0x30(%rbp)
cmpq $0x0, (%r9)
je 0x1de16
movq %rbx, %rdi
callq 0x27c58
leaq -0x58(%rbp), %rcx
movq %rax, (%rcx)
movq %r13, -0x60(%rbp)
movq %r15, %r13
movq -0x38(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq -0x30(%rbp), %rbx
movq %rbx, %r8
callq 0x3e8c2
movq %rax, %r12
movq (%rbx), %rcx
movq (%r14), %r8
movq %r15, %rdi
movq %r13, %r15
movq %rax, %rsi
movq -0x60(%rbp), %rdx
callq 0x3ed6a
leaq 0x27ebf(%rip), %rsi     # 0x45ca4
movq %r15, %rdi
callq 0x40f0
testl %eax, %eax
jne 0x1de04
movq -0x30(%rbp), %rax
movq (%rax), %rdx
movq -0x38(%rbp), %rdi
movq %r12, %rsi
callq 0x243be
movq %r12, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rdi
callq 0x2d39c
testl %eax, %eax
je 0x1de7f
movq %r13, %rdi
callq 0x2b2f4
testb %al, %al
je 0x1dea5
movq %rbx, %rdi
callq 0x27c58
movq %rax, %rbx
leaq -0x58(%rbp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x3cf1e
movq -0x30(%rbp), %rax
movq (%rax), %r8
movq -0x38(%rbp), %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x3d2dc
movq %rax, %r12
leaq -0x48(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1ddde
callq 0x42b0
jmp 0x1ddde
movq %rbx, %rdi
callq 0x27c58
movq -0x30(%rbp), %rcx
movq (%rcx), %rcx
movq -0x38(%rbp), %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x3d4b0
movq %rax, %r12
jmp 0x1ddde
leaq -0x48(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x27dbb(%rip), %rsi     # 0x45c6f
leaq 0x27de8(%rip), %rdx     # 0x45ca3
leaq -0x58(%rbp), %rdi
callq 0xf868
movq -0x30(%rbp), %rax
movq (%rax), %rsi
leaq -0xa0(%rbp), %rdi
callq 0xe50f
leaq 0x27806(%rip), %rsi     # 0x456e4
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq 0xe495
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
leaq -0x58(%rbp), %rdi
callq 0x4110
leaq -0x70(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1df11
callq 0x42b0
leaq -0x90(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1df26
callq 0x42b0
movl $0x28, %edi
callq 0x4190
movq %rax, %r14
leaq -0x58(%rbp), %rdx
movq %rax, %rdi
movl $0x13, %esi
callq 0x333ee
leaq 0x3ce25(%rip), %rsi     # 0x5ad70
leaq -0xf9b2(%rip), %rdx     # 0xe5a0
movq %r14, %rdi
callq 0x4540
jmp 0x1df9a
movq %rax, %rbx
movq %r14, %rdi
callq 0x4250
jmp 0x1df9d
movq %rax, %rbx
leaq -0x70(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1df83
callq 0x42b0
jmp 0x1df83
movq %rax, %rbx
leaq -0x90(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1df9d
callq 0x42b0
jmp 0x1df9d
movq %rax, %rbx
movq -0x58(%rbp), %rdi
cmpq %r15, %rdi
jne 0x1dfbd
jmp 0x1dfc2
movq %rax, %rbx
jmp 0x1dfc2
movq %rax, %rbx
leaq -0x48(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1dfc2
callq 0x42b0
movq %rbx, %rdi
callq 0x4560