// File: /workspace/github_c_makefile_star2_O3/PoulinV[P]AxiCLASS/build/../source/fourier.c
// Function: fourier_sigma_at_z
int fourier_sigma_at_z(
                       struct background * pba,
                       struct fourier * pfo,
                       double R,
                       double z,
                       int index_pk,
                       double k_per_decade,
                       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,
                            k_per_decade,
                            out_sigma,
                            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 $0x838, %rsp            # imm = 0x838
movq %rcx, 0x20(%rsp)
movsd %xmm2, 0x18(%rsp)
movl %edx, %r12d
movsd %xmm1, 0x28(%rsp)
movsd %xmm0, 0x10(%rsp)
movq %rsi, %rbx
movq %rdi, %r14
movslq 0x6c(%rsi), %rbp
movq %rbp, %r13
shlq $0x3, %r13
movq %r13, %rdi
callq 0x8460
testq %rax, %rax
je 0xa3cd9
movq %rax, %r15
movq %r13, %rdi
callq 0x8460
testq %rax, %rax
je 0xa3d1c
movq %rax, %r13
movq $0x0, (%rsp)
movl $0x1, %ebp
movq %r14, %rdi
movq %rbx, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
movsd 0x28(%rsp), %xmm0
movl %r12d, %r8d
movq %r15, %r9
callq 0x9d04c
testl %eax, %eax
je 0xa3d6e
addq $0x192, %rbx            # imm = 0x192
leaq 0x4a74e(%rip), %rsi     # 0xee3f0
leaq 0x78704(%rip), %rdx     # 0x11c3ad
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x4a372(%rip), %rsi     # 0xee034
leaq 0x7a453(%rip), %rdx     # 0x11e11c
movq %rbx, %rdi
movl $0xb37, %ecx            # imm = 0xB37
movq %r14, %r8
jmp 0xa3ddc
leal (,%rbp,8), %ecx
leaq 0x4a31d(%rip), %rsi     # 0xee004
leaq 0x786b8(%rip), %rdx     # 0x11c3a6
leaq 0x30(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x192, %rbx            # imm = 0x192
leaq 0x4a329(%rip), %rsi     # 0xee034
leaq 0x7a40a(%rip), %rdx     # 0x11e11c
movq %rbx, %rdi
movl $0xb29, %ecx            # imm = 0xB29
jmp 0xa3d5d
leal (,%rbp,8), %ecx
leaq 0x4a2da(%rip), %rsi     # 0xee004
leaq 0x78673(%rip), %rdx     # 0x11c3a4
leaq 0x30(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x192, %rbx            # imm = 0x192
leaq 0x4a2e6(%rip), %rsi     # 0xee034
leaq 0x7a3c7(%rip), %rdx     # 0x11e11c
movq %rbx, %rdi
movl $0xb2a, %ecx            # imm = 0xB2A
movq %r14, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %ebp
jmp 0xa3de3
movq 0x80(%rbx), %rdi
movl 0x6c(%rbx), %esi
leaq 0x192(%rbx), %r12
movq %r12, (%rsp)
movl $0x1, %ebp
movq %r15, %rdx
movl $0x1, %ecx
movq %r13, %r8
movl $0x1, %r9d
callq 0x1577e
cmpl $0x1, %eax
jne 0xa3df7
leaq 0x4a646(%rip), %rsi     # 0xee3f0
leaq 0x7864f(%rip), %rdx     # 0x11c400
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x4a26a(%rip), %rsi     # 0xee034
leaq 0x7a34b(%rip), %rdx     # 0x11e11c
movq %r12, %rdi
movl $0xb43, %ecx            # imm = 0xB43
movq %rbx, %r8
xorl %eax, %eax
callq 0x30af0
movl %ebp, %eax
addq $0x838, %rsp            # imm = 0x838
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x6c(%rbx), %ecx
xorl %ebp, %ebp
movq %rbx, %rdi
movsd 0x10(%rsp), %xmm0
movq %r15, %rsi
movq %r13, %rdx
movsd 0x18(%rsp), %xmm1
xorl %r8d, %r8d
movq 0x20(%rsp), %r9
callq 0x9f650
testl %eax, %eax
je 0xa3e60
leaq 0x4a5c7(%rip), %rsi     # 0xee3f0
leaq 0x7a2ff(%rip), %rdx     # 0x11e12f
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x4a1eb(%rip), %rsi     # 0xee034
leaq 0x7a2cc(%rip), %rdx     # 0x11e11c
movq %r12, %rdi
movl $0xb50, %ecx            # imm = 0xB50
movq %rbx, %r8
jmp 0xa3d60
movq %r15, %rdi
callq 0x8410
movq %r13, %rdi
callq 0x8410
jmp 0xa3de3
nopl (%rax)