// File: /workspace/github_cpp_makefile_star2_O3/ashlall[P]StreamStats/ChiSquareExperiments/./../SourceCode/ChiSquare/../Quantiles/Q-Digest.cpp
// Function: QDigest::compressDownward(long)
void QDigest::compressDownward(long seedNode)
{
  double threshold = std :: floor(size/compression_factor); 
	
  std::queue<long, std::list<long> > queue;
  queue.push(seedNode);
  while(!queue.empty())
  {
    long node = queue.front();
    queue.pop();
    long atNode = get(node);
    long atSibling = get(sibling(node));
    if (atNode == 0 && atSibling == 0)
      continue;
    long parent_ = parent(node);
    long atParent = get(parent_);
    if (atParent + atNode + atSibling > threshold)
       continue;
    if (node2count.find(parent_) == node2count.end())
      node2count.insert(std::make_pair (parent_, atParent + atNode + atSibling));
    else
      node2count[parent_] += 1;
    node2count.erase(node);
    node2count.erase(sibling(node));

    // Ensures that P2 holds for node and sibling subtrees
    if (!isLeaf(node))
    {
      queue.push(leftChild(node));
      queue.push(leftChild(sibling(node)));
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r15
cvtsi2sdq 0x40(%rdi), %xmm0
movq %rdi, -0x50(%rbp)
divsd 0x60(%rdi), %xmm0
callq 0x2310
movsd %xmm0, -0x70(%rbp)
leaq -0x68(%rbp), %rbx
movq %rbx, 0x8(%rbx)
movq %rbx, (%rbx)
movq $0x0, 0x10(%rbx)
movl $0x18, %edi
callq 0x2220
movq %r15, 0x10(%rax)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2070
incq -0x58(%rbp)
movq -0x68(%rbp), %r13
cmpq %rbx, %r13
je 0x3c2f
movq -0x50(%rbp), %rax
leaq 0x8(%rax), %r15
leaq -0x48(%rbp), %r12
movq 0x10(%r13), %rax
movq %rax, -0x30(%rbp)
decq -0x58(%rbp)
movq %r13, %rdi
callq 0x22f0
movq %r13, %rdi
callq 0x21f0
movq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x7330
testq %rax, %rax
je 0x3ad0
movq 0x10(%rax), %r13
jmp 0x3ad3
xorl %r13d, %r13d
movq -0x30(%rbp), %rax
movl %eax, %ecx
andl $0x1, %ecx
negq %rcx
orq $0x1, %rcx
addq %rax, %rcx
movq %rcx, -0x48(%rbp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x7330
testq %rax, %rax
je 0x3b00
movq 0x10(%rax), %r14
jmp 0x3b03
xorl %r14d, %r14d
movq %r14, %rax
orq %r13, %rax
je 0x3c22
movq -0x30(%rbp), %rax
movq %rax, %rcx
shrq $0x3f, %rcx
addq %rax, %rcx
sarq %rcx
movq %rcx, -0x38(%rbp)
movq %rcx, -0x48(%rbp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x7330
testq %rax, %rax
je 0x3b3e
movq 0x10(%rax), %rax
jmp 0x3b40
xorl %eax, %eax
addq %r13, %r14
addq %rax, %r14
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
ucomisd -0x70(%rbp), %xmm0
ja 0x3c22
movq %r15, %rdi
leaq -0x38(%rbp), %rsi
callq 0x7330
testq %rax, %rax
je 0x3b7b
movq %r15, %rdi
leaq -0x38(%rbp), %rsi
callq 0x7630
incq (%rax)
jmp 0x3b92
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq %r14, -0x40(%rbp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x7392
movq %r15, %rdi
leaq -0x30(%rbp), %rsi
callq 0x7b9e
movq -0x30(%rbp), %rax
movl %eax, %ecx
andl $0x1, %ecx
negq %rcx
orq $0x1, %rcx
addq %rax, %rcx
movq %rcx, -0x48(%rbp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x7b9e
movq -0x30(%rbp), %r14
movq -0x50(%rbp), %rax
cmpq %r14, 0x48(%rax)
jle 0x3c22
movl $0x18, %edi
callq 0x2220
addq %r14, %r14
movq %r14, 0x10(%rax)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2070
incq -0x58(%rbp)
movq -0x30(%rbp), %r14
movl $0x18, %edi
callq 0x2220
movl %r14d, %ecx
andl $0x1, %ecx
negq %rcx
orq $0x1, %rcx
addq %r14, %rcx
addq %rcx, %rcx
movq %rcx, 0x10(%rax)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2070
incq -0x58(%rbp)
movq -0x68(%rbp), %r13
cmpq %rbx, %r13
jne 0x3a96
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3c4e
jmp 0x3c4e
jmp 0x3c4e
jmp 0x3c4e
jmp 0x3c4e
jmp 0x3c4e
jmp 0x3c4e
jmp 0x3c4e
movq %rax, %r14
movq -0x68(%rbp), %rdi
cmpq %rbx, %rdi
je 0x3c6a
movq (%rdi), %r15
callq 0x21f0
movq %r15, %rdi
cmpq %rbx, %r15
jne 0x3c5a
movq %r14, %rdi
callq 0x2360