// File: /workspace/github_c_makefile_star2_O2/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, %r13d
movsd %xmm1, 0x28(%rsp)
movsd %xmm0, 0x10(%rsp)
movq %rsi, %r14
movq %rdi, %r15
movslq 0x6c(%rsi), %rbp
movq %rbp, %rbx
shlq $0x3, %rbx
movq %rbx, %rdi
callq 0x8490
testq %rax, %rax
je 0x9eafa
movq %rax, %r12
movq %rbx, %rdi
callq 0x8490
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x9eb3d
andq $0x0, (%rsp)
pushq $0x1
popq %rbx
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
xorl %ecx, %ecx
movsd 0x28(%rsp), %xmm0
movl %r13d, %r8d
movq %r12, %r9
callq 0x98198
testl %eax, %eax
je 0x9eb90
addq $0x192, %r14            # imm = 0x192
leaq 0x4692d(%rip), %rsi     # 0xe53f0
leaq 0x74783(%rip), %rdx     # 0x11324d
leaq 0x30(%rsp), %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x46551(%rip), %rsi     # 0xe5034
leaq 0x764d2(%rip), %rdx     # 0x114fbc
movq %r14, %rdi
movl $0xb37, %ecx            # imm = 0xB37
movq %r15, %r8
jmp 0x9ec5e
leal (,%rbp,8), %ecx
leaq 0x464fc(%rip), %rsi     # 0xe5004
leaq 0x74737(%rip), %rdx     # 0x113246
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x192, %r14            # imm = 0x192
leaq 0x46508(%rip), %rsi     # 0xe5034
leaq 0x76489(%rip), %rdx     # 0x114fbc
movq %r14, %rdi
movl $0xb29, %ecx            # imm = 0xB29
jmp 0x9eb7e
leal (,%rbp,8), %ecx
leaq 0x464b9(%rip), %rsi     # 0xe5004
leaq 0x746f2(%rip), %rdx     # 0x113244
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x192, %r14            # imm = 0x192
leaq 0x464c5(%rip), %rsi     # 0xe5034
leaq 0x76446(%rip), %rdx     # 0x114fbc
movq %r14, %rdi
movl $0xb2a, %ecx            # imm = 0xB2A
movq %rbx, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rbx
jmp 0x9ec65
movq 0x80(%r14), %rdi
movl 0x6c(%r14), %esi
leaq 0x192(%r14), %r13
movq %r13, (%rsp)
pushq $0x1
popq %rbx
movq %r12, %rdx
movl %ebx, %ecx
movq 0x8(%rsp), %r15
movq %r15, %r8
movl %ebx, %r9d
callq 0x139d8
cmpl $0x1, %eax
jne 0x9ebfb
leaq 0x46826(%rip), %rsi     # 0xe53f0
leaq 0x746cf(%rip), %rdx     # 0x1132a0
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %r13, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x4644a(%rip), %rsi     # 0xe5034
leaq 0x763cb(%rip), %rdx     # 0x114fbc
movq %r13, %rdi
movl $0xb43, %ecx            # imm = 0xB43
jmp 0x9ec5b
movl 0x6c(%r14), %ecx
movq %r14, %rdi
movsd 0x10(%rsp), %xmm0
movq %r12, %rsi
movq %r15, %rdx
movsd 0x18(%rsp), %xmm1
xorl %r8d, %r8d
movq 0x20(%rsp), %r9
callq 0x9a68f
testl %eax, %eax
je 0x9ec79
leaq 0x467c4(%rip), %rsi     # 0xe53f0
leaq 0x7639c(%rip), %rdx     # 0x114fcf
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %r13, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x463e8(%rip), %rsi     # 0xe5034
leaq 0x76369(%rip), %rdx     # 0x114fbc
movq %r13, %rdi
movl $0xb50, %ecx            # imm = 0xB50
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
movl %ebx, %eax
addq $0x838, %rsp            # imm = 0x838
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
callq 0x8430
movq %r15, %rdi
callq 0x8430
xorl %ebx, %ebx
jmp 0x9ec65
nopl (%rax)