// File: /workspace/github_cpp_makefile_star2_O2/j-faria[P]kima/src/RVmodel.cpp
// Function: RVmodel::setPriors()
void RVmodel::setPriors()  // BUG: should be done by only one thread!
{
    auto data = Data::get_instance();

    betaprior = make_prior<Gaussian>(0, 1);
    // sigmaMA_prior = make_prior<ModifiedLogUniform>(1.0, 10.);
    // sigmaMA_prior = make_prior<TruncatedGaussian>(0.0, 1.0, -1.0, 1.0);
    sigmaMA_prior = make_prior<Uniform>(-1, 1);
    tauMA_prior = make_prior<LogUniform>(1, 100);
    
    if (!Cprior)
        Cprior = make_prior<Uniform>(data.get_RV_min(), data.get_RV_max());

    if (!Jprior)
        Jprior = make_prior<ModifiedLogUniform>(min(1.0, 0.1*data.get_max_RV_span()), data.get_max_RV_span());

    // if (!slope_prior)
    //     slope_prior = make_prior<Uniform>( -data.topslope(), data.topslope() );

    if (trend){
        if (degree == 0)
            throw std::logic_error("trend=true but degree=0, what gives?");
        if (degree > 3)
            throw std::range_error("can't go higher than 3rd degree trends");
        if (degree >= 1 & !slope_prior)
            slope_prior = make_prior<Gaussian>( 0.0, pow(10, data.get_trend_magnitude(1)) );
        if (degree >= 2 & !quadr_prior)
            quadr_prior = make_prior<Gaussian>( 0.0, pow(10, data.get_trend_magnitude(2)) );
        if (degree == 3 & !cubic_prior)
            cubic_prior = make_prior<Gaussian>( 0.0, pow(10, data.get_trend_magnitude(3)) );
    }

    if (!offsets_prior)
        offsets_prior = make_prior<Uniform>( -data.get_RV_span(), data.get_RV_span() );

    if (GP) { /* GP parameters */
        if (!log_eta1_prior)
            log_eta1_prior = make_prior<Uniform>(-5, 5);
        if (!eta2_prior)
            eta2_prior = make_prior<LogUniform>(1, 100);
        if (!eta3_prior)
            eta3_prior = make_prior<Uniform>(10, 40);
        if (!log_eta4_prior & kernel==standard)
            log_eta4_prior = make_prior<Uniform>(-1, 1);
    }

    if (known_object) { // KO mode!
        // if (n_known_object == 0) cout << "Warning: `known_object` is true, but `n_known_object` is set to 0";
        for (int i = 0; i < n_known_object; i++){
            if (!KO_Pprior[i] || !KO_Kprior[i] || !KO_eprior[i] || !KO_phiprior[i] || !KO_wprior[i])
                throw std::logic_error("When known_object=true, please set priors for each (KO_Pprior, KO_Kprior, KO_eprior, KO_phiprior, KO_wprior)");
        }
    }

    if (studentt)
        nu_prior = make_prior<LogUniform>(2, 1000);

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rdi, %rbx
leaq 0x57f5d(%rip), %rsi     # 0x64580
leaq 0x40(%rsp), %rdi
callq 0x11aa2
leaq 0x18(%rsp), %rsi
andl $0x0, (%rsi)
leaq 0x20(%rsp), %rdx
movl $0x1, (%rdx)
leaq 0x8(%rsp), %rdi
callq 0x14651
leaq 0x418(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x147fe
leaq 0x10(%rsp), %rdi
callq 0x8710
leaq 0x18(%rsp), %rsi
orl $-0x1, (%rsi)
leaq 0x20(%rsp), %rdx
movl $0x1, (%rdx)
leaq 0x8(%rsp), %rdi
callq 0x1482c
leaq 0x428(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x8b20
leaq 0x10(%rsp), %rdi
callq 0x8710
leaq 0x18(%rsp), %r14
movl $0x1, (%r14)
leaq 0x20(%rsp), %r15
movl $0x64, (%r15)
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x1492a
leaq 0x438(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x9004
leaq 0x10(%rsp), %rdi
callq 0x8710
cmpq $0x0, 0x3b8(%rbx)
jne 0xc737
leaq 0x40(%rsp), %rdi
callq 0x11bfc
movsd %xmm0, 0x18(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x11c14
leaq 0x20(%rsp), %rdx
movsd %xmm0, (%rdx)
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x14a28
leaq 0x3b8(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x8b20
leaq 0x10(%rsp), %rdi
callq 0x8710
cmpq $0x0, 0x3c8(%rbx)
jne 0xc7c9
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x18(%rsp)
leaq 0x40(%rsp), %rdi
callq 0xab2e
mulsd 0x2fef2(%rip), %xmm0    # 0x3c658
movsd %xmm0, 0x30(%rsp)
movsd %xmm0, 0x20(%rsp)
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
leaq 0x40(%rsp), %rdi
callq 0xab2e
movsd 0x28(%rsp), %xmm1
ucomisd 0x30(%rsp), %xmm1
cmovaq %r15, %r14
leaq 0x38(%rsp), %rdx
movsd %xmm0, (%rdx)
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x14b26
leaq 0x3c8(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x91be
leaq 0x10(%rsp), %rdi
callq 0x8710
leaq 0x3a83f(%rip), %rax     # 0x4700f
cmpb $0x1, (%rax)
jne 0xc924
leaq 0x3a830(%rip), %rax     # 0x47010
movl (%rax), %ebp
testl %ebp, %ebp
je 0xcbbb
cmpl $0x4, %ebp
jge 0xcbe5
testl %ebp, %ebp
jle 0xc858
cmpq $0x0, 0x3d8(%rbx)
jne 0xc858
andq $0x0, 0x18(%rsp)
leaq 0x40(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0xad9a
cvtsi2sd %eax, %xmm1
movsd 0x2fe40(%rip), %xmm0    # 0x3c660
callq 0x66c0
leaq 0x20(%rsp), %rdx
movsd %xmm0, (%rdx)
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x14c24
leaq 0x3d8(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x147fe
leaq 0x10(%rsp), %rdi
callq 0x8710
cmpl $0x2, %ebp
jl 0xc8be
cmpq $0x0, 0x3e8(%rbx)
jne 0xc8be
andq $0x0, 0x18(%rsp)
leaq 0x40(%rsp), %rdi
pushq $0x2
popq %rsi
callq 0xad9a
cvtsi2sd %eax, %xmm1
movsd 0x2fdda(%rip), %xmm0    # 0x3c660
callq 0x66c0
leaq 0x20(%rsp), %rdx
movsd %xmm0, (%rdx)
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x14c24
leaq 0x3e8(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x147fe
leaq 0x10(%rsp), %rdi
callq 0x8710
cmpl $0x3, %ebp
jne 0xc924
cmpq $0x0, 0x3f8(%rbx)
jne 0xc924
andq $0x0, 0x18(%rsp)
leaq 0x40(%rsp), %rdi
pushq $0x3
popq %rsi
callq 0xad9a
cvtsi2sd %eax, %xmm1
movsd 0x2fd74(%rip), %xmm0    # 0x3c660
callq 0x66c0
leaq 0x20(%rsp), %rdx
movsd %xmm0, (%rdx)
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x14c24
leaq 0x3f8(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x147fe
leaq 0x10(%rsp), %rdi
callq 0x8710
cmpq $0x0, 0x408(%rbx)
jne 0xc983
leaq 0x40(%rsp), %rdi
callq 0xaaf8
xorpd 0x2fdd0(%rip), %xmm0    # 0x3c710
movlpd %xmm0, 0x18(%rsp)
leaq 0x40(%rsp), %rdi
callq 0xaaf8
leaq 0x20(%rsp), %rdx
movsd %xmm0, (%rdx)
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x14a28
leaq 0x408(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x8b20
leaq 0x10(%rsp), %rdi
callq 0x8710
leaq 0x3a682(%rip), %rax     # 0x4700c
cmpb $0x1, (%rax)
jne 0xcaad
cmpq $0x0, 0x448(%rbx)
jne 0xc9d8
leaq 0x18(%rsp), %rsi
movl $0xfffffffb, (%rsi)     # imm = 0xFFFFFFFB
leaq 0x20(%rsp), %rdx
movl $0x5, (%rdx)
leaq 0x8(%rsp), %rdi
callq 0x1482c
leaq 0x448(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x8b20
leaq 0x10(%rsp), %rdi
callq 0x8710
cmpq $0x0, 0x458(%rbx)
jne 0xca1d
leaq 0x18(%rsp), %rsi
movl $0x1, (%rsi)
leaq 0x20(%rsp), %rdx
movl $0x64, (%rdx)
leaq 0x8(%rsp), %rdi
callq 0x1492a
leaq 0x458(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x9004
leaq 0x10(%rsp), %rdi
callq 0x8710
cmpq $0x0, 0x468(%rbx)
jne 0xca62
leaq 0x18(%rsp), %rsi
movl $0xa, (%rsi)
leaq 0x20(%rsp), %rdx
movl $0x28, (%rdx)
leaq 0x8(%rsp), %rdi
callq 0x1482c
leaq 0x468(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x8b20
leaq 0x10(%rsp), %rdi
callq 0x8710
cmpq $0x0, 0x478(%rbx)
jne 0xcaad
cmpl $0x0, 0x1a8(%rbx)
jne 0xcaad
leaq 0x18(%rsp), %rsi
orl $-0x1, (%rsi)
leaq 0x20(%rsp), %rdx
movl $0x1, (%rdx)
leaq 0x8(%rsp), %rdi
callq 0x1482c
leaq 0x478(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x8b20
leaq 0x10(%rsp), %rdi
callq 0x8710
leaq 0x3a561(%rip), %rax     # 0x47015
cmpb $0x1, (%rax)
jne 0xcb59
leaq 0x3a554(%rip), %rax     # 0x47018
movl (%rax), %eax
movq 0x488(%rbx), %rcx
movq 0x4a0(%rbx), %rdx
movq 0x4b8(%rbx), %rsi
movq 0x4d0(%rbx), %rdi
movq 0x4e8(%rbx), %r8
xorl %r9d, %r9d
testl %eax, %eax
cmovlel %r9d, %eax
shlq $0x4, %rax
addq $0x10, %rax
leaq 0x10(%r9), %r10
cmpq %r10, %rax
je 0xcb59
cmpq $0x0, (%rcx,%r9)
je 0xcb29
cmpq $0x0, (%rdx,%r9)
je 0xcb29
cmpq $0x0, (%rsi,%r9)
je 0xcb29
cmpq $0x0, (%rdi,%r9)
je 0xcb29
cmpq $0x0, (%r8,%r9)
movq %r10, %r9
jne 0xcafa
pushq $0x10
popq %rdi
callq 0x61d0
movq %rax, %r14
leaq 0x2feb1(%rip), %rsi     # 0x3c9ec
movq %rax, %rdi
callq 0x6580
movq 0x5747e(%rip), %rsi     # 0x63fc8
movq 0x57437(%rip), %rdx     # 0x63f88
movq %r14, %rdi
callq 0x6690
leaq 0x3a4bc(%rip), %rax     # 0x4701c
cmpb $0x1, (%rax)
jne 0xcba3
leaq 0x18(%rsp), %rsi
movl $0x2, (%rsi)
leaq 0x20(%rsp), %rdx
movl $0x3e8, (%rdx)          # imm = 0x3E8
leaq 0x8(%rsp), %rdi
callq 0x1492a
addq $0x500, %rbx            # imm = 0x500
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x9004
leaq 0x10(%rsp), %rdi
callq 0x8710
leaq 0x40(%rsp), %rdi
callq 0xb0be
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x61d0
movq %rax, %r14
leaq 0x2fdd3(%rip), %rsi     # 0x3c9a0
movq %rax, %rdi
callq 0x6580
movq 0x573ac(%rip), %rdx     # 0x63f88
movq 0x573e5(%rip), %rsi     # 0x63fc8
jmp 0xcc0d
pushq $0x10
popq %rdi
callq 0x61d0
movq %rax, %r14
leaq 0x2fdce(%rip), %rsi     # 0x3c9c5
movq %rax, %rdi
callq 0x66a0
movq 0x5736a(%rip), %rdx     # 0x63f70
movq 0x573a3(%rip), %rsi     # 0x63fb0
movq %r14, %rdi
callq 0x6690
jmp 0xcc3d
jmp 0xcc3d
jmp 0xcc3d
jmp 0xcc3d
jmp 0xcc42
jmp 0xcc42
jmp 0xcc3d
jmp 0xcc3d
jmp 0xcc3d
jmp 0xcc3d
jmp 0xcc3d
jmp 0xcc3d
jmp 0xcc3d
jmp 0xcc3d
jmp 0xcc3d
jmp 0xcc3d
jmp 0xcc3d
jmp 0xcc3d
jmp 0xcc3d
jmp 0xcc3d
movq %rax, %rbx
jmp 0xcc4d
movq %rax, %rbx
movq %r14, %rdi
callq 0x6340
leaq 0x40(%rsp), %rdi
callq 0xb0be
movq %rbx, %rdi
callq 0x66e0
nop