// File: /workspace/github_cpp_makefile_star2_O2/eniac[P]Mantis/src/compile/compile_c.cpp
// Function: mirrorFieldArg(std::vector<AstNode*, std::allocator<AstNode*>>, std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char>>&, std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char>>&, std::vector<std::pair<std::vector<std::pair<ReactionArgNode*, int>, std::allocator<std::pair<ReactionArgNode*, int>>>, int>, std::allocator<std::pair<std::vector<std::pair<ReactionArgNode*, int>, std::allocator<std::pair<ReactionArgNode*, int>>>, int>>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool)
void mirrorFieldArg(std::vector<AstNode*> nodeArray, ostringstream& oss_reaction_mirror, 
                    ostringstream& oss_preprocessor, vector<ReactionArgBin> bins,
                    string prefix_str, bool forIng) {
    for (int i = 0; i < bins.size(); ++i) {
        // Applies to both cases with/without isolation by indexing __mv
        if(forIng) {
            oss_reaction_mirror << str(boost::format(kIngFieldArgPollT) % std::to_string(bins[i].second) % std::to_string(i) % prefix_str);
        } else {
            oss_reaction_mirror << str(boost::format(kEgrFieldArgPollT) % std::to_string(bins[i].second) % std::to_string(i) % prefix_str);
        }

        // Reverse order
        for (int j = bins[i].first.size()-1; j >= 0; --j) {      
            AstNode* arg_node = bins[i].first[j].first->arg_;
            int width = bins[i].first[j].second;
            std::regex e_dot2underscore ("\\.");
            string field_arg_c = std::regex_replace(arg_node->toString(), e_dot2underscore, "_");

            ostringstream oss_mask_tmp;
            oss_mask_tmp << "0b";
            for (int k = 0; k < width; ++k) {
                oss_mask_tmp << "1";
            }
            if(forIng) {
                oss_reaction_mirror << "\n  uint"
                                    << width
                                    << "_t "
                                    << field_arg_c
                                    << "="
                                    << "__mantis__values_riSetArgs_"
                                    << i
                                    << "[1]&"
                                    << oss_mask_tmp.str()
                                    << ";";    
                oss_reaction_mirror << "\n  __mantis__values_riSetArgs_"
                                    << i
                                    << "[1]>>"
                                    << width
                                    << ";";                   
            } else {
                oss_reaction_mirror << "\n  uint"
                                    << width
                                    << "_t "
                                    << field_arg_c
                                    << "="
                                    << "__mantis__values_reSetArgs_"
                                    << i
                                    << "[1]&"
                                    << oss_mask_tmp.str()
                                    << ";";    
                oss_reaction_mirror << "\n  __mantis__values_reSetArgs_"
                                    << i
                                    << "[1]>>"
                                    << width
                                    << ";";   
            }                                       
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movl %r9d, -0x44(%rbp)
movq %r8, -0x58(%rbp)
movq %rcx, -0x40(%rbp)
movq %rsi, -0x38(%rbp)
xorl %r14d, %r14d
leaq -0x238(%rbp), %r13
leaq -0xc0(%rbp), %r12
leaq 0x2b5f4(%rip), %r15     # 0x7be40
movq -0x40(%rbp), %rcx
movq 0x8(%rcx), %rax
subq (%rcx), %rax
sarq $0x5, %rax
cmpq %r14, %rax
jbe 0x50c5b
cmpb $0x0, -0x44(%rbp)
je 0x508ef
movq %r13, %rdi
leaq 0x28fad(%rip), %rsi     # 0x79825
callq 0x58b7c
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %r14, %rcx
shlq $0x5, %rcx
movl 0x18(%rax,%rcx), %esi
leaq -0x78(%rbp), %rbx
movq %rbx, %rdi
callq 0x49e1c
movq %r13, %rdi
movq %rbx, %rsi
callq 0x5b849
movq %rax, %rbx
movq %r12, %rdi
movl %r14d, %esi
callq 0x49e1c
movq %rbx, %rdi
movq %r12, %rsi
callq 0x5b849
movq %rax, %rdi
movq -0x58(%rbp), %rsi
callq 0x6919f
leaq -0x98(%rbp), %rdi
movq %rax, %rsi
callq 0x5c6f6
movq -0x38(%rbp), %rdi
leaq -0x98(%rbp), %rbx
movq %rbx, %rsi
callq 0x41380
jmp 0x5096e
movq %r13, %rdi
leaq 0x29048(%rip), %rsi     # 0x79941
callq 0x58b7c
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %r14, %rcx
shlq $0x5, %rcx
movl 0x18(%rax,%rcx), %esi
leaq -0x78(%rbp), %rbx
movq %rbx, %rdi
callq 0x49e1c
movq %r13, %rdi
movq %rbx, %rsi
callq 0x5b849
movq %rax, %rbx
movq %r12, %rdi
movl %r14d, %esi
callq 0x49e1c
movq %rbx, %rdi
movq %r12, %rsi
callq 0x5b849
movq %rax, %rdi
movq -0x58(%rbp), %rsi
callq 0x6919f
leaq -0x98(%rbp), %rdi
movq %rax, %rsi
callq 0x5c6f6
movq -0x38(%rbp), %rdi
leaq -0x98(%rbp), %rbx
movq %rbx, %rsi
callq 0x41380
movq %rbx, %rdi
callq 0x418c8
movq %r12, %rdi
callq 0x418c8
leaq -0x78(%rbp), %rdi
callq 0x418c8
movq %r13, %rdi
callq 0x58c68
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %r14, -0x50(%rbp)
shlq $0x5, %r14
movq 0x8(%rax,%r14), %rcx
movq %r14, -0xa0(%rbp)
subq (%rax,%r14), %rcx
shrq $0x4, %rcx
movl %ecx, %r14d
decq %r14
testl %r14d, %r14d
leaq -0x98(%rbp), %rbx
js 0x50c4f
movq -0x40(%rbp), %rax
movq (%rax), %rax
movl %r14d, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq -0xa0(%rbp), %rdx
movq (%rax,%rdx), %rax
shlq $0x4, %rcx
movq (%rax,%rcx), %rdx
movq 0x40(%rdx), %r12
movl 0x8(%rax,%rcx), %eax
movl %eax, -0x2c(%rbp)
movq %rbx, %rdi
leaq 0x2905d(%rip), %rsi     # 0x79a5d
pushq $0x10
popq %rdx
callq 0x58ca6
movq (%r12), %rax
movq %r13, %rdi
movq %r12, %rsi
callq *(%rax)
leaq -0x78(%rbp), %rdi
movq %r13, %rsi
movq %rbx, %rdx
leaq 0x29ec5(%rip), %rcx     # 0x7a8ea
xorl %r8d, %r8d
callq 0x58d10
movq %r13, %rdi
callq 0x418c8
movq %r13, %rdi
callq 0x415a0
movq %r13, %rdi
leaq 0x29019(%rip), %rsi     # 0x79a60
callq 0x413d0
movl -0x2c(%rbp), %eax
testl %eax, %eax
movl $0x0, %r12d
cmovgl %eax, %r12d
subl $0x1, %r12d
jb 0x50a6e
movq %r13, %rdi
movq %r15, %rsi
callq 0x413d0
jmp 0x50a5b
cmpb $0x0, -0x44(%rbp)
je 0x50b37
movq -0x38(%rbp), %rdi
leaq 0x28fe0(%rip), %rsi     # 0x79a63
callq 0x413d0
movq %rax, %rdi
movl -0x2c(%rbp), %esi
callq 0x41760
movq %rax, %rdi
leaq 0x29e2a(%rip), %rsi     # 0x7a8c7
callq 0x413d0
movq %rax, %rdi
leaq -0x78(%rbp), %rsi
callq 0x41380
movq %rax, %rdi
leaq 0x26d23(%rip), %rsi     # 0x777db
callq 0x413d0
movq %rax, %rdi
leaq 0x28fac(%rip), %rsi     # 0x79a73
callq 0x413d0
movq %rax, %rdi
movq -0x50(%rbp), %rsi
callq 0x41760
movq %rax, %rdi
leaq 0x28f89(%rip), %rsi     # 0x79a6b
callq 0x413d0
movq %rax, %r12
leaq -0xc0(%rbp), %rbx
movq %rbx, %rdi
leaq -0x230(%rbp), %rsi
callq 0x416b0
movq %r12, %rdi
movq %rbx, %rsi
callq 0x41380
movq %rax, %rdi
leaq 0x28bf8(%rip), %rsi     # 0x7970d
callq 0x413d0
movq %rbx, %rdi
callq 0x418c8
movq -0x38(%rbp), %rdi
leaq 0x28f43(%rip), %rsi     # 0x79a70
callq 0x413d0
jmp 0x50bf1
movq -0x38(%rbp), %rdi
leaq 0x28f21(%rip), %rsi     # 0x79a63
callq 0x413d0
movq %rax, %rdi
movl -0x2c(%rbp), %esi
callq 0x41760
movq %rax, %rdi
leaq 0x29d6b(%rip), %rsi     # 0x7a8c7
callq 0x413d0
movq %rax, %rdi
leaq -0x78(%rbp), %rsi
callq 0x41380
movq %rax, %rdi
leaq 0x26c64(%rip), %rsi     # 0x777db
callq 0x413d0
movq %rax, %rdi
leaq 0x28f12(%rip), %rsi     # 0x79a98
callq 0x413d0
movq %rax, %rdi
movq -0x50(%rbp), %rsi
callq 0x41760
movq %rax, %rdi
leaq 0x28eca(%rip), %rsi     # 0x79a6b
callq 0x413d0
movq %rax, %r12
leaq -0xc0(%rbp), %rbx
movq %rbx, %rdi
leaq -0x230(%rbp), %rsi
callq 0x416b0
movq %r12, %rdi
movq %rbx, %rsi
callq 0x41380
movq %rax, %rdi
leaq 0x28b39(%rip), %rsi     # 0x7970d
callq 0x413d0
movq %rbx, %rdi
callq 0x418c8
movq -0x38(%rbp), %rdi
leaq 0x28ea9(%rip), %rsi     # 0x79a95
callq 0x413d0
movq %rax, %rdi
movq -0x50(%rbp), %rsi
callq 0x41760
movq %rax, %rdi
leaq 0x28e88(%rip), %rsi     # 0x79a8f
callq 0x413d0
movq %rax, %rdi
movl -0x2c(%rbp), %esi
callq 0x41760
movq %rax, %rdi
leaq 0x28aec(%rip), %rsi     # 0x7970d
callq 0x413d0
movq %r13, %rdi
callq 0x410e0
leaq -0x78(%rbp), %rdi
callq 0x418c8
leaq -0x98(%rbp), %rdi
callq 0x58e18
leaq -0xc0(%rbp), %r12
jmp 0x509b5
movq -0x50(%rbp), %r14
incq %r14
jmp 0x5084c
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x50c73
jmp 0x50c86
jmp 0x50c86
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0x418c8
jmp 0x50c97
jmp 0x50c86
movq %rax, %rbx
jmp 0x50ca3
jmp 0x50c8d
movq %rax, %rbx
jmp 0x50cac
jmp 0x50c94
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0x418c8
leaq -0x78(%rbp), %rdi
callq 0x418c8
leaq -0x238(%rbp), %rdi
callq 0x58c68
jmp 0x50d0d
jmp 0x50ce9
jmp 0x50ce9
jmp 0x50cc0
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0x418c8
jmp 0x50cec
movq %rax, %rbx
leaq -0x238(%rbp), %rdi
jmp 0x50cfc
movq %rax, %rbx
jmp 0x50d01
movq %rax, %rbx
jmp 0x50cf8
jmp 0x50ce9
movq %rax, %rbx
leaq -0x238(%rbp), %rdi
callq 0x410e0
leaq -0x78(%rbp), %rdi
callq 0x418c8
leaq -0x98(%rbp), %rdi
callq 0x58e18
movq %rbx, %rdi
callq 0x41790