// File: /workspace/github_cpp_makefile_star2_O1/JenTus[P]TCEM/src_TCEM/allocator.cc
// Function: Cide::allocator::lowerBoundOPT()
double allocator::lowerBoundOPT() {

        double epsilon_1 = epsilon * 2.0; //

        for (int x = 1; x < log2(n); x++) {

            int64 theta_x = (2+2.0/3.0 * epsilon_1)* (ell * log(n) + logP(n,k_r,tao) + log(log2(n))) * pow(2.0,x) / (epsilon_1 * epsilon_1);
            //int64 theta_x =  (2+2.0/3.0 * epsilon_1)* (ell * log(n) + logcnk(n*(n-1), k_r*k_b) + log(log2(n))) * pow(2.0,x) / (epsilon_1 * epsilon_1);
            
//            std::cout << "theta_x " << theta_x << std::endl;
            generateRCSets(theta_x);
            
            double ept = rcGreedy(theta_x, false);

//            cout << "ept is: " << ept << endl;

            if (ept > ((1+epsilon_1) / pow(2.0, x))) {
                double lowerBound = ept * n / (1 + epsilon_1);
                // kontrol:
//                std:cout << "x and theta_x " << x << " " << theta_x << std::endl;
                return lowerBound;
            }
        }
        cout << "returning naive lower bound  " << endl;
        double naive = 1.0;
        return naive;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movsd 0x90(%rdi), %xmm0
movsd %xmm0, 0x20(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdl 0x68(%rdi), %xmm0
callq 0x35d0
ucomisd 0x9294(%rip), %xmm0     # 0x12150
setbe %al
ja 0x8ec6
jmp 0x913a
movsd 0x20(%rsp), %xmm1
addsd %xmm1, %xmm1
movsd 0x92a8(%rip), %xmm0     # 0x12180
mulsd %xmm1, %xmm0
addsd 0x92a4(%rip), %xmm0     # 0x12188
movsd %xmm0, 0x38(%rsp)
movapd %xmm1, %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
addsd 0x9250(%rip), %xmm1     # 0x12150
movsd %xmm1, 0x20(%rsp)
movl $0x1, %r15d
movb %al, 0xf(%rsp)
movsd 0xa0(%rbx), %xmm0
movsd %xmm0, 0x28(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdl 0x68(%rbx), %xmm0
callq 0x3240
movsd %xmm0, 0x40(%rsp)
movl 0x68(%rbx), %r13d
movl 0x78(%rbx), %r14d
movl 0x80(%rbx), %r12d
movl %r12d, %ebp
notl %ebp
imull %r14d, %ebp
leal (%rbp,%r13), %eax
xorpd %xmm0, %xmm0
cmpl %r13d, %eax
jge 0x8f8b
incl %r13d
movsd %xmm0, 0x10(%rsp)
leal (%r13,%rbp), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
callq 0x3240
movsd 0x10(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
movsd 0x10(%rsp), %xmm0
incl %ebp
jne 0x8f5a
movapd %xmm0, %xmm1
testl %r14d, %r14d
jle 0x8fd6
movl %r14d, %ebp
movsd 0x91b1(%rip), %xmm2     # 0x12150
movsd %xmm1, 0x10(%rsp)
movsd %xmm2, 0x18(%rsp)
movapd %xmm2, %xmm0
callq 0x3240
movsd 0x10(%rsp), %xmm1
movsd 0x18(%rsp), %xmm2
subsd %xmm0, %xmm1
movsd 0x9184(%rip), %xmm0     # 0x12150
addsd %xmm0, %xmm2
decl %ebp
jne 0x8f9f
jmp 0x8fde
movsd 0x9172(%rip), %xmm0     # 0x12150
movsd %xmm1, 0x10(%rsp)
xorpd %xmm1, %xmm1
testl %r12d, %r12d
jle 0x9023
movapd %xmm0, %xmm2
movsd %xmm2, 0x48(%rsp)
movsd %xmm1, 0x18(%rsp)
movapd %xmm2, %xmm0
callq 0x3240
movsd 0x48(%rsp), %xmm2
movsd 0x18(%rsp), %xmm1
addsd %xmm0, %xmm1
addsd 0x9132(%rip), %xmm2     # 0x12150
decl %r12d
jne 0x8ff1
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
mulsd %xmm1, %xmm0
movsd 0x10(%rsp), %xmm1
subsd %xmm0, %xmm1
movsd 0x28(%rsp), %xmm0
mulsd 0x40(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdl 0x68(%rbx), %xmm0
callq 0x35d0
callq 0x3240
addsd 0x28(%rsp), %xmm0
mulsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
movsd %xmm0, 0x10(%rsp)
callq 0x3290
mulsd 0x18(%rsp), %xmm0
divsd 0x30(%rsp), %xmm0
cvttsd2si %xmm0, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x919c
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x93f8
movsd %xmm0, 0x18(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x3290
movsd 0x20(%rsp), %xmm2
movapd %xmm2, %xmm1
divsd %xmm0, %xmm1
movsd 0x18(%rsp), %xmm3
ucomisd %xmm1, %xmm3
xorps %xmm0, %xmm0
cvtsi2sdl 0x68(%rbx), %xmm0
mulsd %xmm3, %xmm0
divsd %xmm2, %xmm0
cmpnltsd %xmm3, %xmm1
movapd %xmm1, %xmm2
andnpd %xmm0, %xmm2
andpd 0x50(%rsp), %xmm1
orpd %xmm2, %xmm1
movapd %xmm1, 0x50(%rsp)
ja 0x9136
incl %r15d
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
movsd %xmm0, 0x10(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdl 0x68(%rbx), %xmm0
callq 0x35d0
ucomisd 0x10(%rsp), %xmm0
setbe %al
ja 0x8f0c
jmp 0x913a
movb 0xf(%rsp), %al
testb $0x1, %al
movaps 0x50(%rsp), %xmm0
je 0x918d
movq 0xee8e(%rip), %rbx      # 0x17fd8
leaq 0x910a(%rip), %rsi      # 0x1225b
movl $0x1d, %edx
movq %rbx, %rdi
callq 0x3340
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x32d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31e0
movsd 0x8fc3(%rip), %xmm0     # 0x12150
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq