// File: /workspace/github_c_makefile_star2_O1/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 0xa237d
movq %rax, %r12
movq %r13, %rdi
callq 0x8460
testq %rax, %rax
je 0xa23c0
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 0x9ff68
testl %eax, %eax
je 0xa2412
addq $0x192, %rbx            # imm = 0x192
leaq 0x4f0aa(%rip), %rsi     # 0xf13f0
leaq 0x7d020(%rip), %rdx     # 0x11f36d
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x4ecce(%rip), %rsi     # 0xf1034
leaq 0x7cfe3(%rip), %rdx     # 0x11f350
movq %rbx, %rdi
movl $0x46f, %ecx            # imm = 0x46F
movq %r14, %r8
jmp 0xa2480
leal (,%rbp,8), %ecx
leaq 0x4ec79(%rip), %rsi     # 0xf1004
leaq 0x7cfd4(%rip), %rdx     # 0x11f366
leaq 0x30(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x192, %rbx            # imm = 0x192
leaq 0x4ec85(%rip), %rsi     # 0xf1034
leaq 0x7cf9a(%rip), %rdx     # 0x11f350
movq %rbx, %rdi
movl $0x461, %ecx            # imm = 0x461
jmp 0xa2401
leal (,%rbp,8), %ecx
leaq 0x4ec36(%rip), %rsi     # 0xf1004
leaq 0x7cf8f(%rip), %rdx     # 0x11f364
leaq 0x30(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x192, %rbx            # imm = 0x192
leaq 0x4ec42(%rip), %rsi     # 0xf1034
leaq 0x7cf57(%rip), %rdx     # 0x11f350
movq %rbx, %rdi
movl $0x462, %ecx            # imm = 0x462
movq %r14, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %ebp
jmp 0xa2487
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 0x15654
cmpl $0x1, %eax
jne 0xa249b
leaq 0x4efa2(%rip), %rsi     # 0xf13f0
leaq 0x7cf6b(%rip), %rdx     # 0x11f3c0
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x4ebc6(%rip), %rsi     # 0xf1034
leaq 0x7cedb(%rip), %rdx     # 0x11f350
movq %r14, %rdi
movl $0x47b, %ecx            # imm = 0x47B
movq %rbx, %r8
xorl %eax, %eax
callq 0x30c2c
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 0xa2522
testl %eax, %eax
je 0xa250b
leaq 0x4ef1c(%rip), %rsi     # 0xf13f0
leaq 0x7cf44(%rip), %rdx     # 0x11f41f
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x4eb40(%rip), %rsi     # 0xf1034
leaq 0x7ce55(%rip), %rdx     # 0x11f350
movq %r14, %rdi
movl $0x488, %ecx            # imm = 0x488
movq %rbx, %r8
jmp 0xa2404
movq %r12, %rdi
callq 0x8410
movq %r13, %rdi
callq 0x8410
xorl %ebp, %ebp
jmp 0xa2487