// File: /workspace/github_cpp_makefile_star2_O1/ashlall[P]StreamStats/ChiSquareExperiments/./../SourceCode/ChiSquare/../Quantiles/Q-Digest.cpp
// Function: QDigest::offer(long)
void QDigest::offer(long value)
{
  if (value < 0 || value == MAX_VALUE)
  {
    try 
    {
      throw value;
    }
    catch (long value)
    {
      cout << "Can only accept values in the range 0.. " <<  MAX_VALUE - 1 << endl;
    }  
  }
	
  // Rebuild if the value is too large for the current tree height
  if (value >= capacity)
    rebuildToCapacity(highestOneBit(value) << 1);   
		
 long leaf = value2leaf(value);
 if (node2count.find(leaf) == node2count.end())
   node2count.insert(std::make_pair (leaf, get(leaf)+1));
 else
   node2count[leaf] += 1;   
 size++;

 //Always compress at the inserted node, and recompress fully
 //if the tree becomes too large.
 compressUpward(leaf);
 if (node2count.size() > 3 * compression_factor) 
   compressFully();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
testq %rsi, %rsi
js 0x32e9
cmpq $0x3b9aca00, %r14       # imm = 0x3B9ACA00
je 0x32e9
cmpq %r14, 0x48(%rbx)
jg 0x31f0
movq %r14, %rsi
testq %r14, %r14
je 0x31e8
cmpq $0x1, %r14
jne 0x31cc
movl $0x2, %esi
jmp 0x31e8
movl $0x1, %edx
movq %r14, %rcx
movl %edx, %eax
sarq %rcx
leal (%rax,%rax), %edx
cmpq $0x2, %rcx
jae 0x31d4
shll $0x2, %eax
movslq %eax, %rsi
movq %rbx, %rdi
callq 0x3664
addq 0x48(%rbx), %r14
movq %r14, -0x20(%rbp)
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdi
xorl %r9d, %r9d
movq %r14, %rax
xorl %edx, %edx
divq %rdi
movq (%rsi,%rdx,8), %rax
testq %rax, %rax
je 0x3252
movq (%rax), %r8
movq %rax, %r9
cmpq 0x8(%r8), %r14
je 0x3252
movq %rdx, %rcx
movq %r8, %r10
movq (%r8), %r8
testq %r8, %r8
je 0x324f
movq 0x8(%r8), %rsi
movq %rsi, %rax
xorl %edx, %edx
divq %rdi
movl $0x0, %r9d
cmpq %rcx, %rdx
jne 0x3252
movq %r10, %r9
cmpq %rsi, %r14
jne 0x3223
jmp 0x3252
xorl %r9d, %r9d
leaq 0x8(%rbx), %r15
testq %r9, %r9
je 0x3272
cmpq $0x0, (%r9)
je 0x3272
leaq -0x20(%rbp), %rsi
movq %r15, %rdi
callq 0x77cc
incq (%rax)
jmp 0x3293
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3864
incq %rax
leaq -0x30(%rbp), %rsi
movq %r14, (%rsi)
movq %rax, 0x8(%rsi)
movq %r15, %rdi
callq 0x7522
incq 0x40(%rbx)
movq -0x20(%rbp), %rsi
movq %rbx, %rdi
callq 0x38de
movsd 0x20(%rbx), %xmm0
unpcklps 0x5ef1(%rip), %xmm0     # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x5ef9(%rip), %xmm0     # 0x91b0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd 0x60(%rbx), %xmm0
mulsd 0x5d50(%rip), %xmm0     # 0x9020
ucomisd %xmm0, %xmm1
jbe 0x32de
movq %rbx, %rdi
callq 0x3ad2
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x2100
movq %r14, (%rax)
movq 0x9ce3(%rip), %rsi      # 0xcfe0
movq %rax, %rdi
xorl %edx, %edx
callq 0x2330
movq %rax, %r15
cmpl $0x1, %edx
jne 0x335a
movq %r15, %rdi
callq 0x20d0
movq 0x9cb2(%rip), %rdi      # 0xcfd0
leaq 0x5f58(%rip), %rsi      # 0x927d
movl $0x28, %edx
callq 0x2230
movq 0x9c9a(%rip), %rdi      # 0xcfd0
movl $0x3b9ac9ff, %esi       # imm = 0x3B9AC9FF
callq 0x2340
movq %rax, %rdi
callq 0x20f0
callq 0x2300
jmp 0x31b1
movq %rax, %r15
callq 0x2300
movq %r15, %rdi
callq 0x2360