// File: /workspace/github_cpp_makefile_star2_O1/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 0x3e62a(%rip), %rax     # 0x5c32c
movq $-0x1, %r12
cmpb $0x1, (%rax)
jne 0x1dda0
movq %r9, %r14
movq %r8, %r15
movq %rcx, %rbx
movq %rdx, %r13
movq %rsi, -0x38(%rbp)
movq %rdi, -0x30(%rbp)
cmpq $0x0, (%r9)
je 0x1ddb2
movq %rbx, %rdi
callq 0x282ec
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 0x3f282
movq %rax, %r12
movq (%rbx), %rcx
movq (%r14), %r8
movq %r15, %rdi
movq %r13, %r15
movq %rax, %rsi
movq -0x60(%rbp), %rdx
callq 0x3f72e
leaq 0x28f23(%rip), %rsi     # 0x46ca4
movq %r15, %rdi
callq 0x40f0
testl %eax, %eax
jne 0x1dda0
movq -0x30(%rbp), %rax
movq (%rax), %rdx
movq -0x38(%rbp), %rdi
movq %r12, %rsi
callq 0x24a28
movq %r12, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rdi
callq 0x2dc78
testl %eax, %eax
je 0x1de1b
movq %r13, %rdi
callq 0x2bb90
testb %al, %al
je 0x1de41
movq %rbx, %rdi
callq 0x282ec
movq %rax, %rbx
leaq -0x58(%rbp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x3d8b8
movq -0x30(%rbp), %rax
movq (%rax), %r8
movq -0x38(%rbp), %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x3dc76
movq %rax, %r12
leaq -0x48(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1dd7a
callq 0x42b0
jmp 0x1dd7a
movq %rbx, %rdi
callq 0x282ec
movq -0x30(%rbp), %rcx
movq (%rcx), %rcx
movq -0x38(%rbp), %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x3de4a
movq %rax, %r12
jmp 0x1dd7a
leaq -0x48(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x28e1f(%rip), %rsi     # 0x46c6f
leaq 0x28e4c(%rip), %rdx     # 0x46ca3
leaq -0x58(%rbp), %rdi
callq 0xf65c
movq -0x30(%rbp), %rax
movq (%rax), %rsi
leaq -0xa0(%rbp), %rdi
callq 0xe329
leaq 0x2886a(%rip), %rsi     # 0x466e4
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
callq 0xe2af
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 0x1dead
callq 0x42b0
leaq -0x90(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1dec2
callq 0x42b0
movl $0x28, %edi
callq 0x4190
movq %rax, %r14
leaq -0x58(%rbp), %rdx
movq %rax, %rdi
movl $0x13, %esi
callq 0x33d12
leaq 0x3de89(%rip), %rsi     # 0x5bd70
leaq -0xfb34(%rip), %rdx     # 0xe3ba
movq %r14, %rdi
callq 0x4540
jmp 0x1df36
movq %rax, %rbx
movq %r14, %rdi
callq 0x4250
jmp 0x1df39
movq %rax, %rbx
leaq -0x70(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1df1f
callq 0x42b0
jmp 0x1df1f
movq %rax, %rbx
leaq -0x90(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1df39
callq 0x42b0
jmp 0x1df39
movq %rax, %rbx
movq -0x58(%rbp), %rdi
cmpq %r15, %rdi
jne 0x1df59
jmp 0x1df5e
movq %rax, %rbx
jmp 0x1df5e
movq %rax, %rbx
leaq -0x48(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1df5e
callq 0x42b0
movq %rbx, %rdi
callq 0x4560