// File: grame-cncm[P]digraph/tests.cpp
// Function: test13(std::ostream&)
void test13(std::ostream& ss)
{
    // roots and leaves
    digraph<char, int> h;
    h.add('A', 'B', 0).add('B', 'C', 0).add('C', 'D', 0).add('B', 'G', 0);
    h.add('E', 'F', 0).add('F', 'G', 0).add('G', 'H', 0);  //.add('F', 'C', 0);

    ss << "graph h   : " << h << std::endl;
    ss << "roots(h)  : " << roots(h) << std::endl;
    ss << "leafs(h)  : " << leaves(h) << std::endl;
    ss << dfschedule(h) << ", cost: " << schedulingcost(h, dfschedule(h)) << std::endl;
    ss << bfschedule(h) << ", cost: " << schedulingcost(h, bfschedule(h)) << std::endl;
}

// Assembly:
subq $0x268, %rsp            # imm = 0x268
movq %rdi, 0x260(%rsp)
leaq 0x250(%rsp), %rdi
movq %rdi, 0xa8(%rsp)
callq 0x24270
movq 0xa8(%rsp), %rdi
movb $0x41, 0x24f(%rsp)
movb $0x42, 0x24e(%rsp)
movl $0x0, 0x248(%rsp)
leaq 0x24f(%rsp), %rsi
leaq 0x24e(%rsp), %rdx
leaq 0x248(%rsp), %rcx
callq 0x242b0
movq %rax, 0xb0(%rsp)
jmp 0x222de
movq 0xb0(%rsp), %rdi
movb $0x42, 0x23b(%rsp)
movb $0x43, 0x23a(%rsp)
movl $0x0, 0x234(%rsp)
leaq 0x23b(%rsp), %rsi
leaq 0x23a(%rsp), %rdx
leaq 0x234(%rsp), %rcx
callq 0x242b0
movq %rax, 0xa0(%rsp)
jmp 0x22328
movq 0xa0(%rsp), %rdi
movb $0x43, 0x233(%rsp)
movb $0x44, 0x232(%rsp)
movl $0x0, 0x22c(%rsp)
leaq 0x233(%rsp), %rsi
leaq 0x232(%rsp), %rdx
leaq 0x22c(%rsp), %rcx
callq 0x242b0
movq %rax, 0x98(%rsp)
jmp 0x22372
movq 0x98(%rsp), %rdi
movb $0x42, 0x22b(%rsp)
movb $0x47, 0x22a(%rsp)
movl $0x0, 0x224(%rsp)
leaq 0x22b(%rsp), %rsi
leaq 0x22a(%rsp), %rdx
leaq 0x224(%rsp), %rcx
callq 0x242b0
jmp 0x223b4
movb $0x45, 0x223(%rsp)
movb $0x46, 0x222(%rsp)
movl $0x0, 0x21c(%rsp)
leaq 0x250(%rsp), %rdi
leaq 0x223(%rsp), %rsi
leaq 0x222(%rsp), %rdx
leaq 0x21c(%rsp), %rcx
callq 0x242b0
movq %rax, 0x90(%rsp)
jmp 0x223fe
movq 0x90(%rsp), %rdi
movb $0x46, 0x21b(%rsp)
movb $0x47, 0x21a(%rsp)
movl $0x0, 0x214(%rsp)
leaq 0x21b(%rsp), %rsi
leaq 0x21a(%rsp), %rdx
leaq 0x214(%rsp), %rcx
callq 0x242b0
movq %rax, 0x88(%rsp)
jmp 0x22448
movq 0x88(%rsp), %rdi
movb $0x47, 0x213(%rsp)
movb $0x48, 0x212(%rsp)
movl $0x0, 0x20c(%rsp)
leaq 0x213(%rsp), %rsi
leaq 0x212(%rsp), %rdx
leaq 0x20c(%rsp), %rcx
callq 0x242b0
jmp 0x2248a
movq 0x260(%rsp), %rdi
leaq 0x1c78a(%rip), %rsi     # 0x3ec23
callq 0x2180
movq %rax, 0x80(%rsp)
jmp 0x224a8
movq 0x80(%rsp), %rdi
leaq 0x250(%rsp), %rsi
callq 0x24300
movq %rax, 0x78(%rsp)
jmp 0x224c4
movq 0x78(%rsp), %rdi
movq 0x33ae8(%rip), %rsi     # 0x55fb8
callq 0x21b0
jmp 0x224d7
movq 0x260(%rsp), %rdi
leaq 0x1c74a(%rip), %rsi     # 0x3ec30
callq 0x2180
movq %rax, 0x70(%rsp)
jmp 0x224f2
leaq 0x1f0(%rsp), %rdi
leaq 0x250(%rsp), %rsi
callq 0x27060
jmp 0x22509
movq 0x70(%rsp), %rdi
leaq 0x1f0(%rsp), %rsi
callq 0x26ef0
movq %rax, 0x68(%rsp)
jmp 0x22522
movq 0x68(%rsp), %rdi
movq 0x33a8a(%rip), %rsi     # 0x55fb8
callq 0x21b0
jmp 0x22535
leaq 0x1f0(%rsp), %rdi
callq 0x27300
movq 0x260(%rsp), %rdi
leaq 0x1c6ec(%rip), %rsi     # 0x3ec3d
callq 0x2180
movq %rax, 0x60(%rsp)
jmp 0x2255d
leaq 0x1d8(%rsp), %rdi
leaq 0x250(%rsp), %rsi
callq 0x27360
jmp 0x22574
movq 0x60(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
callq 0x26ef0
movq %rax, 0x58(%rsp)
jmp 0x2258d
movq 0x58(%rsp), %rdi
movq 0x33a1f(%rip), %rsi     # 0x55fb8
callq 0x21b0
jmp 0x225a0
leaq 0x1d8(%rsp), %rdi
callq 0x27300
movq 0x260(%rsp), %rax
movq %rax, 0x50(%rsp)
leaq 0x190(%rsp), %rdi
leaq 0x250(%rsp), %rsi
callq 0x27640
jmp 0x225d1
movq 0x50(%rsp), %rdi
leaq 0x190(%rsp), %rsi
callq 0x27470
movq %rax, 0x48(%rsp)
jmp 0x225ea
movq 0x48(%rsp), %rdi
leaq 0x1c654(%rip), %rsi     # 0x3ec4a
callq 0x2180
movq %rax, 0x40(%rsp)
jmp 0x22602
leaq 0x148(%rsp), %rdi
leaq 0x250(%rsp), %rsi
callq 0x27640
jmp 0x22619
leaq 0x250(%rsp), %rdi
leaq 0x148(%rsp), %rsi
callq 0x27800
movl %eax, 0x3c(%rsp)
jmp 0x22634
movl 0x3c(%rsp), %esi
movq 0x40(%rsp), %rdi
callq 0x2280
movq %rax, 0x30(%rsp)
jmp 0x22649
movq 0x30(%rsp), %rdi
movq 0x33963(%rip), %rsi     # 0x55fb8
callq 0x21b0
jmp 0x2265c
leaq 0x148(%rsp), %rdi
callq 0x27930
leaq 0x190(%rsp), %rdi
callq 0x27930
movq 0x260(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0x100(%rsp), %rdi
leaq 0x250(%rsp), %rsi
callq 0x27960
jmp 0x2269a
movq 0x28(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x27470
movq %rax, 0x20(%rsp)
jmp 0x226b3
movq 0x20(%rsp), %rdi
leaq 0x1c58b(%rip), %rsi     # 0x3ec4a
callq 0x2180
movq %rax, 0x18(%rsp)
jmp 0x226cb
leaq 0xb8(%rsp), %rdi
leaq 0x250(%rsp), %rsi
callq 0x27960
jmp 0x226e2
leaq 0x250(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x27800
movl %eax, 0x14(%rsp)
jmp 0x226fd
movl 0x14(%rsp), %esi
movq 0x18(%rsp), %rdi
callq 0x2280
movq %rax, 0x8(%rsp)
jmp 0x22712
movq 0x8(%rsp), %rdi
movq 0x3389a(%rip), %rsi     # 0x55fb8
callq 0x21b0
jmp 0x22725
leaq 0xb8(%rsp), %rdi
callq 0x27930
leaq 0x100(%rsp), %rdi
callq 0x27930
leaq 0x250(%rsp), %rdi
callq 0x24610
addq $0x268, %rsp            # imm = 0x268
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
jmp 0x22843
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
leaq 0x1f0(%rsp), %rdi
callq 0x27300
jmp 0x22843
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
leaq 0x1d8(%rsp), %rdi
callq 0x27300
jmp 0x22843
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
jmp 0x227f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
leaq 0x148(%rsp), %rdi
callq 0x27930
leaq 0x190(%rsp), %rdi
callq 0x27930
jmp 0x22843
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
jmp 0x22836
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x240(%rsp)
movl %eax, 0x23c(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0x27930
leaq 0x100(%rsp), %rdi
callq 0x27930
leaq 0x250(%rsp), %rdi
callq 0x24610
movq 0x240(%rsp), %rdi
callq 0x2290
nopl (%rax)