// File: /workspace/github_c_makefile_star2_O2/PoulinV[P]AxiCLASS/build/../source/perturbations.c
// Function: perturbations_sources_at_k_and_z
int perturbations_sources_at_k_and_z(
                                     struct background * pba,
                                     struct perturbations * ppt,
                                     int index_md,
                                     int index_ic,
                                     int index_tp,
                                     double k,
                                     double z,
                                     double * psource_at_k_and_z
                                     ) {

  double * sources;
  double * ddsources_dk2;
  int last_index;

  class_alloc(sources,
              ppt->k_size[index_md]*sizeof(double),
              ppt->error_message);

  class_alloc(ddsources_dk2,
              ppt->k_size[index_md]*sizeof(double),
              ppt->error_message);

  class_call(perturbations_sources_at_z(pba,ppt,index_md,index_ic,index_tp,z,sources),
             ppt->error_message,
             ppt->error_message);

  class_call(array_spline_table_lines(ppt->k[index_md],
                                      ppt->k_size[index_md],
                                      sources,
                                      1,
                                      ddsources_dk2,
                                      _SPLINE_EST_DERIV_,
                                      ppt->error_message),
             ppt->error_message,
             ppt->error_message);

  class_call(array_interpolate_spline(ppt->k[index_md],
                                      ppt->k_size[index_md],
                                      sources,
                                      ddsources_dk2,
                                      1,
                                      k,
                                      &last_index,
                                      psource_at_k_and_z,
                                      1,
                                      ppt->error_message),
             ppt->error_message,
             ppt->error_message);

  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x838, %rsp            # imm = 0x838
movq %r9, 0x10(%rsp)
movsd %xmm1, 0x20(%rsp)
movsd %xmm0, 0x8(%rsp)
movl %r8d, 0x4(%rsp)
movl %ecx, (%rsp)
movl %edx, %r14d
movq %rsi, %rbx
movq %rdi, 0x18(%rsp)
movq 0x9c8(%rsi), %rax
movslq %edx, %r15
movslq (%rax,%r15,4), %r13
movq %r13, %rbp
shlq $0x3, %rbp
movq %rbp, %rdi
callq 0x8490
testq %rax, %rax
je 0x6d516
movq %rax, %r12
movq %rbp, %rdi
callq 0x8490
testq %rax, %rax
je 0x6d55a
movq %rax, %rbp
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
movl %r14d, %edx
movl (%rsp), %ecx
movl 0x4(%rsp), %r8d
movsd 0x20(%rsp), %xmm0
movq %r12, %r9
callq 0x6d344
testl %eax, %eax
je 0x6d5bd
addq $0x6c8a, %rbx           # imm = 0x6C8A
leaq 0x77f0e(%rip), %rsi     # 0xe53f0
leaq 0x9c85c(%rip), %rdx     # 0x109d45
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x77b32(%rip), %rsi     # 0xe5034
leaq 0x9c80d(%rip), %rdx     # 0x109d16
movq %rbx, %rdi
movl $0xcc, %ecx
jmp 0x6d59c
leal (,%r13,8), %ecx
leaq 0x77adf(%rip), %rsi     # 0xe5004
leaq 0xa1c4b(%rip), %rdx     # 0x10f177
leaq 0x30(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x6c8a, %rbx           # imm = 0x6C8A
leaq 0x77aeb(%rip), %rsi     # 0xe5034
leaq 0x9c7c6(%rip), %rdx     # 0x109d16
movq %rbx, %rdi
movl $0xc4, %ecx
jmp 0x6d59c
leal (,%r13,8), %ecx
leaq 0x77a9b(%rip), %rsi     # 0xe5004
leaq 0x9c7c7(%rip), %rdx     # 0x109d37
leaq 0x30(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x6c8a, %rbx           # imm = 0x6C8A
leaq 0x77aa7(%rip), %rsi     # 0xe5034
leaq 0x9c782(%rip), %rdx     # 0x109d16
movq %rbx, %rdi
movl $0xc8, %ecx
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x838, %rsp            # imm = 0x838
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x9c8(%rbx), %rax
movq 0x9d0(%rbx), %rcx
movq (%rcx,%r15,8), %rdi
movl (%rax,%r15,4), %esi
leaq 0x6c8a(%rbx), %r13
subq $0x8, %rsp
movq %rbp, %r14
pushq $0x1
popq %rbp
movq %r12, %rdx
movl %ebp, %ecx
movq %r14, %r8
movl %ebp, %r9d
pushq %r13
callq 0x125a5
popq %rcx
popq %rdx
cmpl $0x1, %eax
jne 0x6d642
leaq 0x77dec(%rip), %rsi     # 0xe53f0
leaq 0x9c783(%rip), %rdx     # 0x109d8e
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x77a10(%rip), %rsi     # 0xe5034
leaq 0x9c6eb(%rip), %rdx     # 0x109d16
movq %r13, %rdi
movl $0xd6, %ecx
movq %rbx, %r8
xorl %eax, %eax
callq 0x2e014
jmp 0x6d5a9
movq 0x9c8(%rbx), %rax
movq 0x9d0(%rbx), %rcx
movq (%rcx,%r15,8), %rdi
movl (%rax,%r15,4), %esi
subq $0x8, %rsp
pushq $0x1
popq %rbx
leaq 0x34(%rsp), %r9
movq %r12, %rdx
movq %r14, %rcx
movl %ebx, %r8d
movsd 0x10(%rsp), %xmm0
pushq %r13
pushq $0x1
pushq 0x28(%rsp)
callq 0x1604b
addq $0x20, %rsp
xorl %ebp, %ebp
cmpl $0x1, %eax
jne 0x6d5a9
leaq 0x77d5a(%rip), %rsi     # 0xe53f0
leaq 0x9c765(%rip), %rdx     # 0x109e02
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %r13, %rcx
xorl %eax, %eax
callq 0x2e014
leaq 0x7797e(%rip), %rsi     # 0xe5034
leaq 0x9c659(%rip), %rdx     # 0x109d16
movq %r13, %rdi
movl $0xe3, %ecx
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
movl %ebx, %ebp
jmp 0x6d5a9