// File: /workspace/github_cpp_makefile_star2_O2/eniac[P]Mantis/src/compile/compile_p4.cpp
// Function: transformMalleableRefs(std::vector<MblRefNode*, std::allocator<MblRefNode*>>*, 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&, std::vector<AstNode*, std::allocator<AstNode*>>*)
void transformMalleableRefs(
            vector<MblRefNode*>* mblRefs,
            const unordered_map<string, P4RMalleableValueNode*>& mblValues,
            const unordered_map<string, P4RMalleableFieldNode*>& mblFields,
            vector<AstNode*>* nodeArray) {
    while (!mblRefs->empty()) {
        MblRefNode* varRef = mblRefs->front();
        mblRefs->erase(mblRefs->begin());

        if (varRef->transformed_) {
            // We must have processed this variable reference in a previous pass
            // e.g., multiple references in the same action
            continue;
        }

        string* varName = varRef->name_->word_;

        if (mblValues.find(*varName) != mblValues.end()) {
            // we should treat variable value references in reaction and others differently
            bool is_in_reaction = false;
            AstNode* parent = varRef->parent_;
            while (parent != NULL) {
                if (typeContains(parent, "P4RReactionNode")) {
                    is_in_reaction = true;
                    break;
                }
                parent = parent->parent_;
            }
            if (is_in_reaction) {
                // For c code, we skip the transformation
                varRef->inReaction_ = true;
            } else {
                // Otherwise, transform it to valid meta data
                varRef->transform(string(kP4rIngMetadataName), *varRef->name_->word_);
            }
        } else if (mblFields.find(*varName) != mblFields.end()) {
            // Reference to a variable field
            transformMalleableFieldRef(varRef, mblRefs, nodeArray,
                                      *mblFields.find(*varName)->second);
        } else {
            PANIC("Unknown malleable ref!");
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
movq %rcx, -0x88(%rbp)
movq %rdx, -0x90(%rbp)
movq %rsi, -0x98(%rbp)
movq %rdi, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movq (%rdi), %rsi
cmpq 0x8(%rdi), %rsi
je 0x6a953
movq (%rsi), %r12
callq 0x71054
cmpb $0x0, 0x39(%r12)
jne 0x6a17c
movq 0x80(%r12), %rax
movq 0x40(%rax), %rbx
movq -0x98(%rbp), %rdi
movq %rbx, %rsi
callq 0x71b12
testq %rax, %rax
je 0x6a1e8
movq %r12, %rbx
movq 0x30(%rbx), %rbx
testq %rbx, %rbx
je 0x6a264
movq %rbx, %rdi
leaq 0x129cb(%rip), %rsi     # 0x7cba2
callq 0x71cf8
testb %al, %al
je 0x6a1c0
movb $0x1, 0x3a(%r12)
jmp 0x6a17c
movq -0x90(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x71bf0
testq %rax, %rax
je 0x6a998
movq %r14, %rdi
movq %rbx, %rsi
callq 0x71bf0
movq 0x28(%rax), %r14
movq %r12, %rbx
movq 0x30(%rbx), %rbx
testq %rbx, %rbx
je 0x6a965
movq %rbx, %rdi
leaq 0x10723(%rip), %rsi     # 0x7a94f
callq 0x71cf8
testb %al, %al
jne 0x6a2a5
movq %rbx, %rdi
leaq 0x10992(%rip), %rsi     # 0x7abd1
callq 0x71cf8
testb %al, %al
jne 0x6a758
movq %rbx, %rdi
leaq 0x1294c(%rip), %rsi     # 0x7cba2
callq 0x71cf8
testb %al, %al
je 0x6a215
jmp 0x6a17c
leaq -0x280(%rbp), %rbx
movq %rbx, %rdi
leaq 0x10966(%rip), %rsi     # 0x7abdb
leaq -0xd0(%rbp), %rdx
callq 0x411c0
movq 0x80(%r12), %rax
movq 0x40(%rax), %rdx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x4dbe0
movq %rbx, %rdi
callq 0x418c8
jmp 0x6a17c
movq %rbx, %rdi
leaq 0x2a3e1(%rip), %rsi     # 0x94690
leaq 0x2ac9a(%rip), %rdx     # 0x94f50
xorl %ecx, %ecx
callq 0x41480
movq %rax, %rbx
movq 0x40(%rax), %rax
movq 0x40(%rax), %rsi
leaq -0xf0(%rbp), %rdi
callq 0x415b0
movq 0x80(%r12), %rax
movq 0x40(%rax), %rsi
leaq -0x68(%rbp), %rdi
callq 0x415b0
movq %rbx, -0x38(%rbp)
leaq -0x108(%rbp), %rdi
movq %r14, %rsi
callq 0x72552
andq $0x0, -0x70(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x80(%rbp)
movq -0x108(%rbp), %r13
movq -0x100(%rbp), %rax
movq %rax, -0x40(%rbp)
movb $0x1, %al
cmpq -0x40(%rbp), %r13
je 0x6a545
movq (%r13), %rcx
movq 0x40(%rcx), %rdx
movq 0x48(%rcx), %rcx
movq 0x40(%rdx), %r12
movq 0x40(%rcx), %rcx
movq %rcx, -0x30(%rbp)
testb $0x1, %al
je 0x6a417
leaq -0x280(%rbp), %rbx
movq %rbx, %rdi
callq 0x415a0
movq %rbx, %rdi
leaq 0x12b35(%rip), %rsi     # 0x7ce94
callq 0x413d0
movq %rax, %rdi
movq %r12, %rsi
callq 0x41380
movq %rax, %rdi
leaq 0x12b1b(%rip), %rsi     # 0x7ce94
callq 0x413d0
movq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0x41380
movq %rax, %rdi
leaq 0x12b00(%rip), %rsi     # 0x7ce94
callq 0x413d0
movq %rax, %rdi
leaq -0xf0(%rbp), %rsi
callq 0x41380
leaq -0xd0(%rbp), %rbx
movq %rbx, %rdi
leaq -0x278(%rbp), %rsi
callq 0x416b0
leaq -0x80(%rbp), %rdi
movq %rbx, %rsi
callq 0x4ba06
movq %rbx, %rdi
callq 0x418c8
movq %rbx, %rdi
leaq -0x278(%rbp), %rsi
callq 0x416b0
movq -0x38(%rbp), %r14
movq 0x40(%r14), %rax
movq 0x40(%rax), %rdi
movq %rbx, %rsi
callq 0x41500
movq %rbx, %rdi
callq 0x418c8
movq %r14, %rdi
xorl %esi, %esi
leaq -0x68(%rbp), %rdx
movq %r12, %rcx
movq -0x30(%rbp), %r8
callq 0x72430
jmp 0x6a52e
leaq -0x280(%rbp), %rbx
movq %rbx, %rdi
callq 0x415a0
movq %rbx, %rdi
leaq 0x12a64(%rip), %rsi     # 0x7ce94
callq 0x413d0
movq %rax, %rdi
movq %r12, %rsi
callq 0x41380
movq %rax, %rdi
leaq 0x12a4a(%rip), %rsi     # 0x7ce94
callq 0x413d0
movq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0x41380
movq %rax, %rdi
leaq 0x12a2f(%rip), %rsi     # 0x7ce94
callq 0x413d0
movq %rax, %rdi
leaq -0xf0(%rbp), %rsi
callq 0x41380
leaq -0xd0(%rbp), %rbx
movq %rbx, %rdi
leaq -0x278(%rbp), %rsi
callq 0x416b0
leaq -0x80(%rbp), %rdi
movq %rbx, %rsi
callq 0x4ba06
movq %rbx, %rdi
callq 0x418c8
movq %rbx, %rdi
leaq -0x278(%rbp), %rsi
callq 0x416b0
movq -0x38(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x498ba
movq %rax, %r14
movq %rbx, %rdi
callq 0x418c8
movq 0x30(%r15), %rdi
testq %rdi, %rdi
je 0x6a4ef
leaq 0x2a1b4(%rip), %rsi     # 0x94690
leaq 0x2a4e5(%rip), %rdx     # 0x949c8
xorl %ecx, %ecx
callq 0x41480
movq %rax, %rbx
jmp 0x6a4f1
xorl %ebx, %ebx
pushq $0x50
popq %rdi
callq 0x413f0
movq %rax, %r15
movq 0x40(%rbx), %rsi
movq %rax, %rdi
movq %r14, %rdx
callq 0x44434
movq %r15, 0x40(%rbx)
movq %rbx, 0x30(%r15)
movq %r15, 0x30(%r14)
movq %r14, %rdi
movq -0x48(%rbp), %rsi
leaq -0x68(%rbp), %rdx
movq %r12, %rcx
movq -0x30(%rbp), %r8
callq 0x72430
leaq -0x280(%rbp), %rdi
callq 0x410e0
addq $0x8, %r13
xorl %eax, %eax
jmp 0x6a31c
leaq -0xd0(%rbp), %rdi
movq -0x88(%rbp), %rsi
leaq -0xf0(%rbp), %rdx
callq 0x72293
leaq -0xc0(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
testq %rax, %rax
je 0x6a71d
movq 0x8(%rax), %rcx
movq %rcx, -0x40(%rbp)
movq %rax, -0x38(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x80(%rbp), %r12
movq -0x78(%rbp), %r15
movb $0x1, %bl
cmpq %r15, %r12
je 0x6a63c
leaq -0x280(%rbp), %rdi
movq %r12, %rsi
callq 0x415b0
testb $0x1, %bl
je 0x6a5cf
movq -0x40(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x40(%rax), %rdi
leaq -0x280(%rbp), %rsi
callq 0x41290
jmp 0x6a625
pushq $0x48
popq %rdi
callq 0x413f0
movq %rax, %r14
pushq $0x48
popq %rdi
callq 0x413f0
movq %rax, %rbx
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %r13
movq %rax, %rdi
leaq -0x280(%rbp), %rsi
callq 0x415b0
movq %rbx, %rdi
movq %r13, %rsi
callq 0x4465a
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4800c
movq -0x30(%rbp), %rax
movq 0x50(%rax), %rdi
movq %r14, %rsi
callq 0x44560
leaq -0x280(%rbp), %rdi
callq 0x418c8
addq $0x20, %r12
xorl %ebx, %ebx
jmp 0x6a598
leaq -0x280(%rbp), %rbx
movq %rbx, %rdi
callq 0x415a0
movq %rbx, %rdi
leaq 0x10586(%rip), %rsi     # 0x7abdb
callq 0x413d0
movq %rax, %rdi
leaq 0x102a5(%rip), %rsi     # 0x7a909
callq 0x413d0
movq %rax, %rdi
leaq -0x68(%rbp), %rsi
callq 0x41380
movq %rax, %rdi
leaq 0x1089f(%rip), %rsi     # 0x7af1e
callq 0x413d0
leaq -0x2a0(%rbp), %r14
movq %r14, %rdi
leaq -0x278(%rbp), %rsi
callq 0x416b0
movq -0x30(%rbp), %rdi
movq %r14, %rsi
callq 0x723aa
movl %eax, %ebx
movq %r14, %rdi
callq 0x418c8
testb %bl, %bl
jne 0x6a70c
pushq $0x48
popq %rdi
callq 0x413f0
movq %rax, %r12
pushq $0x48
popq %rdi
callq 0x413f0
movq %rax, %r14
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %rbx
movq %rax, %rdi
leaq -0x278(%rbp), %rsi
callq 0x416b0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x44730
movq %r12, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x47dbc
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rdi
movq %r12, %rsi
callq 0x4452e
leaq -0x280(%rbp), %rdi
callq 0x410e0
jmp 0x6a56a
leaq -0xd0(%rbp), %rdi
callq 0x71104
leaq -0x80(%rbp), %rdi
callq 0x49d44
leaq -0x108(%rbp), %rdi
callq 0x71770
leaq -0x68(%rbp), %rdi
callq 0x418c8
leaq -0xf0(%rbp), %rdi
callq 0x418c8
jmp 0x6a17c
movq %rbx, %rdi
leaq 0x29f2e(%rip), %rbx     # 0x94690
movq %rbx, %rsi
leaq 0x2a73c(%rip), %rdx     # 0x94ea8
xorl %ecx, %ecx
callq 0x41480
movq %rax, -0x38(%rbp)
movq 0x30(%r12), %rax
movq 0x30(%rax), %rdi
movl $0x0, %eax
movq %rax, -0x40(%rbp)
testq %rdi, %rdi
je 0x6a7a3
movq %rbx, %rsi
leaq 0x2a4d0(%rip), %rdx     # 0x94c68
xorl %ecx, %ecx
callq 0x41480
movq %rax, -0x40(%rbp)
leaq -0x68(%rbp), %rdi
movq %r14, %rsi
callq 0x72552
movq -0x68(%rbp), %r15
movq -0x60(%rbp), %rax
movq %rax, -0x30(%rbp)
movb $0x1, %al
cmpq -0x30(%rbp), %r15
je 0x6a842
movq (%r15), %r13
testb $0x1, %al
je 0x6a812
movq 0x40(%r13), %rax
movq 0x48(%r13), %rcx
movq 0x40(%rcx), %rdx
movq 0x40(%rax), %rsi
movq %r12, %rdi
callq 0x4dbe0
movq 0x30(%r12), %rdi
leaq 0x29ea2(%rip), %rsi     # 0x94690
leaq 0x2a683(%rip), %rdx     # 0x94e78
xorl %ecx, %ecx
callq 0x41480
movl 0x3c(%rax), %r14d
testl %r14d, %r14d
jne 0x6a837
movl $0x1, 0x3c(%rax)
pushq $0x1
popq %r14
jmp 0x6a837
pushq $0x48
popq %rdi
callq 0x413f0
movq %rax, %rbx
movq %rax, %rdi
movl %r14d, %esi
movq %r13, %rdx
callq 0x47dbc
movq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0x4452e
addq $0x8, %r15
xorl %eax, %eax
jmp 0x6a7bd
movq 0x80(%r12), %rax
movq 0x40(%rax), %rsi
leaq -0xd0(%rbp), %rdi
callq 0x415b0
leaq -0x280(%rbp), %rbx
movq %rbx, %rdi
callq 0x415a0
movq -0x38(%rbp), %r12
movq %rbx, %rdi
leaq 0x10364(%rip), %rsi     # 0x7abdb
callq 0x413d0
movq %rax, %rdi
leaq 0x10083(%rip), %rsi     # 0x7a909
callq 0x413d0
movq %rax, %rdi
leaq -0xd0(%rbp), %rsi
callq 0x41380
movq %rax, %rdi
leaq 0x1067a(%rip), %rsi     # 0x7af1e
callq 0x413d0
leaq -0xf0(%rbp), %r14
movq %r14, %rdi
leaq -0x278(%rbp), %rsi
callq 0x416b0
movq %r12, %rdi
movq %r14, %rsi
callq 0x723aa
movl %eax, %ebx
movq %r14, %rdi
callq 0x418c8
testb %bl, %bl
jne 0x6a92d
pushq $0x48
popq %rdi
callq 0x413f0
movq %rax, %r15
pushq $0x48
popq %rdi
callq 0x413f0
movq %rax, %r14
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %rbx
movq %rax, %rdi
leaq -0x278(%rbp), %rsi
callq 0x416b0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x44730
movq %r15, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x47dbc
movq 0x48(%r12), %rdi
movq %r15, %rsi
callq 0x4452e
leaq -0x280(%rbp), %rdi
callq 0x410e0
leaq -0xd0(%rbp), %rdi
callq 0x418c8
leaq -0x68(%rbp), %rdi
callq 0x71770
jmp 0x6a17c
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2b644(%rip), %rax     # 0x95fb0
movq (%rax), %rdi
leaq 0x12572(%rip), %rsi     # 0x7cee8
leaq 0x120a2(%rip), %rdx     # 0x7ca1f
leaq 0x125b0(%rip), %r8      # 0x7cf34
movl $0x165, %ecx            # imm = 0x165
xorl %eax, %eax
callq 0x41600
pushq $0x1
popq %rdi
callq 0x414f0
movq 0x2b611(%rip), %rax     # 0x95fb0
movq (%rax), %rdi
leaq 0x12209(%rip), %rsi     # 0x7cbb2
leaq 0x1206f(%rip), %rdx     # 0x7ca1f
leaq 0x12223(%rip), %r8      # 0x7cbda
movl $0x1dd, %ecx            # imm = 0x1DD
jmp 0x6a989
movq %rax, %r12
movq %rbx, %rdi
callq 0x413a0
jmp 0x6a9d5
jmp 0x6aa2d
movq %rax, %r12
jmp 0x6a9dd
movq %rax, %r12
movq %r14, %rdi
callq 0x413a0
movq %r15, %rdi
callq 0x413a0
jmp 0x6aa30
movq %rax, %r12
leaq -0xf0(%rbp), %rdi
callq 0x418c8
jmp 0x6aa30
jmp 0x6aa2d
movq %rax, %r12
jmp 0x6aa3c
movq %rax, %r12
jmp 0x6aa48
movq %rax, %r15
jmp 0x6ab63
movq %rax, %r15
jmp 0x6ab6c
jmp 0x6aa93
movq %rax, %r15
leaq -0x280(%rbp), %rdi
jmp 0x6ab73
movq %rax, %r15
jmp 0x6ab78
movq %rax, %r12
leaq -0x280(%rbp), %rdi
callq 0x410e0
leaq -0xd0(%rbp), %rdi
callq 0x418c8
movq %r12, %r15
jmp 0x6aaa0
movq %rax, %r15
movq %rbx, %rdi
callq 0x413a0
jmp 0x6aaa0
jmp 0x6aa9d
movq %rax, %r15
movq %rbx, %rdi
callq 0x413a0
jmp 0x6aab1
jmp 0x6aa93
jmp 0x6aa73
jmp 0x6aae3
jmp 0x6aae3
jmp 0x6aa73
movq %rax, %r15
leaq -0xd0(%rbp), %rdi
callq 0x418c8
jmp 0x6aae6
jmp 0x6aae3
movq %r15, %rdi
movq %rax, %r15
callq 0x413a0
jmp 0x6aae6
movq %rax, %r15
jmp 0x6ab4e
jmp 0x6aae3
movq %rax, %r15
leaq -0x68(%rbp), %rdi
callq 0x71770
jmp 0x6ab78
movq %rax, %r15
movq %r14, %rdi
callq 0x413a0
jmp 0x6aac0
jmp 0x6aaf4
movq %rax, %r15
movq %r12, %rdi
callq 0x413a0
jmp 0x6aaf7
jmp 0x6ab3f
movq %rax, %r15
leaq -0x2a0(%rbp), %rdi
callq 0x418c8
jmp 0x6aaf7
jmp 0x6aaf4
jmp 0x6aae3
jmp 0x6aae3
movq %rax, %r15
leaq -0x280(%rbp), %rdi
callq 0x410e0
jmp 0x6ab4e
movq %rax, %r15
leaq -0x280(%rbp), %rdi
callq 0x410e0
jmp 0x6ab42
movq %rax, %r15
movq %r13, %rdi
callq 0x413a0
jmp 0x6ab17
jmp 0x6ab2e
movq %rax, %r15
movq %rbx, %rdi
callq 0x413a0
jmp 0x6ab24
movq %rax, %r15
movq %r14, %rdi
callq 0x413a0
jmp 0x6ab31
movq %rax, %r15
leaq -0x280(%rbp), %rdi
callq 0x418c8
jmp 0x6ab42
movq %rax, %r15
leaq -0xd0(%rbp), %rdi
callq 0x71104
leaq -0x80(%rbp), %rdi
callq 0x49d44
leaq -0x108(%rbp), %rdi
callq 0x71770
leaq -0x68(%rbp), %rdi
callq 0x418c8
leaq -0xf0(%rbp), %rdi
callq 0x418c8
movq %r15, %rdi
callq 0x41790