// File: /workspace/github_cpp_makefile_star2_O1/eniac[P]Mantis/src/compile/compile_p4.cpp
// Function: generateMetadata(std::vector<AstNode*, std::allocator<AstNode*>>*, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, P4RMalleableValueNode*, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, P4RMalleableValueNode*>>> const&, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, P4RMalleableFieldNode*, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, P4RMalleableFieldNode*>>> const&, int, int)
void generateMetadata(vector<AstNode*>* newNodes,
                      const unordered_map<string,
                                          P4RMalleableValueNode*>& mblValues,
                      const unordered_map<string,
                                          P4RMalleableFieldNode*>& mblFields,
                      int ing_iso_opt, int egr_iso_opt) {
    ostringstream oss;
    // Ing
    oss << "header_type "<< kP4rIngMetadataType << " {\n"
        << "  fields {\n";
    if (((unsigned int)ing_iso_opt) & 0b1) {
        oss << "  __mv : 1;\n";
    } 
    if (((unsigned int)ing_iso_opt) & 0b10) {
        oss << "  __vv : 1;\n";        
    }

    // Presume malleables at ing
    for (auto kv : mblValues){
        // Values need to be as wide as specified
        VarWidthNode* widthNode =
                dynamic_cast<VarWidthNode*>(kv.second->varWidth_);
        string varWidth = widthNode->val_->toString();
        oss << "  " << kv.first << " : " << varWidth << ";" << endl;
    }
    for (auto kv : mblFields){
        // Ref-vars only need to be wide enough to store an index
        auto alts = findAllAlts(*kv.second);
        int indexWidth = 1;
        if(alts.size()!=1) {
            indexWidth = int(ceil(log2(alts.size())));
        }
        oss << "  " << kv.first << kP4rIndexSuffix << " : "
            << indexWidth << ";" << endl;
    }

    oss << " }" << endl;
    oss << "}" << endl;
    oss << "metadata " << kP4rIngMetadataType << " "
                       << kP4rIngMetadataName << ";\n\n";

    newNodes->push_back(new UnanchoredNode(new string(oss.str()),
                                           new string("metadata"),
                                           new string(kP4rIngMetadataName)));
    // Egr
    oss.str("");
    oss << "header_type "<< kP4rEgrMetadataType << " {\n"
        << "  fields {\n";
    if (((unsigned int)egr_iso_opt) & 0b1) {
        oss << "  __mv : 1;\n";
    }

    oss << "  }" << endl;
    oss << "}" << endl;
    oss << "metadata " << kP4rEgrMetadataType << " "
                       << kP4rEgrMetadataName << ";\n\n";

    newNodes->push_back(new UnanchoredNode(new string(oss.str()),
                                           new string("metadata"),
                                           new string(kP4rEgrMetadataName)));    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movl %r8d, -0x64(%rbp)
movl %ecx, %r14d
movq %rdx, -0x38(%rbp)
movq %rsi, %rbx
movq %rdi, -0x30(%rbp)
leaq -0x200(%rbp), %r15
movq %r15, %rdi
callq 0x2e550
leaq 0x918c(%rip), %rsi      # 0x75de5
movl $0xc, %edx
movq %r15, %rdi
callq 0x2e440
leaq 0xd124(%rip), %rsi      # 0x79d91
leaq -0x200(%rbp), %rdi
movl $0xe, %edx
callq 0x2e440
leaq 0xcf4a(%rip), %rsi      # 0x79bcf
leaq -0x200(%rbp), %rdi
movl $0x3, %edx
callq 0x2e440
leaq 0x9155(%rip), %rsi      # 0x75df2
leaq -0x200(%rbp), %rdi
movl $0xb, %edx
callq 0x2e440
testb $0x1, %r14b
je 0x6cccc
leaq 0xd0e5(%rip), %rsi      # 0x79da0
leaq -0x200(%rbp), %rdi
movl $0xc, %edx
callq 0x2e440
testb $0x2, %r14b
je 0x6ccea
leaq 0xd0d4(%rip), %rsi      # 0x79dad
leaq -0x200(%rbp), %rdi
movl $0xc, %edx
callq 0x2e440
movq 0x10(%rbx), %r15
testq %r15, %r15
je 0x6cdf4
leaq -0x50(%rbp), %r12
leaq -0x200(%rbp), %r13
leaq 0x9a24(%rip), %rbx      # 0x7672d
movq %r12, -0x60(%rbp)
movq 0x8(%r15), %rsi
movq 0x10(%r15), %rdx
addq %rsi, %rdx
leaq -0x60(%rbp), %rdi
callq 0x32f92
movq 0x28(%r15), %rax
movq %rax, -0x40(%rbp)
movq 0x48(%rax), %rax
movq 0x40(%rax), %rsi
movq (%rsi), %rax
leaq -0x88(%rbp), %rdi
callq *(%rax)
movl $0x2, %edx
movq %r13, %rdi
leaq 0xb324(%rip), %rsi      # 0x78070
callq 0x2e440
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq %r13, %rdi
callq 0x2e440
movq %rax, %r14
movl $0x3, %edx
movq %rax, %rdi
leaq 0xcfc9(%rip), %rsi      # 0x79d3c
callq 0x2e440
movq -0x88(%rbp), %rsi
movq -0x80(%rbp), %rdx
movq %r14, %rdi
callq 0x2e440
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2e440
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2e370
movsbl %al, %esi
movq %r14, %rdi
callq 0x2e040
movq %rax, %rdi
callq 0x2e2b0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x6cdda
callq 0x2e360
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0x6cde8
callq 0x2e360
movq (%r15), %r15
testq %r15, %r15
jne 0x6cd09
movq -0x38(%rbp), %rax
movq 0x10(%rax), %r12
testq %r12, %r12
je 0x6cf4f
leaq -0x50(%rbp), %r15
leaq -0x200(%rbp), %r14
movq %r15, -0x60(%rbp)
movq 0x8(%r12), %rsi
movq 0x10(%r12), %rdx
addq %rsi, %rdx
leaq -0x60(%rbp), %rdi
callq 0x32f92
movq 0x28(%r12), %rsi
movq %rsi, -0x40(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x6fda9
movq -0x80(%rbp), %rax
subq -0x88(%rbp), %rax
movl $0x1, %r13d
cmpq $0x8, %rax
je 0x6ce8a
sarq $0x3, %rax
movq %rax, %xmm1
punpckldq 0xca89(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0xca91(%rip), %xmm1     # 0x79900
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
callq 0x2e740
callq 0x2e0a0
cvttsd2si %xmm0, %r13d
movl $0x2, %edx
movq %r14, %rdi
leaq 0xb1d7(%rip), %rsi      # 0x78070
callq 0x2e440
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq %r14, %rdi
callq 0x2e440
movq %rax, %rbx
movl $0x5, %edx
movq %rax, %rdi
leaq 0xb07e(%rip), %rsi      # 0x77f3e
callq 0x2e440
movl $0x3, %edx
movq %rbx, %rdi
leaq 0xce68(%rip), %rsi      # 0x79d3c
callq 0x2e440
movq %rbx, %rdi
movl %r13d, %esi
callq 0x2e700
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0x9837(%rip), %rsi      # 0x7672d
callq 0x2e440
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2e370
movsbl %al, %esi
movq %r13, %rdi
callq 0x2e040
movq %rax, %rdi
callq 0x2e2b0
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0x6cf34
callq 0x2e360
movq -0x60(%rbp), %rdi
cmpq %r15, %rdi
je 0x6cf42
callq 0x2e360
movq (%r12), %r12
testq %r12, %r12
jne 0x6ce10
leaq 0xce74(%rip), %rsi      # 0x79dca
leaq -0x200(%rbp), %rbx
movl $0x2, %edx
movq %rbx, %rdi
callq 0x2e440
movq -0x200(%rbp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2e370
movsbl %al, %esi
leaq -0x200(%rbp), %rdi
callq 0x2e040
movq %rax, %rdi
callq 0x2e2b0
leaq 0xad30(%rip), %rsi      # 0x77cd0
leaq -0x200(%rbp), %rbx
movl $0x1, %edx
movq %rbx, %rdi
callq 0x2e440
movq -0x200(%rbp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2e370
movsbl %al, %esi
leaq -0x200(%rbp), %rdi
callq 0x2e040
movq %rax, %rdi
callq 0x2e2b0
leaq 0x8e1c(%rip), %rsi      # 0x75e06
leaq -0x200(%rbp), %rdi
movl $0x9, %edx
callq 0x2e440
leaq 0xcd8f(%rip), %rsi      # 0x79d91
leaq -0x200(%rbp), %rdi
movl $0xe, %edx
callq 0x2e440
leaq 0xb057(%rip), %rsi      # 0x78071
leaq -0x200(%rbp), %rdi
movl $0x1, %edx
callq 0x2e440
leaq 0xabc9(%rip), %rsi      # 0x77bfb
leaq -0x200(%rbp), %rdi
movl $0xc, %edx
callq 0x2e440
leaq 0xa18a(%rip), %rsi      # 0x771d4
leaq -0x200(%rbp), %rdi
movl $0x3, %edx
callq 0x2e440
movl $0x58, %edi
callq 0x2e3a0
movq %rax, %r14
movl $0x20, %edi
callq 0x2e3a0
movq %rax, %r13
leaq -0x1f8(%rbp), %rsi
movq %rax, %rdi
callq 0x2e660
movl $0x20, %edi
callq 0x2e3a0
movq %rax, %r12
addq $0x10, %rax
movq %rax, (%r12)
movb $0x1, %al
movl %eax, -0x38(%rbp)
leaq 0xcc9b(%rip), %rsi      # 0x79d40
leaq 0xcc9c(%rip), %rdx      # 0x79d48
movb $0x1, %r15b
movq %r12, %rdi
callq 0x33112
xorl %r15d, %r15d
movl $0x20, %edi
callq 0x2e3a0
movq %rax, %rbx
addq $0x10, %rax
movq %rax, (%rbx)
movb $0x1, %al
movl %eax, -0x38(%rbp)
leaq 0xab21(%rip), %rsi      # 0x77bfb
leaq 0xab26(%rip), %rdx      # 0x77c07
movb $0x1, %r15b
movq %rbx, %rdi
callq 0x33112
xorl %r15d, %r15d
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x3e566
movq %r14, -0x60(%rbp)
movq -0x30(%rbp), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x6d11c
movq %r14, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x6d12f
xorl %r15d, %r15d
leaq -0x60(%rbp), %rdx
movl $0x0, -0x38(%rbp)
callq 0x333de
leaq -0x50(%rbp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0xa79d(%rip), %rdx      # 0x778db
leaq -0x60(%rbp), %rdi
movq %rdx, %rsi
callq 0x33112
leaq -0x60(%rbp), %rsi
leaq -0x1f8(%rbp), %r15
movq %r15, %rdi
callq 0x2e610
movq -0x60(%rbp), %rdi
cmpq %rbx, %rdi
je 0x6d16b
callq 0x2e360
leaq 0x8c73(%rip), %rsi      # 0x75de5
leaq -0x200(%rbp), %rdi
movl $0xc, %edx
callq 0x2e440
leaq 0xcc30(%rip), %rsi      # 0x79dba
leaq -0x200(%rbp), %rdi
movl $0xe, %edx
callq 0x2e440
leaq 0xca2d(%rip), %rsi      # 0x79bcf
leaq -0x200(%rbp), %rdi
movl $0x3, %edx
callq 0x2e440
leaq 0x8c38(%rip), %rsi      # 0x75df2
leaq -0x200(%rbp), %rdi
movl $0xb, %edx
callq 0x2e440
testb $0x1, -0x64(%rbp)
je 0x6d1e9
leaq 0xcbc8(%rip), %rsi      # 0x79da0
leaq -0x200(%rbp), %rdi
movl $0xc, %edx
callq 0x2e440
leaq 0xcbd9(%rip), %rsi      # 0x79dc9
leaq -0x200(%rbp), %rbx
movl $0x3, %edx
movq %rbx, %rdi
callq 0x2e440
movq -0x200(%rbp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2e370
movsbl %al, %esi
leaq -0x200(%rbp), %rdi
callq 0x2e040
movq %rax, %rdi
callq 0x2e2b0
leaq 0xaa96(%rip), %rsi      # 0x77cd0
leaq -0x200(%rbp), %rbx
movl $0x1, %edx
movq %rbx, %rdi
callq 0x2e440
movq -0x200(%rbp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2e370
movsbl %al, %esi
leaq -0x200(%rbp), %rdi
callq 0x2e040
movq %rax, %rdi
callq 0x2e2b0
leaq 0x8b82(%rip), %rsi      # 0x75e06
leaq -0x200(%rbp), %rdi
movl $0x9, %edx
callq 0x2e440
leaq 0xcb1e(%rip), %rsi      # 0x79dba
leaq -0x200(%rbp), %rdi
movl $0xe, %edx
callq 0x2e440
leaq 0xadbd(%rip), %rsi      # 0x78071
leaq -0x200(%rbp), %rdi
movl $0x1, %edx
callq 0x2e440
leaq 0xa94d(%rip), %rsi      # 0x77c19
leaq -0x200(%rbp), %rdi
movl $0xc, %edx
callq 0x2e440
leaq 0x9ef0(%rip), %rsi      # 0x771d4
leaq -0x200(%rbp), %rdi
movl $0x3, %edx
callq 0x2e440
movl $0x58, %edi
callq 0x2e3a0
movq %rax, %r14
movl $0x20, %edi
callq 0x2e3a0
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
callq 0x2e660
movl $0x20, %edi
callq 0x2e3a0
movq %rax, %r15
addq $0x10, %rax
movq %rax, (%r15)
movb $0x1, %al
movl %eax, -0x38(%rbp)
leaq 0xca06(%rip), %rsi      # 0x79d40
leaq 0xca07(%rip), %rdx      # 0x79d48
movb $0x1, %r13b
movq %r15, %rdi
callq 0x33112
xorl %r13d, %r13d
movl $0x20, %edi
callq 0x2e3a0
movq %rax, %rbx
addq $0x10, %rax
movq %rax, (%rbx)
movb $0x1, %al
movl %eax, -0x38(%rbp)
leaq 0xa8aa(%rip), %rsi      # 0x77c19
leaq 0xa8af(%rip), %rdx      # 0x77c25
movb $0x1, %r13b
movq %rbx, %rdi
callq 0x33112
xorl %r13d, %r13d
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3e566
movq %r14, -0x60(%rbp)
movq -0x30(%rbp), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x6d3b1
movq %r14, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x6d3c4
xorl %r13d, %r13d
leaq -0x60(%rbp), %rdx
movl $0x0, -0x38(%rbp)
callq 0x333de
movq 0x20bdd(%rip), %rsi     # 0x8dfa8
leaq -0x200(%rbp), %rdi
callq 0x2e230
leaq -0x190(%rbp), %rdi
callq 0x2e150
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, -0x30(%rbp)
movq %r12, %rdi
jmp 0x6d421
jmp 0x6d428
movq %rax, %r14
movq -0x60(%rbp), %rdi
cmpq %rbx, %rdi
jne 0x6d4ed
jmp 0x6d4f2
jmp 0x6d4a8
movq %rax, -0x30(%rbp)
movq %r13, %rdi
callq 0x2e360
jmp 0x6d440
movq %rax, -0x30(%rbp)
jmp 0x6d494
movq %rax, -0x30(%rbp)
jmp 0x6d45b
jmp 0x6d43c
movq %rax, -0x30(%rbp)
jmp 0x6d479
movq %rax, -0x30(%rbp)
movb $0x1, %al
movl %eax, -0x38(%rbp)
jmp 0x6d486
movq %rax, -0x30(%rbp)
testb %r13b, %r13b
je 0x6d458
movq %rbx, %rdi
callq 0x2e360
xorl %r13d, %r13d
testb %r13b, %r13b
je 0x6d486
movq %r15, %rdi
jmp 0x6d481
movq %rax, -0x30(%rbp)
testb %r15b, %r15b
je 0x6d476
movq %rbx, %rdi
callq 0x2e360
xorl %r15d, %r15d
testb %r15b, %r15b
je 0x6d486
movq %r12, %rdi
callq 0x2e360
cmpb $0x0, -0x38(%rbp)
je 0x6d494
movq %r14, %rdi
callq 0x2e360
movq -0x30(%rbp), %r14
jmp 0x6d4f2
jmp 0x6d4a8
movq %rax, %r14
jmp 0x6d4e4
jmp 0x6d4a8
movq %rax, %r14
jmp 0x6d4c5
movq %rax, %r14
jmp 0x6d4f2
movq %rax, %r14
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x6d4c5
callq 0x2e360
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
jne 0x6d4ed
jmp 0x6d4f2
movq %rax, %r14
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0x6d4e4
callq 0x2e360
movq -0x60(%rbp), %rdi
cmpq %r15, %rdi
je 0x6d4f2
callq 0x2e360
movq 0x20aaf(%rip), %rsi     # 0x8dfa8
leaq -0x200(%rbp), %rdi
callq 0x2e230
leaq -0x190(%rbp), %rdi
callq 0x2e150
movq %r14, %rdi
callq 0x2e730