// File: /workspace/github_cpp_makefile_star2_O3/eniac[P]Mantis/src/compile/compile_p4.cpp
// Function: generateArgRegistersForIng(std::vector<AstNode*, std::allocator<AstNode*>>*, 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>>> const&, int, bool)
static void generateArgRegistersForIng(vector<AstNode*>* newNodes,
                          const vector<ReactionArgBin>& bins, int ing_iso_opt, bool forIng) {
    string p4rArgHdrName;
    string p4rMetaName;
    string p4rSetArgsTableNameBase;
    string p4rSetArgsActionNameBase;
    string p4rSetArgsBlackboxNameBase;
    string p4rSetArgsRegNameBase;
    if(forIng) {
        p4rArgHdrName = std::string(kP4rIngArghdrName);
        p4rMetaName = std::string(kP4rIngMetadataName);
        p4rSetArgsTableNameBase = "__tiSetArgs";
        p4rSetArgsActionNameBase = "__aiSetArgs";
        p4rSetArgsBlackboxNameBase = "__biSetArgs";
        p4rSetArgsRegNameBase = "__riSetArgs";
    } else {
        p4rArgHdrName = std::string(kP4rEgrArghdrName);
        p4rMetaName = std::string(kP4rEgrMetadataName);
        p4rSetArgsTableNameBase = "__teSetArgs";
        p4rSetArgsActionNameBase = "__aeSetArgs";
        p4rSetArgsBlackboxNameBase = "__beSetArgs";
        p4rSetArgsRegNameBase = "__reSetArgs";
    }

    for (int i = 0; i < bins.size(); ++i) {
        ostringstream oss;
        oss << "table " << p4rSetArgsTableNameBase << i << " {\n"
            << "  actions { " << p4rSetArgsActionNameBase << i << "; }\n"
            << "  default_action : " << p4rSetArgsActionNameBase << i << "();\n"
            << "}\n\n"
            << "action " << p4rSetArgsActionNameBase << i << "() {\n";
        if (((unsigned int)ing_iso_opt) & 0b1) {
            oss << "  " << p4rSetArgsBlackboxNameBase << i << ".execute_stateful_alu("<< p4rMetaName << ".__mv);\n";
        } else {
            oss << "  " << p4rSetArgsBlackboxNameBase << i << ".execute_stateful_alu(0);\n";
        }
        oss << "}\n\n"
            << "blackbox stateful_alu " << p4rSetArgsBlackboxNameBase << i << " {\n"
            << "  reg : " << p4rSetArgsRegNameBase << i << ";\n"
            << "  update_lo_1_value : " << p4rArgHdrName
                                       << ".reg" << i << ";\n"
            << "}\n\n"
            << "register " << p4rSetArgsRegNameBase << i << " {\n"
            << "  width : " << bins[i].second << ";\n"
            << "  instance_count : 2;\n"
            << "}\n\n";

        auto newSetArgsNode = new UnanchoredNode(new string(oss.str()),
                                                 new string("table"),
                                                 new string("__tiSetArgs"));
        newNodes->push_back(newSetArgsNode);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x268, %rsp            # imm = 0x268
movl %edx, -0x34(%rbp)
movq %rsi, -0x30(%rbp)
movq %rdi, -0x108(%rbp)
leaq -0xf0(%rbp), %rdx
movq %rdx, -0x10(%rdx)
xorl %eax, %eax
movq %rax, -0x8(%rdx)
movb %al, (%rdx)
leaq -0xd0(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq %rax, -0x8(%rdx)
movb %al, (%rdx)
leaq -0xb0(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq %rax, -0x8(%rdx)
movb %al, (%rdx)
leaq -0x68(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq %rax, -0x8(%rdx)
movb %al, (%rdx)
leaq -0x48(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq %rax, -0x8(%rdx)
movb %al, (%rdx)
leaq -0x90(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq %rax, -0x8(%rdx)
movb %al, (%rdx)
leaq -0x278(%rbp), %r14
testl %ecx, %ecx
je 0x6b940
movq %r14, -0x10(%r14)
leaq 0xe6e6(%rip), %rsi      # 0x79f54
leaq 0xe6ee(%rip), %rdx      # 0x79f63
leaq -0x288(%rbp), %rdi
callq 0x32e40
leaq -0x100(%rbp), %rdi
leaq -0x288(%rbp), %rbx
movq %rbx, %rsi
callq 0x2e4c0
movq (%rbx), %rdi
cmpq %r14, %rdi
je 0x6b8a4
callq 0x2e360
leaq -0x288(%rbp), %rdi
movq %r14, (%rdi)
leaq 0xc346(%rip), %rsi      # 0x77bfb
leaq 0xc34b(%rip), %rdx      # 0x77c07
callq 0x32e40
leaq -0xe0(%rbp), %rdi
movq %rbx, %rsi
callq 0x2e4c0
movq (%rbx), %rdi
cmpq %r14, %rdi
je 0x6b8dd
callq 0x2e360
leaq -0xc0(%rbp), %rdi
movq 0x8(%rdi), %rdx
leaq 0xe294(%rip), %rcx      # 0x79b83
movl $0xb, %r8d
xorl %esi, %esi
callq 0x2e640
leaq -0x78(%rbp), %rdi
movq 0x8(%rdi), %rdx
leaq 0xe813(%rip), %rcx      # 0x7a11e
movl $0xb, %r8d
xorl %esi, %esi
callq 0x2e640
leaq -0x58(%rbp), %rdi
movq 0x8(%rdi), %rdx
leaq 0xe803(%rip), %rcx      # 0x7a12a
movl $0xb, %r8d
xorl %esi, %esi
callq 0x2e640
leaq 0xe7fb(%rip), %rcx      # 0x7a136
jmp 0x6ba18
movq %r14, -0x10(%r14)
leaq 0xe65f(%rip), %rsi      # 0x79faa
leaq 0xe667(%rip), %rdx      # 0x79fb9
leaq -0x288(%rbp), %rdi
callq 0x32e40
leaq -0x100(%rbp), %rdi
leaq -0x288(%rbp), %rbx
movq %rbx, %rsi
callq 0x2e4c0
movq (%rbx), %rdi
cmpq %r14, %rdi
je 0x6b981
callq 0x2e360
leaq -0x288(%rbp), %rdi
movq %r14, (%rdi)
leaq 0xc287(%rip), %rsi      # 0x77c19
leaq 0xc28c(%rip), %rdx      # 0x77c25
callq 0x32e40
leaq -0xe0(%rbp), %rdi
movq %rbx, %rsi
callq 0x2e4c0
movq (%rbx), %rdi
cmpq %r14, %rdi
je 0x6b9ba
callq 0x2e360
leaq -0xc0(%rbp), %rdi
movq 0x8(%rdi), %rdx
leaq 0xe1e4(%rip), %rcx      # 0x79bb0
movl $0xb, %r8d
xorl %esi, %esi
callq 0x2e640
leaq -0x78(%rbp), %rdi
movq 0x8(%rdi), %rdx
leaq 0xe75a(%rip), %rcx      # 0x7a142
movl $0xb, %r8d
xorl %esi, %esi
callq 0x2e640
leaq -0x58(%rbp), %rdi
movq 0x8(%rdi), %rdx
leaq 0xe74a(%rip), %rcx      # 0x7a14e
movl $0xb, %r8d
xorl %esi, %esi
callq 0x2e640
leaq 0xe742(%rip), %rcx      # 0x7a15a
leaq -0xa0(%rbp), %rdi
movq 0x8(%rdi), %rdx
movl $0xb, %r8d
xorl %esi, %esi
callq 0x2e640
movq -0x30(%rbp), %rcx
movq 0x8(%rcx), %rax
cmpq (%rcx), %rax
je 0x6bf28
movl $0x18, %eax
movq %rax, -0x80(%rbp)
xorl %r12d, %r12d
movq %rbx, %rdi
callq 0x2e550
movl $0x6, %edx
movq %rbx, %rdi
leaq 0xa362(%rip), %rsi      # 0x75dc6
callq 0x2e440
movq -0xc0(%rbp), %rsi
movq -0xb8(%rbp), %rdx
leaq -0x288(%rbp), %rdi
callq 0x2e440
movq %rax, %rdi
movl %r12d, %esi
callq 0x2e700
movq %rax, %rbx
movl $0x3, %edx
movq %rax, %rdi
leaq 0xe12f(%rip), %rsi      # 0x79bcf
callq 0x2e440
movl $0xc, %edx
movq %rbx, %rdi
leaq 0xe6b2(%rip), %rsi      # 0x7a166
callq 0x2e440
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
movq %rbx, %rdi
callq 0x2e440
movq %rax, %rdi
movl %r12d, %esi
callq 0x2e700
movq %rax, %rbx
movl $0x4, %edx
movq %rax, %rdi
leaq 0xe68d(%rip), %rsi      # 0x7a173
callq 0x2e440
movl $0x13, %edx
movq %rbx, %rdi
leaq 0xe4fa(%rip), %rsi      # 0x79ff4
callq 0x2e440
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
movq %rbx, %rdi
callq 0x2e440
movq %rax, %rdi
movl %r12d, %esi
callq 0x2e700
movq %rax, %rbx
movl $0x4, %edx
movq %rax, %rdi
leaq 0xdebc(%rip), %rsi      # 0x799e8
callq 0x2e440
movl $0x3, %edx
movq %rbx, %rdi
leaq 0xe54d(%rip), %rsi      # 0x7a08d
callq 0x2e440
movl $0x7, %edx
movq %rbx, %rdi
leaq 0xa75f(%rip), %rsi      # 0x762b3
callq 0x2e440
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
movq %rbx, %rdi
callq 0x2e440
movq %rax, %rdi
movl %r12d, %esi
callq 0x2e700
movl $0x5, %edx
movq %rax, %rdi
leaq 0xe5f5(%rip), %rsi      # 0x7a178
callq 0x2e440
testb $0x1, -0x34(%rbp)
jne 0x6bbd3
movl $0x2, %edx
leaq -0x288(%rbp), %rdi
leaq 0xc4cf(%rip), %rsi      # 0x78070
callq 0x2e440
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
leaq -0x288(%rbp), %rdi
callq 0x2e440
movq %rax, %rdi
movl %r12d, %esi
callq 0x2e700
movl $0x1a, %edx
leaq 0xe5b6(%rip), %rsi      # 0x7a187
jmp 0x6bc43
movl $0x2, %edx
leaq -0x288(%rbp), %rdi
leaq 0xc48a(%rip), %rsi      # 0x78070
callq 0x2e440
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
leaq -0x288(%rbp), %rdi
callq 0x2e440
movq %rax, %rdi
movl %r12d, %esi
callq 0x2e700
movq %rax, %rbx
movl $0x16, %edx
movq %rax, %rdi
leaq 0xe0b3(%rip), %rsi      # 0x79ccf
callq 0x2e440
movq -0xe0(%rbp), %rsi
movq -0xd8(%rbp), %rdx
movq %rbx, %rdi
callq 0x2e440
movl $0x8, %edx
leaq 0xe53b(%rip), %rsi      # 0x7a17e
movq %rax, %rdi
callq 0x2e440
movl $0x3, %edx
leaq -0x288(%rbp), %rdi
leaq 0xe42f(%rip), %rsi      # 0x7a08d
callq 0x2e440
movl $0x16, %edx
leaq -0x288(%rbp), %rdi
leaq 0xdfc5(%rip), %rsi      # 0x79c3b
callq 0x2e440
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
leaq -0x288(%rbp), %rdi
callq 0x2e440
movq %rax, %rdi
movl %r12d, %esi
callq 0x2e700
movq %rax, %rbx
movl $0x3, %edx
movq %rax, %rdi
leaq 0xdf23(%rip), %rsi      # 0x79bcf
callq 0x2e440
movl $0x8, %edx
movq %rbx, %rdi
leaq 0xdf99(%rip), %rsi      # 0x79c59
callq 0x2e440
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rdx
movq %rbx, %rdi
callq 0x2e440
movq %rax, %rdi
movl %r12d, %esi
callq 0x2e700
movq %rax, %rbx
movl $0x2, %edx
movq %rax, %rdi
leaq 0xa12d(%rip), %rsi      # 0x75e25
callq 0x2e440
movl $0x16, %edx
movq %rbx, %rdi
leaq 0xdf7e(%rip), %rsi      # 0x79c8a
callq 0x2e440
movq -0x100(%rbp), %rsi
movq -0xf8(%rbp), %rdx
movq %rbx, %rdi
callq 0x2e440
movq %rax, %rbx
movl $0x4, %edx
movq %rax, %rdi
leaq 0xe469(%rip), %rsi      # 0x7a1a2
callq 0x2e440
movq %rbx, %rdi
movl %r12d, %esi
callq 0x2e700
movq %rax, %rbx
movl $0x2, %edx
movq %rax, %rdi
leaq 0xa0ca(%rip), %rsi      # 0x75e25
callq 0x2e440
movl $0x3, %edx
movq %rbx, %rdi
leaq 0xe31e(%rip), %rsi      # 0x7a08d
callq 0x2e440
movl $0x9, %edx
movq %rbx, %rdi
leaq 0xa00d(%rip), %rsi      # 0x75d90
callq 0x2e440
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rdx
movq %rbx, %rdi
callq 0x2e440
movq %rax, %rdi
movl %r12d, %esi
callq 0x2e700
movq %rax, %rbx
movl $0x3, %edx
movq %rax, %rdi
leaq 0xde14(%rip), %rsi      # 0x79bcf
callq 0x2e440
movl $0xa, %edx
movq %rbx, %rdi
leaq 0xe3d8(%rip), %rsi      # 0x7a1a7
callq 0x2e440
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x80(%rbp), %rcx
movl (%rax,%rcx), %esi
movq %rbx, %rdi
callq 0x2e700
movq %rax, %rbx
movl $0x2, %edx
movq %rax, %rdi
leaq 0xa029(%rip), %rsi      # 0x75e25
callq 0x2e440
movl $0x16, %edx
movq %rbx, %rdi
leaq 0xe3a2(%rip), %rsi      # 0x7a1b2
callq 0x2e440
movl $0x3, %edx
movq %rbx, %rdi
leaq 0xe269(%rip), %rsi      # 0x7a08d
callq 0x2e440
movl $0x58, %edi
callq 0x2e3a0
movq %rax, %rbx
movl $0x20, %edi
callq 0x2e3a0
movq %rax, %r15
movq %rax, %rdi
leaq -0x280(%rbp), %rsi
callq 0x2e660
movl $0x20, %edi
callq 0x2e3a0
movq %rax, %r14
addq $0x10, %rax
movq %rax, (%r14)
movq %r14, %rdi
leaq 0xde91(%rip), %rsi      # 0x79d01
leaq 0xde8f(%rip), %rdx      # 0x79d06
callq 0x32e40
movl $0x20, %edi
callq 0x2e3a0
movq %rax, %r13
addq $0x10, %rax
movq %rax, (%r13)
movq %r13, %rdi
leaq 0xdce8(%rip), %rsi      # 0x79b83
leaq 0xdcec(%rip), %rdx      # 0x79b8e
callq 0x32e40
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %r13, %rcx
callq 0x3e120
movq %rbx, -0x110(%rbp)
movq -0x108(%rbp), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x6beda
movq %rbx, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x6bee6
leaq -0x110(%rbp), %rdx
callq 0x3311a
leaq -0x288(%rbp), %rbx
movq %rbx, %rdi
movq 0x220b1(%rip), %rsi     # 0x8dfa8
callq 0x2e230
leaq -0x218(%rbp), %rdi
callq 0x2e150
movq -0x30(%rbp), %rcx
movq 0x8(%rcx), %rax
subq (%rcx), %rax
incq %r12
sarq $0x5, %rax
addq $0x20, -0x80(%rbp)
cmpq %r12, %rax
ja 0x6ba4d
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x6bf40
callq 0x2e360
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x6bf52
callq 0x2e360
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x6bf64
callq 0x2e360
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
cmpq %rax, %rdi
je 0x6bf7c
callq 0x2e360
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
cmpq %rax, %rdi
je 0x6bf94
callq 0x2e360
movq -0x100(%rbp), %rdi
leaq -0xf0(%rbp), %rax
cmpq %rax, %rdi
je 0x6bfac
callq 0x2e360
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6bfed
jmp 0x6bfed
jmp 0x6bfed
jmp 0x6bfed
jmp 0x6bfed
jmp 0x6bfff
movq %rax, %r12
movq %r15, %rdi
jmp 0x6bfe2
movq %rax, %r12
movq %r14, %rdi
jmp 0x6bfe2
jmp 0x6bff2
movq %rax, %r12
movq %r13, %rdi
callq 0x2e360
jmp 0x6bff5
jmp 0x6bff2
jmp 0x6bfff
movq %rax, %r12
jmp 0x6c021
movq %rax, %r12
movq %rbx, %rdi
callq 0x2e360
jmp 0x6c002
movq %rax, %r12
movq 0x21f9f(%rip), %rsi     # 0x8dfa8
leaq -0x288(%rbp), %rdi
callq 0x2e230
leaq -0x218(%rbp), %rdi
callq 0x2e150
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x6c039
callq 0x2e360
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x6c04b
callq 0x2e360
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x6c05d
callq 0x2e360
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
cmpq %rax, %rdi
je 0x6c075
callq 0x2e360
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
cmpq %rax, %rdi
je 0x6c08d
callq 0x2e360
movq -0x100(%rbp), %rdi
leaq -0xf0(%rbp), %rax
cmpq %rax, %rdi
je 0x6c0a5
callq 0x2e360
movq %r12, %rdi
callq 0x2e730