// File: eniac[P]Mantis/src/compile/find_nodes.cpp
// Function: findRegargInIng(ReactionArgNode*, std::vector<AstNode*, std::allocator<AstNode*>>)
bool findRegargInIng(ReactionArgNode* regarg, std::vector<AstNode*> nodeArray) {

    if(regarg->argType_!=ReactionArgNode::REGISTER) {
        PRINT_VERBOSE("Miscall findRegargInIng for arg %s\n", regarg->toString().c_str());
        return false;
    }

    vector<P4ExprNode*> blackboxes = findBlackbox(nodeArray);
    
    std::string prog_name;
    for (auto blackbox : blackboxes) {
        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_;
                }
            }
        }
        if(reg_name.compare(regarg->toString())==0) {
            break;
        }
    }
    string action_name;
    bool found = 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) {
                    found = true;
                    action_name = tmp_action_node->name_->toString();
                    break;
                }
            }
            if (found) {
                break;
            }
        }
    }
    if(!found) {
        PANIC("Action missing to execute the stateful alu for %s\n", regarg->toString().c_str());
    }
    string table_name;
    found = false;
    for (auto node : nodeArray) {
        if(typeContains(node, "TableNode") && !typeContains(node, "P4R")) {
            TableNode* table = dynamic_cast<TableNode*>(node);
            table_name = *(table->name_->word_);
            TableActionStmtsNode* actions = table->actions_;
            for (TableActionStmtNode* tas : *actions->list_) {
                string tmp_action_name = *tas->name_->word_;
                if(tmp_action_name.compare(action_name)==0) {
                    found = true;
                    break;
                }
            }
            if(found) {
                break;
            }        
        }
    }
    if(!found) {
        PANIC("Table missing for %s\n", regarg->toString().c_str());
    }    
    // Now locate ing/egr for the table
    P4ExprNode* ing_node = findIngress(nodeArray);
    P4ExprNode* egr_node = findEgress(nodeArray);
    if(ing_node==NULL || egr_node==NULL) {
        PANIC("Missing ing/egr node for %s\n", regarg->toString().c_str());
    }
    // A valid table will either be applied at ing or egr
    if(ing_node->body_->toString().find(table_name) != string::npos) {
        return true;
    } else if (egr_node->body_->toString().find(table_name) != string::npos) {
        return false;
    } else {
        PANIC("Failed to locate %s for %s\n", table_name.c_str(), regarg->toString().c_str());
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x7a0, %rsp            # imm = 0x7A0
movq %rsi, -0x6d0(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x4, 0x3c(%rax)
je 0x12e81d
movb $0x0, -0x1(%rbp)
jmp 0x12f61d
movq -0x6d0(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x12cda0
leaq -0x50(%rbp), %rdi
callq 0xaa7f0
leaq -0x30(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
callq 0x127d80
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rdi
callq 0x127db0
movq %rax, -0x68(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x127de0
testb $0x1, %al
jne 0x12e86e
jmp 0x12ec87
leaq -0x60(%rbp), %rdi
callq 0x127e20
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq 0x50(%rax), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x90(%rbp), %rdi
callq *%rax
jmp 0x12e897
leaq -0x50(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movq %rsi, -0x6d8(%rbp)
callq 0xaa6d0
movq -0x6d8(%rbp), %rdi
callq 0xaabe8
movq -0x70(%rbp), %rax
movq 0x60(%rax), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x248(%rbp), %rdi
callq *%rax
jmp 0x12e8d3
movl $0x10, %edi
movl $0x8, %esi
callq 0xbff00
movl %eax, -0x6dc(%rbp)
jmp 0x12e8ea
movl -0x6dc(%rbp), %edx
leaq -0x228(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0xaa920
jmp 0x12e905
leaq -0x248(%rbp), %rdi
callq 0xaabe8
leaq -0x268(%rbp), %rdi
callq 0xaa7f0
leaq -0x288(%rbp), %rdi
callq 0xaa7f0
leaq -0x228(%rbp), %rdi
leaq -0x288(%rbp), %rsi
movl $0x3b, %edx
callq 0xaaae0
movq %rax, -0x6e8(%rbp)
jmp 0x12e94a
movq -0x6e8(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0xaa6f0
movb %al, -0x6e9(%rbp)
jmp 0x12e968
movb -0x6e9(%rbp), %al
testb $0x1, %al
jne 0x12e977
jmp 0x12eb9f
movl $0x10, %edi
movl $0x8, %esi
callq 0xbff00
movl %eax, -0x6f0(%rbp)
jmp 0x12e98e
movl -0x6f0(%rbp), %edx
leaq -0x410(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0xaa920
jmp 0x12e9a9
leaq -0x430(%rbp), %rdi
callq 0xaa7f0
leaq -0x410(%rbp), %rdi
leaq -0x430(%rbp), %rsi
movl $0x3a, %edx
callq 0xaaae0
movq %rax, -0x6f8(%rbp)
jmp 0x12e9d6
movq -0x6f8(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0xaa6f0
movb %al, -0x6f9(%rbp)
jmp 0x12e9f4
movb -0x6f9(%rbp), %al
testb $0x1, %al
jne 0x12ea03
jmp 0x12eb65
leaq -0x438(%rbp), %rdi
movq %rdi, -0x708(%rbp)
callq 0xaabc0
movq -0x708(%rbp), %rsi
leaq -0x430(%rbp), %rdi
callq 0xbff20
jmp 0x12ea2b
leaq -0x438(%rbp), %rdi
callq 0xaa810
leaq -0x430(%rbp), %rdi
leaq 0xf973(%rip), %rsi      # 0x13e3b8
callq 0xaa180
cmpl $0x0, %eax
jne 0x12eb60
leaq -0x410(%rbp), %rdi
leaq -0x430(%rbp), %rsi
movl $0x3a, %edx
callq 0xaaae0
jmp 0x12ea6d
leaq -0x440(%rbp), %rdi
movq %rdi, -0x710(%rbp)
callq 0xaabc0
movq -0x710(%rbp), %rsi
leaq -0x430(%rbp), %rdi
callq 0xbff20
jmp 0x12ea95
leaq -0x440(%rbp), %rdi
callq 0xaa810
leaq -0x268(%rbp), %rdi
leaq -0x430(%rbp), %rsi
callq 0xaa070
jmp 0x12eab6
jmp 0x12eb60
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x12f609
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x248(%rbp), %rdi
callq 0xaabe8
jmp 0x12f609
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x12ec5e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x12eb82
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x438(%rbp), %rdi
callq 0xaa810
jmp 0x12eb82
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x440(%rbp), %rdi
callq 0xaa810
jmp 0x12eb82
jmp 0x12e9b5
leaq -0x430(%rbp), %rdi
callq 0xaabe8
leaq -0x410(%rbp), %rdi
callq 0xaa440
jmp 0x12e929
leaq -0x430(%rbp), %rdi
callq 0xaabe8
leaq -0x410(%rbp), %rdi
callq 0xaa440
jmp 0x12ec5e
movq -0x10(%rbp), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x460(%rbp), %rdi
callq *%rax
jmp 0x12ebb4
leaq -0x268(%rbp), %rdi
leaq -0x460(%rbp), %rsi
callq 0xaa060
movl %eax, -0x714(%rbp)
jmp 0x12ebcf
leaq -0x460(%rbp), %rdi
callq 0xaabe8
movl -0x714(%rbp), %eax
cmpl $0x0, %eax
jne 0x12ec12
movl $0x2, -0x464(%rbp)
jmp 0x12ec1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x460(%rbp), %rdi
callq 0xaabe8
jmp 0x12ec5e
movl $0x0, -0x464(%rbp)
leaq -0x288(%rbp), %rdi
callq 0xaabe8
leaq -0x268(%rbp), %rdi
callq 0xaabe8
leaq -0x228(%rbp), %rdi
callq 0xaa440
movl -0x464(%rbp), %eax
testl %eax, %eax
je 0x12ec4e
jmp 0x12ec4c
jmp 0x12ec87
jmp 0x12ec50
leaq -0x60(%rbp), %rdi
callq 0x127e40
jmp 0x12e858
leaq -0x288(%rbp), %rdi
callq 0xaabe8
leaq -0x268(%rbp), %rdi
callq 0xaabe8
leaq -0x228(%rbp), %rdi
callq 0xaa440
jmp 0x12f609
leaq -0x488(%rbp), %rdi
callq 0xaa7f0
movq -0x6d0(%rbp), %rax
movb $0x0, -0x489(%rbp)
movq %rax, -0x498(%rbp)
movq -0x498(%rbp), %rdi
callq 0xb2ae0
movq %rax, -0x4a0(%rbp)
movq -0x498(%rbp), %rdi
callq 0xb2b10
movq %rax, -0x4a8(%rbp)
leaq -0x4a0(%rbp), %rdi
leaq -0x4a8(%rbp), %rsi
callq 0xb2b40
testb $0x1, %al
jne 0x12ecea
jmp 0x12f004
leaq -0x4a0(%rbp), %rdi
callq 0xb2b80
movq (%rax), %rax
movq %rax, -0x4b0(%rbp)
movq -0x4b0(%rbp), %rdi
leaq 0xcf29(%rip), %rsi      # 0x13bc37
callq 0x12c730
movb %al, -0x715(%rbp)
jmp 0x12ed1b
movb -0x715(%rbp), %al
testb $0x1, %al
jne 0x12ed2a
jmp 0x12eff1
movq -0x4b0(%rbp), %rdi
leaq 0xce5a(%rip), %rsi      # 0x13bb92
callq 0x12c730
movb %al, -0x716(%rbp)
jmp 0x12ed45
movb -0x716(%rbp), %al
testb $0x1, %al
jne 0x12eff1
jmp 0x12ed55
movq -0x4b0(%rbp), %rax
movq %rax, -0x720(%rbp)
cmpq $0x0, %rax
je 0x12eda7
movq -0x720(%rbp), %rdi
leaq 0x43869(%rip), %rsi     # 0x1725e0
leaq 0x44122(%rip), %rdx     # 0x172ea0
xorl %eax, %eax
movl %eax, %ecx
callq 0xaa660
movq %rax, -0x728(%rbp)
jmp 0x12edb2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x12f5fd
xorl %eax, %eax
movq %rax, -0x728(%rbp)
jmp 0x12edb2
movq -0x728(%rbp), %rax
movq %rax, -0x4b8(%rbp)
movq -0x4b8(%rbp), %rax
movq 0x40(%rax), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x4d8(%rbp), %rdi
callq *%rax
jmp 0x12eddc
movq -0x4b8(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x4e0(%rbp)
movq -0x4e0(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x4e8(%rbp)
movq -0x4e8(%rbp), %rdi
callq 0xb6410
movq %rax, -0x4f0(%rbp)
movq -0x4e8(%rbp), %rdi
callq 0xb62a0
movq %rax, -0x4f8(%rbp)
leaq -0x4f0(%rbp), %rdi
leaq -0x4f8(%rbp), %rsi
callq 0xc0ca0
testb $0x1, %al
jne 0x12ee42
jmp 0x12efa5
leaq -0x4f0(%rbp), %rdi
callq 0xc0ce0
movq (%rax), %rax
movq %rax, -0x500(%rbp)
movq -0x500(%rbp), %rsi
movq (%rsi), %rax
movq (%rax), %rax
movb $0x0, -0x541(%rbp)
leaq -0x520(%rbp), %rdi
callq *%rax
jmp 0x12ee77
leaq -0x520(%rbp), %rdi
leaq 0xf2b2(%rip), %rsi      # 0x13e137
xorl %eax, %eax
movl %eax, %edx
callq 0xaab90
movq %rax, %rcx
xorl %eax, %eax
cmpq $-0x1, %rcx
movb %al, -0x729(%rbp)
je 0x12eedf
movq -0x500(%rbp), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x540(%rbp), %rdi
callq *%rax
jmp 0x12eeb7
movb $0x1, -0x541(%rbp)
leaq -0x540(%rbp), %rdi
leaq -0x50(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xaabb0
cmpq $-0x1, %rax
setne %al
movb %al, -0x729(%rbp)
movb -0x729(%rbp), %al
movb %al, -0x72a(%rbp)
testb $0x1, -0x541(%rbp)
jne 0x12eef6
jmp 0x12ef02
leaq -0x540(%rbp), %rdi
callq 0xaabe8
leaq -0x520(%rbp), %rdi
callq 0xaabe8
movb -0x72a(%rbp), %al
testb $0x1, %al
jne 0x12ef1a
jmp 0x12ef92
movb $0x1, -0x489(%rbp)
movq -0x4b8(%rbp), %rax
movq 0x40(%rax), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x568(%rbp), %rdi
callq *%rax
jmp 0x12ef3d
leaq -0x488(%rbp), %rdi
leaq -0x568(%rbp), %rsi
callq 0xaa6d0
leaq -0x568(%rbp), %rdi
callq 0xaabe8
jmp 0x12efa5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x12efe0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x520(%rbp), %rdi
callq 0xaabe8
jmp 0x12efe0
jmp 0x12ef94
leaq -0x4f0(%rbp), %rdi
callq 0xc0d00
jmp 0x12ee26
testb $0x1, -0x489(%rbp)
je 0x12efba
movl $0x8, -0x464(%rbp)
jmp 0x12efc4
movl $0x0, -0x464(%rbp)
leaq -0x4d8(%rbp), %rdi
callq 0xaabe8
movl -0x464(%rbp), %eax
testl %eax, %eax
je 0x12efde
jmp 0x12efdc
jmp 0x12f004
jmp 0x12eff1
leaq -0x4d8(%rbp), %rdi
callq 0xaabe8
jmp 0x12f5fd
jmp 0x12eff3
leaq -0x4a0(%rbp), %rdi
callq 0xb2ba0
jmp 0x12ecce
testb $0x1, -0x489(%rbp)
jne 0x12f080
movq 0x44f9c(%rip), %rax     # 0x173fb0
movq (%rax), %rax
movq %rax, -0x738(%rbp)
movq -0x10(%rbp), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x588(%rbp), %rdi
callq *%rax
jmp 0x12f033
leaq -0x588(%rbp), %rdi
callq 0xaa270
movq -0x738(%rbp), %rdi
movq %rax, %r9
leaq 0xf825(%rip), %rsi      # 0x13e875
leaq 0xf682(%rip), %rdx      # 0x13e6d9
movl $0x17a, %ecx            # imm = 0x17A
leaq 0xf856(%rip), %r8       # 0x13e8b9
movb $0x0, %al
callq 0xaa850
leaq -0x588(%rbp), %rdi
callq 0xaabe8
movl $0x1, %edi
callq 0xaa6c0
leaq -0x5a8(%rbp), %rdi
callq 0xaa7f0
movq -0x6d0(%rbp), %rax
movb $0x0, -0x489(%rbp)
movq %rax, -0x5b0(%rbp)
movq -0x5b0(%rbp), %rdi
callq 0xb2ae0
movq %rax, -0x5b8(%rbp)
movq -0x5b0(%rbp), %rdi
callq 0xb2b10
movq %rax, -0x5c0(%rbp)
leaq -0x5b8(%rbp), %rdi
leaq -0x5c0(%rbp), %rsi
callq 0xb2b40
testb $0x1, %al
jne 0x12f0e3
jmp 0x12f322
leaq -0x5b8(%rbp), %rdi
callq 0xb2b80
movq (%rax), %rax
movq %rax, -0x5c8(%rbp)
movq -0x5c8(%rbp), %rdi
leaq 0xcdb2(%rip), %rsi      # 0x13beb9
callq 0x12c730
movb %al, -0x739(%rbp)
jmp 0x12f114
movb -0x739(%rbp), %al
testb $0x1, %al
jne 0x12f123
jmp 0x12f30f
movq -0x5c8(%rbp), %rdi
leaq 0xca61(%rip), %rsi      # 0x13bb92
callq 0x12c730
movb %al, -0x73a(%rbp)
jmp 0x12f13e
movb -0x73a(%rbp), %al
testb $0x1, %al
jne 0x12f30f
jmp 0x12f14e
movq -0x5c8(%rbp), %rax
movq %rax, -0x748(%rbp)
cmpq $0x0, %rax
je 0x12f1a0
movq -0x748(%rbp), %rdi
leaq 0x43470(%rip), %rsi     # 0x1725e0
leaq 0x43c81(%rip), %rdx     # 0x172df8
xorl %eax, %eax
movl %eax, %ecx
callq 0xaa660
movq %rax, -0x750(%rbp)
jmp 0x12f1ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x12f5f1
xorl %eax, %eax
movq %rax, -0x750(%rbp)
jmp 0x12f1ab
movq -0x750(%rbp), %rax
movq %rax, -0x5d0(%rbp)
movq -0x5d0(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x40(%rax), %rsi
leaq -0x5a8(%rbp), %rdi
callq 0xaa070
jmp 0x12f1d6
movq -0x5d0(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x5d8(%rbp)
movq -0x5d8(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x5e0(%rbp)
movq -0x5e0(%rbp), %rdi
callq 0xb4ca0
movq %rax, -0x5e8(%rbp)
movq -0x5e0(%rbp), %rdi
callq 0xb4b30
movq %rax, -0x5f0(%rbp)
leaq -0x5e8(%rbp), %rdi
leaq -0x5f0(%rbp), %rsi
callq 0xc0190
testb $0x1, %al
jne 0x12f23c
jmp 0x12f302
leaq -0x5e8(%rbp), %rdi
callq 0xc01d0
movq (%rax), %rax
movq %rax, -0x5f8(%rbp)
movq -0x5f8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x40(%rax), %rsi
leaq -0x618(%rbp), %rdi
callq 0xaa290
jmp 0x12f26f
leaq -0x618(%rbp), %rdi
leaq -0x488(%rbp), %rsi
callq 0xaa060
movl %eax, -0x754(%rbp)
jmp 0x12f28a
movl -0x754(%rbp), %eax
cmpl $0x0, %eax
jne 0x12f2cb
movb $0x1, -0x489(%rbp)
movl $0xe, -0x464(%rbp)
jmp 0x12f2d5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x618(%rbp), %rdi
callq 0xaabe8
jmp 0x12f5f1
movl $0x0, -0x464(%rbp)
leaq -0x618(%rbp), %rdi
callq 0xaabe8
movl -0x464(%rbp), %eax
testl %eax, %eax
je 0x12f2ef
jmp 0x12f2ed
jmp 0x12f302
jmp 0x12f2f1
leaq -0x5e8(%rbp), %rdi
callq 0xc01f0
jmp 0x12f220
testb $0x1, -0x489(%rbp)
je 0x12f30d
jmp 0x12f322
jmp 0x12f30f
jmp 0x12f311
leaq -0x5b8(%rbp), %rdi
callq 0xb2ba0
jmp 0x12f0c7
testb $0x1, -0x489(%rbp)
jne 0x12f39e
movq 0x44c7e(%rip), %rax     # 0x173fb0
movq (%rax), %rax
movq %rax, -0x760(%rbp)
movq -0x10(%rbp), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x638(%rbp), %rdi
callq *%rax
jmp 0x12f351
leaq -0x638(%rbp), %rdi
callq 0xaa270
movq -0x760(%rbp), %rdi
movq %rax, %r9
leaq 0xf55b(%rip), %rsi      # 0x13e8c9
leaq 0xf364(%rip), %rdx      # 0x13e6d9
movl $0x190, %ecx            # imm = 0x190
leaq 0xf538(%rip), %r8       # 0x13e8b9
movb $0x0, %al
callq 0xaa850
leaq -0x638(%rbp), %rdi
callq 0xaabe8
movl $0x1, %edi
callq 0xaa6c0
movq -0x6d0(%rbp), %rdi
callq 0x12c8a0
movq %rax, -0x768(%rbp)
jmp 0x12f3b3
movq -0x6d0(%rbp), %rdi
movq -0x768(%rbp), %rax
movq %rax, -0x640(%rbp)
callq 0x12cb20
movq %rax, -0x770(%rbp)
jmp 0x12f3d6
movq -0x770(%rbp), %rax
movq %rax, -0x648(%rbp)
cmpq $0x0, -0x640(%rbp)
je 0x12f3f8
cmpq $0x0, -0x648(%rbp)
jne 0x12f46b
movq 0x44bb1(%rip), %rax     # 0x173fb0
movq (%rax), %rax
movq %rax, -0x778(%rbp)
movq -0x10(%rbp), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x668(%rbp), %rdi
callq *%rax
jmp 0x12f41e
leaq -0x668(%rbp), %rdi
callq 0xaa270
movq -0x778(%rbp), %rdi
movq %rax, %r9
leaq 0xf3c0(%rip), %rsi      # 0x13e7fb
leaq 0xf297(%rip), %rdx      # 0x13e6d9
movl $0x196, %ecx            # imm = 0x196
leaq 0xf46b(%rip), %r8       # 0x13e8b9
movb $0x0, %al
callq 0xaa850
leaq -0x668(%rbp), %rdi
callq 0xaabe8
movl $0x1, %edi
callq 0xaa6c0
movq -0x640(%rbp), %rax
movq 0x60(%rax), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x688(%rbp), %rdi
callq *%rax
jmp 0x12f487
leaq -0x688(%rbp), %rdi
leaq -0x5a8(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xaabb0
movq %rax, -0x780(%rbp)
leaq -0x688(%rbp), %rdi
callq 0xaabe8
movq -0x780(%rbp), %rax
cmpq $-0x1, %rax
je 0x12f4d1
movb $0x1, -0x1(%rbp)
movl $0x1, -0x464(%rbp)
jmp 0x12f5c5
movq -0x648(%rbp), %rax
movq 0x60(%rax), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x6a8(%rbp), %rdi
callq *%rax
jmp 0x12f4ed
leaq -0x6a8(%rbp), %rdi
leaq -0x5a8(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xaabb0
movq %rax, -0x788(%rbp)
leaq -0x6a8(%rbp), %rdi
callq 0xaabe8
movq -0x788(%rbp), %rax
cmpq $-0x1, %rax
je 0x12f537
movb $0x0, -0x1(%rbp)
movl $0x1, -0x464(%rbp)
jmp 0x12f5c5
movq 0x44a72(%rip), %rax     # 0x173fb0
movq (%rax), %rax
movq %rax, -0x798(%rbp)
leaq -0x5a8(%rbp), %rdi
callq 0xaa270
movq %rax, -0x790(%rbp)
movq -0x10(%rbp), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x6c8(%rbp), %rdi
callq *%rax
jmp 0x12f570
leaq -0x6c8(%rbp), %rdi
callq 0xaa270
movq -0x798(%rbp), %rdi
movq -0x790(%rbp), %r9
leaq 0xf35f(%rip), %rsi      # 0x13e8f0
leaq 0xf141(%rip), %rdx      # 0x13e6d9
movl $0x19e, %ecx            # imm = 0x19E
leaq 0xf315(%rip), %r8       # 0x13e8b9
movq %rax, (%rsp)
movb $0x0, %al
callq 0xaa850
leaq -0x6c8(%rbp), %rdi
callq 0xaabe8
movl $0x1, %edi
callq 0xaa6c0
leaq -0x5a8(%rbp), %rdi
callq 0xaabe8
leaq -0x488(%rbp), %rdi
callq 0xaabe8
leaq -0x50(%rbp), %rdi
callq 0xaabe8
leaq -0x30(%rbp), %rdi
callq 0x127ca0
jmp 0x12f61d
leaq -0x5a8(%rbp), %rdi
callq 0xaabe8
leaq -0x488(%rbp), %rdi
callq 0xaabe8
leaq -0x50(%rbp), %rdi
callq 0xaabe8
leaq -0x30(%rbp), %rdi
callq 0x127ca0
jmp 0x12f62b
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x7a0, %rsp            # imm = 0x7A0
popq %rbp
retq
movq -0x98(%rbp), %rdi
callq 0xaaa60
nopw (%rax,%rax)