// File: /workspace/github_cpp_makefile_star2_O1/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
cmpq %rbx, %r13
je 0x7019b
leaq 0xa1bb(%rip), %r15      # 0x7a2dc
leaq -0x58(%rbp), %r12
movq (%r13), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x6f390
testb %al, %al
je 0x70192
testq %r14, %r14
je 0x7015a
movq %r14, %rdi
leaq 0x1c4e9(%rip), %rsi     # 0x8c630
leaq 0x1cd2a(%rip), %rdx     # 0x8ce78
xorl %ecx, %ecx
callq 0x2e430
movq %rax, %r14
jmp 0x7015d
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 0x726ca
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x70192
callq 0x2e360
addq $0x8, %r13
cmpq %rbx, %r13
jne 0x70125
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), %rbx
movq 0x8(%rax), %r15
cmpq %r15, %rbx
je 0x70254
leaq 0xa11b(%rip), %r14      # 0x7a2f6
leaq -0x58(%rbp), %r12
movq (%rbx), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x6f390
testb %al, %al
je 0x7024b
testq %r13, %r13
je 0x70213
movq %r13, %rdi
leaq 0x1c430(%rip), %rsi     # 0x8c630
leaq 0x1cc89(%rip), %rdx     # 0x8ce90
xorl %ecx, %ecx
callq 0x2e430
movq %rax, %r13
jmp 0x70216
xorl %r13d, %r13d
movq 0x40(%r13), %rax
movq 0x40(%rax), %rsi
leaq -0x90(%rbp), %rdi
callq 0x72ad0
testq %rax, %rax
je 0x70273
movq 0x28(%rax), %rax
movq %rax, -0x58(%rbp)
movq 0x48(%r13), %rax
movq 0x40(%rax), %rsi
movq -0x30(%rbp), %rdi
movq %r12, %rdx
callq 0x72b14
addq $0x8, %rbx
cmpq %r15, %rbx
jne 0x701df
leaq -0x90(%rbp), %rdi
callq 0x40200
movq -0x30(%rbp), %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8e3a(%rip), %rdi      # 0x790b4
callq 0x2e5c0
jmp 0x7029c
jmp 0x702aa
movq %rax, %r14
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x702ad
callq 0x2e360
jmp 0x702ad
jmp 0x7029c
movq %rax, %r14
movq -0x30(%rbp), %rdi
callq 0x40200
jmp 0x702ad
movq %rax, %r14
leaq -0x90(%rbp), %rdi
callq 0x40200
movq %r14, %rdi
callq 0x2e730