// File: /workspace/github_cpp_makefile_star2_O1/JenTus[P]TCEM/src_TCEM/allocator.cc
// Function: Cide::allocator::tdem()
double allocator::tdem() {
        
        cout << "computation for lower bounding OPT started " << endl;

        clock_t common_begin = clock();
        double lb = lowerBoundOPT();
        cout << "lower bound identified: " << lb << endl;
        
        theta = (8 + 4/3.0 * epsilon) * n * (ell * log(n) + log(2) +  logP(n,k_r,tao)) / (epsilon * epsilon * lb);
        //theta = (2 + 2/3.0 * epsilon) * n * (ell * log(n) + log(2) +  logP(n,k_r,tao)) / (epsilon * epsilon * lb);
        
        cout << "final sample size " << theta << endl;
        generateRCSets(theta);
        
        clock_t common_end = clock();
        duration_common = double(common_end - common_begin) / CLOCKS_PER_SEC;

        double greedySolution = n * rcGreedy(theta, true);

        return greedySolution; 
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movq 0x11e08(%rip), %r15     # 0x17fd8
leaq 0xc02c(%rip), %rsi      # 0x12203
movl $0x2b, %edx
movq %r15, %rdi
callq 0x3340
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x32d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31e0
callq 0x31d0
movq %rax, %r14
movq %rbx, %rdi
callq 0x8e88
movsd %xmm0, 0x18(%rsp)
leaq 0xc007(%rip), %rsi      # 0x1222f
movl $0x18, %edx
movq %r15, %rdi
callq 0x3340
movq %r15, %rdi
movsd 0x18(%rsp), %xmm0
callq 0x3500
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x32d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31e0
movsd 0x90(%rbx), %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0xa0(%rbx), %xmm0
movsd %xmm0, 0x30(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdl 0x68(%rbx), %xmm0
movsd %xmm0, 0x28(%rsp)
callq 0x3240
movsd %xmm0, 0x20(%rsp)
movl 0x68(%rbx), %r12d
movl 0x78(%rbx), %ebp
movl 0x80(%rbx), %r15d
movl %r15d, %r13d
notl %r13d
imull %ebp, %r13d
leal (%r12,%r13), %eax
xorpd %xmm0, %xmm0
cmpl %r12d, %eax
jge 0x62fb
incl %r12d
movsd %xmm0, 0x8(%rsp)
leal (%r12,%r13), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
callq 0x3240
movsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
movsd 0x8(%rsp), %xmm0
incl %r13d
jne 0x62ca
testl %ebp, %ebp
jle 0x6348
movsd 0xbe49(%rip), %xmm1     # 0x12150
movl %ebp, %r12d
movsd %xmm1, 0x10(%rsp)
movsd %xmm0, 0x8(%rsp)
movapd %xmm1, %xmm0
callq 0x3240
movsd 0x8(%rsp), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
movsd 0x10(%rsp), %xmm1
movsd 0x8(%rsp), %xmm0
addsd 0xbe0d(%rip), %xmm1     # 0x12150
decl %r12d
jne 0x630a
testl %r15d, %r15d
movsd %xmm0, 0x8(%rsp)
xorpd %xmm3, %xmm3
jle 0x6393
movsd 0xbdf1(%rip), %xmm0     # 0x12150
movsd %xmm0, 0x10(%rsp)
movsd %xmm3, 0x40(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x3240
movsd 0x40(%rsp), %xmm3
addsd %xmm0, %xmm3
movsd 0x10(%rsp), %xmm0
addsd 0xbdc2(%rip), %xmm0     # 0x12150
decl %r15d
jne 0x635f
movsd 0x30(%rsp), %xmm2
mulsd 0x20(%rsp), %xmm2
addsd 0xbdb1(%rip), %xmm2     # 0x12158
movsd 0x38(%rsp), %xmm1
mulsd 0xbdab(%rip), %xmm1     # 0x12160
addsd 0xbdab(%rip), %xmm1     # 0x12168
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
mulsd 0x28(%rsp), %xmm1
mulsd %xmm3, %xmm0
movsd 0x8(%rsp), %xmm3
subsd %xmm0, %xmm3
addsd %xmm2, %xmm3
mulsd %xmm1, %xmm3
movsd 0x90(%rbx), %xmm0
mulsd %xmm0, %xmm0
movsd 0x18(%rsp), %xmm1
mulsd %xmm0, %xmm1
divsd %xmm1, %xmm3
cvttsd2si %xmm3, %rax
movq %rax, 0x10(%rbx)
movq 0x11bce(%rip), %r15     # 0x17fd8
leaq 0xbe37(%rip), %rsi      # 0x12248
movl $0x12, %edx
movq %r15, %rdi
callq 0x3340
movq 0x10(%rbx), %rsi
movq %r15, %rdi
callq 0x3100
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x32d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31e0
movq 0x10(%rbx), %rsi
movq %rbx, %rdi
callq 0x919c
callq 0x31d0
subq %r14, %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0xbcf8(%rip), %xmm0     # 0x12170
movsd %xmm0, 0x8(%rbx)
xorps %xmm0, %xmm0
cvtsi2sdl 0x68(%rbx), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x10(%rbx), %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x93f8
mulsd 0x8(%rsp), %xmm0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop