// File: /workspace/github_c_makefile_star2_O1/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 0xa6b76
movq %rax, %r15
movq %r13, %rdi
callq 0x8460
testq %rax, %rax
je 0xa6bb9
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 0x9ff68
testl %eax, %eax
je 0xa6c0b
addq $0x192, %rbx            # imm = 0x192
leaq 0x4a8b1(%rip), %rsi     # 0xf13f0
leaq 0x78827(%rip), %rdx     # 0x11f36d
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x4a4d5(%rip), %rsi     # 0xf1034
leaq 0x7a576(%rip), %rdx     # 0x1210dc
movq %rbx, %rdi
movl $0xb37, %ecx            # imm = 0xB37
movq %r14, %r8
jmp 0xa6c79
leal (,%rbp,8), %ecx
leaq 0x4a480(%rip), %rsi     # 0xf1004
leaq 0x787db(%rip), %rdx     # 0x11f366
leaq 0x30(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x192, %rbx            # imm = 0x192
leaq 0x4a48c(%rip), %rsi     # 0xf1034
leaq 0x7a52d(%rip), %rdx     # 0x1210dc
movq %rbx, %rdi
movl $0xb29, %ecx            # imm = 0xB29
jmp 0xa6bfa
leal (,%rbp,8), %ecx
leaq 0x4a43d(%rip), %rsi     # 0xf1004
leaq 0x78796(%rip), %rdx     # 0x11f364
leaq 0x30(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x192, %rbx            # imm = 0x192
leaq 0x4a449(%rip), %rsi     # 0xf1034
leaq 0x7a4ea(%rip), %rdx     # 0x1210dc
movq %rbx, %rdi
movl $0xb2a, %ecx            # imm = 0xB2A
movq %r14, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %ebp
jmp 0xa6c80
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 0x15654
cmpl $0x1, %eax
jne 0xa6c94
leaq 0x4a7a9(%rip), %rsi     # 0xf13f0
leaq 0x78772(%rip), %rdx     # 0x11f3c0
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x4a3cd(%rip), %rsi     # 0xf1034
leaq 0x7a46e(%rip), %rdx     # 0x1210dc
movq %r12, %rdi
movl $0xb43, %ecx            # imm = 0xB43
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
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 0xa2522
testl %eax, %eax
je 0xa6cfd
leaq 0x4a72a(%rip), %rsi     # 0xf13f0
leaq 0x7a422(%rip), %rdx     # 0x1210ef
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x30c2c
leaq 0x4a34e(%rip), %rsi     # 0xf1034
leaq 0x7a3ef(%rip), %rdx     # 0x1210dc
movq %r12, %rdi
movl $0xb50, %ecx            # imm = 0xB50
movq %rbx, %r8
jmp 0xa6bfd
movq %r15, %rdi
callq 0x8410
movq %r13, %rdi
callq 0x8410
jmp 0xa6c80
nop