// File: /workspace/github_c_makefile_star2_O3/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 $0x838, %rsp            # imm = 0x838
movq %r9, 0x20(%rsp)
movl %r8d, 0xc(%rsp)
movl %ecx, %r15d
movsd %xmm1, 0x28(%rsp)
movsd %xmm0, 0x18(%rsp)
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, 0x10(%rsp)
movslq 0x6c(%rdx), %rbp
movq %rbp, %r13
shlq $0x3, %r13
movq %r13, %rdi
callq 0x8460
testq %rax, %rax
je 0x9f4ab
movq %rax, %r12
movq %r13, %rdi
callq 0x8460
testq %rax, %rax
je 0x9f4ee
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 %r15d, %r8d
movq %r12, %r9
callq 0x9d04c
testl %eax, %eax
je 0x9f540
addq $0x192, %rbx            # imm = 0x192
leaq 0x4ef7c(%rip), %rsi     # 0xee3f0
leaq 0x7cf32(%rip), %rdx     # 0x11c3ad
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x4eba0(%rip), %rsi     # 0xee034
leaq 0x7cef5(%rip), %rdx     # 0x11c390
movq %rbx, %rdi
movl $0x46f, %ecx            # imm = 0x46F
movq %r14, %r8
jmp 0x9f5ae
leal (,%rbp,8), %ecx
leaq 0x4eb4b(%rip), %rsi     # 0xee004
leaq 0x7cee6(%rip), %rdx     # 0x11c3a6
leaq 0x30(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x192, %rbx            # imm = 0x192
leaq 0x4eb57(%rip), %rsi     # 0xee034
leaq 0x7ceac(%rip), %rdx     # 0x11c390
movq %rbx, %rdi
movl $0x461, %ecx            # imm = 0x461
jmp 0x9f52f
leal (,%rbp,8), %ecx
leaq 0x4eb08(%rip), %rsi     # 0xee004
leaq 0x7cea1(%rip), %rdx     # 0x11c3a4
leaq 0x30(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x192, %rbx            # imm = 0x192
leaq 0x4eb14(%rip), %rsi     # 0xee034
leaq 0x7ce69(%rip), %rdx     # 0x11c390
movq %rbx, %rdi
movl $0x462, %ecx            # imm = 0x462
movq %r14, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %ebp
jmp 0x9f5b5
movq 0x80(%rbx), %rdi
movl 0x6c(%rbx), %esi
leaq 0x192(%rbx), %r14
movq %r14, (%rsp)
movl $0x1, %ebp
movq %r12, %rdx
movl $0x1, %ecx
movq %r13, %r8
movl $0x1, %r9d
callq 0x1577e
cmpl $0x1, %eax
jne 0x9f5c9
leaq 0x4ee74(%rip), %rsi     # 0xee3f0
leaq 0x7ce7d(%rip), %rdx     # 0x11c400
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x4ea98(%rip), %rsi     # 0xee034
leaq 0x7cded(%rip), %rdx     # 0x11c390
movq %r14, %rdi
movl $0x47b, %ecx            # imm = 0x47B
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
movq 0x10(%rsp), %rax
movsd 0x830(%rax), %xmm1
movq %rbx, %rdi
movsd 0x18(%rsp), %xmm0
movq %r12, %rsi
movq %r13, %rdx
movl 0xc(%rsp), %r8d
movq 0x20(%rsp), %r9
callq 0x9f650
testl %eax, %eax
je 0x9f639
leaq 0x4edee(%rip), %rsi     # 0xee3f0
leaq 0x7ce56(%rip), %rdx     # 0x11c45f
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x4ea12(%rip), %rsi     # 0xee034
leaq 0x7cd67(%rip), %rdx     # 0x11c390
movq %r14, %rdi
movl $0x488, %ecx            # imm = 0x488
movq %rbx, %r8
jmp 0x9f532
movq %r12, %rdi
callq 0x8410
movq %r13, %rdi
callq 0x8410
xorl %ebp, %ebp
jmp 0x9f5b5