// File: /workspace/github_cpp_makefile_star2_O2/ahupowerdns[P]spamidea/getsender.cc
// Function: MailTreeNode::emitLinks(std::basic_ofstream<char, std::char_traits<char>>&, int) const
void emitLinks(ofstream& fs, int depth=0) const
  {
    string prefix(depth, ' ');
    //    cout << prefix << '"' << d_name << "\"\n";
    fs << "\"a" << (void*) this << "\" [label=\""<< d_name << "\"]\n";
    unsigned int ccount=0;

    vector<MailTreeNode*> children;
    for(const auto& mtn : d_children) {
      children.push_back(mtn.get());
    }
    sort(children.begin(), children.end(),
         [](const auto& a, const auto& b) {
           return (b)->d_count < (a)->d_count;
         });
    
    //    reverse(children.begin() + children.size()/2, children.end());
    for(const auto& mtn : children) {
      ccount += mtn->d_count;
      if(mtn->d_count > 2) {
        cout << prefix << '"' << d_name << "\" -> \"" << mtn->d_name << "\""<< endl; 
        fs << "\"a" <<(void*)mtn  << "\" -> \"a" << (void*) this << "\" ";
        fs << " [ label = \" " << mtn->d_count<<" \"] ";
        fs << " [ weight = " << mtn->d_count<<" ]\n";

        mtn->emitLinks(fs, depth+1);
      }
    }
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r14
movq %rdi, %r15
movl %edx, 0xc(%rsp)
movslq %edx, %rsi
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x38(%rsp), %rdi
pushq $0x20
popq %rdx
callq 0x4370
leaq 0xcc30(%rip), %rsi      # 0x12244
movq %r14, %rdi
callq 0x42c0
movq %rax, %rdi
movq %r15, %rsi
callq 0x4250
leaq 0xcbfb(%rip), %rsi      # 0x12229
movq %rax, %rdi
callq 0x42c0
movq %rax, %rdi
movq %r15, %rsi
callq 0x42a0
leaq 0xcbec(%rip), %rsi      # 0x12234
movq %rax, %rdi
callq 0x42c0
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r12
andq $0x0, 0x10(%r12)
movaps %xmm0, (%r12)
movq 0x28(%r15), %rbp
movq 0x30(%r15), %rbx
leaq 0x30(%rsp), %r13
cmpq %rbx, %rbp
je 0x568f
movq (%rbp), %rax
movq %rax, 0x30(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x5e70
addq $0x8, %rbp
jmp 0x5670
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x6001
movq 0x10(%rsp), %r12
movq 0x18(%rsp), %r13
movl 0xc(%rsp), %ebx
incl %ebx
leaq 0xcbb2(%rip), %rbp      # 0x12267
cmpq %r13, %r12
je 0x57d6
movq (%r12), %rax
cmpl $0x3, 0x20(%rax)
jb 0x57cd
movq 0x178dd(%rip), %rdi     # 0x1cfb0
leaq 0x38(%rsp), %rsi
callq 0x42a0
movq %rax, %rdi
pushq $0x22
popq %rsi
callq 0x4380
movq %rax, %rdi
movq %r15, %rsi
callq 0x42a0
movq %rax, %rdi
leaq 0xcb3b(%rip), %rsi      # 0x12238
callq 0x42c0
movq (%r12), %rsi
movq %rax, %rdi
callq 0x42a0
movq %rax, %rdi
leaq 0xcb25(%rip), %rsi      # 0x1223d
callq 0x42c0
movq %rax, %rdi
callq 0x4160
movq %r14, %rdi
leaq 0xcb15(%rip), %rsi      # 0x12244
callq 0x42c0
movq (%r12), %rsi
movq %rax, %rdi
callq 0x4250
movq %rax, %rdi
leaq 0xcaf5(%rip), %rsi      # 0x1223f
callq 0x42c0
movq %rax, %rdi
movq %r15, %rsi
callq 0x4250
movq %rax, %rdi
leaq 0xcaee(%rip), %rsi      # 0x12252
callq 0x42c0
movq %r14, %rdi
leaq 0xcad4(%rip), %rsi      # 0x12247
callq 0x42c0
movq (%r12), %rcx
movl 0x20(%rcx), %esi
movq %rax, %rdi
callq 0x4200
movq %rax, %rdi
leaq 0xcac4(%rip), %rsi      # 0x12255
callq 0x42c0
movq %r14, %rdi
leaq 0xcaba(%rip), %rsi      # 0x1225a
callq 0x42c0
movq (%r12), %rcx
movl 0x20(%rcx), %esi
movq %rax, %rdi
callq 0x4200
movq %rax, %rdi
movq %rbp, %rsi
callq 0x42c0
movq (%r12), %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x55dc
addq $0x8, %r12
jmp 0x56b5
leaq 0x10(%rsp), %rdi
callq 0x6458
leaq 0x38(%rsp), %rdi
callq 0x4140
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5802
movq %rax, %rbx
jmp 0x580f
jmp 0x5802
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x6458
leaq 0x38(%rsp), %rdi
callq 0x4140
movq %rbx, %rdi
callq 0x4500
nop