// File: /workspace/github_cpp_makefile_star2_O2/eniac[P]Mantis/src/compile/compile_p4.cpp
// Function: generatePackingTablesForIng(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&, bool)
static vector<MblRefNode*> generatePackingTablesForIng(vector<AstNode*>* newNodes,
                                          const vector<ReactionArgBin>& bins, bool forIng) {
    vector<MblRefNode*> reactionArgRefs;

    string p4rArgHdrType;
    string p4rArgHdrName;
    string p4rPackTableNameBase;
    string p4rPackActionNameBase;
    string p4rPackFlcNameBase;
    string p4rPackFlNameBase;
    if(forIng) {
        p4rArgHdrType = std::string(kP4rIngArghdrType);
        p4rArgHdrName = std::string(kP4rIngArghdrName);
        p4rPackTableNameBase = "__tiPack";
        p4rPackActionNameBase = "__aiPack";
        p4rPackFlcNameBase = "__flci_packedArgs_reg";
        p4rPackFlNameBase = "__fli_packedArgs_reg";
    } else {
        p4rArgHdrType = std::string(kP4rEgrArghdrType);
        p4rArgHdrName = std::string(kP4rEgrArghdrName);
        p4rPackTableNameBase = "__tePack";
        p4rPackActionNameBase = "__aePack";
        p4rPackFlcNameBase = "__flce_packedArgs_reg";
        p4rPackFlNameBase = "__fle_packedArgs_reg";
    }

    // Generate packed fields
    ostringstream oss_fld;
    oss_fld << "header_type " << p4rArgHdrType << " {\n"
            << "  fields {\n";
    for (int i = 0; i < bins.size(); ++i) {
        oss_fld << "  reg" << i << " : " << bins[i].second << ";\n";
    }
    oss_fld << " }\n"
            << "}\n\n"
            << "metadata " << p4rArgHdrType << " "
                           << p4rArgHdrName << ";\n\n";
    auto packedMetaNode = new UnanchoredNode(
            new string(oss_fld.str()), new string("metadata"),
            new string(p4rArgHdrType));
    newNodes->push_back(packedMetaNode);

    // Synthesize table/action for each pack
    for (int i = 0; i < bins.size(); ++i) {
        // Generate packing table
        auto tiPackName = new NameNode(new string(p4rPackTableNameBase+std::to_string(i)));
        auto tiPackReads = new TableReadStmtsNode();
        auto tiPackActions = new TableActionStmtsNode();
        tiPackActions->push_back(
                new TableActionStmtNode(new NameNode(new string(p4rPackActionNameBase+std::to_string(i)))));
        auto tiPackTable = new TableNode(tiPackName, tiPackReads, tiPackActions,
                                        "  default_action : "+p4rPackActionNameBase+std::to_string(i)+"();\nsize:1;", "");
        newNodes->push_back(tiPackTable);

        // Generate packing action
        auto aiPackName = new NameNode(new string(p4rPackActionNameBase+std::to_string(i)));
        auto aiPackParams = new ActionParamsNode();
        auto aiPackStmts = new ActionStmtsNode(); 

        // Actual size of the reg (<= 32)
        int regsize = 0;
        // Generate field list node
        ostringstream oss_fl;
        oss_fl << "field_list " << p4rPackFlNameBase << i << "{\n";
        for (int j = 0; j < bins[i].first.size(); ++j) {

            AstNode* arg = bins[i].first[j].first->arg_;
            int width = bins[i].first[j].second;
            regsize += width;

            if (typeContains(arg, "FieldNode")) {
                oss_fl << arg->toString() << ";\n";
            } else if (typeContains(arg, "MblRefNode")) {
                oss_fl << arg->toString() << ";\n";
                // Mark this ref for future processing
                // Currently not supporting field list and hash duplication
                reactionArgRefs.push_back(dynamic_cast<MblRefNode*>(arg));
            } else {
                assert(false);
            }            

        }
        // Close field_list
        oss_fl << "\n}\n\n";
        newNodes->push_back(
            new UnanchoredNode(
                new string(oss_fl.str()), new string("field_list"),
                new string("field_list"+std::to_string(i)))
        );  

        // Generate field_list_calculation
        ostringstream oss_flc;
        oss_flc << "field_list_calculation " << p4rPackFlcNameBase << i << " {\n"
                << "  input {\n"
                << "    " << p4rPackFlNameBase << i << ";\n"
                << "  }\n"
                << "  algorithm : identity;\n"
                << "  output_width : " << regsize << ";\n"
                << "}\n\n";

        newNodes->push_back(
            new UnanchoredNode(
                new string(oss_flc.str()), new string("field_list_calc"),
                new string(p4rPackFlcNameBase+std::to_string(i)))
        ); 

        // Example: modify_field_with_hash_based_offset(dst, 0, __flce_packedArgs_reg0, 4294967296);
        // Note: alternative approach using (modify - shift_left - add_to_field) would not fit into a single action due to data plane constraints
        auto aiPackStmtName = new NameNode(new string("modify_field_with_hash_based_offset"));
        auto aiPackStmtArgs = new ArgsNode();
        // dst
        ostringstream oss_postfix;
        oss_postfix << "reg" << i;
        BodyWordNode* targetBodyWord = new BodyWordNode(
            BodyWordNode::FIELD,
                new FieldNode(
                    new NameNode(new string(p4rArgHdrName)),
                    new NameNode(new string(oss_postfix.str()))));
        aiPackStmtArgs->push_back(targetBodyWord);
        // base
        aiPackStmtArgs->push_back(
                new BodyWordNode(
                    BodyWordNode::INTEGER,
                    new IntegerNode(new string(to_string(0))))); 
        // __calc_packedArgs_regx
        aiPackStmtArgs->push_back(
                new BodyWordNode(
                    BodyWordNode::STRING,
                    new StrNode(new string(p4rPackFlcNameBase+std::to_string(i)))));             
        // size (power of 2)           
        aiPackStmtArgs->push_back(
                new BodyWordNode(
                    BodyWordNode::INTEGER,
                    new IntegerNode(new string(to_string((long long)(pow(2, regsize))))))); 

        aiPackStmts->push_back(
                new ActionStmtNode(aiPackStmtName, aiPackStmtArgs, ActionStmtNode::NAME_ARGLIST, NULL, NULL));        
        
        auto aiPackAction = new ActionNode(aiPackName, aiPackParams, aiPackStmts);
        auto aiPackActionWrapper = new InputNode(NULL, aiPackAction);
        newNodes->push_back(aiPackActionWrapper);
    }
    
    return reactionArgRefs;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x768, %rsp            # imm = 0x768
movq %rdx, %r14
andq $0x0, 0x10(%rdi)
leaq -0x100(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rsi, -0x68(%rbp)
xorl %edx, %edx
leaq -0x120(%rbp), %rsi
movq %rsi, -0x10(%rsi)
andq $0x0, -0x8(%rsi)
leaq -0x160(%rbp), %r8
movq %r8, -0x10(%r8)
andq $0x0, -0x8(%r8)
movb %dl, (%rax)
movb %dl, (%rsi)
leaq -0xe0(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
leaq -0xc0(%rbp), %rsi
movq %rsi, -0x10(%rsi)
andq $0x0, -0x8(%rsi)
movb %dl, (%r8)
movb %dl, (%rax)
movb %dl, (%rsi)
leaq -0x140(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorpd %xmm0, %xmm0
movq %rdi, -0x88(%rbp)
movupd %xmm0, (%rdi)
movb %dl, (%rax)
testl %ecx, %ecx
je 0x6e27b
leaq 0xedfe(%rip), %rsi      # 0x7cfd2
leaq -0x618(%rbp), %rdi
leaq -0x308(%rbp), %rdx
callq 0x411c0
leaq -0x110(%rbp), %rdi
leaq -0x618(%rbp), %rbx
movq %rbx, %rsi
callq 0x41500
movq %rbx, %rdi
callq 0x418c8
leaq 0xedd8(%rip), %rsi      # 0x7cfe4
leaq -0x618(%rbp), %rdi
leaq -0x308(%rbp), %rdx
callq 0x411c0
leaq -0x130(%rbp), %rdi
movq %rbx, %rsi
callq 0x41500
movq %rbx, %rdi
callq 0x418c8
leaq 0xe9c5(%rip), %rsi      # 0x7cc02
leaq -0x170(%rbp), %rdi
callq 0x41850
leaq 0xeda4(%rip), %rsi      # 0x7cff4
leaq -0xf0(%rbp), %rdi
callq 0x41850
leaq 0xed9a(%rip), %rsi      # 0x7cffd
leaq -0xd0(%rbp), %rdi
callq 0x41850
leaq 0xed9d(%rip), %rsi      # 0x7d013
jmp 0x6e324
leaq 0xeda6(%rip), %rsi      # 0x7d028
leaq -0x618(%rbp), %rdi
leaq -0x308(%rbp), %rdx
callq 0x411c0
leaq -0x110(%rbp), %rdi
leaq -0x618(%rbp), %rbx
movq %rbx, %rsi
callq 0x41500
movq %rbx, %rdi
callq 0x418c8
leaq 0xed80(%rip), %rsi      # 0x7d03a
leaq -0x618(%rbp), %rdi
leaq -0x308(%rbp), %rdx
callq 0x411c0
leaq -0x130(%rbp), %rdi
movq %rbx, %rsi
callq 0x41500
movq %rbx, %rdi
callq 0x418c8
leaq 0xe944(%rip), %rsi      # 0x7cc2f
leaq -0x170(%rbp), %rdi
callq 0x41850
leaq 0xed4c(%rip), %rsi      # 0x7d04a
leaq -0xf0(%rbp), %rdi
callq 0x41850
leaq 0xed42(%rip), %rsi      # 0x7d053
leaq -0xd0(%rbp), %rdi
callq 0x41850
leaq 0xed45(%rip), %rsi      # 0x7d069
leaq -0x150(%rbp), %rdi
callq 0x41850
leaq -0x618(%rbp), %rdi
callq 0x415a0
movq %r14, -0x70(%rbp)
leaq 0xaa7e(%rip), %rsi      # 0x78dc5
leaq -0x618(%rbp), %rdi
callq 0x413d0
leaq -0x110(%rbp), %rsi
movq %rax, %rdi
callq 0x41380
leaq 0xe8f6(%rip), %rsi      # 0x7cc5f
movq %rax, %rdi
callq 0x413d0
leaq 0xaa5a(%rip), %rsi      # 0x78dd2
movq %rax, %rdi
callq 0x413d0
pushq $0x18
popq %r14
xorl %ebx, %ebx
leaq -0x618(%rbp), %r15
leaq 0xea38(%rip), %r12      # 0x7cdcc
leaq 0xaa6a(%rip), %r13      # 0x78e05
movq -0x70(%rbp), %rcx
movq 0x8(%rcx), %rax
subq (%rcx), %rax
sarq $0x5, %rax
cmpq %rbx, %rax
jbe 0x6e3fa
movq %r15, %rdi
leaq 0xecc5(%rip), %rsi      # 0x7d07e
callq 0x413d0
movq %rax, %rdi
movl %ebx, %esi
callq 0x41760
movq %rax, %rdi
movq %r12, %rsi
callq 0x413d0
movq -0x70(%rbp), %rcx
movq (%rcx), %rcx
movl (%rcx,%r14), %esi
movq %rax, %rdi
callq 0x41760
movq %rax, %rdi
movq %r13, %rsi
callq 0x413d0
incq %rbx
addq $0x20, %r14
jmp 0x6e39b
leaq 0xbf96(%rip), %rsi      # 0x7a397
leaq -0x618(%rbp), %rdi
callq 0x413d0
leaq 0xed09(%rip), %rsi      # 0x7d11d
movq %rax, %rdi
callq 0x413d0
leaq 0xa9c3(%rip), %rsi      # 0x78de6
movq %rax, %rdi
callq 0x413d0
leaq -0x110(%rbp), %rsi
movq %rax, %rdi
callq 0x41380
leaq 0xcc10(%rip), %rsi      # 0x7b051
movq %rax, %rdi
callq 0x413d0
leaq -0x130(%rbp), %rsi
movq %rax, %rdi
callq 0x41380
leaq 0xbd55(%rip), %rsi      # 0x7a1b4
movq %rax, %rdi
callq 0x413d0
pushq $0x58
popq %rdi
callq 0x413f0
movq -0x70(%rbp), %r15
movq %rax, %rbx
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %r14
leaq -0x610(%rbp), %rsi
movq %rax, %rdi
callq 0x416b0
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %r12
leaq 0xe92e(%rip), %rsi      # 0x7cdd0
leaq -0x308(%rbp), %rdx
movq %rax, %rdi
callq 0x411c0
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %r13
leaq -0x110(%rbp), %rsi
movq %rax, %rdi
callq 0x415b0
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x4dd8e
leaq -0x308(%rbp), %rsi
movq %rbx, (%rsi)
movq -0x68(%rbp), %rdi
callq 0x44d46
xorl %ecx, %ecx
movq 0x8(%r15), %rax
subq (%r15), %rax
sarq $0x5, %rax
movq %rcx, -0x48(%rbp)
cmpq %rcx, %rax
jbe 0x6eea7
pushq $0x48
popq %r15
movq %r15, %rdi
callq 0x413f0
movq %rax, %r13
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %rbx
leaq -0x308(%rbp), %r12
movq %r12, %rdi
movq -0x48(%rbp), %rsi
callq 0x49e1c
movb $0x1, %r14b
movq %rbx, %rdi
leaq -0x170(%rbp), %rsi
movq %r12, %rdx
callq 0x71505
xorl %r14d, %r14d
movq %r13, %rdi
movq %rbx, %rsi
callq 0x4465a
leaq -0x308(%rbp), %rdi
callq 0x418c8
movq %r15, %rdi
callq 0x413f0
movq %rax, %r12
movq %rax, %rdi
callq 0x47f10
movq %r15, %rdi
callq 0x413f0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x48132
movq %r15, %rdi
callq 0x413f0
movq %rax, -0x50(%rbp)
movq %r15, %rdi
callq 0x413f0
movq %rax, -0x58(%rbp)
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %r14
movq %r12, -0x30(%rbp)
movq %r13, -0x40(%rbp)
leaq -0x308(%rbp), %rbx
movq %rbx, %rdi
movq -0x48(%rbp), %rsi
callq 0x49e1c
movb $0x1, %r13b
movb $0x1, %r12b
movb $0x1, %r15b
movq %r14, %rdi
leaq -0xf0(%rbp), %rsi
movq %rbx, %rdx
callq 0x71505
xorl %r15d, %r15d
movb $0x1, %r12b
movq -0x58(%rbp), %rdi
movq %r14, %rsi
callq 0x4465a
xorl %r12d, %r12d
xorl %r15d, %r15d
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x4800c
xorl %r12d, %r12d
xorl %r13d, %r13d
xorl %r15d, %r15d
movq -0x38(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x44560
leaq -0x308(%rbp), %rdi
callq 0x418c8
movl $0x98, %edi
callq 0x413f0
movq %rax, %r14
leaq -0x4a0(%rbp), %rdi
leaq 0xea3c(%rip), %rsi      # 0x7d084
leaq -0xf0(%rbp), %rdx
callq 0x58eb6
movq -0x40(%rbp), %r12
leaq -0x790(%rbp), %r15
movq %r15, %rdi
movq -0x48(%rbp), %rsi
callq 0x49e1c
movq %rbx, %rdi
leaq -0x4a0(%rbp), %rsi
movq %r15, %rdx
callq 0x443b8
leaq -0x190(%rbp), %rdi
movq %rbx, %rsi
leaq 0xea0a(%rip), %rdx      # 0x7d098
callq 0x4ed31
leaq -0x328(%rbp), %r15
movq %r15, %rdi
leaq 0xc217(%rip), %rsi      # 0x7a8bb
leaq -0xb0(%rbp), %rdx
callq 0x411c0
movq %r14, %rdi
movq %r12, %rsi
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %rcx
leaq -0x190(%rbp), %rbx
movq %rbx, %r8
movq %r15, %r9
callq 0x4822e
movq %r15, %rdi
callq 0x418c8
movq %rbx, %rdi
callq 0x418c8
leaq -0x308(%rbp), %rbx
movq %rbx, %rdi
callq 0x418c8
leaq -0x790(%rbp), %rdi
callq 0x418c8
leaq -0x4a0(%rbp), %rdi
callq 0x418c8
movq %r14, -0x308(%rbp)
movq -0x68(%rbp), %rdi
movq %rbx, %rsi
callq 0x44d46
pushq $0x48
popq %rdi
callq 0x413f0
movq %rax, -0x58(%rbp)
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %rbx
leaq -0x308(%rbp), %r12
movq %r12, %rdi
movq -0x48(%rbp), %rsi
callq 0x49e1c
movb $0x1, %r14b
movq %rbx, %rdi
leaq -0xf0(%rbp), %rsi
movq %r12, %rdx
callq 0x71505
xorl %r14d, %r14d
movq -0x58(%rbp), %rdi
movq %rbx, %rsi
callq 0x4465a
leaq -0x308(%rbp), %rdi
callq 0x418c8
pushq $0x48
popq %rdi
callq 0x413f0
movq %rax, -0x90(%rbp)
movq %rax, %rdi
callq 0x491dc
pushq $0x48
popq %rdi
callq 0x413f0
movq %rax, -0x50(%rbp)
movq %rax, %rdi
callq 0x4969e
leaq -0x308(%rbp), %rbx
movq %rbx, %rdi
callq 0x415a0
movq %rbx, %rdi
leaq 0xe8ec(%rip), %rsi      # 0x7d0a4
callq 0x413d0
movq %rax, %rdi
leaq -0x150(%rbp), %rsi
callq 0x41380
movq %rax, %rdi
movq -0x48(%rbp), %rsi
callq 0x41760
movq %rax, %rdi
leaq 0xe47e(%rip), %rsi      # 0x7cc60
callq 0x413d0
xorl %r12d, %r12d
pushq $0x8
popq %r13
xorl %ebx, %ebx
movq -0x70(%rbp), %rax
movq (%rax), %rcx
movq -0x48(%rbp), %rdx
shlq $0x5, %rdx
movq (%rcx,%rdx), %rax
movq 0x8(%rcx,%rdx), %rcx
subq %rax, %rcx
sarq $0x4, %rcx
cmpq %r12, %rcx
jbe 0x6e8ff
movq -0x8(%rax,%r13), %rcx
movq 0x40(%rcx), %r14
addl (%rax,%r13), %ebx
movq %r14, %rdi
leaq 0xc6e5(%rip), %rsi      # 0x7af14
callq 0x71cf8
testb %al, %al
je 0x6e876
movq (%r14), %rax
leaq -0x4a0(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq *(%rax)
leaq -0x308(%rbp), %rdi
movq %r15, %rsi
callq 0x41380
movq %rax, %rdi
leaq 0xa5a2(%rip), %rsi      # 0x78e05
callq 0x413d0
leaq -0x4a0(%rbp), %rdi
callq 0x418c8
jmp 0x6e8f3
movq %r14, %rdi
leaq 0xa570(%rip), %rsi      # 0x78df0
callq 0x71cf8
testb %al, %al
je 0x6ef14
movq (%r14), %rax
leaq -0x4a0(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq *(%rax)
leaq -0x308(%rbp), %rdi
movq %r15, %rsi
callq 0x41380
movq %rax, %rdi
leaq 0xa54d(%rip), %rsi      # 0x78e05
callq 0x413d0
movq %r15, %rdi
callq 0x418c8
movq %r14, %rdi
leaq 0x25dc1(%rip), %rsi     # 0x94690
leaq 0x26c02(%rip), %rdx     # 0x954d8
xorl %ecx, %ecx
callq 0x41480
movq %rax, -0x4a0(%rbp)
movq -0x88(%rbp), %rdi
movq %r15, %rsi
callq 0x71594
incq %r12
addq $0x10, %r13
jmp 0x6e7f0
leaq -0x308(%rbp), %rdi
leaq 0xe80f(%rip), %rsi      # 0x7d11c
callq 0x413d0
pushq $0x58
popq %rdi
callq 0x413f0
movq %rax, %r14
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %r15
movq %rax, %rdi
leaq -0x300(%rbp), %rsi
callq 0x416b0
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %r13
movq %rax, %rdi
leaq 0xe7d5(%rip), %rsi      # 0x7d121
leaq -0xb0(%rbp), %rdx
callq 0x411c0
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, -0x38(%rbp)
movq %r14, -0x40(%rbp)
leaq -0x4a0(%rbp), %r14
movq %r14, %rdi
movq -0x48(%rbp), %rsi
callq 0x49e1c
movb $0x1, %al
movl %eax, -0x30(%rbp)
movb $0x1, %r12b
movq -0x38(%rbp), %rdi
leaq 0xe793(%rip), %rsi      # 0x7d121
movq %r14, %rdx
movq -0x40(%rbp), %r14
callq 0x4ed5a
xorl %r12d, %r12d
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq -0x38(%rbp), %rcx
callq 0x4dd8e
movq %r14, -0x790(%rbp)
xorl %r12d, %r12d
movl $0x0, -0x30(%rbp)
movq -0x68(%rbp), %rdi
leaq -0x790(%rbp), %rsi
callq 0x44d46
leaq -0x4a0(%rbp), %r14
movq %r14, %rdi
callq 0x418c8
movq %r14, %rdi
callq 0x415a0
movq %r14, %rdi
leaq 0xe73b(%rip), %rsi      # 0x7d12c
callq 0x413d0
movq %rax, %rdi
leaq -0xd0(%rbp), %rsi
callq 0x41380
movq %rax, %rdi
movq -0x48(%rbp), %rsi
callq 0x41760
movq %rax, %rdi
leaq 0xe244(%rip), %rsi      # 0x7cc5f
callq 0x413d0
movq %rax, %rdi
leaq 0xe71a(%rip), %rsi      # 0x7d144
callq 0x413d0
movq %rax, %rdi
leaq 0xa355(%rip), %rsi      # 0x78d8e
callq 0x413d0
movq %rax, %rdi
leaq -0x150(%rbp), %rsi
callq 0x41380
movq %rax, %rdi
movq -0x48(%rbp), %rsi
callq 0x41760
movq %rax, %rdi
leaq 0xa3a2(%rip), %rsi      # 0x78e05
callq 0x413d0
movq %rax, %rdi
leaq 0xb924(%rip), %rsi      # 0x7a396
callq 0x413d0
movq %rax, %rdi
leaq 0xe6ce(%rip), %rsi      # 0x7d14f
callq 0x413d0
movq %rax, %rdi
leaq 0xe6d8(%rip), %rsi      # 0x7d168
callq 0x413d0
movq %rax, %rdi
movl %ebx, %esi
callq 0x41760
movq %rax, %rdi
leaq 0xa35c(%rip), %rsi      # 0x78e05
callq 0x413d0
movq %rax, %rdi
leaq 0xe665(%rip), %rsi      # 0x7d11d
callq 0x413d0
pushq $0x58
popq %rdi
callq 0x413f0
movq %rax, %r14
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %r15
movq %rax, %rdi
leaq -0x498(%rbp), %rsi
callq 0x416b0
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %r13
movq %rax, %rdi
leaq 0xe683(%rip), %rsi      # 0x7d17a
leaq -0x59(%rbp), %rdx
callq 0x411c0
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, -0x38(%rbp)
movq %r14, -0x40(%rbp)
leaq -0x790(%rbp), %r14
movq %r14, %rdi
movq -0x48(%rbp), %rsi
callq 0x49e1c
movb $0x1, %al
movl %eax, -0x30(%rbp)
movb $0x1, %r12b
movq -0x38(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
movq %r14, %rdx
movq -0x40(%rbp), %r14
callq 0x71505
xorl %r12d, %r12d
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq -0x38(%rbp), %rcx
callq 0x4dd8e
movq %r14, -0xb0(%rbp)
xorl %r12d, %r12d
movl $0x0, -0x30(%rbp)
movq -0x68(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x44d46
leaq -0x790(%rbp), %rdi
callq 0x418c8
pushq $0x48
popq %r15
movq %r15, %rdi
callq 0x413f0
movq %rax, -0x80(%rbp)
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %r14
movq %rax, %rdi
leaq 0xe5e1(%rip), %rsi      # 0x7d18a
leaq -0x790(%rbp), %rdx
callq 0x411c0
movq -0x80(%rbp), %rdi
movq %r14, %rsi
callq 0x4465a
movq %r15, %rdi
callq 0x413f0
movq %rax, -0x38(%rbp)
movq %rax, %rdi
callq 0x48f72
leaq -0x790(%rbp), %r14
movq %r14, %rdi
callq 0x415a0
movq %r14, %rdi
leaq 0xe492(%rip), %rsi      # 0x7d080
callq 0x413d0
movq %rax, %rdi
movq -0x48(%rbp), %rsi
callq 0x41760
pushq $0x50
popq %rdi
callq 0x413f0
movq %rax, -0x40(%rbp)
pushq $0x50
popq %rdi
callq 0x413f0
movq %rax, -0x30(%rbp)
movq %r15, %rdi
callq 0x413f0
movq %rax, %r14
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %r13
movq %rax, %rdi
leaq -0x130(%rbp), %rsi
callq 0x415b0
movq %r14, %rdi
movq %r13, %rsi
callq 0x4465a
movq %r15, %rdi
callq 0x413f0
movq %rax, %r13
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %r12
movq %rax, %rdi
leaq -0x788(%rbp), %rsi
callq 0x416b0
movq %r13, %rdi
movq %r12, %rsi
callq 0x4465a
movq -0x30(%rbp), %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x4c88a
movq -0x40(%rbp), %rdi
pushq $0x2
popq %rsi
movq -0x30(%rbp), %rdx
callq 0x46ba0
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x44628
pushq $0x50
popq %rdi
callq 0x413f0
movq %rax, %r14
pushq $0x48
popq %rdi
callq 0x413f0
movq %rax, %r12
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %r13
movq %rax, %rdi
xorl %esi, %esi
callq 0x49e1c
movq %r12, %rdi
movq %r13, %rsi
callq 0x447c0
movq %r14, %rdi
pushq $0x4
popq %rsi
movq %r12, %rdx
callq 0x46ba0
movq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x44628
pushq $0x50
popq %rdi
callq 0x413f0
movq %rax, -0x78(%rbp)
pushq $0x48
popq %rdi
callq 0x413f0
movq %rax, -0x30(%rbp)
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, -0x40(%rbp)
leaq -0xb0(%rbp), %r14
movq %r14, %rdi
movq -0x48(%rbp), %rsi
callq 0x49e1c
movb $0x1, %r13b
movb $0x1, %r12b
movb $0x1, %r15b
movq -0x40(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
movq %r14, %rdx
callq 0x71505
xorl %r12d, %r12d
movb $0x1, %r15b
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x44730
xorl %r12d, %r12d
xorl %r15d, %r15d
movq -0x78(%rbp), %rdi
pushq $0x3
popq %rsi
movq -0x30(%rbp), %rdx
callq 0x46ba0
xorl %r12d, %r12d
xorl %r15d, %r15d
xorl %r13d, %r13d
movq -0x38(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x44628
leaq -0xb0(%rbp), %rdi
callq 0x418c8
pushq $0x50
popq %rdi
callq 0x413f0
movq -0x70(%rbp), %r15
movq %rax, %r14
pushq $0x48
popq %rdi
callq 0x413f0
movq %rax, %r12
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %r13
movsd 0xdbe2(%rip), %xmm0     # 0x7c9a0
movl %ebx, %edi
callq 0x41680
cvttsd2si %xmm0, %rsi
movq %r13, %rdi
callq 0x71533
movq %r12, %rdi
movq %r13, %rsi
callq 0x447c0
movq %r14, %rdi
pushq $0x4
popq %rsi
movq %r12, %rdx
callq 0x46ba0
movq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x44628
pushq $0x60
popq %rdi
callq 0x413f0
movq %rax, %rbx
movq %rax, %rdi
movq -0x80(%rbp), %rsi
movq -0x38(%rbp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x49362
movq -0x50(%rbp), %rdi
movq %rbx, %rsi
callq 0x445f6
pushq $0x58
popq %rdi
callq 0x413f0
movq %rax, %rbx
movq %rax, %rdi
movq -0x58(%rbp), %rsi
movq -0x90(%rbp), %rdx
movq -0x50(%rbp), %rcx
callq 0x49804
pushq $0x50
popq %rdi
callq 0x413f0
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x44434
movq %r14, -0xb0(%rbp)
movq -0x68(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x44d46
leaq -0x790(%rbp), %rdi
callq 0x410e0
leaq -0x4a0(%rbp), %rdi
callq 0x410e0
leaq -0x308(%rbp), %rdi
callq 0x410e0
movq -0x48(%rbp), %rcx
incq %rcx
jmp 0x6e4f1
leaq -0x618(%rbp), %rdi
callq 0x410e0
leaq -0x150(%rbp), %rdi
callq 0x418c8
leaq -0xd0(%rbp), %rdi
callq 0x418c8
leaq -0xf0(%rbp), %rdi
callq 0x418c8
leaq -0x170(%rbp), %rdi
callq 0x418c8
leaq -0x130(%rbp), %rdi
callq 0x418c8
leaq -0x110(%rbp), %rdi
callq 0x418c8
movq -0x88(%rbp), %rax
addq $0x768, %rsp            # imm = 0x768
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9df9(%rip), %rdi      # 0x78d14
leaq 0xdafd(%rip), %rsi      # 0x7ca1f
leaq 0xe187(%rip), %rcx      # 0x7d0b0
movl $0x3fa, %edx            # imm = 0x3FA
callq 0x412f0
jmp 0x6ef71
jmp 0x6ef71
jmp 0x6ef71
jmp 0x6ef71
jmp 0x6f31c
movq %rax, %r15
movq %r13, %rdi
jmp 0x6ef56
movq %rax, %r15
movq %r12, %rdi
jmp 0x6ef56
movq %rax, %r15
movq %r14, %rdi
callq 0x413a0
jmp 0x6ef69
jmp 0x6f31c
jmp 0x6ef71
jmp 0x6ef66
movq %rax, %r15
movq %rbx, %rdi
jmp 0x6f20e
movq %rax, %rbx
jmp 0x6f377
jmp 0x6f31c
jmp 0x6f321
jmp 0x6efd5
jmp 0x6f186
jmp 0x6f321
jmp 0x6f321
jmp 0x6ef96
movq %rbx, %rdi
movq %rax, %rbx
jmp 0x6f2d9
movq %rax, %rbx
movq %r14, %rdi
callq 0x413a0
jmp 0x6f068
movq %rax, %rbx
jmp 0x6f2d5
movq %rax, %rbx
movq -0x38(%rbp), %rdi
jmp 0x6f263
jmp 0x6f332
movq %rax, %rbx
movb $0x1, %r13b
jmp 0x6f2c7
movq %rax, %rbx
movq %r13, %rdi
callq 0x413a0
jmp 0x6f196
movq %rax, %rbx
movq %r12, %rdi
callq 0x413a0
jmp 0x6f1a9
movq %rax, %rbx
movb $0x1, %r13b
movb $0x1, %r15b
jmp 0x6f2b9
jmp 0x6f065
movq %rax, %rbx
movq %r13, %rdi
callq 0x413a0
jmp 0x6f18e
jmp 0x6f332
jmp 0x6f35c
jmp 0x6f1bd
movq %rax, %rbx
movb $0x1, %al
movl %eax, -0x30(%rbp)
jmp 0x6f281
movq %rax, %rbx
movq %r15, %rdi
jmp 0x6f044
jmp 0x6f332
movq %rax, %rbx
movq %r13, %rdi
callq 0x413a0
jmp 0x6f260
jmp 0x6f332
jmp 0x6f1c5
movq %rax, %rbx
movb $0x1, %al
movl %eax, -0x30(%rbp)
jmp 0x6f249
movq %rax, %rbx
movq -0x80(%rbp), %rdi
jmp 0x6f263
jmp 0x6f35c
movq %rax, %rbx
movq %r13, %rdi
jmp 0x6f084
movq %rax, %rbx
movq %r15, %rdi
callq 0x413a0
jmp 0x6f298
movq %rax, %rbx
leaq -0x328(%rbp), %rdi
callq 0x418c8
jmp 0x6f0f0
movq %rax, %rbx
movq -0x90(%rbp), %rdi
jmp 0x6f313
jmp 0x6f31c
jmp 0x6f31c
movq %rax, %rbx
jmp 0x6f120
movq %rax, %rbx
jmp 0x6f114
movq %rax, %r15
jmp 0x6f1e1
movq %rax, %rbx
jmp 0x6f108
jmp 0x6f17a
jmp 0x6f31c
jmp 0x6f31c
jmp 0x6f31c
jmp 0x6f31c
movq %rax, %rbx
jmp 0x6f0fc
movq %rax, %rbx
leaq -0x190(%rbp), %rdi
callq 0x418c8
leaq -0x308(%rbp), %rdi
callq 0x418c8
leaq -0x790(%rbp), %rdi
callq 0x418c8
leaq -0x4a0(%rbp), %rdi
callq 0x418c8
movq %r14, %rdi
jmp 0x6f313
movq %rax, %r15
jmp 0x6f1e9
jmp 0x6f31c
movq %rax, %r15
jmp 0x6f203
jmp 0x6f31c
movq %rax, %rbx
movb $0x1, %r13b
jmp 0x6f301
movq %rax, %rbx
movq %r12, %rdi
jmp 0x6f313
movq %rax, %r15
jmp 0x6f20b
movq %rax, %rbx
movq -0x38(%rbp), %rdi
jmp 0x6f313
movq %rax, %rbx
movb $0x1, %r13b
movb $0x1, %r12b
jmp 0x6f2f4
movq %rax, %rbx
jmp 0x6f30f
jmp 0x6f193
jmp 0x6f186
movq %rax, %rbx
jmp 0x6f19e
movq %rax, %rbx
movq %r14, %rdi
jmp 0x6f1ac
movq %rax, %rbx
movq %r12, %rdi
callq 0x413a0
movq %r14, %rdi
jmp 0x6f2d9
movq %rax, %rbx
movq %r13, %rdi
callq 0x413a0
jmp 0x6f223
movq %rax, %rbx
jmp 0x6f22c
jmp 0x6f321
movq %rax, %rbx
jmp 0x6f260
movq %rax, %rbx
jmp 0x6f298
movq %rax, %r15
leaq -0x308(%rbp), %rdi
callq 0x418c8
testb %r14b, %r14b
je 0x6f1e9
movq %rbx, %rdi
callq 0x413a0
movq -0x58(%rbp), %rdi
jmp 0x6f20e
movq %rax, %r15
leaq -0x308(%rbp), %rdi
callq 0x418c8
testb %r14b, %r14b
je 0x6f20b
movq %rbx, %rdi
callq 0x413a0
movq %r13, %rdi
callq 0x413a0
movq %r15, %rbx
jmp 0x6f36b
jmp 0x6f31c
movq %rax, %rbx
movq -0x30(%rbp), %rdi
callq 0x413a0
movq -0x40(%rbp), %rdi
jmp 0x6f2d9
movq %rax, %rbx
leaq -0x790(%rbp), %rdi
callq 0x418c8
testb %r12b, %r12b
je 0x6f252
movq -0x38(%rbp), %rdi
callq 0x413a0
cmpb $0x0, -0x30(%rbp)
movq -0x40(%rbp), %r14
je 0x6f335
movq %r14, %rdi
callq 0x413a0
jmp 0x6f335
movq %rax, %rbx
leaq -0x4a0(%rbp), %rdi
callq 0x418c8
testb %r12b, %r12b
je 0x6f28a
movq -0x38(%rbp), %rdi
callq 0x413a0
cmpb $0x0, -0x30(%rbp)
movq -0x40(%rbp), %r14
je 0x6f35f
movq %r14, %rdi
callq 0x413a0
jmp 0x6f35f
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0x418c8
testb %r12b, %r12b
je 0x6f2c2
movq -0x40(%rbp), %rdi
callq 0x413a0
testb %r15b, %r15b
je 0x6f2d0
movq -0x30(%rbp), %rdi
callq 0x413a0
testb %r13b, %r13b
je 0x6f324
movq -0x78(%rbp), %rdi
callq 0x413a0
jmp 0x6f324
movq %rax, %rbx
leaq -0x308(%rbp), %rdi
callq 0x418c8
testb %r15b, %r15b
je 0x6f2fc
movq %r14, %rdi
callq 0x413a0
testb %r12b, %r12b
je 0x6f30a
movq -0x58(%rbp), %rdi
callq 0x413a0
testb %r13b, %r13b
je 0x6f36b
movq -0x50(%rbp), %rdi
callq 0x413a0
jmp 0x6f36b
jmp 0x6f35c
movq %rax, %rbx
jmp 0x6f36b
movq %rax, %rbx
leaq -0x790(%rbp), %rdi
callq 0x410e0
jmp 0x6f335
movq %rax, %rbx
leaq -0x4a0(%rbp), %rdi
callq 0x410e0
jmp 0x6f35f
jmp 0x6f35c
jmp 0x6f35c
jmp 0x6f35c
jmp 0x6f34b
movq %rax, %rbx
leaq -0x4a0(%rbp), %rdi
callq 0x418c8
jmp 0x6f35f
movq %rax, %rbx
leaq -0x308(%rbp), %rdi
callq 0x410e0
leaq -0x618(%rbp), %rdi
callq 0x410e0
leaq -0x150(%rbp), %rdi
callq 0x418c8
leaq -0xd0(%rbp), %rdi
callq 0x418c8
leaq -0xf0(%rbp), %rdi
callq 0x418c8
leaq -0x170(%rbp), %rdi
callq 0x418c8
leaq -0x130(%rbp), %rdi
callq 0x418c8
leaq -0x110(%rbp), %rdi
callq 0x418c8
movq -0x88(%rbp), %rdi
callq 0x4f7f8
movq %rbx, %rdi
callq 0x41790