// File: /workspace/github_c_makefile_star2_O3/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 0x8460
testq %rax, %rax
je 0x71b5d
movq %rax, %r12
movq %rbp, %rdi
callq 0x8460
testq %rax, %rax
je 0x71ba1
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 0x71989
testl %eax, %eax
je 0x71c06
addq $0x6c8a, %rbx           # imm = 0x6C8A
leaq 0x7c8c7(%rip), %rsi     # 0xee3f0
leaq 0xa1375(%rip), %rdx     # 0x112ea5
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x7c4eb(%rip), %rsi     # 0xee034
leaq 0xa1326(%rip), %rdx     # 0x112e76
movq %rbx, %rdi
movl $0xcc, %ecx
jmp 0x71be3
leal (,%r13,8), %ecx
leaq 0x7c498(%rip), %rsi     # 0xee004
leaq 0xa6764(%rip), %rdx     # 0x1182d7
leaq 0x30(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x6c8a, %rbx           # imm = 0x6C8A
leaq 0x7c4a4(%rip), %rsi     # 0xee034
leaq 0xa12df(%rip), %rdx     # 0x112e76
movq %rbx, %rdi
movl $0xc4, %ecx
jmp 0x71be3
leal (,%r13,8), %ecx
leaq 0x7c454(%rip), %rsi     # 0xee004
leaq 0xa12e0(%rip), %rdx     # 0x112e97
leaq 0x30(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x6c8a, %rbx           # imm = 0x6C8A
leaq 0x7c460(%rip), %rsi     # 0xee034
leaq 0xa129b(%rip), %rdx     # 0x112e76
movq %rbx, %rdi
movl $0xc8, %ecx
movq %r14, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %ebp
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), %r14
subq $0x8, %rsp
movq %rbp, %r13
movl $0x1, %ebp
movq %r12, %rdx
movl $0x1, %ecx
movq %r13, %r8
movl $0x1, %r9d
pushq %r14
callq 0x142a8
addq $0x10, %rsp
cmpl $0x1, %eax
jne 0x71c95
leaq 0x7c799(%rip), %rsi     # 0xee3f0
leaq 0xa1290(%rip), %rdx     # 0x112eee
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x7c3bd(%rip), %rsi     # 0xee034
leaq 0xa11f8(%rip), %rdx     # 0x112e76
movq %r14, %rdi
movl $0xd6, %ecx
movq %rbx, %r8
xorl %eax, %eax
callq 0x30af0
jmp 0x71bf2
movq 0x9c8(%rbx), %rax
movq 0x9d0(%rbx), %rcx
movq (%rcx,%r15,8), %rdi
movl (%rax,%r15,4), %esi
subq $0x8, %rsp
leaq 0x34(%rsp), %r9
movq %r12, %rdx
movq %r13, %rcx
movl $0x1, %r8d
movsd 0x10(%rsp), %xmm0
pushq %r14
pushq $0x1
pushq 0x28(%rsp)
callq 0x18071
addq $0x20, %rsp
xorl %ebp, %ebp
cmpl $0x1, %eax
jne 0x71bf2
leaq 0x7c707(%rip), %rsi     # 0xee3f0
leaq 0xa1272(%rip), %rdx     # 0x112f62
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
leaq 0x7c32b(%rip), %rsi     # 0xee034
leaq 0xa1166(%rip), %rdx     # 0x112e76
movq %r14, %rdi
movl $0xe3, %ecx
movq %rbx, %r8
jmp 0x71be6