// File: /workspace/github_cpp_makefile_star2_O2/eniac[P]Mantis/src/compile/compile_p4.cpp
// Function: augmentRegisterArgProgForIng(std::vector<AstNode*, std::allocator<AstNode*>>*, std::vector<AstNode*, std::allocator<AstNode*>>*, std::vector<ReactionArgNode*, std::allocator<ReactionArgNode*>> const&, int, bool)
void augmentRegisterArgProgForIng(vector<AstNode*>* newNodes,
                         vector<AstNode*>* nodeArray,
                         const vector<ReactionArgNode*>& reaction_args,
                         int iso_opt, bool forIng) {
    string p4rRegMetadataType;
    string p4rRegMetadataName;
    if(forIng) {
        p4rRegMetadataType = string(kP4rIngRegMetadataType);
        p4rRegMetadataName = string(kP4rIngRegMetadataName);
    } else {
        p4rRegMetadataType = string(kP4rEgrRegMetadataType);
        p4rRegMetadataName = string(kP4rEgrRegMetadataName);
    }

    // Generate meta data for storing latest value of register index, value
    if (((unsigned int)iso_opt) & 0b1) {
        ostringstream oss;
        oss << "header_type "<< p4rRegMetadataType << " {\n"
            << " fields {\n";        
        vector<P4RegisterNode*> regNodes = findP4RegisterNode(*nodeArray);

        for (auto ra : reaction_args) {    
            if (ra->argType_==ReactionArgNode::REGISTER) {
                if(forIng) {
                    if(!findRegargInIng(ra, *nodeArray)) {
                        continue;
                    }
                } else {
                    if(findRegargInIng(ra, *nodeArray)) {
                        continue;
                    }
                }
                for(auto reg : regNodes) {
                    if(reg->name_->toString().compare(ra->toString())==0) {
                        oss << "  " << ra->toString() << kP4rRegMetadataOutputSuffix << "  : "<< reg->width_ << ";\n";
                        int index_width = int(ceil(log2(reg->instanceCount_)));
                        if (index_width==0) {
                            index_width = 1;
                        }
                        oss << "  " << ra->toString() << kP4rRegMetadataIndexSuffix << "  : "<< index_width << ";\n";
                        break;
                    }
                }
            }
        }        

        oss << " }" << endl;
        oss << "}" << endl;
        oss << "metadata " << p4rRegMetadataType << " "
                           << p4rRegMetadataName << ";\n\n";

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

        // Transform original blackbox program 
        // Currently assume the reg to isolation has no HI member and no output instruction
        // If original blackbox has output instruction already, just mirror that the output meta data

        vector<P4ExprNode*> blackboxes = findBlackbox(*nodeArray);
        for (auto blackbox : blackboxes) {
            std::string prog_name = blackbox->name2_->toString();
            std::stringstream ss(blackbox->body_->toString());
            std::string reg_name;
            std::string item;
            while (std::getline(ss, item, ';'))
            {
                std::stringstream ss_(item);
                std::string item_;
                while (std::getline(ss_, item_, ':')) {
                    boost::algorithm::trim(item_);
                    if(item_.compare("reg")==0) {
                        std::getline(ss_, item_, ':');
                        boost::algorithm::trim(item_);
                        reg_name = item_;
                    }
                }
            }
            ostringstream oss_dst_field, oss_index_field;
            oss_dst_field << p4rRegMetadataName
                             << "."
                             << reg_name
                             << kP4rRegMetadataOutputSuffix;       
            oss_index_field << p4rRegMetadataName
                            << "."
                            << reg_name
                            << kP4rRegMetadataIndexSuffix;                                      
            ostringstream oss_cmd;
            oss_cmd << "  " << "output_value : alu_lo;\n"
                    << "  " << "output_dst : "
                    << oss_dst_field.str()
                    << ";\n";
            string newbodystr = blackbox->body_->toString()+oss_cmd.str();
            blackbox->body_ = new BodyNode(NULL, NULL, new BodyWordNode(BodyWordNode::STRING, new StrNode(new string(newbodystr))));

            // Singleton action that executes the prog
            // Locate the action that executes the stateful prog and mirror the index to meta
            bool transformed = false;
            for (auto tmp_node : *nodeArray) {
                if(typeContains(tmp_node, "ActionNode") && !typeContains(tmp_node, "P4R")) {
                    ActionNode* tmp_action_node = dynamic_cast<ActionNode*>(tmp_node);
                    string tmp_action_name = tmp_action_node->name_->toString();
                    ActionStmtsNode* actionstmts = tmp_action_node->stmts_;
                    for (ActionStmtNode* as : *actionstmts->list_) {
                        if(as->toString().find("execute_stateful_alu")!=string::npos &&
                            as->toString().find(prog_name)!=string::npos) {
                            // Extract the index or index metadata/field
                            unsigned first = as->toString().find("(");
                            unsigned last = as->toString().find(")");
                            string index = as->toString().substr (first+1,last-first-1);
                            
                            // Mirror the index to p4r reg metadata
                            auto tmp_args = new ArgsNode();
                            tmp_args->push_back(new BodyWordNode(
                                BodyWordNode::STRING,
                                new StrNode(new string(oss_index_field.str()))));
                            tmp_args->push_back(new BodyWordNode(
                                BodyWordNode::STRING,
                                new StrNode(new string(index))));                            
                            actionstmts->push_back(new ActionStmtNode(
                                                        new NameNode(new string("modify_field")),
                                                        tmp_args,
                                                        ActionStmtNode::NAME_ARGLIST,
                                                        NULL,
                                                        NULL
                                                    ));     
                            transformed = true;
                            break;
                        }
                    }
                    if (transformed) {
                        break;
                    }
                }
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x958, %rsp            # imm = 0x958
movl %ecx, %r15d
movq %rdx, %rbx
movq %rsi, -0x60(%rbp)
movq %rdi, -0x30(%rbp)
leaq -0x150(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
leaq -0xc0(%rbp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
xorl %edx, %edx
movb %dl, (%rax)
movb %dl, (%rcx)
movl %r8d, -0x68(%rbp)
testl %r8d, %r8d
je 0x6cf18
leaq 0xfecc(%rip), %rsi      # 0x7cd97
leaq -0x388(%rbp), %rdi
leaq -0x510(%rbp), %rdx
callq 0x411c0
leaq -0x160(%rbp), %rdi
leaq -0x388(%rbp), %r14
movq %r14, %rsi
callq 0x41500
movq %r14, %rdi
callq 0x418c8
leaq 0xfe2e(%rip), %rsi      # 0x7cd31
leaq -0x388(%rbp), %rdi
leaq -0x510(%rbp), %rdx
callq 0x411c0
jmp 0x6cf6a
leaq 0xfe8a(%rip), %rsi      # 0x7cda9
leaq -0x388(%rbp), %rdi
leaq -0x510(%rbp), %rdx
callq 0x411c0
leaq -0x160(%rbp), %rdi
leaq -0x388(%rbp), %r14
movq %r14, %rsi
callq 0x41500
movq %r14, %rdi
callq 0x418c8
leaq 0xfe64(%rip), %rsi      # 0x7cdbb
leaq -0x388(%rbp), %rdi
leaq -0x510(%rbp), %rdx
callq 0x411c0
leaq -0xd0(%rbp), %rdi
movq %r14, %rsi
callq 0x41500
movq %r14, %rdi
callq 0x418c8
testb $0x1, %r15b
je 0x6da81
leaq -0x800(%rbp), %rdi
callq 0x415a0
leaq 0xbe27(%rip), %rsi      # 0x78dc5
leaq -0x800(%rbp), %rdi
callq 0x413d0
leaq -0x160(%rbp), %rsi
movq %rax, %rdi
callq 0x41380
leaq 0xfc9f(%rip), %rsi      # 0x7cc5f
movq %rax, %rdi
callq 0x413d0
leaq 0xbe04(%rip), %rsi      # 0x78dd3
movq %rax, %rdi
callq 0x413d0
leaq -0x190(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x7268a
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
movq %rcx, -0x48(%rbp)
leaq -0x510(%rbp), %r15
cmpq -0x48(%rbp), %rax
je 0x6d1f9
movq %rax, -0x58(%rbp)
movq (%rax), %rax
movq %rax, -0x38(%rbp)
cmpl $0x4, 0x3c(%rax)
jne 0x6d1ec
cmpb $0x0, -0x68(%rbp)
je 0x6d050
leaq -0x200(%rbp), %r14
movq %r14, %rdi
movq -0x60(%rbp), %rsi
callq 0x4486c
movq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x72d72
movl %eax, %ebx
movq %r14, %rdi
callq 0x44be0
testb %bl, %bl
jne 0x6d081
jmp 0x6d1ec
leaq -0x1e8(%rbp), %r14
movq %r14, %rdi
movq -0x60(%rbp), %rsi
callq 0x4486c
movq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x72d72
movl %eax, %ebx
movq %r14, %rdi
callq 0x44be0
testb %bl, %bl
jne 0x6d1ec
movq -0x190(%rbp), %r13
movq -0x188(%rbp), %rax
movq %rax, -0x50(%rbp)
cmpq -0x50(%rbp), %r13
je 0x6d1ec
movq (%r13), %r14
movq 0x40(%r14), %rsi
movq (%rsi), %rax
leaq -0x388(%rbp), %rdi
callq *(%rax)
movq -0x38(%rbp), %rsi
movq (%rsi), %rax
movq %r15, %rdi
callq *(%rax)
movq %r15, %r12
leaq -0x388(%rbp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x41040
movl %eax, %ebx
movq %r12, %rdi
callq 0x418c8
movq %r15, %rdi
callq 0x418c8
addq $0x8, %r13
testl %ebx, %ebx
movq %r12, %r15
jne 0x6d093
leaq -0x800(%rbp), %rdi
leaq 0xdf53(%rip), %rsi      # 0x7b050
callq 0x413d0
movq %rax, %rbx
movq -0x38(%rbp), %rsi
movq (%rsi), %rax
leaq -0x388(%rbp), %r12
movq %r12, %rdi
callq *(%rax)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x41380
movq %rax, %rdi
leaq 0xfc14(%rip), %rsi      # 0x7cd41
callq 0x413d0
movq %rax, %rdi
leaq 0xfc8f(%rip), %rsi      # 0x7cdcb
callq 0x413d0
movl 0x50(%r14), %esi
movq %rax, %rdi
callq 0x41760
movq %rax, %rdi
leaq 0xbcae(%rip), %rsi      # 0x78e05
callq 0x413d0
movq %r12, %rdi
callq 0x418c8
movl 0x54(%r14), %edi
callq 0x710cb
callq 0x41090
cvttsd2si %xmm0, %r14d
cmpl $0x1, %r14d
adcl $0x0, %r14d
leaq -0x800(%rbp), %rdi
leaq 0xdec3(%rip), %rsi      # 0x7b050
callq 0x413d0
movq %rax, %rbx
movq -0x38(%rbp), %rsi
movq (%rsi), %rax
movq %r12, %rdi
callq *(%rax)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x41380
movq %rax, %rdi
leaq 0xfbc0(%rip), %rsi      # 0x7cd76
callq 0x413d0
movq %rax, %rdi
leaq 0xfc06(%rip), %rsi      # 0x7cdcb
callq 0x413d0
movq %rax, %rdi
movl %r14d, %esi
callq 0x41760
movq %rax, %rdi
leaq 0xbc26(%rip), %rsi      # 0x78e05
callq 0x413d0
movq %r12, %rdi
callq 0x418c8
movq -0x58(%rbp), %rax
addq $0x8, %rax
jmp 0x6cff9
leaq 0xfc5a(%rip), %rsi      # 0x7ce5a
leaq -0x800(%rbp), %rdi
callq 0x413d0
movq %rax, %rdi
callq 0x41240
leaq 0xda95(%rip), %rsi      # 0x7acb0
leaq -0x800(%rbp), %rdi
callq 0x413d0
movq %rax, %rdi
callq 0x41240
leaq 0xbbb0(%rip), %rsi      # 0x78de6
leaq -0x800(%rbp), %rdi
callq 0x413d0
leaq -0x160(%rbp), %rsi
movq %rax, %rdi
callq 0x41380
leaq 0xddf9(%rip), %rsi      # 0x7b051
movq %rax, %rdi
callq 0x413d0
leaq -0xd0(%rbp), %rsi
movq %rax, %rdi
callq 0x41380
leaq 0xcf3e(%rip), %rsi      # 0x7a1b4
movq %rax, %rdi
callq 0x413d0
pushq $0x58
popq %rdi
callq 0x413f0
movq %rax, %r14
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %r15
leaq -0x7f8(%rbp), %rsi
movq %rax, %rdi
callq 0x416b0
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %r12
leaq 0xfb1b(%rip), %rsi      # 0x7cdd0
leaq -0x510(%rbp), %rdx
movq %rax, %rdi
callq 0x411c0
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %r13
leaq -0xd0(%rbp), %rsi
movq %rax, %rdi
callq 0x415b0
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x4dd8e
leaq -0x388(%rbp), %rsi
movq %r14, (%rsi)
movq -0x30(%rbp), %rdi
callq 0x44d46
leaq -0x178(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x72002
movq -0x178(%rbp), %rax
movq -0x170(%rbp), %rcx
movq %rcx, -0xd8(%rbp)
leaq -0x678(%rbp), %r14
leaq -0x688(%rbp), %r12
leaq -0x978(%rbp), %rbx
cmpq -0xd8(%rbp), %rax
je 0x6da5d
movq %rax, -0xe0(%rbp)
movq (%rax), %r15
movq 0x50(%r15), %rsi
movq (%rsi), %rax
leaq -0x1d0(%rbp), %rdi
callq *(%rax)
movq %r15, -0x38(%rbp)
movq 0x60(%r15), %rsi
movq (%rsi), %rax
leaq -0x510(%rbp), %r13
movq %r13, %rdi
callq *(%rax)
leaq -0x388(%rbp), %rdi
movq %r13, %rsi
pushq $0x18
popq %rdx
callq 0x416c0
movq %r13, %rdi
callq 0x418c8
leaq -0xa0(%rbp), %rax
movq %rax, -0xb0(%rbp)
andq $0x0, -0xa8(%rbp)
xorl %ecx, %ecx
movb %cl, -0xa0(%rbp)
leaq -0x110(%rbp), %rax
movq %rax, -0x120(%rbp)
andq $0x0, -0x118(%rbp)
movb %cl, -0x110(%rbp)
leaq -0x388(%rbp), %rdi
leaq -0x120(%rbp), %rsi
pushq $0x3b
popq %rdx
callq 0x417f0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x6d4ca
leaq -0x510(%rbp), %rdi
leaq -0x120(%rbp), %rsi
pushq $0x18
popq %rdx
callq 0x416c0
movq %r14, -0x688(%rbp)
andq $0x0, -0x680(%rbp)
movb $0x0, -0x678(%rbp)
leaq -0x510(%rbp), %rdi
movq %r12, %rsi
pushq $0x3a
popq %rdx
callq 0x417f0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x6d4b1
movq %rbx, %rdi
callq 0x418a0
movq %r12, %rdi
movq %rbx, %rsi
callq 0x49aca
movq %rbx, %rdi
callq 0x415e0
movq %r12, %rdi
leaq 0xfc19(%rip), %rsi      # 0x7d080
callq 0x41130
testl %eax, %eax
jne 0x6d422
leaq -0x510(%rbp), %rdi
movq %r12, %rsi
pushq $0x3a
popq %rdx
callq 0x417f0
movq %rbx, %rdi
callq 0x418a0
movq %r12, %rdi
movq %rbx, %rsi
callq 0x49aca
movq %rbx, %rdi
callq 0x415e0
leaq -0xb0(%rbp), %rdi
movq %r12, %rsi
callq 0x41290
jmp 0x6d422
movq %r12, %rdi
callq 0x418c8
leaq -0x510(%rbp), %rdi
callq 0x41330
jmp 0x6d3ce
leaq -0x510(%rbp), %rdi
callq 0x415a0
movq %r12, %rdi
callq 0x415a0
leaq -0x510(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x41380
movq %rax, %rdi
leaq 0xd40e(%rip), %rsi      # 0x7a909
callq 0x413d0
movq %rax, %rdi
leaq -0xb0(%rbp), %rsi
callq 0x41380
movq %rax, %rdi
leaq 0xf828(%rip), %rsi      # 0x7cd41
callq 0x413d0
movq %r12, %rdi
leaq -0xd0(%rbp), %rsi
callq 0x41380
movq %rax, %rdi
leaq 0xd3d2(%rip), %rsi      # 0x7a909
callq 0x413d0
movq %rax, %rdi
leaq -0xb0(%rbp), %rsi
callq 0x41380
movq %rax, %rdi
leaq 0xf821(%rip), %rsi      # 0x7cd76
callq 0x413d0
movq %rbx, %rdi
callq 0x415a0
movq %rbx, %rdi
leaq 0xdae4(%rip), %rsi      # 0x7b050
callq 0x413d0
movq %rax, %rdi
leaq 0xf85e(%rip), %rsi      # 0x7cdd9
callq 0x413d0
movq %rax, %rdi
leaq 0xdac6(%rip), %rsi      # 0x7b050
callq 0x413d0
movq %rax, %rdi
leaq 0xf858(%rip), %rsi      # 0x7cdf1
callq 0x413d0
movq %rax, %r13
leaq -0x140(%rbp), %r15
movq %r15, %rdi
leaq -0x508(%rbp), %rsi
callq 0x416b0
movq %r13, %rdi
movq %r15, %rsi
callq 0x41380
movq %rax, %rdi
leaq 0xb839(%rip), %rsi      # 0x78e05
callq 0x413d0
leaq -0x140(%rbp), %rdi
callq 0x418c8
movq -0x38(%rbp), %rax
movq 0x60(%rax), %rsi
movq (%rsi), %rax
leaq -0x100(%rbp), %rdi
callq *(%rax)
leaq -0x90(%rbp), %r13
movq %r13, %rdi
leaq -0x970(%rbp), %rsi
callq 0x416b0
leaq -0x140(%rbp), %rdi
leaq -0x100(%rbp), %r15
movq %r15, %rsi
movq %r13, %rdx
callq 0x443b8
movq %r13, %rdi
callq 0x418c8
movq %r15, %rdi
callq 0x418c8
pushq $0x60
popq %rdi
callq 0x413f0
movq %rax, %r15
pushq $0x50
popq %rdi
callq 0x413f0
movq %rax, -0x50(%rbp)
pushq $0x48
popq %rdi
callq 0x413f0
movq %rax, -0x58(%rbp)
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %r13
movq %rax, %rdi
leaq -0x140(%rbp), %rsi
callq 0x415b0
movq -0x58(%rbp), %rdi
movq %r13, %rsi
callq 0x44730
movq -0x50(%rbp), %rdi
pushq $0x3
popq %rsi
movq -0x58(%rbp), %rdx
callq 0x46ba0
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
movq -0x50(%rbp), %rcx
callq 0x46fa6
movq -0x38(%rbp), %rax
movq %r15, 0x60(%rax)
movq -0x60(%rbp), %rax
movq (%rax), %r15
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
cmpq -0x58(%rbp), %r15
je 0x6d9f5
movq (%r15), %r13
movq %r13, %rdi
leaq 0xd288(%rip), %rsi      # 0x7a94f
callq 0x71cf8
testb %al, %al
je 0x6d9ec
movq %r13, %rdi
leaq 0xd1cc(%rip), %rsi      # 0x7a8aa
callq 0x71cf8
testb %al, %al
jne 0x6d9ec
testq %r13, %r13
je 0x6d70d
movq %r13, %rdi
leaq 0x26f96(%rip), %rsi     # 0x94690
leaq 0x2784f(%rip), %rdx     # 0x94f50
xorl %ecx, %ecx
callq 0x41480
movq %rax, %r13
jmp 0x6d710
xorl %r13d, %r13d
leaq -0x100(%rbp), %rdi
movq 0x40(%r13), %rsi
movq (%rsi), %rax
callq *(%rax)
movq 0x50(%r13), %rax
movq %rax, -0x68(%rbp)
movq 0x40(%rax), %rax
movq (%rax), %r14
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq %r15, -0x50(%rbp)
cmpq -0x38(%rbp), %r14
je 0x6d7d6
movq (%r14), %r13
movq (%r13), %rax
leaq -0x90(%rbp), %r15
movq %r15, %rdi
movq %r13, %rsi
callq *(%rax)
movq %r15, %rdi
leaq 0xf69a(%rip), %rsi      # 0x7cdff
xorl %edx, %edx
callq 0x41880
cmpq $-0x1, %rax
je 0x6d7c1
movq %r12, %rbx
movq %r14, %r12
movq (%r13), %rax
leaq -0x1b0(%rbp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq *(%rax)
movq %r14, %rdi
leaq -0x1d0(%rbp), %rsi
xorl %edx, %edx
callq 0x41890
movq %rax, %r15
movq %r14, %rdi
callq 0x418c8
leaq -0x90(%rbp), %rdi
callq 0x418c8
cmpq $-0x1, %r15
movq %r12, %r14
movq %rbx, %r12
je 0x6d7c9
jmp 0x6d7f5
movq %r15, %rdi
callq 0x418c8
addq $0x8, %r14
movq -0x50(%rbp), %r15
jmp 0x6d73b
leaq -0x100(%rbp), %rdi
callq 0x418c8
leaq -0x678(%rbp), %r14
leaq -0x978(%rbp), %rbx
jmp 0x6d9ec
movq (%r13), %rax
leaq -0x90(%rbp), %r15
movq %r15, %rdi
movq %r13, %rsi
callq *(%rax)
movq %r15, %rdi
leaq 0xf43f(%rip), %rsi      # 0x7cc51
xorl %edx, %edx
callq 0x41880
movq %rax, %rbx
movq %r15, %rdi
callq 0x418c8
movq (%r13), %rax
movq %r15, %rdi
movq %r13, %rsi
callq *(%rax)
movq %r15, %rdi
leaq 0xfc5f(%rip), %rsi      # 0x7d499
xorl %edx, %edx
callq 0x41880
movq %rax, -0x48(%rbp)
movq %r15, %rdi
callq 0x418c8
movq (%r13), %rax
leaq -0x1b0(%rbp), %r15
movq %r15, %rdi
movq %r13, %rsi
callq *(%rax)
leal 0x1(%rbx), %edx
notl %ebx
movq -0x48(%rbp), %rcx
addl %ebx, %ecx
leaq -0x90(%rbp), %rdi
movq %r15, %rsi
callq 0x41420
movq %r15, %rdi
callq 0x418c8
pushq $0x48
popq %rdi
callq 0x413f0
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %r15
leaq -0x978(%rbp), %rbx
movq -0x48(%rbp), %rdi
callq 0x48f72
pushq $0x50
popq %rdi
callq 0x413f0
movq %rax, -0x30(%rbp)
pushq $0x48
popq %rdi
callq 0x413f0
movq %rax, -0x40(%rbp)
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %r13
movq %rax, %rdi
leaq -0x680(%rbp), %rsi
callq 0x416b0
movq -0x40(%rbp), %rdi
movq %r13, %rsi
callq 0x44730
movq -0x30(%rbp), %rdi
pushq $0x3
popq %rsi
movq -0x40(%rbp), %rdx
callq 0x46ba0
movq -0x48(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x44628
pushq $0x50
popq %rdi
callq 0x413f0
movq %rax, -0x30(%rbp)
pushq $0x48
popq %rdi
callq 0x413f0
movq %rax, -0x40(%rbp)
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %r13
movq %rax, %rdi
leaq -0x90(%rbp), %rsi
callq 0x415b0
movq -0x40(%rbp), %rdi
movq %r13, %rsi
callq 0x44730
movq -0x30(%rbp), %rdi
pushq $0x3
popq %rsi
movq -0x40(%rbp), %rdx
callq 0x46ba0
movq -0x48(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x44628
pushq $0x60
popq %rdi
callq 0x413f0
movq %rax, -0x30(%rbp)
pushq $0x48
popq %rdi
callq 0x413f0
movq %rax, -0x40(%rbp)
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, -0x70(%rbp)
movq %rax, %rdi
leaq 0xf48e(%rip), %rsi      # 0x7ce14
leaq -0x1b0(%rbp), %rdx
callq 0x411c0
movq -0x40(%rbp), %r13
movq %r13, %rdi
movq -0x70(%rbp), %rsi
callq 0x4465a
movq -0x30(%rbp), %rdi
movq %r13, %rsi
movq -0x48(%rbp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x49362
movq -0x68(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x445f6
leaq -0x90(%rbp), %rdi
callq 0x418c8
leaq -0x100(%rbp), %rdi
callq 0x418c8
cmpq -0x38(%rbp), %r14
leaq -0x678(%rbp), %r14
jne 0x6d9f5
addq $0x8, %r15
jmp 0x6d6b0
leaq -0x140(%rbp), %rdi
callq 0x418c8
movq %rbx, %rdi
callq 0x410e0
movq %r12, %rdi
callq 0x410e0
leaq -0x510(%rbp), %rdi
callq 0x410e0
leaq -0x120(%rbp), %rdi
callq 0x418c8
leaq -0xb0(%rbp), %rdi
callq 0x418c8
leaq -0x388(%rbp), %rdi
callq 0x41330
leaq -0x1d0(%rbp), %rdi
callq 0x418c8
movq -0xe0(%rbp), %rax
addq $0x8, %rax
jmp 0x6d33c
leaq -0x178(%rbp), %rdi
callq 0x71ce2
leaq -0x190(%rbp), %rdi
callq 0x71cce
leaq -0x800(%rbp), %rdi
callq 0x410e0
leaq -0xd0(%rbp), %rdi
callq 0x418c8
leaq -0x160(%rbp), %rdi
callq 0x418c8
addq $0x958, %rsp            # imm = 0x958
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6dc50
jmp 0x6dc50
movq %rax, %rbx
movq %r13, %rdi
jmp 0x6dacb
movq %rax, %rbx
movq %r12, %rdi
jmp 0x6dacb
movq %rax, %rbx
movq %r15, %rdi
callq 0x413a0
jmp 0x6daee
jmp 0x6dc50
jmp 0x6db0f
jmp 0x6dae1
jmp 0x6dae1
jmp 0x6dae1
jmp 0x6dae1
movq %rax, %rbx
jmp 0x6dd64
jmp 0x6daeb
movq %rax, %rbx
movq %r14, %rdi
callq 0x413a0
jmp 0x6dd4c
jmp 0x6dc50
jmp 0x6dc50
jmp 0x6dc50
jmp 0x6dc50
movq %rax, %rbx
jmp 0x6dd58
movq %rax, %rbx
leaq -0x200(%rbp), %rdi
jmp 0x6db2d
movq %rax, %rbx
leaq -0x1e8(%rbp), %rdi
callq 0x44be0
jmp 0x6dd4c
jmp 0x6dc50
jmp 0x6dc50
jmp 0x6dc3c
jmp 0x6dc3c
movq %rax, %rbx
movq %r13, %rdi
callq 0x413a0
jmp 0x6dbca
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x418c8
jmp 0x6db83
jmp 0x6dc34
movq %rax, %rbx
jmp 0x6dcd4
jmp 0x6dc7a
jmp 0x6dc8b
movq %rax, %rbx
leaq -0x100(%rbp), %rdi
jmp 0x6dcb7
jmp 0x6dc34
jmp 0x6dc83
movq %rax, %rbx
leaq -0x510(%rbp), %rdi
callq 0x418c8
jmp 0x6dd34
movq %rax, %rbx
jmp 0x6dd40
movq %rax, %rbx
jmp 0x6dd34
movq %rax, %rbx
jmp 0x6dbdc
movq %rax, %rbx
jmp 0x6dbd3
movq %rax, %rbx
movq -0x58(%rbp), %rdi
callq 0x413a0
movq -0x50(%rbp), %rdi
callq 0x413a0
movq %r15, %rdi
callq 0x413a0
jmp 0x6dcb0
jmp 0x6dc8b
jmp 0x6dc5c
jmp 0x6dc90
jmp 0x6dc6a
jmp 0x6dc6a
movq %rax, %rbx
movq -0x70(%rbp), %rdi
jmp 0x6dc0c
jmp 0x6dc5c
jmp 0x6dc06
movq %rax, %rbx
movq %r13, %rdi
callq 0x413a0
jmp 0x6dc5f
jmp 0x6dca1
jmp 0x6dca1
movq %rax, %rbx
movq -0x48(%rbp), %rdi
jmp 0x6dc71
movq %rax, %rbx
leaq -0x1b0(%rbp), %rdi
jmp 0x6dc9a
jmp 0x6dca1
movq %rax, %rbx
jmp 0x6dcbc
movq %rax, %rbx
leaq -0x388(%rbp), %rdi
callq 0x418c8
jmp 0x6dd4c
movq %rax, %rbx
jmp 0x6dd4c
jmp 0x6dc5c
jmp 0x6dc6a
movq %rax, %rbx
movq -0x40(%rbp), %rdi
callq 0x413a0
jmp 0x6dc6d
movq %rax, %rbx
movq -0x30(%rbp), %rdi
callq 0x413a0
jmp 0x6dc93
jmp 0x6dc8b
movq %rax, %rbx
jmp 0x6dcc8
jmp 0x6dc90
jmp 0x6dc83
movq %rax, %rbx
jmp 0x6dd10
movq %rax, %rbx
jmp 0x6dcb0
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x418c8
jmp 0x6dca4
movq %rax, %rbx
leaq -0x100(%rbp), %rdi
callq 0x418c8
leaq -0x140(%rbp), %rdi
callq 0x418c8
leaq -0x978(%rbp), %rdi
callq 0x410e0
leaq -0x688(%rbp), %rdi
callq 0x410e0
leaq -0x510(%rbp), %rdi
callq 0x410e0
jmp 0x6dd10
jmp 0x6dce4
movq %rax, %rbx
leaq -0x978(%rbp), %rdi
callq 0x415e0
jmp 0x6dcf8
movq %rax, %rbx
leaq -0x688(%rbp), %rdi
callq 0x418c8
leaq -0x510(%rbp), %rdi
callq 0x41330
leaq -0x120(%rbp), %rdi
callq 0x418c8
leaq -0xb0(%rbp), %rdi
callq 0x418c8
leaq -0x388(%rbp), %rdi
callq 0x41330
leaq -0x1d0(%rbp), %rdi
callq 0x418c8
leaq -0x178(%rbp), %rdi
callq 0x71ce2
leaq -0x190(%rbp), %rdi
callq 0x71cce
leaq -0x800(%rbp), %rdi
callq 0x410e0
leaq -0xd0(%rbp), %rdi
callq 0x418c8
leaq -0x160(%rbp), %rdi
callq 0x418c8
movq %rbx, %rdi
callq 0x41790