LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/eniac[P]Mantis/src/compile/find_nodes.cpp
// Function: findIngress(std::vector<AstNode*, std::allocator<AstNode*>> const&)
P4ExprNode* findIngress(const std::vector<AstNode*>& astNodes) {
    for (auto node : astNodes) {
        if (typeContains(node, "P4ExprNode")) {
            P4ExprNode* exprNode = dynamic_cast<P4ExprNode*>(node);
            // Might be called after ing transformation
            if (exprNode->name1_->toString().find("ingress") != string::npos || exprNode->name1_->toString().find(string(kOrigIngControlName)) != string::npos) {
                return exprNode;
            }
        }
    }

    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq (%rdi), %r14
movq 0x8(%rdi), %r12
leaq 0xb56e(%rip), %rbx      # 0x7d329
cmpq %r12, %r14
je 0x71e87
movq (%r14), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x71cf8
testb %al, %al
je 0x71e7e
movq %r13, %rdi
leaq 0x228ac(%rip), %rsi     # 0x94690
leaq 0x2302d(%rip), %rdx     # 0x94e18
xorl %ecx, %ecx
callq 0x41480
movq %rax, %r13
movq 0x48(%rax), %rsi
movq (%rsi), %rax
leaq -0x78(%rbp), %r15
movq %r15, %rdi
callq *(%rax)
movq %r15, %rdi
leaq 0xb525(%rip), %rsi      # 0x7d334
xorl %edx, %edx
callq 0x41880
cmpq $-0x1, %rax
movq %r13, -0x38(%rbp)
jne 0x71e91
movq 0x48(%r13), %rsi
movq (%rsi), %rax
leaq -0x58(%rbp), %rdi
callq *(%rax)
movq %r12, %r15
leaq -0x98(%rbp), %r13
movq %r13, %rdi
leaq 0xac08(%rip), %rsi      # 0x7ca49
leaq -0x29(%rbp), %rdx
callq 0x411c0
leaq -0x58(%rbp), %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x41890
movq %rax, %r12
movq %r13, %rdi
callq 0x418c8
leaq -0x58(%rbp), %rdi
callq 0x418c8
leaq -0x78(%rbp), %rdi
callq 0x418c8
cmpq $-0x1, %r12
movq %r15, %r12
jne 0x71e9a
addq $0x8, %r14
jmp 0x71dbb
movq $0x0, -0x38(%rbp)
jmp 0x71e9a
leaq -0x78(%rbp), %rdi
callq 0x418c8
movq -0x38(%rbp), %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x418c8
jmp 0x71ebe
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x418c8
movq %rbx, %rdi
callq 0x41790
// File: /workspace/github_cpp_makefile_star2_O2/eniac[P]Mantis/src/compile/find_nodes.cpp
// Function: findEgress(std::vector<AstNode*, std::allocator<AstNode*>> const&)
P4ExprNode* findEgress(const std::vector<AstNode*>& astNodes) {
    for (auto node : astNodes) {
        if (typeContains(node, "P4ExprNode")) {
            P4ExprNode* exprNode = dynamic_cast<P4ExprNode*>(node);
            if (exprNode->name1_->toString().find("egress") != string::npos || exprNode->name1_->toString().find(string(kOrigEgrControlName)) != string::npos) {
                return exprNode;
            }
        }
    }

    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq (%rdi), %r14
movq 0x8(%rdi), %r12
leaq 0xb43b(%rip), %rbx      # 0x7d329
cmpq %r12, %r14
je 0x71fba
movq (%r14), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x71cf8
testb %al, %al
je 0x71fb1
movq %r13, %rdi
leaq 0x22779(%rip), %rsi     # 0x94690
leaq 0x22efa(%rip), %rdx     # 0x94e18
xorl %ecx, %ecx
callq 0x41480
movq %rax, %r13
movq 0x48(%rax), %rsi
movq (%rsi), %rax
leaq -0x78(%rbp), %r15
movq %r15, %rdi
callq *(%rax)
movq %r15, %rdi
leaq 0xb3fa(%rip), %rsi      # 0x7d33c
xorl %edx, %edx
callq 0x41880
cmpq $-0x1, %rax
movq %r13, -0x38(%rbp)
jne 0x71fc4
movq 0x48(%r13), %rsi
movq (%rsi), %rax
leaq -0x58(%rbp), %rdi
callq *(%rax)
movq %r12, %r15
leaq -0x98(%rbp), %r13
movq %r13, %rdi
leaq 0xab99(%rip), %rsi      # 0x7cb0d
leaq -0x29(%rbp), %rdx
callq 0x411c0
leaq -0x58(%rbp), %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x41890
movq %rax, %r12
movq %r13, %rdi
callq 0x418c8
leaq -0x58(%rbp), %rdi
callq 0x418c8
leaq -0x78(%rbp), %rdi
callq 0x418c8
cmpq $-0x1, %r12
movq %r15, %r12
jne 0x71fcd
addq $0x8, %r14
jmp 0x71eee
movq $0x0, -0x38(%rbp)
jmp 0x71fcd
leaq -0x78(%rbp), %rdi
callq 0x418c8
movq -0x38(%rbp), %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x418c8
jmp 0x71ff1
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x418c8
movq %rbx, %rdi
callq 0x41790
// File: /workspace/github_cpp_makefile_star2_O2/eniac[P]Mantis/src/compile/find_nodes.cpp
// Function: findBlackbox(std::vector<AstNode*, std::allocator<AstNode*>> const&)
vector<P4ExprNode*> findBlackbox(const std::vector<AstNode*>& astNodes) {
    vector<P4ExprNode*> ret;
    for (auto node : astNodes) {
        if (typeContains(node, "P4ExprNode")) {
            P4ExprNode* exprNode = dynamic_cast<P4ExprNode*>(node);
            if (exprNode->keyword_->toString().find("blackbox") != string::npos) {
                ret.push_back(exprNode);
            }
        }
    }
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq %rdi, -0x30(%rbp)
andq $0x0, 0x10(%rdi)
movq (%rsi), %r15
movq 0x8(%rsi), %rbx
leaq 0xb2f9(%rip), %r14      # 0x7d329
leaq -0x58(%rbp), %r13
cmpq %rbx, %r15
je 0x720a8
movq (%r15), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x71cf8
testb %al, %al
je 0x720a2
movq %r12, %rdi
leaq 0x2263b(%rip), %rsi     # 0x94690
leaq 0x22dbc(%rip), %rdx     # 0x94e18
xorl %ecx, %ecx
callq 0x41480
movq %rax, -0x38(%rbp)
movq 0x40(%rax), %rsi
movq (%rsi), %rax
movq %r13, %rdi
callq *(%rax)
movq %r13, %rdi
leaq 0xaccd(%rip), %rsi      # 0x7cd4a
xorl %edx, %edx
callq 0x41880
movq %rax, %r12
movq %r13, %rdi
callq 0x418c8
cmpq $-0x1, %r12
je 0x720a2
movq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x73654
addq $0x8, %r15
jmp 0x72034
movq -0x30(%rbp), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x720bf
jmp 0x720bf
movq %rax, %r14
movq -0x30(%rbp), %rdi
callq 0x71ce2
movq %r14, %rdi
callq 0x41790
// File: /workspace/github_cpp_makefile_star2_O2/eniac[P]Mantis/src/compile/find_nodes.cpp
// Function: findMalleableRefs(std::vector<MblRefNode*, std::allocator<MblRefNode*>>*, std::vector<AstNode*, std::allocator<AstNode*>> const&)
void findMalleableRefs(vector<MblRefNode*>* varRefs,
                      const vector<AstNode*>& astNodes) {
    for (AstNode* node : astNodes) {
        if (typeContains(node, "MblRefNode")) {
            MblRefNode* varRef = dynamic_cast<MblRefNode*>(node);
            varRefs->push_back(varRef);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rsi), %r13
movq 0x8(%rsi), %r15
leaq 0x6bbb(%rip), %r14      # 0x78df0
cmpq %r15, %r13
je 0x72284
movq (%r13), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x71cf8
testb %al, %al
je 0x7227e
testq %r12, %r12
je 0x7226c
movq %r12, %rdi
leaq 0x22434(%rip), %rsi     # 0x94690
leaq 0x23275(%rip), %rdx     # 0x954d8
xorl %ecx, %ecx
callq 0x41480
jmp 0x7226e
xorl %eax, %eax
movq %rax, -0x30(%rbp)
movq %rbx, %rdi
leaq -0x30(%rbp), %rsi
callq 0x73678
addq $0x8, %r13
jmp 0x72235
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/eniac[P]Mantis/src/compile/find_nodes.cpp
// Function: findTableActionStmts(std::vector<AstNode*, std::allocator<AstNode*>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
unordered_map<TableActionStmtNode*, TableNode*> findTableActionStmts(
            const vector<AstNode*>& astNodes, const string& actionName) {
    auto ret = unordered_map<TableActionStmtNode*, TableNode*>();

    for (auto node : astNodes) {
        if (typeContains(node, "TableNode") && !typeContains(node, "P4R")) {
            TableNode* table = dynamic_cast<TableNode*>(node);
            TableActionStmtsNode* actions = table->actions_;
            for (TableActionStmtNode* tas : *actions->list_) {
                if (*tas->name_->word_ == actionName) {
                    ret.emplace(tas, table);
                    break;
                }
            }
        }
    }
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
andq $0x0, 0x20(%rdi)
leaq 0x30(%rdi), %rax
movq %rax, (%rdi)
movq $0x1, 0x8(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
movl $0x3f800000, 0x20(%rdi) # imm = 0x3F800000
movq %rdi, -0x30(%rbp)
movups %xmm0, 0x28(%rdi)
movq (%rsi), %r12
movq 0x8(%rsi), %rbx
leaq 0x88f2(%rip), %r15      # 0x7abd1
cmpq %rbx, %r12
je 0x72381
movq (%r12), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x71cf8
testb %al, %al
je 0x72378
movq %r13, %rdi
leaq 0x85a5(%rip), %rsi      # 0x7a8aa
callq 0x71cf8
testb %al, %al
jne 0x72378
movq %r13, %rdi
leaq 0x22378(%rip), %rsi     # 0x94690
leaq 0x22b89(%rip), %rdx     # 0x94ea8
xorl %ecx, %ecx
callq 0x41480
movq %rax, -0x40(%rbp)
movq 0x50(%rax), %rax
movq 0x40(%rax), %rax
movq (%rax), %r13
movq 0x8(%rax), %r15
cmpq %r15, %r13
je 0x72371
movq (%r13), %rax
movq %rax, -0x38(%rbp)
movq 0x40(%rax), %rax
movq 0x40(%rax), %rdi
movq %r14, %rsi
callq 0x619cc
testb %al, %al
jne 0x72360
addq $0x8, %r13
jmp 0x72339
movq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x74386
leaq 0x8859(%rip), %r15      # 0x7abd1
addq $0x8, %r12
jmp 0x722df
movq -0x30(%rbp), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x72396
movq %rax, %r14
movq -0x30(%rbp), %rdi
callq 0x71104
movq %r14, %rdi
callq 0x41790
// File: /workspace/github_cpp_makefile_star2_O2/eniac[P]Mantis/src/compile/find_nodes.cpp
// Function: findTableReadStmt(TableNode const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool findTableReadStmt(const TableNode& table, const string& fieldName) {
    TableReadStmtsNode* reads = table.reads_;
    for (TableReadStmtNode* trs : *reads->list_) {
        if (typeContains(trs->field_, "StrNode")) {
            StrNode* sn = dynamic_cast<StrNode*>(trs->field_);
            if (*sn->word_ == fieldName) {
                return true;
            }
        }
    }

    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq 0x48(%rdi), %rax
movq 0x40(%rax), %rax
movq (%rax), %r13
movq 0x8(%rax), %r15
leaq 0xaf83(%rip), %r14      # 0x7d354
cmpq %r15, %r13
je 0x7241b
movq (%r13), %r12
movq 0x40(%r12), %rdi
movq %r14, %rsi
callq 0x71cf8
testb %al, %al
je 0x72415
movq 0x40(%r12), %rdi
leaq 0x22299(%rip), %rsi     # 0x94690
leaq 0x226a2(%rip), %rdx     # 0x94aa0
xorl %ecx, %ecx
callq 0x41480
movq 0x40(%rax), %rdi
movq %rbx, %rsi
callq 0x619cc
testb %al, %al
jne 0x7241b
addq $0x8, %r13
jmp 0x723d1
cmpq %r15, %r13
setne %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/eniac[P]Mantis/src/compile/find_nodes.cpp
// Function: findAndTransformMblRefsInAction(ActionNode*, std::vector<MblRefNode*, std::allocator<MblRefNode*>>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void findAndTransformMblRefsInAction(ActionNode* action,
                                     vector<MblRefNode*>* varRefs,
                                     const string& varName,
                                     const string& altHeader,
                                     const string& altField) {

    for (ActionStmtNode* as : *action->stmts_->list_) {
        for (BodyWordNode* bw : *as->args_->list_) {
            if (bw->wordType_ != BodyWordNode::VARREF) {
                continue;
            }

            auto varRef = dynamic_cast<MblRefNode*>(bw->contents_);
            if (*varRef->name_->word_ == varName) {
                varRef->transform(altHeader, altField);
            } else if (varRefs && !varRef->transformed_) {
                varRefs->push_back(dynamic_cast<MblRefNode*>(bw->contents_));
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, -0x50(%rbp)
movq %rcx, -0x48(%rbp)
movq %rdx, %r15
movq %rsi, -0x30(%rbp)
movq 0x50(%rdi), %rax
movq 0x40(%rax), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq -0x38(%rbp), %rcx
je 0x72543
movq %rcx, -0x40(%rbp)
movq (%rcx), %rax
movq 0x58(%rax), %rax
movq 0x40(%rax), %rax
movq (%rax), %rbx
movq 0x8(%rax), %r14
cmpq %r14, %rbx
je 0x72536
movq (%rbx), %r12
cmpl $0x0, 0x3c(%r12)
jne 0x7252d
movq 0x40(%r12), %rdi
testq %rdi, %rdi
je 0x724bf
leaq 0x221e4(%rip), %rsi     # 0x94690
leaq 0x23025(%rip), %rdx     # 0x954d8
xorl %ecx, %ecx
callq 0x41480
movq %rax, %r13
jmp 0x724c2
xorl %r13d, %r13d
movq 0x80(%r13), %rax
movq 0x40(%rax), %rdi
movq %r15, %rsi
callq 0x619cc
testb %al, %al
je 0x724eb
movq %r13, %rdi
movq -0x48(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0x4dbe0
jmp 0x7252d
cmpq $0x0, -0x30(%rbp)
je 0x7252d
cmpb $0x0, 0x39(%r13)
jne 0x7252d
movq 0x40(%r12), %rdi
testq %rdi, %rdi
je 0x7251a
leaq 0x22186(%rip), %rsi     # 0x94690
leaq 0x22fc7(%rip), %rdx     # 0x954d8
xorl %ecx, %ecx
callq 0x41480
jmp 0x7251c
xorl %eax, %eax
movq %rax, -0x58(%rbp)
movq -0x30(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x71594
addq $0x8, %rbx
jmp 0x72483
movq -0x40(%rbp), %rcx
addq $0x8, %rcx
jmp 0x72463
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/eniac[P]Mantis/src/compile/find_nodes.cpp
// Function: findInitBlock(std::vector<AstNode*, std::allocator<AstNode*>>)
P4RInitBlockNode* findInitBlock(std::vector<AstNode*> astNodes){
    // Currently get a single node, easily generalize to multiple distributed init/reaction block
	for (auto node : astNodes) {
		if (node->nodeType_.find(string("InitBlockNode")) != string::npos) {
			P4RInitBlockNode * iNode = dynamic_cast<P4RInitBlockNode *>(node);
			return iNode;
		}
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq (%rdi), %r15
movq 0x8(%rdi), %r13
leaq -0x50(%rbp), %r12
cmpq %r13, %r15
je 0x725ef
movq (%r15), %r14
movq %r12, %rdi
leaq 0xada2(%rip), %rsi      # 0x7d346
leaq -0x29(%rbp), %rdx
callq 0x411c0
leaq 0x10(%r14), %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x41890
movq %rax, %rbx
movq %r12, %rdi
callq 0x418c8
addq $0x8, %r15
cmpq $-0x1, %rbx
je 0x72592
testq %r14, %r14
je 0x725ef
leaq 0x220b4(%rip), %rsi     # 0x94690
leaq 0x22e95(%rip), %rdx     # 0x95478
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x41480
jmp 0x725f1
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/eniac[P]Mantis/src/compile/find_nodes.cpp
// Function: findReaction(std::vector<AstNode*, std::allocator<AstNode*>>)
P4RReactionNode* findReaction(std::vector<AstNode*> astNodes){
	for (auto node : astNodes) {
		if (node->nodeType_.find(string("ReactionNode")) != string::npos) {
			P4RReactionNode * reactionNode = dynamic_cast<P4RReactionNode *>(node);
			return reactionNode;
		}
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq (%rdi), %r15
movq 0x8(%rdi), %r13
leaq -0x50(%rbp), %r12
cmpq %r13, %r15
je 0x72679
movq (%r15), %r14
movq %r12, %rdi
leaq 0xa577(%rip), %rsi      # 0x7cba5
leaq -0x29(%rbp), %rdx
callq 0x411c0
leaq 0x10(%r14), %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x41890
movq %rax, %rbx
movq %r12, %rdi
callq 0x418c8
addq $0x8, %r15
cmpq $-0x1, %rbx
je 0x7261c
testq %r14, %r14
je 0x72679
leaq 0x2202a(%rip), %rsi     # 0x94690
leaq 0x22e23(%rip), %rdx     # 0x95490
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x41480
jmp 0x7267b
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/eniac[P]Mantis/src/compile/find_nodes.cpp
// Function: findP4RegisterNode(std::vector<AstNode*, std::allocator<AstNode*>> const&)
vector<P4RegisterNode*> findP4RegisterNode(const vector<AstNode*>& astNodes) {
    vector<P4RegisterNode*> ret;
    for (auto node : astNodes) {
        if (typeContains(node, "P4RegisterNode")) {
            ret.push_back(dynamic_cast<P4RegisterNode*>(node));
        }
    }
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
andq $0x0, 0x10(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq (%rsi), %r13
movq 0x8(%rsi), %r15
leaq 0x7400(%rip), %r14      # 0x79ab4
cmpq %r15, %r13
je 0x72703
movq (%r13), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x71cf8
testb %al, %al
je 0x726fd
testq %r12, %r12
je 0x726eb
movq %r12, %rdi
leaq 0x21fb5(%rip), %rsi     # 0x94690
leaq 0x2271e(%rip), %rdx     # 0x94e00
xorl %ecx, %ecx
callq 0x41480
jmp 0x726ed
xorl %eax, %eax
movq %rax, -0x30(%rbp)
movq %rbx, %rdi
leaq -0x30(%rbp), %rsi
callq 0x74732
addq $0x8, %r13
jmp 0x726b4
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x72717
movq %rax, %r14
movq %rbx, %rdi
callq 0x71cce
movq %r14, %rdi
callq 0x41790
// File: /workspace/github_cpp_makefile_star2_O2/eniac[P]Mantis/src/compile/find_nodes.cpp
// Function: findReactionArgs(std::vector<AstNode*, std::allocator<AstNode*>> const&)
vector<ReactionArgNode*> findReactionArgs(const vector<AstNode*>& astNodes) {
    vector<ReactionArgNode*> ret;
    // Find all the argument nodes
    for (auto node : astNodes) {
        if (typeContains(node, "ReactionArgNode")) {
            ret.push_back(dynamic_cast<ReactionArgNode*>(node));
        }
    }
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
andq $0x0, 0x10(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq (%rsi), %r13
movq 0x8(%rsi), %r15
leaq 0xac08(%rip), %r14      # 0x7d35c
cmpq %r15, %r13
je 0x727a3
movq (%r13), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x71cf8
testb %al, %al
je 0x7279d
testq %r12, %r12
je 0x7278b
movq %r12, %rdi
leaq 0x21f15(%rip), %rsi     # 0x94690
leaq 0x22d3e(%rip), %rdx     # 0x954c0
xorl %ecx, %ecx
callq 0x41480
jmp 0x7278d
xorl %eax, %eax
movq %rax, -0x30(%rbp)
movq %rbx, %rdi
leaq -0x30(%rbp), %rsi
callq 0x748a8
addq $0x8, %r13
jmp 0x72754
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x727b7
movq %rax, %r14
movq %rbx, %rdi
callq 0x4f87c
movq %r14, %rdi
callq 0x41790
// File: /workspace/github_cpp_makefile_star2_O2/eniac[P]Mantis/src/compile/find_nodes.cpp
// Function: findAndRemoveReactions(std::vector<P4RReactionNode*, std::allocator<P4RReactionNode*>>*, std::vector<AstNode*, std::allocator<AstNode*>> const&)
void findAndRemoveReactions(vector<P4RReactionNode*>* reactions,
                            const vector<AstNode*>& astNodes) {
    // Find all the malleables
    for (auto n : astNodes) {
        if (typeContains(n, "P4RReactionNode")) {
            auto r = dynamic_cast<P4RReactionNode*>(n);
            reactions->push_back(r);
            n->removed_ = true;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rsi), %r13
movq 0x8(%rsi), %r15
leaq 0x9f98(%rip), %r14      # 0x7cba2
cmpq %r15, %r13
je 0x72c5f
movq (%r13), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x71cf8
testb %al, %al
je 0x72c59
testq %r12, %r12
je 0x72c41
movq %r12, %rdi
leaq 0x21a5f(%rip), %rsi     # 0x94690
leaq 0x22858(%rip), %rdx     # 0x95490
xorl %ecx, %ecx
callq 0x41480
jmp 0x72c43
xorl %eax, %eax
movq %rax, -0x30(%rbp)
movq %rbx, %rdi
leaq -0x30(%rbp), %rsi
callq 0x73724
movb $0x1, 0x38(%r12)
addq $0x8, %r13
jmp 0x72c0a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/eniac[P]Mantis/src/compile/find_nodes.cpp
// Function: findTblInIng(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<AstNode*, std::allocator<AstNode*>> const&)
bool findTblInIng(string tableName, const vector<AstNode*>& nodeArray) {
    P4ExprNode* ing_node = findIngress(nodeArray);
    P4ExprNode* egr_node = findEgress(nodeArray);
    // Currently assume that control ing/egr doesn't wrap other control blocks (otherwise requires recursive search)
    if(ing_node==NULL || egr_node==NULL) {
        PANIC("Missing ing/egr node for %s\n", tableName.c_str());
    }
    if(ing_node->body_->toString().find(tableName) != string::npos) {
        return true;
    } else if (egr_node->body_->toString().find(tableName) != string::npos) {
        return false;
    } else {
        PANIC("Failed to locate %s in ing/egr control block\n", tableName.c_str());
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x71d9c
movq %rax, %r15
movq %r14, %rdi
callq 0x71ecf
testq %r15, %r15
je 0x72d13
movq %rax, %r14
testq %rax, %rax
je 0x72d13
movq 0x60(%r15), %rsi
movq (%rsi), %rax
leaq -0x40(%rbp), %r12
movq %r12, %rdi
callq *(%rax)
movq %r12, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x41890
movq %rax, %r15
movq %r12, %rdi
callq 0x418c8
cmpq $-0x1, %r15
jne 0x72cff
movq 0x60(%r14), %rsi
movq (%rsi), %rax
leaq -0x40(%rbp), %r14
movq %r14, %rdi
callq *(%rax)
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x41890
movq %rax, %r12
movq %r14, %rdi
callq 0x418c8
cmpq $-0x1, %r12
je 0x72d3c
cmpq $-0x1, %r15
setne %al
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x23296(%rip), %rax     # 0x95fb0
movq (%rax), %rdi
movq (%rbx), %r9
leaq 0xa794(%rip), %rsi      # 0x7d4bb
leaq 0xa66b(%rip), %rdx      # 0x7d399
leaq 0xa7b4(%rip), %r8       # 0x7d4e9
movl $0x13a, %ecx            # imm = 0x13A
jmp 0x72d63
movq 0x2326d(%rip), %rax     # 0x95fb0
movq (%rax), %rdi
movq (%rbx), %r9
leaq 0xa7a6(%rip), %rsi      # 0x7d4f6
leaq 0xa642(%rip), %rdx      # 0x7d399
leaq 0xa78b(%rip), %r8       # 0x7d4e9
movl $0x141, %ecx            # imm = 0x141
xorl %eax, %eax
callq 0x41600
pushq $0x1
popq %rdi
callq 0x414f0
// File: /workspace/github_cpp_makefile_star2_O2/eniac[P]Mantis/src/compile/find_nodes.cpp
// Function: findRegargWidth(ReactionArgNode*, std::vector<AstNode*, std::allocator<AstNode*>>)
int findRegargWidth(ReactionArgNode* regarg, std::vector<AstNode*> nodeArray) {
    vector<P4RegisterNode*> regNodes = findP4RegisterNode(nodeArray);
    for(auto reg : regNodes) {
        if(reg->name_->toString().compare(regarg->toString())==0) {
            return reg->width_;
        }
    }
    PANIC("Non existing reg arg %s\n", regarg->toString().c_str());
    return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
leaq -0x68(%rbp), %r14
movq %r14, %rdi
callq 0x7268a
movq (%r14), %r13
movq 0x8(%r14), %rax
movq %rax, -0x30(%rbp)
cmpq -0x30(%rbp), %r13
je 0x735ce
movq (%r13), %r14
movq 0x40(%r14), %rsi
movq (%rsi), %rax
leaq -0x50(%rbp), %r12
movq %r12, %rdi
callq *(%rax)
leaq -0x88(%rbp), %r15
movq (%rbx), %rax
movq %r15, %rdi
movq %rbx, %rsi
callq *(%rax)
movq %r12, %rdi
movq %r15, %rsi
callq 0x41040
movq %r15, %rdi
movq %r12, %r15
movl %eax, %r12d
callq 0x418c8
movq %r15, %rdi
callq 0x418c8
addq $0x8, %r13
testl %r12d, %r12d
jne 0x7355a
movl 0x50(%r14), %ebx
leaq -0x68(%rbp), %rdi
callq 0x71cce
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x229db(%rip), %rax     # 0x95fb0
movq (%rax), %r14
movq (%rbx), %rax
leaq -0x50(%rbp), %rdi
movq %rbx, %rsi
callq *(%rax)
leaq -0x50(%rbp), %rbx
movq (%rbx), %r9
leaq 0x9feb(%rip), %rsi      # 0x7d5dd
leaq 0x9da0(%rip), %rdx      # 0x7d399
leaq 0xa007(%rip), %r8       # 0x7d607
movq %r14, %rdi
movl $0x1a9, %ecx            # imm = 0x1A9
xorl %eax, %eax
callq 0x41600
movq %rbx, %rdi
callq 0x418c8
pushq $0x1
popq %rdi
callq 0x414f0
jmp 0x73621
movq %rax, %rbx
jmp 0x73643
movq %rax, %rbx
jmp 0x7363a
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
callq 0x418c8
leaq -0x50(%rbp), %rdi
callq 0x418c8
leaq -0x68(%rbp), %rdi
callq 0x71cce
movq %rbx, %rdi
callq 0x41790
// File: /workspace/github_cpp_makefile_star2_O2/attractivechaos[P]udb2/khashl/./../common-block.c
// Function: traverse_rng
uint64_t traverse_rng(uint32_t n, uint32_t x0)
{
	uint64_t sum = 0;
	uint32_t i, x;
	uint8_t block[MAX_BLOCK_LEN];
	for (i = 0, x = x0; i < n; ++i) {
		x = hash32(x);
		sum += get_key_block(n, x, block);
	}
	return sum;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebp
movl %edi, %ebx
movq %rsp, %r14
movl %edi, %r15d
subl $0x1, %r15d
jb 0x120d
movl %ebp, %edi
callq 0x121e
movl %eax, %ebp
movl %ebx, %edi
movl %eax, %esi
movq %r14, %rdx
callq 0x1249
jmp 0x11f0
movl %ebx, %eax
shlq $0x4, %rax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/attractivechaos[P]udb2/khashl/./../common-block.c
// Function: get_key_block
static inline int32_t get_key_block(const uint32_t n, const uint32_t x, uint8_t block[MAX_BLOCK_LEN])
{
	uint32_t y;
	int32_t i, len;
	y = hash32(x % (n>>2));
	len = MAX_BLOCK_LEN;
	for (i = 0; i < len; i += 4)
		memcpy(&block[i], &y, 4);
	return len;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %eax
shrl $0x2, %edi
xorl %r14d, %r14d
xorl %edx, %edx
divl %edi
movl %edx, %edi
callq 0x121e
cmpq $0xf, %r14
ja 0x1273
movl %eax, (%rbx,%r14)
addq $0x4, %r14
jmp 0x1263
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/attractivechaos[P]udb2/khashl/./../common-block.c
// Function: murmur3_32
uint32_t murmur3_32(const uint8_t* key, size_t len, uint32_t seed) // from wiki
{
	uint32_t h = seed;
    uint32_t k;
	size_t i;
    for (i = len >> 2; i; i--) {
        memcpy(&k, key, sizeof(uint32_t));
        key += sizeof(uint32_t);
        h ^= murmur_32_scramble(k);
        h = (h << 13) | (h >> 19);
        h = h * 5 + 0xe6546b64;
    }
    k = 0;
    for (i = len & 3; i; i--) {
        k <<= 8;
        k |= key[i - 1];
    }
    h ^= murmur_32_scramble(k);
	h ^= len;
	h ^= h >> 16;
	h *= 0x85ebca6b;
	h ^= h >> 13;
	h *= 0xc2b2ae35;
	h ^= h >> 16;
	return h;
}

// Assembly:
movq %rsi, %rcx
shrq $0x2, %rcx
movq %rsi, %rax
andq $-0x4, %rax
xorl %r8d, %r8d
cmpq %r8, %rcx
je 0x12c7
movl (%rdi,%r8,4), %r9d
imull $0xcc9e2d51, %r9d, %r10d # imm = 0xCC9E2D51
imull $0x16a88000, %r9d, %r9d # imm = 0x16A88000
shrl $0x11, %r10d
orl %r9d, %r10d
imull $0x1b873593, %r10d, %r9d # imm = 0x1B873593
xorl %edx, %r9d
roll $0xd, %r9d
leal (%r9,%r9,4), %edx
addl $0xe6546b64, %edx       # imm = 0xE6546B64
incq %r8
jmp 0x128c
movl %esi, %r8d
andl $0x3, %r8d
leaq (%rax,%rdi), %rcx
decq %rcx
xorl %eax, %eax
movq %r8, %rdi
subq $0x1, %rdi
jb 0x12f0
shll $0x8, %eax
movzbl (%rcx,%r8), %r8d
orl %r8d, %eax
movq %rdi, %r8
jmp 0x12da
imull $0xcc9e2d51, %eax, %ecx # imm = 0xCC9E2D51
imull $0x16a88000, %eax, %eax # imm = 0x16A88000
shrl $0x11, %ecx
orl %eax, %ecx
imull $0x1b873593, %ecx, %eax # imm = 0x1B873593
xorl %edx, %esi
xorl %eax, %esi
movl %esi, %eax
shrl $0x10, %eax
xorl %esi, %eax
imull $0x85ebca6b, %eax, %eax # imm = 0x85EBCA6B
movl %eax, %ecx
shrl $0xd, %ecx
xorl %eax, %ecx
imull $0xc2b2ae35, %ecx, %ecx # imm = 0xC2B2AE35
movl %ecx, %eax
shrl $0x10, %eax
xorl %ecx, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/attractivechaos[P]udb2/khashl/./../common-block.c
// Function: main
int main(int argc, char *argv[])
{
	uint32_t test_int(uint32_t n, uint32_t x0);
	int c;
	double t, t0;
	uint32_t i, m = 5, max = 50000000, n = 10000000, x0 = 1, step;
	uint64_t sum;
	long m0;

	while ((c = getopt(argc, argv, "n:x:0:k:")) >= 0) {
		if (c == 'n') n = atol(optarg);
		else if (c == 'x') max = atol(optarg);
		else if (c == '0') x0 = atol(optarg);
		else if (c == 'k') m = atoi(optarg);
	}

	t = cputime();
	sum = traverse_rng(n, x0);
	t0 = cputime() - t;
	fprintf(stderr, "CPU time spent on RNG: %.3f sec; total sum: %lu\n", t0, (unsigned long)sum);
	m0 = peakrss();

	step = (max - n) / m;
	for (i = 0; i <= m; ++i, n += step) {
		double t, mem;
		uint32_t size;
		t = cputime();
		size = test_int(n, x0);
		t = cputime() - t;
		mem = (peakrss() - m0) / 1024.0 / 1024.0;
		printf("%d\t%d\t%.3f\t%.3f\t%.4f\t%.4f\n", i, n, t, mem, t * 1e6 / n, mem * 1e6 / size);
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r13
movl %edi, %ebp
pushq $0x5
popq %rbx
movl $0x2faf080, %eax        # imm = 0x2FAF080
movq %rax, (%rsp)
movl $0x989680, %r14d        # imm = 0x989680
pushq $0x1
popq %rax
movq %rax, 0x8(%rsp)
leaq 0xcbf(%rip), %r12       # 0x2020
movq 0x2c70(%rip), %r15      # 0x3fd8
movl %ebp, %edi
movq %r13, %rsi
movq %r12, %rdx
callq 0x10c0
testl %eax, %eax
js 0x13c3
cmpl $0x30, %eax
je 0x139a
cmpl $0x6b, %eax
je 0x13a9
cmpl $0x78, %eax
je 0x13b5
cmpl $0x6e, %eax
jne 0x1368
movq (%r15), %rdi
callq 0x10a0
movq %rax, %r14
jmp 0x1368
movq (%r15), %rdi
callq 0x10a0
movq %rax, 0x8(%rsp)
jmp 0x1368
movq (%r15), %rdi
callq 0x10d0
movl %eax, %ebx
jmp 0x1368
movq (%r15), %rdi
callq 0x10a0
movq %rax, (%rsp)
jmp 0x1368
callq 0x14cd
movsd %xmm0, 0x10(%rsp)
movl %r14d, %edi
movq 0x8(%rsp), %rsi
callq 0x11dc
movq %rax, %r12
callq 0x14cd
subsd 0x10(%rsp), %xmm0
movq 0x2c08(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xc2f(%rip), %rsi       # 0x2029
movq %r12, %rdx
movb $0x1, %al
callq 0x1060
callq 0x1510
movq %rax, %r12
movq (%rsp), %rax
subl %r14d, %eax
xorl %ebp, %ebp
xorl %edx, %edx
divl %ebx
movl %eax, %r13d
cmpl %ebx, %ebp
ja 0x14bc
callq 0x14cd
movsd %xmm0, (%rsp)
movl %r14d, %edi
movq 0x8(%rsp), %rsi
callq 0x1536
movl %eax, %r15d
callq 0x14cd
subsd (%rsp), %xmm0
movsd %xmm0, (%rsp)
callq 0x1510
subq %r12, %rax
cvtsi2sd %rax, %xmm1
movsd 0xba6(%rip), %xmm0      # 0x2008
mulsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
movsd (%rsp), %xmm0
movapd %xmm0, %xmm2
movl %r14d, %eax
cvtsi2sd %rax, %xmm5
movsd 0xb8d(%rip), %xmm4      # 0x2010
mulsd %xmm4, %xmm2
divsd %xmm5, %xmm2
movapd %xmm1, %xmm3
mulsd %xmm4, %xmm3
movl %r15d, %eax
cvtsi2sd %rax, %xmm4
divsd %xmm4, %xmm3
leaq 0xbb4(%rip), %rdi       # 0x205a
movl %ebp, %esi
movl %r14d, %edx
movb $0x4, %al
callq 0x1040
incl %ebp
addl %r13d, %r14d
jmp 0x141c
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/attractivechaos[P]udb2/khashl/test-block.c
// Function: test_int
KHASHL_CMAP_INIT(, blockmap_t, blockmap, udb_data_t, int, hash_fn_block, hash_eq_block)

uint32_t test_int(uint32_t n, uint32_t x0)
{
	uint32_t i, x, z = 0;
	khint_t k;
	udb_data_t t0, t;
	uint8_t block[MAX_BLOCK_LEN];
	blockmap_t *h;

	t0.data = block;
	h = blockmap_init();
	for (i = 0, x = x0; i < n; ++i) {
		khint_t k;
		int absent;
		x = hash32(x);
		t0.len = get_key_block(n, x, t0.data);
		k = blockmap_put(h, t0, &absent);
		if (absent) {
			t.len = t0.len;
			t.data = (uint8_t*)malloc(t.len);
			memcpy(t.data, t0.data, t.len);
			kh_key(h, k) = t;
			kh_val(h, k) = 0;
		}
		z += ++kh_val(h, k);
	}
	fprintf(stderr, "# unique keys: %d; checksum: %u; capacity: %u\n", kh_size(h), z, kh_capacity(h));
	x = kh_size(h);
	for (k = 0; k != kh_end(h); ++k)
		if (kh_exist(h, k))
			free(kh_key(h, k).data);
	blockmap_destroy(h);
	return x;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, %r15d
movl %edi, %r14d
xorl %ebp, %ebp
callq 0x1680
movq %rax, %rbx
movl %r14d, 0x8(%rsp)
subl $0x1, %r14d
jb 0x15ea
movl %r15d, %edi
callq 0x121e
movl %eax, %r15d
movl 0x8(%rsp), %edi
movl %eax, %esi
leaq 0x10(%rsp), %r12
movq %r12, %rdx
callq 0x1249
movq %rbx, %rdi
pushq $0x10
popq %rsi
movq %r12, %rdx
leaq 0xc(%rsp), %rcx
callq 0x183c
cmpl $0x0, 0xc(%rsp)
movq 0x10(%rbx), %r13
movl %eax, %r12d
je 0x15cf
pushq $0x10
popq %rdi
callq 0x1070
movaps 0x10(%rsp), %xmm0
movups %xmm0, (%rax)
imulq $0x18, %r12, %rcx
movl $0x10, (%r13,%rcx)
movq %rax, 0x8(%r13,%rcx)
andl $0x0, 0x10(%r13,%rcx)
pushq $0x1
popq %rax
jmp 0x15da
imulq $0x18, %r12, %rax
movl 0x10(%r13,%rax), %eax
incl %eax
imulq $0x18, %r12, %rcx
movl %eax, 0x10(%r13,%rcx)
addl %eax, %ebp
jmp 0x1559
movq 0x2a07(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movl 0x4(%rbx), %r14d
movq 0x10(%rbx), %r15
xorl %r12d, %r12d
movl $0x0, %r8d
testq %r15, %r15
je 0x1613
movb (%rbx), %cl
pushq $0x1
popq %r8
shll %cl, %r8d
leaq 0xa5b(%rip), %rsi       # 0x2075
movl %r14d, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x1060
pushq $0x1
popq %rbp
testq %r15, %r15
je 0x1636
movb (%rbx), %cl
movl %ebp, %eax
shll %cl, %eax
jmp 0x1638
xorl %eax, %eax
cmpl %eax, %r12d
je 0x1666
movq 0x8(%rbx), %rax
movl %r12d, %ecx
shrl $0x5, %ecx
movl (%rax,%rcx,4), %eax
btl %r12d, %eax
jae 0x1661
movl %r12d, %eax
imulq $0x18, %rax, %rax
movq 0x8(%r15,%rax), %rdi
callq 0x1030
incl %r12d
jmp 0x1629
movq %rbx, %rdi
callq 0x168b
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/gchen98[P]macs/simulator.cpp
// Function: Configuration::Configuration()
Configuration::Configuration(){
    bDebug = false;
    bVariableRecomb = false;
    bSNPAscertainment = false;
    bFlipAlleles = false;
    bNewickFormat = false;
    bMigrationChangeEventDefined = false;
    dTheta = 0; // mutation rate parameter theta
    dRecombRateRAcrossSites = 0.0; // recombination rate parameter r
    dSeqLength = 0.;
    dGeneConvRatio = 0.;
    iGeneConvTract = 1;
    iTotalPops = 1; // total populations declared
    dBasesToTrack = 1;
    iRandomSeed = time(NULL);
    iIterations = 1;
    pAlleleFreqBinPtrSet = NULL;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
andq $0x0, (%rdi)
xorps %xmm0, %xmm0
andq $0x0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
andl $0x0, 0x48(%rdi)
andw $0x0, 0x4c(%rdi)
movups %xmm0, 0x50(%rdi)
movups %xmm0, 0x60(%rdi)
movups %xmm0, 0x70(%rdi)
pushq $0x1
popq %rbp
movl %ebp, 0x38(%rdi)
movw $0x1, 0x3c(%rdi)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x28(%rdi)
xorl %edi, %edi
callq 0x3230
movq %rax, 0x40(%rbx)
movl %ebp, 0x34(%rbx)
andq $0x0, 0x90(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/gchen98[P]macs/simulator.cpp
// Function: Configuration::~Configuration()
Configuration::~Configuration(){
    cerr<<"Configuration destructor\n";
    delete pEventList;
    if (bSNPAscertainment){
        AlleleFreqBinPtrSet::iterator it;
        for (it=pAlleleFreqBinPtrSet->begin();it!=pAlleleFreqBinPtrSet->end();++it){
            delete(*it);
        }
        delete pAlleleFreqBinPtrSet;
    }
    if (bVariableRecomb){
        HotSpotBinPtrList::iterator it;
        for(it=pHotSpotBinPtrList->begin();it!=pHotSpotBinPtrList->end();++it){
            delete(*it);
        }
        delete pHotSpotBinPtrList;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x1af90(%rip), %rdi     # 0x1eff0
leaq 0x10a02(%rip), %rsi     # 0x14a69
callq 0x3250
movq 0x80(%rbx), %r14
testq %r14, %r14
je 0x4080
movq %r14, %rdi
callq 0x6fde
pushq $0x18
popq %rsi
movq %r14, %rdi
callq 0x3270
cmpb $0x1, 0x49(%rbx)
jne 0x40f3
movq 0x90(%rbx), %r12
movq 0x18(%r12), %r15
pushq $0x20
popq %r14
leaq 0x8(%r12), %rax
cmpq %rax, %r15
je 0x40db
movq 0x20(%r15), %r12
testq %r12, %r12
je 0x40bc
movq %r12, %rdi
callq 0xf6f0
movq %r12, %rdi
movq %r14, %rsi
callq 0x3270
movq %r15, %rdi
callq 0x32a0
movq %rax, %r15
movq 0x90(%rbx), %r12
jmp 0x40a1
testq %r12, %r12
je 0x40e8
movq %r12, %rdi
callq 0x701e
pushq $0x30
popq %rsi
movq %r12, %rdi
callq 0x3270
cmpb $0x1, 0x4b(%rbx)
jne 0x413e
movq 0x88(%rbx), %r14
pushq $0x18
popq %r15
movq %r14, %r12
movq (%r12), %r12
cmpq %r14, %r12
je 0x4126
movq 0x10(%r12), %rdi
movq %r15, %rsi
callq 0x3270
movq 0x88(%rbx), %r14
jmp 0x4107
testq %r14, %r14
je 0x4133
movq %r14, %rdi
callq 0x7076
pushq $0x18
popq %rsi
movq %r14, %rdi
callq 0x3270
leaq 0x68(%rbx), %rdi
callq 0x7270
addq $0x50, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x6c12
movq %rax, %rdi
callq 0x6c07
// File: /workspace/github_cpp_makefile_star2_O2/gchen98[P]macs/simulator.cpp
// Function: Simulator::beginSimulation()
void Simulator::beginSimulation(){
    try{
        RandNumGenerator * rg = new RandNumGenerator(pConfig->iRandomSeed);
        cout<<SEED<<"\t"<<pConfig->iRandomSeed<<endl;
        for(unsigned int i=0;i<pConfig->iIterations;++i){
            if (pConfig->bDebug){
                cerr<<"Iteration: "<<i<<endl;
            }
            GraphBuilder graphBuilder = GraphBuilder(pConfig,rg);
            graphBuilder.build();
            graphBuilder.printHaplotypes();

        }
        delete rg;
    }catch(const char* message){
        cerr<<"Simulator caught exception with message:"<<endl<<message<<endl;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rdi, %r14
pushq $0x8
popq %rdi
callq 0x3260
movq %rax, %rbx
movq (%r14), %rax
movq 0x40(%rax), %rsi
movq %rbx, %rdi
callq 0x3b6c
movq 0x18869(%rip), %rdi     # 0x1efd0
leaq 0x18b22(%rip), %rsi     # 0x1f290
callq 0x3210
leaq 0xd9ac(%rip), %rsi      # 0x14126
movq %rax, %rdi
callq 0x3250
movq (%r14), %rcx
movq 0x40(%rcx), %rsi
movq %rax, %rdi
callq 0x3240
movq %rax, %rdi
callq 0x3100
xorl %r15d, %r15d
movq 0x1884d(%rip), %r12     # 0x1eff0
leaq 0xf226(%rip), %r13      # 0x159d0
leaq 0x8(%rsp), %rbp
movq (%r14), %rsi
movl 0x34(%rsi), %eax
cmpq %rax, %r15
jae 0x6809
cmpb $0x1, 0x48(%rsi)
jne 0x67e1
movq %r12, %rdi
movq %r13, %rsi
callq 0x3250
movq %rax, %rdi
movq %r15, %rsi
callq 0x31a0
movq %rax, %rdi
callq 0x3100
movq (%r14), %rsi
movq %rbp, %rdi
movq %rbx, %rdx
callq 0xff82
movq %rbp, %rdi
callq 0xd3ec
movq %rbp, %rdi
callq 0x112ec
movq %rbp, %rdi
callq 0xfd50
incq %r15
jmp 0x67af
movq %rbx, %rdi
callq 0x3bd0
pushq $0x8
popq %rsi
movq %rbx, %rdi
callq 0x3270
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdx, %r15
movq %rax, %r14
pushq $0x8
popq %rsi
movq %rbx, %rdi
callq 0x3270
jmp 0x685d
jmp 0x6845
jmp 0x6845
movq %rdx, %r15
movq %rax, %r14
jmp 0x685d
movq %rdx, %r15
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0xfd50
cmpl $0x1, %r15d
jne 0x68ae
movq %r14, %rdi
callq 0x30d0
movq %rax, %rbx
movq 0x1877b(%rip), %rdi     # 0x1eff0
leaq 0xf160(%rip), %rsi      # 0x159dc
callq 0x3250
movq %rax, %rdi
callq 0x3100
movq %rax, %rdi
movq %rbx, %rsi
callq 0x3250
movq %rax, %rdi
callq 0x3100
callq 0x33a0
jmp 0x681c
movq %rax, %r14
callq 0x33a0
movq %r14, %rdi
callq 0x3400
// File: /workspace/github_cpp_makefile_star2_O2/gchen98[P]macs/algorithm.cpp
// Function: GraphBuilder::mutateBelowEdge(boost::shared_ptr<Edge>&)
void GraphBuilder::mutateBelowEdge(EdgePtr & edge){
    NodePtr & bottomNode = edge->getBottomNodeRef();
    if (bottomNode->getType()==Node::SAMPLE  ){
        SampleNode* sample = static_cast<SampleNode*>(bottomNode.get());
        // mark this sampled node as affected.
        sample->bAffected = true;
    }else{
        for (unsigned int i=0;i<bottomNode->getBottomEdgeSize();++i){
            #ifdef DIAG
            if (bottomNode->getBottomEdgeByIndex(i)->bDeleted){
                throw "Mutate below edge: this edge should have been removed";
            }
            #endif
            EdgePtr edge = bottomNode->getBottomEdgeByIndex(i);
            if (edge->iGraphIteration==iGraphIteration){
                mutateBelowEdge(edge);
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq %rsi, %rdi
callq 0xda24
movq %rax, %r14
addq $0x20, %r14
movq %r14, %rdi
callq 0xda4e
cmpl $0x3, 0x64(%rax)
jne 0x8ba6
movq (%r14), %rax
movb $0x1, 0x7c(%rax)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
leaq 0x8(%rsp), %r15
movq %rsp, %r12
movq %r14, %rdi
callq 0xda4e
movzwl 0x6a(%rax), %eax
cmpl %eax, %ebp
jae 0x8b99
movq %r14, %rdi
callq 0xda4e
movzwl %bp, %edx
movq %r12, %rdi
movq %rax, %rsi
callq 0xdaf6
movq %r12, %rdi
callq 0xda24
movl 0x14(%rax), %eax
cmpl 0xd0(%rbx), %eax
jne 0x8bf4
movq %rbx, %rdi
movq %r12, %rsi
callq 0x8b66
movq %r15, %rdi
callq 0xdff8
incl %ebp
jmp 0x8bb0
movq %rax, %rbx
movq %r15, %rdi
callq 0xdff8
movq %rbx, %rdi
callq 0x3400
nop
// File: /workspace/github_cpp_makefile_star2_O2/gchen98[P]macs/algorithm.cpp
// Function: GraphBuilder::markEdgesBelow(boost::shared_ptr<Edge>&)
void GraphBuilder::markEdgesBelow(EdgePtr & selectedEdge){
    selectedEdge->iGraphIteration = iGraphIteration;
    NodePtr  & bottomNode = selectedEdge->getBottomNodeRef();
    if (bottomNode->getType()==Node::COAL||
    bottomNode->getType()==Node::SAMPLE) return;
    else{
        EdgePtr bottomEdge = bottomNode->getBottomEdgeByIndex(0);
        markEdgesBelow(bottomEdge);
    }

}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl 0xd0(%rdi), %ebp
movq %rsi, %rdi
callq 0xda24
movl %ebp, 0x14(%rax)
movq %r14, %rdi
callq 0xda24
movq %rax, %r14
addq $0x20, %r14
movq %r14, %rdi
callq 0xda4e
cmpl $0x0, 0x64(%rax)
je 0x8f12
movq %r14, %rdi
callq 0xda4e
cmpl $0x3, 0x64(%rax)
je 0x8f12
movq %r14, %rdi
callq 0xda4e
leaq 0x40(%rax), %rsi
movq %rsp, %r14
movq %r14, %rdi
callq 0xe1ca
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8e9c
leaq 0x8(%rsp), %rdi
callq 0xdff8
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xdff8
movq %rbx, %rdi
callq 0x3400
// File: /workspace/github_cpp_makefile_star2_O2/gchen98[P]macs/algorithm.cpp
// Function: GraphBuilder::pruneEdgesBelow(boost::shared_ptr<Edge>&)
void GraphBuilder::pruneEdgesBelow(EdgePtr & selectedEdge){
    NodePtr & bottomNode = selectedEdge->getBottomNodeRef();
    if (bottomNode->getType()==Node::COAL){
        // this is the terminating condition and should be the new
        // lower MRCA
        grandMRCA = bottomNode;
        grandMRCA->clearTopEdges();
    }else{
        // we didn't find a coalescent node (MRCA) so keep searching down
        bottomNode->removeEvent();
        EdgePtr bottomEdge = bottomNode->getBottomEdgeByIndex(0);
        pruneEdgesBelow(bottomEdge);
    }
    deleteEdge(selectedEdge);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0xda24
movq %rax, %r15
addq $0x20, %r15
movq %r15, %rdi
callq 0xda4e
cmpl $0x0, 0x64(%rax)
je 0x8f9e
movq %r15, %rdi
callq 0xda4e
movq %rax, %rdi
callq 0xdb54
movq %r15, %rdi
callq 0xda4e
leaq 0x40(%rax), %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0xe1ca
movq %r14, %rdi
movq %r15, %rsi
callq 0x8f30
leaq 0x10(%rsp), %rdi
callq 0xdff8
jmp 0x8fba
leaq 0x38(%r14), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xdb16
movq %r12, %rdi
callq 0xda4e
andw $0x0, 0x68(%rax)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x10f3a
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xdff8
movq %rbx, %rdi
callq 0x3400
// File: /workspace/github_cpp_makefile_star2_O2/gchen98[P]macs/algorithm.cpp
// Function: GraphBuilder::pruneEdgesAbove(boost::shared_ptr<Edge>&)
void GraphBuilder::pruneEdgesAbove(EdgePtr & selectedEdge){
    NodePtr & topNode = selectedEdge->getTopNodeRef();
    short int topNodeType = topNode->getType();
    if (topNodeType==Node::COAL){
        EdgePtr edge0 = topNode->getBottomEdgeByIndex(0);
        EdgePtr edge1 = topNode->getBottomEdgeByIndex(1);
        if (topNode->getTopEdgeSize()==0){
            #ifdef DIAG
            if (topNode!=grandMRCA) throw "Top node is NOT grandMRCA!\n";
            #endif
            EdgePtr & otherEdge = edge0==selectedEdge ?
            edge1 : edge0;
            pruneEdgesBelow(otherEdge);
        }else{
            // just some coal node below the grandMRCA. fuse the other two edges.
            EdgePtr edgeAboveNode = topNode->getTopEdgeByIndex(0);
            EdgePtr & edgeBelowNode = edge0==
            selectedEdge?edge1:edge0;
            mergeEdges(edgeAboveNode,edgeBelowNode);
        }

    }else{
        #ifdef DIAG
        if (topNodeType!=Node::MIGRATION
        && topNodeType!=Node::QUERY){
            cerr<<"At edge with "<<selectedEdge->getBottomNodeRef()->getHeight()<<
            " and "<<selectedEdge->getTopNodeRef()->getHeight()<<endl;
            throw "Prune up did not find a migration node";
        }
        #endif
        EdgePtr topEdge = topNode->getTopEdgeByIndex(0);
        pruneEdgesAbove(topEdge);
    }
    topNode->removeEvent();
    deleteEdge(selectedEdge);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0xda24
movq %rax, %r15
addq $0x18, %r15
movq %r15, %rdi
callq 0xda4e
cmpw $0x0, 0x64(%rax)
je 0x9041
movq %r15, %rdi
callq 0xda4e
leaq 0x20(%rax), %rsi
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0xe1ca
movq %r14, %rdi
movq %r12, %rsi
callq 0x8fe6
jmp 0x90e2
movq %r15, %rdi
callq 0xda4e
leaq 0x40(%rax), %rsi
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0xe1ca
movq %r15, %rdi
callq 0xda4e
leaq 0x50(%rax), %rsi
leaq 0x28(%rsp), %r13
movq %r13, %rdi
callq 0xe1ca
movq %r15, %rdi
callq 0xda4e
cmpw $0x0, 0x68(%rax)
je 0x90c1
movq %r15, %rdi
callq 0xda4e
leaq 0x20(%rax), %rsi
leaq 0x18(%rsp), %rbp
movq %rbp, %rdi
callq 0xe1ca
movq 0x8(%rsp), %rax
cmpq (%rbx), %rax
cmoveq %r13, %r12
movq %r14, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x10ec6
leaq 0x20(%rsp), %rdi
callq 0xdff8
jmp 0x90d8
movq 0x8(%rsp), %rax
cmpq (%rbx), %rax
cmoveq %r13, %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x8f30
leaq 0x30(%rsp), %rdi
callq 0xdff8
leaq 0x10(%rsp), %rdi
callq 0xdff8
movq %r15, %rdi
callq 0xda4e
movq %rax, %rdi
callq 0xdb54
movq %r14, %rdi
movq %rbx, %rsi
callq 0x10f3a
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x9128
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xdff8
leaq 0x30(%rsp), %rdi
callq 0xdff8
jmp 0x9137
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xdff8
movq %rbx, %rdi
callq 0x3400
nop
// File: /workspace/github_cpp_makefile_star2_O2/gchen98[P]macs/algorithm.cpp
// Function: GraphBuilder::markCurrentTree()
void GraphBuilder::markCurrentTree(){
    iTotalTreeEdges = 0;
    unsigned int iTotalSamples=pConfig->iSampleSize;
    for(unsigned int i=0;i<iTotalSamples;++i){
        NodePtr & node = pSampleNodeArray[i];
        pTreeEdgesToCoalesceArray[i]=node->getTopEdgeByIndex(0);
    }
    unsigned int iIndex = 0;
    int iIterations = 0;
    bool bFirstSample = true;
    while(iIndex<iTotalSamples){
        EdgePtr & curEdge = pTreeEdgesToCoalesceArray[iIndex];
        if (markEdgesAbove(bFirstSample,true,curEdge,iIndex)){
            ++iIndex;
        }else{
            // start over
            iIndex = 0;
        }
        bFirstSample = false;
        ++iIterations;
    }
    #ifdef DIAG
    if (localMRCA->getBottomEdgeByIndex(0)->iGraphIteration!=
    localMRCA->getBottomEdgeByIndex(1)->iGraphIteration){
        printDataStructures();
        cerr<<"Proposed grandMRCA at :"<<localMRCA->getHeight()<<endl;
        throw "Proposed grandMRCA's edges' histories don't match";
    }
    #endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
andl $0x0, 0x20(%rdi)
movq 0x8(%rdi), %rax
movl 0x30(%rax), %r12d
movq %r12, %r13
shlq $0x4, %r13
xorl %ebp, %ebp
leaq 0x8(%rsp), %r15
xorl %r14d, %r14d
cmpq %r14, %r13
je 0xc8d4
movq 0xc0(%rbx), %rdi
addq %rbp, %rdi
callq 0xda4e
leaq 0x20(%rax), %rsi
movq %r15, %rdi
callq 0xe1ca
movq 0xb8(%rbx), %rdi
addq %r14, %rdi
movq %r15, %rsi
callq 0xdbce
leaq 0x10(%rsp), %rdi
callq 0xdff8
addq $0x10, %r14
addq $0x8, %rbp
jmp 0xc88e
movb $0x1, %dl
xorl %eax, %eax
pushq $0x1
popq %rbp
leaq 0x8(%rsp), %r14
movl %eax, 0x8(%rsp)
cmpl %r12d, %eax
jae 0xc91b
movl %eax, %ecx
shlq $0x4, %rcx
addq 0xb8(%rbx), %rcx
movzbl %dl, %esi
andl $0x1, %esi
movq %rbx, %rdi
movl %ebp, %edx
movq %r14, %r8
callq 0x8c14
xorl %edx, %edx
testb %al, %al
jne 0xc913
xorl %eax, %eax
jmp 0xc8e0
movl 0x8(%rsp), %eax
incl %eax
jmp 0xc8e0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq