// File: /workspace/github_cpp_makefile_star2_O3/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), %r15
movq 0x8(%rsi), %r13
cmpq %r13, %r15
je 0x6f70c
movq %rsi, -0x38(%rbp)
leaq 0xac56(%rip), %rbx      # 0x7a2dc
leaq -0x58(%rbp), %r12
movq (%r15), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x6e968
testb %al, %al
je 0x6f6f6
testq %r14, %r14
je 0x6f6be
movq %r14, %rdi
leaq 0x1d005(%rip), %rsi     # 0x8c6b0
leaq 0x1d846(%rip), %rdx     # 0x8cef8
xorl %ecx, %ecx
callq 0x2e430
movq %rax, %r14
jmp 0x6f6c1
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 0x71b3a
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x6f6f6
callq 0x2e360
addq $0x8, %r15
cmpq %r13, %r15
jne 0x6f68a
movq -0x38(%rbp), %rax
movq (%rax), %rbx
movq 0x8(%rax), %r15
jmp 0x6f70f
movq %r15, %rbx
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)
cmpq %r15, %rbx
je 0x6f7bd
leaq 0xabb2(%rip), %r14      # 0x7a2f6
leaq -0x58(%rbp), %r12
movq (%rbx), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x6e968
testb %al, %al
je 0x6f7b4
testq %r13, %r13
je 0x6f77c
movq %r13, %rdi
leaq 0x1cf47(%rip), %rsi     # 0x8c6b0
leaq 0x1d7a0(%rip), %rdx     # 0x8cf10
xorl %ecx, %ecx
callq 0x2e430
movq %rax, %r13
jmp 0x6f77f
xorl %r13d, %r13d
movq 0x40(%r13), %rax
movq 0x40(%rax), %rsi
leaq -0x90(%rbp), %rdi
callq 0x71f40
testq %rax, %rax
je 0x6f7dc
movq 0x28(%rax), %rax
movq %rax, -0x58(%rbp)
movq 0x48(%r13), %rax
movq 0x40(%rax), %rsi
movq -0x30(%rbp), %rdi
movq %r12, %rdx
callq 0x71f84
addq $0x8, %rbx
cmpq %r15, %rbx
jne 0x6f748
leaq -0x90(%rbp), %rdi
callq 0x3fdb6
movq -0x30(%rbp), %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x98d1(%rip), %rdi      # 0x790b4
callq 0x2e5c0
jmp 0x6f805
jmp 0x6f813
movq %rax, %r14
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x6f816
callq 0x2e360
jmp 0x6f816
jmp 0x6f805
movq %rax, %r14
movq -0x30(%rbp), %rdi
callq 0x3fdb6
jmp 0x6f816
movq %rax, %r14
leaq -0x90(%rbp), %rdi
callq 0x3fdb6
movq %r14, %rdi
callq 0x2e730