// File: /workspace/github_cpp_makefile_star2_O1/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 $0x278, %rsp            # imm = 0x278
movl %edx, -0x3c(%rbp)
movq %rsi, %r12
movq %rdi, %r13
leaq -0x100(%rbp), %rdx
movq %rdx, -0x10(%rdx)
xorl %eax, %eax
movq %rax, -0x8(%rdx)
movb %al, (%rdx)
leaq -0xe0(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq %rax, -0x8(%rdx)
movb %al, (%rdx)
leaq -0xc0(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq %rax, -0x8(%rdx)
movb %al, (%rdx)
leaq -0x70(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq %rax, -0x8(%rdx)
movb %al, (%rdx)
leaq -0x50(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq %rax, -0x8(%rdx)
movb %al, (%rdx)
leaq -0xa0(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq %rax, -0x8(%rdx)
movb %al, (%rdx)
leaq -0x288(%rbp), %r14
testl %ecx, %ecx
je 0x6c20b
movq %r14, -0x10(%r14)
leaq 0xde1b(%rip), %rsi      # 0x79f54
leaq 0xde23(%rip), %rdx      # 0x79f63
leaq -0x298(%rbp), %rdi
callq 0x33112
leaq -0x110(%rbp), %rdi
leaq -0x298(%rbp), %rbx
movq %rbx, %rsi
callq 0x2e4c0
movq (%rbx), %rdi
cmpq %r14, %rdi
je 0x6c16f
callq 0x2e360
leaq -0x298(%rbp), %rdi
movq %r14, (%rdi)
leaq 0xba7b(%rip), %rsi      # 0x77bfb
leaq 0xba80(%rip), %rdx      # 0x77c07
callq 0x33112
leaq -0xf0(%rbp), %rdi
movq %rbx, %rsi
callq 0x2e4c0
movq (%rbx), %rdi
cmpq %r14, %rdi
je 0x6c1a8
callq 0x2e360
leaq -0xd0(%rbp), %rdi
movq 0x8(%rdi), %rdx
leaq 0xd9c9(%rip), %rcx      # 0x79b83
movl $0xb, %r8d
xorl %esi, %esi
callq 0x2e640
leaq -0x80(%rbp), %rdi
movq 0x8(%rdi), %rdx
leaq 0xdf48(%rip), %rcx      # 0x7a11e
movl $0xb, %r8d
xorl %esi, %esi
callq 0x2e640
leaq -0x60(%rbp), %rdi
movq 0x8(%rdi), %rdx
leaq 0xdf38(%rip), %rcx      # 0x7a12a
movl $0xb, %r8d
xorl %esi, %esi
callq 0x2e640
leaq 0xdf30(%rip), %rcx      # 0x7a136
jmp 0x6c2e3
movq %r14, -0x10(%r14)
leaq 0xdd94(%rip), %rsi      # 0x79faa
leaq 0xdd9c(%rip), %rdx      # 0x79fb9
leaq -0x298(%rbp), %rdi
callq 0x33112
leaq -0x110(%rbp), %rdi
leaq -0x298(%rbp), %rbx
movq %rbx, %rsi
callq 0x2e4c0
movq (%rbx), %rdi
cmpq %r14, %rdi
je 0x6c24c
callq 0x2e360
leaq -0x298(%rbp), %rdi
movq %r14, (%rdi)
leaq 0xb9bc(%rip), %rsi      # 0x77c19
leaq 0xb9c1(%rip), %rdx      # 0x77c25
callq 0x33112
leaq -0xf0(%rbp), %rdi
movq %rbx, %rsi
callq 0x2e4c0
movq (%rbx), %rdi
cmpq %r14, %rdi
je 0x6c285
callq 0x2e360
leaq -0xd0(%rbp), %rdi
movq 0x8(%rdi), %rdx
leaq 0xd919(%rip), %rcx      # 0x79bb0
movl $0xb, %r8d
xorl %esi, %esi
callq 0x2e640
leaq -0x80(%rbp), %rdi
movq 0x8(%rdi), %rdx
leaq 0xde8f(%rip), %rcx      # 0x7a142
movl $0xb, %r8d
xorl %esi, %esi
callq 0x2e640
leaq -0x60(%rbp), %rdi
movq 0x8(%rdi), %rdx
leaq 0xde7f(%rip), %rcx      # 0x7a14e
movl $0xb, %r8d
xorl %esi, %esi
callq 0x2e640
leaq 0xde77(%rip), %rcx      # 0x7a15a
leaq -0xb0(%rbp), %rdi
movq 0x8(%rdi), %rdx
movl $0xb, %r8d
xorl %esi, %esi
callq 0x2e640
movq 0x8(%r12), %rax
cmpq (%r12), %rax
je 0x6c83c
movl $0x18, %eax
movq %rax, -0x90(%rbp)
movq $0x0, -0x30(%rbp)
movq %r12, -0x88(%rbp)
movq %r13, -0x118(%rbp)
movq %rbx, %rdi
callq 0x2e550
movl $0x6, %edx
movq %rbx, %rdi
leaq 0x9a83(%rip), %rsi      # 0x75dc6
callq 0x2e440
movq -0xd0(%rbp), %rsi
movq -0xc8(%rbp), %rdx
leaq -0x298(%rbp), %rdi
callq 0x2e440
movq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0x2e700
movq %rax, %rbx
movl $0x3, %edx
movq %rax, %rdi
leaq 0xd84f(%rip), %rsi      # 0x79bcf
callq 0x2e440
movl $0xc, %edx
movq %rbx, %rdi
leaq 0xddd2(%rip), %rsi      # 0x7a166
callq 0x2e440
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
movq %rbx, %rdi
callq 0x2e440
movq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0x2e700
movq %rax, %rbx
movl $0x4, %edx
movq %rax, %rdi
leaq 0xddac(%rip), %rsi      # 0x7a173
callq 0x2e440
movl $0x13, %edx
movq %rbx, %rdi
leaq 0xdc19(%rip), %rsi      # 0x79ff4
callq 0x2e440
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
movq %rbx, %rdi
callq 0x2e440
movq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0x2e700
movq %rax, %rbx
movl $0x4, %edx
movq %rax, %rdi
leaq 0xd5da(%rip), %rsi      # 0x799e8
callq 0x2e440
movl $0x3, %edx
movq %rbx, %rdi
leaq 0xdc6b(%rip), %rsi      # 0x7a08d
callq 0x2e440
movl $0x7, %edx
movq %rbx, %rdi
leaq 0x9e7d(%rip), %rsi      # 0x762b3
callq 0x2e440
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
movq %rbx, %rdi
callq 0x2e440
movq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0x2e700
movl $0x5, %edx
movq %rax, %rdi
leaq 0xdd12(%rip), %rsi      # 0x7a178
callq 0x2e440
testb $0x1, -0x3c(%rbp)
jne 0x6c4b7
movl $0x2, %edx
leaq -0x298(%rbp), %rdi
leaq 0xbbec(%rip), %rsi      # 0x78070
callq 0x2e440
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
leaq -0x298(%rbp), %rdi
callq 0x2e440
movq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0x2e700
movl $0x1a, %edx
leaq 0xdcd2(%rip), %rsi      # 0x7a187
jmp 0x6c528
movl $0x2, %edx
leaq -0x298(%rbp), %rdi
leaq 0xbba6(%rip), %rsi      # 0x78070
callq 0x2e440
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
leaq -0x298(%rbp), %rdi
callq 0x2e440
movq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0x2e700
movq %rax, %rbx
movl $0x16, %edx
movq %rax, %rdi
leaq 0xd7ce(%rip), %rsi      # 0x79ccf
callq 0x2e440
movq -0xf0(%rbp), %rsi
movq -0xe8(%rbp), %rdx
movq %rbx, %rdi
callq 0x2e440
movl $0x8, %edx
leaq 0xdc56(%rip), %rsi      # 0x7a17e
movq %rax, %rdi
callq 0x2e440
movl $0x3, %edx
leaq -0x298(%rbp), %rdi
leaq 0xdb4a(%rip), %rsi      # 0x7a08d
callq 0x2e440
movl $0x16, %edx
leaq -0x298(%rbp), %rdi
leaq 0xd6e0(%rip), %rsi      # 0x79c3b
callq 0x2e440
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
leaq -0x298(%rbp), %rdi
callq 0x2e440
movq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0x2e700
movq %rax, %rbx
movl $0x3, %edx
movq %rax, %rdi
leaq 0xd63d(%rip), %rsi      # 0x79bcf
callq 0x2e440
movl $0x8, %edx
movq %rbx, %rdi
leaq 0xd6b3(%rip), %rsi      # 0x79c59
callq 0x2e440
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rdx
movq %rbx, %rdi
callq 0x2e440
movq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0x2e700
movq %rax, %rbx
movl $0x2, %edx
movq %rax, %rdi
leaq 0x9846(%rip), %rsi      # 0x75e25
callq 0x2e440
movl $0x16, %edx
movq %rbx, %rdi
leaq 0xd697(%rip), %rsi      # 0x79c8a
callq 0x2e440
movq -0x110(%rbp), %rsi
movq -0x108(%rbp), %rdx
movq %rbx, %rdi
callq 0x2e440
movq %rax, %rbx
movl $0x4, %edx
movq %rax, %rdi
leaq 0xdb82(%rip), %rsi      # 0x7a1a2
callq 0x2e440
movq %rbx, %rdi
movq -0x30(%rbp), %rsi
callq 0x2e700
movq %rax, %rbx
movl $0x2, %edx
movq %rax, %rdi
leaq 0x97e2(%rip), %rsi      # 0x75e25
callq 0x2e440
movl $0x3, %edx
movq %rbx, %rdi
leaq 0xda36(%rip), %rsi      # 0x7a08d
callq 0x2e440
movl $0x9, %edx
movq %rbx, %rdi
leaq 0x9725(%rip), %rsi      # 0x75d90
callq 0x2e440
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rdx
movq %rbx, %rdi
callq 0x2e440
movq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0x2e700
movq %rax, %rbx
movl $0x3, %edx
movq %rax, %rdi
leaq 0xd52b(%rip), %rsi      # 0x79bcf
callq 0x2e440
movl $0xa, %edx
movq %rbx, %rdi
leaq 0xdaef(%rip), %rsi      # 0x7a1a7
callq 0x2e440
movq (%r12), %rax
movq -0x90(%rbp), %rcx
movl (%rax,%rcx), %esi
movq %rbx, %rdi
callq 0x2e700
movq %rax, %rbx
movl $0x2, %edx
movq %rax, %rdi
leaq 0x9740(%rip), %rsi      # 0x75e25
callq 0x2e440
movl $0x16, %edx
movq %rbx, %rdi
leaq 0xdab9(%rip), %rsi      # 0x7a1b2
callq 0x2e440
movl $0x3, %edx
movq %rbx, %rdi
leaq 0xd980(%rip), %rsi      # 0x7a08d
callq 0x2e440
movl $0x58, %edi
callq 0x2e3a0
movq %rax, -0x38(%rbp)
movl $0x20, %edi
callq 0x2e3a0
movq %rax, %r14
movq %rax, %rdi
leaq -0x290(%rbp), %rsi
callq 0x2e660
movl $0x20, %edi
callq 0x2e3a0
movq %rax, %r15
addq $0x10, %rax
movq %rax, (%r15)
movb $0x1, %r12b
movq %r15, %rdi
leaq 0xd5a4(%rip), %rsi      # 0x79d01
leaq 0xd5a2(%rip), %rdx      # 0x79d06
callq 0x33112
xorl %r12d, %r12d
movl $0x20, %edi
callq 0x2e3a0
movq %rax, %r13
addq $0x10, %rax
movq %rax, (%r13)
movb $0x1, %r12b
movq %r13, %rdi
leaq 0xd3f5(%rip), %rsi      # 0x79b83
leaq 0xd3f9(%rip), %rdx      # 0x79b8e
movq -0x38(%rbp), %rbx
callq 0x33112
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r13, %rcx
callq 0x3e566
movq %rbx, -0x120(%rbp)
movq -0x118(%rbp), %r13
movq 0x8(%r13), %rsi
cmpq 0x10(%r13), %rsi
je 0x6c7db
movq %rbx, (%rsi)
addq $0x8, 0x8(%r13)
movq -0x88(%rbp), %r12
jmp 0x6c7f1
movq %r13, %rdi
leaq -0x120(%rbp), %rdx
callq 0x333de
movq -0x88(%rbp), %r12
leaq -0x298(%rbp), %rbx
movq %rbx, %rdi
movq 0x217a6(%rip), %rsi     # 0x8dfa8
callq 0x2e230
leaq -0x228(%rbp), %rdi
callq 0x2e150
movq 0x8(%r12), %rax
subq (%r12), %rax
movq -0x30(%rbp), %rdx
incq %rdx
sarq $0x5, %rax
addq $0x20, -0x90(%rbp)
movq %rdx, -0x30(%rbp)
cmpq %rdx, %rax
ja 0x6c32c
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x6c854
callq 0x2e360
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x6c866
callq 0x2e360
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x6c878
callq 0x2e360
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x6c890
callq 0x2e360
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x6c8a8
callq 0x2e360
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
je 0x6c8c0
callq 0x2e360
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6c8e8
jmp 0x6c8e8
jmp 0x6c8e8
jmp 0x6c8e8
jmp 0x6c8e8
jmp 0x6c922
movq %rax, %rbx
movq %r14, %rdi
jmp 0x6c912
jmp 0x6c922
movq %rax, %rbx
jmp 0x6c944
movq %rax, %rbx
jmp 0x6c917
movq %rax, %rbx
jmp 0x6c90a
movq %rax, %rbx
testb %r12b, %r12b
je 0x6c907
movq %r13, %rdi
callq 0x2e360
xorl %r12d, %r12d
testb %r12b, %r12b
je 0x6c917
movq %r15, %rdi
callq 0x2e360
movq -0x38(%rbp), %rdi
callq 0x2e360
jmp 0x6c925
movq %rax, %rbx
movq 0x2167c(%rip), %rsi     # 0x8dfa8
leaq -0x298(%rbp), %rdi
callq 0x2e230
leaq -0x228(%rbp), %rdi
callq 0x2e150
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x6c95c
callq 0x2e360
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x6c96e
callq 0x2e360
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x6c980
callq 0x2e360
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x6c998
callq 0x2e360
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x6c9b0
callq 0x2e360
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
je 0x6c9c8
callq 0x2e360
movq %rbx, %rdi
callq 0x2e730