// File: /workspace/github_cpp_makefile_star2_O1/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 0x46779(%rip), %rsi     # 0x53400
leaq 0x40(%rsp), %rdi
callq 0x1560c
leaq 0x10(%rsp), %rcx
movl $0x0, (%rcx)
leaq 0x20(%rsp), %r8
movl $0x1, (%r8)
leaq 0x8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %rsp, %rsi
leaq 0x18(%rsp), %rdx
callq 0x18738
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x420(%rbx), %rdi
movupd %xmm0, 0x418(%rbx)
testq %rdi, %rdi
je 0xcce9
callq 0x8a1a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xccf8
callq 0x8a1a
leaq 0x10(%rsp), %rcx
movl $0xffffffff, (%rcx)     # imm = 0xFFFFFFFF
leaq 0x20(%rsp), %r8
movl $0x1, (%r8)
leaq 0x8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %rsp, %rsi
leaq 0x18(%rsp), %rdx
callq 0x1881a
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x430(%rbx), %rdi
movupd %xmm0, 0x428(%rbx)
testq %rdi, %rdi
je 0xcd50
callq 0x8a1a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xcd5f
callq 0x8a1a
leaq 0x10(%rsp), %r14
movl $0x1, (%r14)
leaq 0x20(%rsp), %r15
movl $0x64, (%r15)
leaq 0x8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %rsp, %rsi
leaq 0x18(%rsp), %rdx
movq %r14, %rcx
movq %r15, %r8
callq 0x1889e
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x440(%rbx), %rdi
movupd %xmm0, 0x438(%rbx)
testq %rdi, %rdi
je 0xcdbe
callq 0x8a1a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xcdcd
callq 0x8a1a
cmpq $0x0, 0x3b8(%rbx)
jne 0xcec2
movq 0x58(%rsp), %rcx
movq 0x60(%rsp), %rax
cmpq %rax, %rcx
sete %dil
movq %rcx, %rdx
addq $0x8, %rdx
cmpq %rax, %rdx
sete %sil
orb %dil, %sil
je 0xce0b
movsd (%rcx), %xmm0
movsd %xmm0, 0x10(%rsp)
jmp 0xce3e
movq %rdx, %rdi
movq %rcx, %r9
movsd (%r9), %xmm0
ucomisd (%rdi), %xmm0
movq %rdi, %r8
ja 0xce22
movq %r9, %r8
addq $0x8, %rdi
movq %r8, %r9
cmpq %rax, %rdi
jne 0xce11
movsd (%r8), %xmm0
movsd %xmm0, 0x10(%rsp)
testb %sil, %sil
je 0xce43
movq %rcx, %rsi
jmp 0xce5f
movsd (%rdx), %xmm0
ucomisd (%rcx), %xmm0
movq %rdx, %rsi
ja 0xce53
movq %rcx, %rsi
addq $0x8, %rdx
movq %rsi, %rcx
cmpq %rax, %rdx
jne 0xce43
movsd (%rsi), %xmm0
leaq 0x20(%rsp), %r8
movsd %xmm0, (%r8)
leaq 0x8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %rsp, %rsi
leaq 0x18(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x18922
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x3c0(%rbx), %rdi
movupd %xmm0, 0x3b8(%rbx)
testq %rdi, %rdi
je 0xceb3
callq 0x8a1a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xcec2
callq 0x8a1a
cmpq $0x0, 0x3c8(%rbx)
jne 0xcf80
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x10(%rsp)
leaq 0x40(%rsp), %rdi
callq 0xb130
mulsd 0x32797(%rip), %xmm0    # 0x3f688
movsd %xmm0, 0x38(%rsp)
movsd %xmm0, 0x20(%rsp)
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
leaq 0x40(%rsp), %rdi
callq 0xb130
movsd 0x30(%rsp), %xmm1
ucomisd 0x38(%rsp), %xmm1
cmovaq %r15, %r14
leaq 0x18(%rsp), %r8
movsd %xmm0, (%r8)
leaq 0x8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %rsp, %rsi
leaq 0x2f(%rsp), %rdx
movq %r14, %rcx
callq 0x189a6
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x3d0(%rbx), %rdi
movupd %xmm0, 0x3c8(%rbx)
testq %rdi, %rdi
je 0xcf71
callq 0x8a1a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xcf80
callq 0x8a1a
leaq 0x383fc(%rip), %rax     # 0x45383
cmpb $0x1, (%rax)
jne 0xd18f
leaq 0x383ed(%rip), %rax     # 0x45384
movl (%rax), %ebp
testl %ebp, %ebp
je 0xd53d
cmpl $0x4, %ebp
jge 0xd569
testl %ebp, %ebp
jle 0xd04b
cmpq $0x0, 0x3d8(%rbx)
jne 0xd04b
movq $0x0, 0x10(%rsp)
leaq 0x40(%rsp), %rdi
movl $0x1, %esi
callq 0xb494
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x326a9(%rip), %xmm0    # 0x3f690
callq 0x66f0
leaq 0x20(%rsp), %r8
movsd %xmm0, (%r8)
leaq 0x8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %rsp, %rsi
leaq 0x18(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x18a2a
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x3e0(%rbx), %rdi
movupd %xmm0, 0x3d8(%rbx)
testq %rdi, %rdi
je 0xd03c
callq 0x8a1a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xd04b
callq 0x8a1a
cmpl $0x2, %ebp
jl 0xd0ed
cmpq $0x0, 0x3e8(%rbx)
jne 0xd0ed
movq $0x0, 0x10(%rsp)
leaq 0x40(%rsp), %rdi
movl $0x2, %esi
callq 0xb494
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x32607(%rip), %xmm0    # 0x3f690
callq 0x66f0
leaq 0x20(%rsp), %r8
movsd %xmm0, (%r8)
leaq 0x8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %rsp, %rsi
leaq 0x18(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x18a2a
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x3f0(%rbx), %rdi
movupd %xmm0, 0x3e8(%rbx)
testq %rdi, %rdi
je 0xd0de
callq 0x8a1a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xd0ed
callq 0x8a1a
cmpl $0x3, %ebp
jne 0xd18f
cmpq $0x0, 0x3f8(%rbx)
jne 0xd18f
movq $0x0, 0x10(%rsp)
leaq 0x40(%rsp), %rdi
movl $0x3, %esi
callq 0xb494
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x32565(%rip), %xmm0    # 0x3f690
callq 0x66f0
leaq 0x20(%rsp), %r8
movsd %xmm0, (%r8)
leaq 0x8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %rsp, %rsi
leaq 0x18(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x18a2a
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x400(%rbx), %rdi
movupd %xmm0, 0x3f8(%rbx)
testq %rdi, %rdi
je 0xd180
callq 0x8a1a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xd18f
callq 0x8a1a
cmpq $0x0, 0x408(%rbx)
jne 0xd21e
leaq 0x40(%rsp), %rdi
callq 0xb0b8
xorpd 0x32591(%rip), %xmm0    # 0x3f740
movlpd %xmm0, 0x10(%rsp)
leaq 0x40(%rsp), %rdi
callq 0xb0b8
leaq 0x20(%rsp), %r8
movsd %xmm0, (%r8)
leaq 0x8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %rsp, %rsi
leaq 0x18(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x18922
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x410(%rbx), %rdi
movupd %xmm0, 0x408(%rbx)
testq %rdi, %rdi
je 0xd20f
callq 0x8a1a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xd21e
callq 0x8a1a
leaq 0x3815b(%rip), %rax     # 0x45380
cmpb $0x1, (%rax)
jne 0xd3fb
cmpq $0x0, 0x448(%rbx)
jne 0xd29f
leaq 0x10(%rsp), %rcx
movl $0xfffffffb, (%rcx)     # imm = 0xFFFFFFFB
leaq 0x20(%rsp), %r8
movl $0x5, (%r8)
leaq 0x8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %rsp, %rsi
leaq 0x18(%rsp), %rdx
callq 0x1881a
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x450(%rbx), %rdi
movupd %xmm0, 0x448(%rbx)
testq %rdi, %rdi
je 0xd290
callq 0x8a1a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xd29f
callq 0x8a1a
cmpq $0x0, 0x458(%rbx)
jne 0xd310
leaq 0x10(%rsp), %rcx
movl $0x1, (%rcx)
leaq 0x20(%rsp), %r8
movl $0x64, (%r8)
leaq 0x8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %rsp, %rsi
leaq 0x18(%rsp), %rdx
callq 0x1889e
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x460(%rbx), %rdi
movupd %xmm0, 0x458(%rbx)
testq %rdi, %rdi
je 0xd301
callq 0x8a1a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xd310
callq 0x8a1a
cmpq $0x0, 0x468(%rbx)
jne 0xd381
leaq 0x10(%rsp), %rcx
movl $0xa, (%rcx)
leaq 0x20(%rsp), %r8
movl $0x28, (%r8)
leaq 0x8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %rsp, %rsi
leaq 0x18(%rsp), %rdx
callq 0x1881a
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x470(%rbx), %rdi
movupd %xmm0, 0x468(%rbx)
testq %rdi, %rdi
je 0xd372
callq 0x8a1a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xd381
callq 0x8a1a
cmpq $0x0, 0x478(%rbx)
jne 0xd3fb
cmpl $0x0, 0x1a8(%rbx)
jne 0xd3fb
leaq 0x10(%rsp), %rcx
movl $0xffffffff, (%rcx)     # imm = 0xFFFFFFFF
leaq 0x20(%rsp), %r8
movl $0x1, (%r8)
leaq 0x8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %rsp, %rsi
leaq 0x18(%rsp), %rdx
callq 0x1881a
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x480(%rbx), %rdi
movupd %xmm0, 0x478(%rbx)
testq %rdi, %rdi
je 0xd3ec
callq 0x8a1a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xd3fb
callq 0x8a1a
leaq 0x37f87(%rip), %rax     # 0x45389
cmpb $0x1, (%rax)
jne 0xd480
leaq 0x37f7e(%rip), %rax     # 0x4538c
movslq (%rax), %rax
testq %rax, %rax
jle 0xd480
movq 0x488(%rbx), %rcx
movq 0x4a0(%rbx), %rdx
movq 0x4b8(%rbx), %rsi
movq 0x4d0(%rbx), %rdi
movq 0x4e8(%rbx), %r8
shlq $0x4, %rax
xorl %r9d, %r9d
cmpq $0x0, (%rcx,%r9)
je 0xd50b
cmpq $0x0, (%rdx,%r9)
je 0xd50b
cmpq $0x0, (%rsi,%r9)
je 0xd50b
cmpq $0x0, (%rdi,%r9)
je 0xd50b
cmpq $0x0, (%r8,%r9)
je 0xd50b
addq $0x10, %r9
cmpq %r9, %rax
jne 0xd440
leaq 0x37f09(%rip), %rax     # 0x45390
cmpb $0x1, (%rax)
jne 0xd4f3
leaq 0x10(%rsp), %rcx
movl $0x2, (%rcx)
leaq 0x20(%rsp), %r8
movl $0x3e8, (%r8)           # imm = 0x3E8
leaq 0x8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %rsp, %rsi
leaq 0x18(%rsp), %rdx
callq 0x1889e
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x508(%rbx), %rdi
movupd %xmm0, 0x500(%rbx)
testq %rdi, %rdi
je 0xd4e4
callq 0x8a1a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xd4f3
callq 0x8a1a
leaq 0x40(%rsp), %rdi
callq 0xb832
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x61d0
movq %rax, %r14
leaq 0x324e1(%rip), %rsi     # 0x3fa00
movq %rax, %rdi
callq 0x6590
movq 0x45a9a(%rip), %rsi     # 0x52fc8
movq 0x45a53(%rip), %rdx     # 0x52f88
movq %r14, %rdi
callq 0x66c0
movl $0x10, %edi
callq 0x61d0
movq %rax, %r14
leaq 0x32463(%rip), %rsi     # 0x3f9b4
movq %rax, %rdi
callq 0x6590
movq 0x45a28(%rip), %rdx     # 0x52f88
movq 0x45a61(%rip), %rsi     # 0x52fc8
jmp 0xd593
movl $0x10, %edi
callq 0x61d0
movq %rax, %r14
leaq 0x3245c(%rip), %rsi     # 0x3f9d9
movq %rax, %rdi
callq 0x66d0
movq 0x459e4(%rip), %rdx     # 0x52f70
movq 0x45a1d(%rip), %rsi     # 0x52fb0
movq %r14, %rdi
callq 0x66c0
jmp 0xd5c1
jmp 0xd5c1
jmp 0xd5c1
jmp 0xd5c1
jmp 0xd5c6
jmp 0xd5c6
jmp 0xd5c1
jmp 0xd5c1
jmp 0xd5c1
jmp 0xd5c1
jmp 0xd5c1
jmp 0xd5c1
jmp 0xd5c1
jmp 0xd5c1
jmp 0xd5c1
jmp 0xd5c1
jmp 0xd5c1
jmp 0xd5c1
jmp 0xd5c1
movq %rax, %rbx
jmp 0xd5d1
movq %rax, %rbx
movq %r14, %rdi
callq 0x6340
leaq 0x40(%rsp), %rdi
callq 0xb832
movq %rbx, %rdi
callq 0x6710
nop