// File: /workspace/github_cpp_makefile_star2_O3/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 0x436c9(%rip), %rsi     # 0x50400
leaq 0x40(%rsp), %rdi
callq 0x15552
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 0x18076
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x420(%rbx), %rdi
movupd %xmm0, 0x418(%rbx)
testq %rdi, %rdi
je 0xcda8
callq 0x8a2a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xcda8
callq 0x8a2a
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 0x18152
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x430(%rbx), %rdi
movupd %xmm0, 0x428(%rbx)
testq %rdi, %rdi
je 0xce0f
callq 0x8a2a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xce0f
callq 0x8a2a
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 0x181d6
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x440(%rbx), %rdi
movupd %xmm0, 0x438(%rbx)
testq %rdi, %rdi
je 0xce7d
callq 0x8a2a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xce7d
callq 0x8a2a
cmpq $0x0, 0x3b8(%rbx)
je 0xd27a
cmpq $0x0, 0x3c8(%rbx)
je 0xd2b1
leaq 0x35a3f(%rip), %rax     # 0x428df
cmpb $0x1, (%rax)
jne 0xd0a8
leaq 0x35a30(%rip), %rax     # 0x428e0
movl (%rax), %ebp
testl %ebp, %ebp
je 0xd648
cmpl $0x4, %ebp
jge 0xd674
testl %ebp, %ebp
jle 0xcf64
cmpq $0x0, 0x3d8(%rbx)
jne 0xcf64
movq $0x0, 0x10(%rsp)
leaq 0x40(%rsp), %rdi
movl $0x1, %esi
callq 0xb552
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x307b8(%rip), %xmm0    # 0x3d6b8
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 0x18362
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x3e0(%rbx), %rdi
movupd %xmm0, 0x3d8(%rbx)
testq %rdi, %rdi
je 0xcf64
callq 0x8a2a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xcf64
callq 0x8a2a
cmpl $0x2, %ebp
jl 0xd006
cmpq $0x0, 0x3e8(%rbx)
jne 0xd006
movq $0x0, 0x10(%rsp)
leaq 0x40(%rsp), %rdi
movl $0x2, %esi
callq 0xb552
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x30716(%rip), %xmm0    # 0x3d6b8
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 0x18362
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x3f0(%rbx), %rdi
movupd %xmm0, 0x3e8(%rbx)
testq %rdi, %rdi
je 0xd006
callq 0x8a2a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xd006
callq 0x8a2a
cmpl $0x3, %ebp
jne 0xd0a8
cmpq $0x0, 0x3f8(%rbx)
jne 0xd0a8
movq $0x0, 0x10(%rsp)
leaq 0x40(%rsp), %rdi
movl $0x3, %esi
callq 0xb552
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x30674(%rip), %xmm0    # 0x3d6b8
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 0x18362
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x400(%rbx), %rdi
movupd %xmm0, 0x3f8(%rbx)
testq %rdi, %rdi
je 0xd0a8
callq 0x8a2a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xd0a8
callq 0x8a2a
cmpq $0x0, 0x408(%rbx)
je 0xd36e
leaq 0x3581f(%rip), %rax     # 0x428dc
cmpb $0x1, (%rax)
jne 0xd16a
cmpq $0x0, 0x448(%rbx)
je 0xd4ba
cmpq $0x0, 0x458(%rbx)
je 0xd52e
cmpq $0x0, 0x468(%rbx)
je 0xd5a2
cmpq $0x0, 0x478(%rbx)
jne 0xd16a
cmpl $0x0, 0x1a8(%rbx)
jne 0xd16a
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 0x18152
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x480(%rbx), %rdi
movupd %xmm0, 0x478(%rbx)
testq %rdi, %rdi
je 0xd16a
callq 0x8a2a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xd16a
callq 0x8a2a
leaq 0x35774(%rip), %rax     # 0x428e5
cmpb $0x1, (%rax)
jne 0xd1ef
leaq 0x3576b(%rip), %rax     # 0x428e8
movslq (%rax), %rax
testq %rax, %rax
jle 0xd1ef
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 0xd616
cmpq $0x0, (%rdx,%r9)
je 0xd616
cmpq $0x0, (%rsi,%r9)
je 0xd616
cmpq $0x0, (%rdi,%r9)
je 0xd616
cmpq $0x0, (%r8,%r9)
je 0xd616
addq $0x10, %r9
cmpq %r9, %rax
jne 0xd1af
leaq 0x356f6(%rip), %rax     # 0x428ec
cmpb $0x1, (%rax)
jne 0xd262
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 0x181d6
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x508(%rbx), %rdi
movupd %xmm0, 0x500(%rbx)
testq %rdi, %rdi
je 0xd262
callq 0x8a2a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xd262
callq 0x8a2a
leaq 0x40(%rsp), %rdi
callq 0xb8d2
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x58(%rsp), %rax
movq 0x60(%rsp), %rcx
cmpq %rcx, %rax
sete %sil
movq %rax, %rdx
addq $0x8, %rdx
cmpq %rcx, %rdx
sete %dil
orb %sil, %dil
movsd (%rax), %xmm0
je 0xd3fc
movsd %xmm0, 0x10(%rsp)
jmp 0xd44a
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x10(%rsp)
leaq 0x40(%rsp), %rdi
callq 0xb1f8
mulsd 0x303de(%rip), %xmm0    # 0x3d6b0
movsd %xmm0, 0x38(%rsp)
movsd %xmm0, 0x20(%rsp)
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
leaq 0x40(%rsp), %rdi
callq 0xb1f8
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 0x182de
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x3d0(%rbx), %rdi
movupd %xmm0, 0x3c8(%rbx)
testq %rdi, %rdi
je 0xce99
callq 0x8a2a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xce99
callq 0x8a2a
jmp 0xce99
leaq 0x40(%rsp), %rdi
callq 0xb180
xorpd 0x303e0(%rip), %xmm0    # 0x3d760
movlpd %xmm0, 0x10(%rsp)
leaq 0x40(%rsp), %rdi
callq 0xb180
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 0x1825a
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x410(%rbx), %rdi
movupd %xmm0, 0x408(%rbx)
testq %rdi, %rdi
je 0xd0b6
callq 0x8a2a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xd0b6
callq 0x8a2a
jmp 0xd0b6
movq %rdx, %rdi
movq %rax, %rsi
movsd (%rdi), %xmm1
ucomisd %xmm1, %xmm0
cmovaq %rdi, %rsi
minsd %xmm0, %xmm1
addq $0x8, %rdi
movapd %xmm1, %xmm0
cmpq %rcx, %rdi
jne 0xd402
movsd (%rsi), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd (%rax), %xmm0
movsd (%rdx), %xmm1
ucomisd %xmm0, %xmm1
cmovaq %rdx, %rax
maxsd %xmm0, %xmm1
addq $0x8, %rdx
movapd %xmm1, %xmm0
cmpq %rcx, %rdx
jne 0xd42d
movsd (%rax), %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 0x1825a
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x3c0(%rbx), %rdi
movupd %xmm0, 0x3b8(%rbx)
testq %rdi, %rdi
je 0xce8b
callq 0x8a2a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xce8b
callq 0x8a2a
jmp 0xce8b
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 0x18152
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x450(%rbx), %rdi
movupd %xmm0, 0x448(%rbx)
testq %rdi, %rdi
je 0xd0d4
callq 0x8a2a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xd0d4
callq 0x8a2a
jmp 0xd0d4
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 0x181d6
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x460(%rbx), %rdi
movupd %xmm0, 0x458(%rbx)
testq %rdi, %rdi
je 0xd0e2
callq 0x8a2a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xd0e2
callq 0x8a2a
jmp 0xd0e2
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 0x18152
movapd (%rsp), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, (%rsp)
movq 0x470(%rbx), %rdi
movupd %xmm0, 0x468(%rbx)
testq %rdi, %rdi
je 0xd0f0
callq 0x8a2a
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xd0f0
callq 0x8a2a
jmp 0xd0f0
movl $0x10, %edi
callq 0x61d0
movq %rax, %r14
leaq 0x30412(%rip), %rsi     # 0x3da3c
movq %rax, %rdi
callq 0x6590
movq 0x4298f(%rip), %rsi     # 0x4ffc8
movq 0x42948(%rip), %rdx     # 0x4ff88
movq %r14, %rdi
callq 0x66c0
movl $0x10, %edi
callq 0x61d0
movq %rax, %r14
leaq 0x30394(%rip), %rsi     # 0x3d9f0
movq %rax, %rdi
callq 0x6590
movq 0x4291d(%rip), %rdx     # 0x4ff88
movq 0x42956(%rip), %rsi     # 0x4ffc8
jmp 0xd69e
movl $0x10, %edi
callq 0x61d0
movq %rax, %r14
leaq 0x3038d(%rip), %rsi     # 0x3da15
movq %rax, %rdi
callq 0x66d0
movq 0x428d9(%rip), %rdx     # 0x4ff70
movq 0x42912(%rip), %rsi     # 0x4ffb0
movq %r14, %rdi
callq 0x66c0
jmp 0xd6cc
jmp 0xd6cc
jmp 0xd6cc
jmp 0xd6cc
jmp 0xd6d1
jmp 0xd6d1
jmp 0xd6cc
jmp 0xd6cc
jmp 0xd6cc
jmp 0xd6cc
jmp 0xd6cc
jmp 0xd6cc
jmp 0xd6cc
jmp 0xd6cc
jmp 0xd6cc
jmp 0xd6cc
jmp 0xd6cc
jmp 0xd6cc
jmp 0xd6cc
movq %rax, %rbx
jmp 0xd6dc
movq %rax, %rbx
movq %r14, %rdi
callq 0x6340
leaq 0x40(%rsp), %rdi
callq 0xb8d2
movq %rbx, %rdi
callq 0x6710