// File: /workspace/github_cpp_makefile_star2_O2/eniac[P]Mantis/src/compile/find_nodes.cpp
// Function: findHeaderDecs[abi:cxx11](std::vector<AstNode*, std::allocator<AstNode*>> const&)
HeaderDecsMap findHeaderDecs(const vector<AstNode*>& astNodes) {
    unordered_map<string /* type */,
                  std::vector<FieldDecNode*>*> typeDecsMap;
    for (auto node : astNodes) {
        if (typeContains(node, "HeaderTypeDeclarationNode")) {
            auto headerDecl = dynamic_cast<HeaderTypeDeclarationNode*>(node);
            typeDecsMap.emplace(headerDecl->name_->toString(),
                                headerDecl->field_decs_->list_);
        }       
    }

    HeaderDecsMap ret;
    for (auto node : astNodes) {
        if (typeContains(node, "HeaderInstanceNode")) {
            auto headerInstance = dynamic_cast<HeaderInstanceNode*>(node);
            auto fieldDecVector = typeDecsMap.at(*headerInstance->type_->word_);
            ret.emplace(*headerInstance->name_->word_, fieldDecVector);
        }
    }

    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, -0x30(%rbp)
leaq -0x60(%rbp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
movq (%rsi), %r13
movq %rsi, -0x38(%rbp)
movq 0x8(%rsi), %rbx
leaq 0xab59(%rip), %r15      # 0x7d36c
leaq -0x58(%rbp), %r12
cmpq %rbx, %r13
je 0x72885
movq (%r13), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x71cf8
testb %al, %al
je 0x7287f
testq %r14, %r14
je 0x72851
movq %r14, %rdi
leaq 0x21e52(%rip), %rsi     # 0x94690
leaq 0x22693(%rip), %rdx     # 0x94ed8
xorl %ecx, %ecx
callq 0x41480
movq %rax, %r14
jmp 0x72854
xorl %r14d, %r14d
movq 0x40(%r14), %rsi
movq (%rsi), %rax
movq %r12, %rdi
callq *(%rax)
movq 0x48(%r14), %rdx
addq $0x40, %rdx
leaq -0x90(%rbp), %rdi
movq %r12, %rsi
callq 0x7498e
movq %r12, %rdi
callq 0x418c8
addq $0x8, %r13
jmp 0x72817
movq -0x30(%rbp), %rcx
leaq 0x30(%rcx), %rax
movq %rax, (%rcx)
movq $0x1, 0x8(%rcx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rcx)
movl $0x3f800000, 0x20(%rcx) # imm = 0x3F800000
movups %xmm0, 0x28(%rcx)
movq -0x38(%rbp), %rax
movq (%rax), %r15
movq 0x8(%rax), %rbx
leaq 0xaaca(%rip), %r14      # 0x7d386
leaq -0x58(%rbp), %r12
cmpq %rbx, %r15
je 0x72931
movq (%r15), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x71cf8
testb %al, %al
je 0x7292b
testq %r13, %r13
je 0x728f9
movq %r13, %rdi
leaq 0x21daa(%rip), %rsi     # 0x94690
leaq 0x22603(%rip), %rdx     # 0x94ef0
xorl %ecx, %ecx
callq 0x41480
movq %rax, %r13
jmp 0x728fc
xorl %r13d, %r13d
movq 0x40(%r13), %rax
movq 0x40(%rax), %rsi
leaq -0x90(%rbp), %rdi
callq 0x74d9e
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq 0x48(%r13), %rax
movq 0x40(%rax), %rsi
movq -0x30(%rbp), %rdi
movq %r12, %rdx
callq 0x74dec
addq $0x8, %r15
jmp 0x728c0
leaq -0x90(%rbp), %rdi
callq 0x4f6e6
movq -0x30(%rbp), %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x72970
movq %rax, %r14
leaq -0x58(%rbp), %rdi
callq 0x418c8
jmp 0x72973
jmp 0x72962
movq %rax, %r14
movq -0x30(%rbp), %rdi
callq 0x4f6e6
jmp 0x72973
movq %rax, %r14
leaq -0x90(%rbp), %rdi
callq 0x4f6e6
movq %r14, %rdi
callq 0x41790