// File: yuanboli233[P]interdyck_graph_reduce/graphtest.cpp
// Function: createNodeMergeMap(SummaryGraph&)
void createNodeMergeMap(SummaryGraph& sGraph){
    unordered_map<unsigned, unsigned> node2orig = sGraph.node2orignodeid;
    unordered_map<unsigned, string> eid2orig = sGraph.eid2origeidstring;
    ofstream out("tmp_color_reach_dk_node_merge.txt", ofstream::out);
    unordered_map<unsigned, list<unsigned>*> mergeMap;
    for(unsigned i = 0; i < sGraph.nodes.size(); i++){
        SummaryNode* node = sGraph.nodes[i];
        if(node->id != root(node->id, sGraph)){
            unsigned existID = node->belongto;
            if(mergeMap.find(existID) == mergeMap.end()){
                mergeMap[existID] = new list<unsigned>();
            }
            mergeMap[existID]->push_back(node->id);
        }else{
            unsigned id = node->id;
            if(mergeMap.find(id) == mergeMap.end()){
                mergeMap[id] = new list<unsigned>();
            }
            mergeMap[id]->push_back(id);
        }
    }

    for(unordered_map<unsigned, list<unsigned>*>::iterator mit = mergeMap.begin(); mit != mergeMap.end(); mit++){
        unsigned existID = mit->first;
        list<unsigned>* l = mit->second;
        out << node2orig[existID] << ": ";
        for(list<unsigned>::iterator lit = l->begin(); lit != l->end(); lit++){
            out << node2orig[*lit] << " ";
        }
        out << endl;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3c0, %rsp            # imm = 0x3C0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x51f0
movq -0x8(%rbp), %rsi
addq $0x38, %rsi
leaq -0x78(%rbp), %rdi
callq 0x5220
jmp 0x3f5f
leaq 0xf0f9(%rip), %rsi      # 0x1305f
leaq -0x288(%rbp), %rdi
movl $0x10, %edx
callq 0x3270
jmp 0x3f79
leaq -0x2c0(%rbp), %rdi
callq 0x5310
movl $0x0, -0x2c4(%rbp)
movl -0x2c4(%rbp), %eax
movq %rax, -0x348(%rbp)
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
callq 0x5250
movq %rax, %rcx
movq -0x348(%rbp), %rax
cmpq %rcx, %rax
jae 0x426c
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
movl -0x2c4(%rbp), %eax
movl %eax, %esi
callq 0x4e30
movq (%rax), %rax
movq %rax, -0x2d0(%rbp)
movq -0x2d0(%rbp), %rax
movl (%rax), %edi
movl %edi, -0x350(%rbp)
movq -0x8(%rbp), %rsi
callq 0x35c0
movl %eax, -0x34c(%rbp)
jmp 0x3ffb
movl -0x350(%rbp), %eax
movl -0x34c(%rbp), %ecx
cmpl %ecx, %eax
je 0x4161
movq -0x2d0(%rbp), %rax
movl 0x68(%rax), %eax
movl %eax, -0x2d4(%rbp)
leaq -0x2c0(%rbp), %rdi
leaq -0x2d4(%rbp), %rsi
callq 0x5360
movq %rax, -0x358(%rbp)
jmp 0x403b
movq -0x358(%rbp), %rax
movq %rax, -0x2e0(%rbp)
leaq -0x2c0(%rbp), %rdi
callq 0x5390
movq %rax, -0x2e8(%rbp)
leaq -0x2e0(%rbp), %rdi
leaq -0x2e8(%rbp), %rsi
callq 0x5330
testb $0x1, %al
jne 0x4078
jmp 0x4128
movl $0x18, %edi
callq 0x3210
movq %rax, -0x360(%rbp)
jmp 0x408b
movq -0x360(%rbp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
callq 0x53c0
leaq -0x2c0(%rbp), %rdi
leaq -0x2d4(%rbp), %rsi
callq 0x53e0
movq %rax, -0x368(%rbp)
jmp 0x40c1
movq -0x368(%rbp), %rax
movq -0x360(%rbp), %rcx
movq %rcx, (%rax)
jmp 0x4128
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x4448
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x443f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x2c0(%rbp), %rdi
callq 0x55f0
leaq -0x288(%rbp), %rdi
callq 0x3330
jmp 0x443f
leaq -0x2c0(%rbp), %rdi
leaq -0x2d4(%rbp), %rsi
callq 0x53e0
movq %rax, -0x370(%rbp)
jmp 0x4144
movq -0x370(%rbp), %rax
movq (%rax), %rdi
movq -0x2d0(%rbp), %rsi
callq 0x5410
jmp 0x415c
jmp 0x4256
movq -0x2d0(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2ec(%rbp)
leaq -0x2c0(%rbp), %rdi
leaq -0x2ec(%rbp), %rsi
callq 0x5360
movq %rax, -0x378(%rbp)
jmp 0x418c
movq -0x378(%rbp), %rax
movq %rax, -0x2f8(%rbp)
leaq -0x2c0(%rbp), %rdi
callq 0x5390
movq %rax, -0x300(%rbp)
leaq -0x2f8(%rbp), %rdi
leaq -0x300(%rbp), %rsi
callq 0x5330
testb $0x1, %al
jne 0x41c6
jmp 0x4220
movl $0x18, %edi
callq 0x3210
movq %rax, -0x380(%rbp)
jmp 0x41d9
movq -0x380(%rbp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
callq 0x53c0
leaq -0x2c0(%rbp), %rdi
leaq -0x2ec(%rbp), %rsi
callq 0x53e0
movq %rax, -0x388(%rbp)
jmp 0x420f
movq -0x388(%rbp), %rax
movq -0x380(%rbp), %rcx
movq %rcx, (%rax)
leaq -0x2c0(%rbp), %rdi
leaq -0x2ec(%rbp), %rsi
callq 0x53e0
movq %rax, -0x390(%rbp)
jmp 0x423c
movq -0x390(%rbp), %rax
movq (%rax), %rdi
leaq -0x2ec(%rbp), %rsi
callq 0x5410
jmp 0x4254
jmp 0x4256
jmp 0x4258
movl -0x2c4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c4(%rbp)
jmp 0x3f8f
leaq -0x2c0(%rbp), %rdi
callq 0x5450
movq %rax, -0x308(%rbp)
leaq -0x2c0(%rbp), %rdi
callq 0x5390
movq %rax, -0x310(%rbp)
leaq -0x308(%rbp), %rdi
leaq -0x310(%rbp), %rsi
callq 0x5480
testb $0x1, %al
jne 0x42ae
jmp 0x440c
leaq -0x308(%rbp), %rdi
movq %rdi, -0x3a0(%rbp)
callq 0x54b0
movq -0x3a0(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x314(%rbp)
callq 0x54b0
movq 0x8(%rax), %rax
movq %rax, -0x320(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x314(%rbp), %rsi
callq 0x5270
movq %rax, -0x398(%rbp)
jmp 0x42f9
movq -0x398(%rbp), %rax
movl (%rax), %esi
leaq -0x288(%rbp), %rdi
callq 0x3300
movq %rax, -0x3a8(%rbp)
jmp 0x4317
movq -0x3a8(%rbp), %rdi
leaq 0xed20(%rip), %rsi      # 0x13045
callq 0x3200
jmp 0x432c
movq -0x320(%rbp), %rdi
callq 0x54e0
movq %rax, -0x328(%rbp)
movq -0x320(%rbp), %rdi
callq 0x5540
movq %rax, -0x330(%rbp)
leaq -0x328(%rbp), %rdi
leaq -0x330(%rbp), %rsi
callq 0x5510
testb $0x1, %al
jne 0x436b
jmp 0x43db
leaq -0x328(%rbp), %rdi
callq 0x5570
movq %rax, %rsi
leaq -0x40(%rbp), %rdi
callq 0x5270
movq %rax, -0x3b0(%rbp)
jmp 0x438c
movq -0x3b0(%rbp), %rax
movl (%rax), %esi
leaq -0x288(%rbp), %rdi
callq 0x3300
movq %rax, -0x3b8(%rbp)
jmp 0x43aa
movq -0x3b8(%rbp), %rdi
leaq 0xec82(%rip), %rsi      # 0x1303a
callq 0x3200
jmp 0x43bf
jmp 0x43c1
leaq -0x328(%rbp), %rdi
xorl %esi, %esi
callq 0x5590
movq %rax, -0x338(%rbp)
jmp 0x433f
movq 0x19bde(%rip), %rsi     # 0x1dfc0
leaq -0x288(%rbp), %rdi
callq 0x3240
jmp 0x43f0
jmp 0x43f2
leaq -0x308(%rbp), %rdi
xorl %esi, %esi
callq 0x55c0
movq %rax, -0x340(%rbp)
jmp 0x427f
leaq -0x2c0(%rbp), %rdi
callq 0x55f0
leaq -0x288(%rbp), %rdi
callq 0x3330
leaq -0x78(%rbp), %rdi
callq 0x52d0
leaq -0x40(%rbp), %rdi
callq 0x52f0
addq $0x3c0, %rsp            # imm = 0x3C0
popq %rbp
retq
leaq -0x78(%rbp), %rdi
callq 0x52d0
leaq -0x40(%rbp), %rdi
callq 0x52f0
movq -0x80(%rbp), %rdi
callq 0x3390
nopw (%rax,%rax)