// File: /workspace/github_c_makefile_star2_O2/PoulinV[P]AxiCLASS/build/../source/fourier.c
// Function: fourier_sigmas_at_z
int fourier_sigmas_at_z(
                        struct precision * ppr,
                        struct background * pba,
                        struct fourier * pfo,
                        double R,
                        double z,
                        int index_pk,
                        enum out_sigmas sigma_output,
                        double * result
                        ) {

  double * out_pk;
  double * ddout_pk;

  /** - allocate temporary array for P(k,z) as a function of k */

  class_alloc(out_pk, pfo->k_size*sizeof(double), pfo->error_message);
  class_alloc(ddout_pk, pfo->k_size*sizeof(double), pfo->error_message);

  /** - get P(k,z) as a function of k, for the right z */

  class_call(fourier_pk_at_z(pba,
                             pfo,
                             logarithmic,
                             pk_linear,
                             z,
                             index_pk,
                             out_pk,
                             NULL),
             pfo->error_message,
             pfo->error_message);

  /** - spline it along k */

  class_call(array_spline_table_columns(pfo->ln_k,
                                        pfo->k_size,
                                        out_pk,
                                        1,
                                        ddout_pk,
                                        _SPLINE_EST_DERIV_,
                                        pfo->error_message),
             pfo->error_message,
             pfo->error_message);

  /** - calll the function computing the sigmas */

  class_call(fourier_sigmas(pfo,
                            R,
                            out_pk,
                            ddout_pk,
                            pfo->k_size,
                            ppr->sigma_k_per_decade,
                            sigma_output,
                            result),
             pfo->error_message,
             pfo->error_message);

  /** - free allocated arrays */

  free(out_pk);
  free(ddout_pk);

  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x848, %rsp            # imm = 0x848
movq %r9, 0x30(%rsp)
movl %r8d, 0x14(%rsp)
movl %ecx, %ebp
movsd %xmm1, 0x38(%rsp)
movsd %xmm0, 0x28(%rsp)
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, 0x20(%rsp)
movslq 0x6c(%rdx), %r13
movq %r13, %rbx
shlq $0x3, %rbx
movq %rbx, %rdi
callq 0x8490
testq %rax, %rax
je 0x9a4f1
movq %rax, %r12
movq %rbx, %rdi
callq 0x8490
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x9a535
andq $0x0, (%rsp)
pushq $0x1
popq %rbx
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
xorl %ecx, %ecx
movsd 0x38(%rsp), %xmm0
movl %ebp, %r8d
movq %r12, %r9
callq 0x98198
testl %eax, %eax
je 0x9a589
addq $0x192, %r14            # imm = 0x192
leaq 0x4af36(%rip), %rsi     # 0xe53f0
leaq 0x78d8c(%rip), %rdx     # 0x11324d
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x4ab5a(%rip), %rsi     # 0xe5034
leaq 0x78d4f(%rip), %rdx     # 0x113230
movq %r14, %rdi
movl $0x46f, %ecx            # imm = 0x46F
movq %r15, %r8
jmp 0x9a660
leal (,%r13,8), %ecx
leaq 0x4ab04(%rip), %rsi     # 0xe5004
leaq 0x78d3f(%rip), %rdx     # 0x113246
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x192, %r14            # imm = 0x192
leaq 0x4ab10(%rip), %rsi     # 0xe5034
leaq 0x78d05(%rip), %rdx     # 0x113230
movq %r14, %rdi
movl $0x461, %ecx            # imm = 0x461
jmp 0x9a577
leal (,%r13,8), %ecx
leaq 0x4aac0(%rip), %rsi     # 0xe5004
leaq 0x78cf9(%rip), %rdx     # 0x113244
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x192, %r14            # imm = 0x192
leaq 0x4aacc(%rip), %rsi     # 0xe5034
leaq 0x78cc1(%rip), %rdx     # 0x113230
movq %r14, %rdi
movl $0x462, %ecx            # imm = 0x462
movq %rbx, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rbx
jmp 0x9a667
movq 0x80(%r14), %rdi
movl 0x6c(%r14), %esi
leaq 0x192(%r14), %r15
movq %r15, (%rsp)
pushq $0x1
popq %rbx
movq %r12, %rdx
movl %ebx, %ecx
movq 0x18(%rsp), %r13
movq %r13, %r8
movl %ebx, %r9d
callq 0x139d8
cmpl $0x1, %eax
jne 0x9a5f4
leaq 0x4ae2d(%rip), %rsi     # 0xe53f0
leaq 0x78cd6(%rip), %rdx     # 0x1132a0
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x4aa51(%rip), %rsi     # 0xe5034
leaq 0x78c46(%rip), %rdx     # 0x113230
movq %r15, %rdi
movl $0x47b, %ecx            # imm = 0x47B
jmp 0x9a65d
movl 0x6c(%r14), %ecx
movq 0x20(%rsp), %rax
movsd 0x830(%rax), %xmm1
movq %r14, %rdi
movsd 0x28(%rsp), %xmm0
movq %r12, %rsi
movq %r13, %rdx
movl 0x14(%rsp), %r8d
movq 0x30(%rsp), %r9
callq 0x9a68f
testl %eax, %eax
je 0x9a67b
leaq 0x4adc2(%rip), %rsi     # 0xe53f0
leaq 0x78cca(%rip), %rdx     # 0x1132ff
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x4a9e6(%rip), %rsi     # 0xe5034
leaq 0x78bdb(%rip), %rdx     # 0x113230
movq %r15, %rdi
movl $0x488, %ecx            # imm = 0x488
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
movl %ebx, %eax
addq $0x848, %rsp            # imm = 0x848
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
callq 0x8430
movq %r13, %rdi
callq 0x8430
xorl %ebx, %ebx
jmp 0x9a667