// File: /workspace/github_cpp_makefile_star2_O1/j-faria[P]kima/src/RVmodel.cpp
// Function: RVmodel::from_prior(DNest4::RNG&)
void RVmodel::from_prior(RNG& rng)
{
    // preliminaries
    setPriors();
    save_setup();

    planets.from_prior(rng);
    planets.consolidate_diff();

    background = Cprior->generate(rng);

    if(multi_instrument)
    {
        for(int i=0; i<offsets.size(); i++)
            offsets[i] = offsets_prior->generate(rng);
        for(int i=0; i<jitters.size(); i++)
            jitters[i] = Jprior->generate(rng);
    }
    else
    {
        extra_sigma = Jprior->generate(rng);
    }


    if(trend)
    {
        if (degree >= 1) slope = slope_prior->generate(rng);
        if (degree >= 2) quadr = quadr_prior->generate(rng);
        if (degree == 3) cubic = cubic_prior->generate(rng);
    }

    if(GP)
    {
        eta1 = exp(log_eta1_prior->generate(rng)); // m/s

        eta2 = eta2_prior->generate(rng); // days

        eta3 = eta3_prior->generate(rng); // days

        if (kernel == standard)
            eta4 = exp(log_eta4_prior->generate(rng));
    }

    if(MA)
    {
        sigmaMA = sigmaMA_prior->generate(rng);
        tauMA = tauMA_prior->generate(rng);
    }

    auto data = Data::get_instance();
    if (data.indicator_correlations)
    {
        for (unsigned i=0; i<data.number_indicators; i++)
            betas[i] = betaprior->generate(rng);
    }

    if (known_object) { // KO mode!
        KO_P.resize(n_known_object);
        KO_K.resize(n_known_object);
        KO_e.resize(n_known_object);
        KO_phi.resize(n_known_object);
        KO_w.resize(n_known_object);

        for (int i=0; i<n_known_object; i++){
            KO_P[i] = KO_Pprior[i]->generate(rng);
            KO_K[i] = KO_Kprior[i]->generate(rng);
            KO_e[i] = KO_eprior[i]->generate(rng);
            KO_phi[i] = KO_phiprior[i]->generate(rng);
            KO_w[i] = KO_wprior[i]->generate(rng);
        }
    }

    if (studentt)
        nu = nu_prior->generate(rng);


    calculate_mu();

    if(GP) calculate_C();

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsi, %r14
movq %rdi, %rbx
callq 0xcc70
movq %rbx, %rdi
callq 0xd9e0
leaq 0x8(%rbx), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x157ea
movq %r15, %rdi
callq 0x158c2
movq 0x3b8(%rbx), %rdi
movq %r14, %rsi
callq 0x3d1dc
movsd %xmm0, 0x120(%rbx)
leaq 0x37d4b(%rip), %rax     # 0x45388
cmpb $0x1, (%rax)
jne 0xd6d2
movq 0x130(%rbx), %rax
cmpq 0x128(%rbx), %rax
je 0xd68b
xorl %r15d, %r15d
movq 0x408(%rbx), %rdi
movq %r14, %rsi
callq 0x3d1dc
movq 0x128(%rbx), %rax
movsd %xmm0, (%rax,%r15,8)
incq %r15
movq 0x130(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r15, %rcx
ja 0xd659
movq 0x148(%rbx), %rax
cmpq 0x140(%rbx), %rax
je 0xd6e9
xorl %r15d, %r15d
movq 0x3c8(%rbx), %rdi
movq %r14, %rsi
callq 0x3d1dc
movq 0x140(%rbx), %rax
movsd %xmm0, (%rax,%r15,8)
incq %r15
movq 0x148(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r15, %rcx
ja 0xd69e
jmp 0xd6e9
movq 0x3c8(%rbx), %rdi
movq %r14, %rsi
callq 0x3d1dc
movsd %xmm0, 0x198(%rbx)
leaq 0x37c93(%rip), %rax     # 0x45383
cmpb $0x1, (%rax)
jne 0xd751
leaq 0x37c88(%rip), %rax     # 0x45384
movl (%rax), %ebp
testl %ebp, %ebp
jle 0xd719
movq 0x3d8(%rbx), %rdi
movq %r14, %rsi
callq 0x3d1dc
movsd %xmm0, 0x170(%rbx)
cmpl $0x2, %ebp
jl 0xd735
movq 0x3e8(%rbx), %rdi
movq %r14, %rsi
callq 0x3d1dc
movsd %xmm0, 0x178(%rbx)
cmpl $0x3, %ebp
jne 0xd751
movq 0x3f8(%rbx), %rdi
movq %r14, %rsi
callq 0x3d1dc
movsd %xmm0, 0x180(%rbx)
leaq 0x37c28(%rip), %rax     # 0x45380
movb (%rax), %bpl
cmpb $0x1, %bpl
jne 0xd7d0
movq 0x448(%rbx), %rdi
movq %r14, %rsi
callq 0x3d1dc
callq 0x6730
movsd %xmm0, 0x1b0(%rbx)
movq 0x458(%rbx), %rdi
movq %r14, %rsi
callq 0x3d1dc
movsd %xmm0, 0x1b8(%rbx)
movq 0x468(%rbx), %rdi
movq %r14, %rsi
callq 0x3d1dc
movsd %xmm0, 0x1c0(%rbx)
cmpl $0x0, 0x1a8(%rbx)
jne 0xd7d0
movq 0x478(%rbx), %rdi
movq %r14, %rsi
callq 0x3d1dc
callq 0x6730
movsd %xmm0, 0x1c8(%rbx)
leaq 0x37baa(%rip), %rax     # 0x45381
cmpb $0x1, (%rax)
jne 0xd80a
movq 0x428(%rbx), %rdi
movq %r14, %rsi
callq 0x3d1dc
movsd %xmm0, 0x188(%rbx)
movq 0x438(%rbx), %rdi
movq %r14, %rsi
callq 0x3d1dc
movsd %xmm0, 0x190(%rbx)
leaq 0x45bef(%rip), %rsi     # 0x53400
movq %rsp, %r15
movq %r15, %rdi
callq 0x1560c
cmpb $0x1, 0x78(%r15)
jne 0xd855
cmpl $0x0, 0x7c(%rsp)
je 0xd855
xorl %r15d, %r15d
movq 0x418(%rbx), %rdi
movq %r14, %rsi
callq 0x3d1dc
movq 0x158(%rbx), %rax
movsd %xmm0, (%rax,%r15,8)
incq %r15
movl 0x7c(%rsp), %eax
cmpq %rax, %r15
jb 0xd82d
leaq 0x37b2d(%rip), %rax     # 0x45389
cmpb $0x1, (%rax)
jne 0xd977
leaq 0x308(%rbx), %rdi
leaq 0x37b19(%rip), %rax     # 0x4538c
movslq (%rax), %r15
movq %r15, %rsi
callq 0x15952
leaq 0x320(%rbx), %rdi
movq %r15, %rsi
callq 0x15952
leaq 0x338(%rbx), %rdi
movq %r15, %rsi
callq 0x15952
leaq 0x350(%rbx), %rdi
movq %r15, %rsi
callq 0x15952
leaq 0x368(%rbx), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x15952
testl %r15d, %r15d
jle 0xd977
shlq $0x3, %r15
xorl %r13d, %r13d
movq 0x488(%rbx), %rax
movq (%rax,%r13,2), %rdi
movq %r14, %rsi
callq 0x3d1dc
movq 0x308(%rbx), %rax
movsd %xmm0, (%rax,%r13)
movq 0x4a0(%rbx), %rax
movq (%rax,%r13,2), %rdi
movq %r14, %rsi
callq 0x3d1dc
movq 0x320(%rbx), %rax
movsd %xmm0, (%rax,%r13)
movq 0x4b8(%rbx), %rax
movq (%rax,%r13,2), %rdi
movq %r14, %rsi
callq 0x3d1dc
movq 0x338(%rbx), %rax
movsd %xmm0, (%rax,%r13)
movq 0x4d0(%rbx), %rax
movq (%rax,%r13,2), %rdi
movq %r14, %rsi
callq 0x3d1dc
movq 0x350(%rbx), %rax
movsd %xmm0, (%rax,%r13)
movq 0x4e8(%rbx), %rax
movq (%rax,%r13,2), %rdi
movq %r14, %rsi
callq 0x3d1dc
movq (%r12), %rax
movsd %xmm0, (%rax,%r13)
addq $0x8, %r13
cmpq %r13, %r15
jne 0xd8cd
leaq 0x37a12(%rip), %rax     # 0x45390
cmpb $0x1, (%rax)
jne 0xd99a
movq 0x500(%rbx), %rdi
movq %r14, %rsi
callq 0x3d1dc
movsd %xmm0, 0x1a0(%rbx)
movq %rbx, %rdi
callq 0xedf2
testb %bpl, %bpl
je 0xd9af
movq %rbx, %rdi
callq 0xf34e
movq %rsp, %rdi
callq 0xb832
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xd9cd
jmp 0xd9cd
movq %rax, %rbx
movq %rsp, %rdi
callq 0xb832
movq %rbx, %rdi
callq 0x6710