// File: /workspace/github_c_makefile_star2_O2/PoulinV[P]AxiCLASS/build/../source/transfer.c
// Function: transfer_get_source_correspondence
int transfer_get_source_correspondence(
                                       struct perturbations * ppt,
                                       struct transfer * ptr,
                                       int ** tp_of_tt
                                       ) {
  /** Summary: */
  /** - running index on modes */
  int index_md;

  /** - running index on transfer types */
  int index_tt;

  /** - which source are we considering? Define correspondence
      between transfer types and source types */

  for (index_md = 0; index_md < ptr->md_size; index_md++) {

    class_alloc(tp_of_tt[index_md],ptr->tt_size[index_md]*sizeof(int),ptr->error_message);

    for (index_tt=0; index_tt<ptr->tt_size[index_md]; index_tt++) {

      if (_scalars_) {

        if ((ppt->has_cl_cmb_temperature == _TRUE_) && (index_tt == ptr->index_tt_t0))
          tp_of_tt[index_md][index_tt]=ppt->index_tp_t0;

        if ((ppt->has_cl_cmb_temperature == _TRUE_) && (index_tt == ptr->index_tt_t1))
          tp_of_tt[index_md][index_tt]=ppt->index_tp_t1;

        if ((ppt->has_cl_cmb_temperature == _TRUE_) && (index_tt == ptr->index_tt_t2))
          tp_of_tt[index_md][index_tt]=ppt->index_tp_t2;

        if ((ppt->has_cl_cmb_polarization == _TRUE_) && (index_tt == ptr->index_tt_e))
          tp_of_tt[index_md][index_tt]=ppt->index_tp_p;

        if ((ppt->has_cl_cmb_lensing_potential == _TRUE_) && (index_tt == ptr->index_tt_lcmb))
          tp_of_tt[index_md][index_tt]=ppt->index_tp_phi_plus_psi;

        if (_index_tt_in_range_(ptr->index_tt_density, ppt->selection_num, ppt->has_nc_density))
          /* use here delta_cb rather than delta_m if density number counts calculated only for cold dark matter + baryon */
          /* (this important comment is referenced in a WARNING message in perturbations.c) */
          tp_of_tt[index_md][index_tt]=ppt->index_tp_delta_m;

        if (_index_tt_in_range_(ptr->index_tt_rsd,     ppt->selection_num, ppt->has_nc_rsd))
          tp_of_tt[index_md][index_tt]=ppt->index_tp_theta_m;

        if (_index_tt_in_range_(ptr->index_tt_d0,      ppt->selection_num, ppt->has_nc_rsd))
          tp_of_tt[index_md][index_tt]=ppt->index_tp_theta_m;

        if (_index_tt_in_range_(ptr->index_tt_d1,      ppt->selection_num, ppt->has_nc_rsd))
          tp_of_tt[index_md][index_tt]=ppt->index_tp_theta_m;

        if (_index_tt_in_range_(ptr->index_tt_nc_lens, ppt->selection_num, ppt->has_nc_lens))
          tp_of_tt[index_md][index_tt]=ppt->index_tp_phi_plus_psi;

        if (_index_tt_in_range_(ptr->index_tt_nc_g1,   ppt->selection_num, ppt->has_nc_gr))
          tp_of_tt[index_md][index_tt]=ppt->index_tp_psi;

        if (_index_tt_in_range_(ptr->index_tt_nc_g2,   ppt->selection_num, ppt->has_nc_gr))
          tp_of_tt[index_md][index_tt]=ppt->index_tp_phi;

        if (_index_tt_in_range_(ptr->index_tt_nc_g3,   ppt->selection_num, ppt->has_nc_gr))
          tp_of_tt[index_md][index_tt]=ppt->index_tp_phi_prime;

        if (_index_tt_in_range_(ptr->index_tt_nc_g4,   ppt->selection_num, ppt->has_nc_gr))
          tp_of_tt[index_md][index_tt]=ppt->index_tp_phi_plus_psi;

        if (_index_tt_in_range_(ptr->index_tt_nc_g5,   ppt->selection_num, ppt->has_nc_gr))
          tp_of_tt[index_md][index_tt]=ppt->index_tp_phi_plus_psi;

        if ((ppt->has_cl_lensing_potential == _TRUE_) && (index_tt >= ptr->index_tt_lensing) && (index_tt < ptr->index_tt_lensing+ppt->selection_num))
          tp_of_tt[index_md][index_tt]=ppt->index_tp_phi_plus_psi;

      }

      if (_vectors_) {

        if ((ppt->has_cl_cmb_temperature == _TRUE_) && (index_tt == ptr->index_tt_t1))
          tp_of_tt[index_md][index_tt]=ppt->index_tp_t1;

        if ((ppt->has_cl_cmb_temperature == _TRUE_) && (index_tt == ptr->index_tt_t2))
          tp_of_tt[index_md][index_tt]=ppt->index_tp_t2;

        if ((ppt->has_cl_cmb_polarization == _TRUE_) && (index_tt == ptr->index_tt_e))
          tp_of_tt[index_md][index_tt]=ppt->index_tp_p;

        if ((ppt->has_cl_cmb_polarization == _TRUE_) && (index_tt == ptr->index_tt_b))
          tp_of_tt[index_md][index_tt]=ppt->index_tp_p;
      }

      if (_tensors_) {

        if ((ppt->has_cl_cmb_temperature == _TRUE_) && (index_tt == ptr->index_tt_t2))
          tp_of_tt[index_md][index_tt]=ppt->index_tp_t2;

        if ((ppt->has_cl_cmb_polarization == _TRUE_) && (index_tt == ptr->index_tt_e))
          tp_of_tt[index_md][index_tt]=ppt->index_tp_p;

        if ((ppt->has_cl_cmb_polarization == _TRUE_) && (index_tt == ptr->index_tt_b))
          tp_of_tt[index_md][index_tt]=ppt->index_tp_p;
      }
    }
  }

  return _SUCCESS_;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x808, %rsp            # imm = 0x808
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r12
movl 0x8a4(%rsi), %r13d
xorl %r14d, %r14d
testl %r13d, %r13d
cmovlel %r14d, %r13d
xorl %ebp, %ebp
cmpq %r13, %rbp
je 0xa0ac3
movq 0x8f0(%rbx), %rax
movslq (%rax,%rbp,4), %rdi
shlq $0x2, %rdi
callq 0x8490
movq %rax, (%r15,%rbp,8)
movq 0x8f0(%rbx), %rcx
testq %rax, %rax
je 0xa0a77
xorl %edx, %edx
movslq (%rcx,%rbp,4), %rsi
cmpq %rsi, %rdx
jge 0xa0a6f
cmpw $0x1, 0xe(%r12)
jne 0xa097d
movl 0x848(%r12), %esi
cmpq %rsi, %rbp
jne 0xa097d
cmpw $0x1, 0x28(%r12)
jne 0xa0782
movl 0x8a8(%rbx), %esi
cmpq %rsi, %rdx
jne 0xa0756
movl 0x8c8(%r12), %esi
movl %esi, (%rax,%rdx,4)
movl 0x8ac(%rbx), %esi
cmpq %rsi, %rdx
jne 0xa076c
movl 0x8cc(%r12), %esi
movl %esi, (%rax,%rdx,4)
movl 0x8b0(%rbx), %esi
cmpq %rsi, %rdx
jne 0xa0782
movl 0x8d0(%r12), %esi
movl %esi, (%rax,%rdx,4)
cmpw $0x1, 0x2a(%r12)
jne 0xa07a1
movl 0x8b4(%rbx), %esi
cmpq %rsi, %rdx
jne 0xa07a1
movl 0x8d4(%r12), %esi
movl %esi, (%rax,%rdx,4)
cmpw $0x1, 0x2c(%r12)
jne 0xa07c0
movl 0x8bc(%rbx), %esi
cmpq %rsi, %rdx
jne 0xa07c0
movl 0x978(%r12), %esi
movl %esi, (%rax,%rdx,4)
cmpw $0x1, 0x3e(%r12)
jne 0xa07ed
movslq 0x8c0(%rbx), %rsi
cmpq %rsi, %rdx
jl 0xa07ed
movslq 0x64(%r12), %rdi
addq %rsi, %rdi
cmpq %rdi, %rdx
jge 0xa07ed
movl 0x8d8(%r12), %esi
movl %esi, (%rax,%rdx,4)
cmpw $0x1, 0x40(%r12)
jne 0xa0862
movslq 0x8c8(%rbx), %rsi
cmpq %rsi, %rdx
jl 0xa081a
movslq 0x64(%r12), %rdi
addq %rsi, %rdi
cmpq %rdi, %rdx
jge 0xa081a
movl 0x934(%r12), %esi
movl %esi, (%rax,%rdx,4)
movslq 0x8cc(%rbx), %rsi
cmpq %rsi, %rdx
jl 0xa083e
movslq 0x64(%r12), %rdi
addq %rsi, %rdi
cmpq %rdi, %rdx
jge 0xa083e
movl 0x934(%r12), %esi
movl %esi, (%rax,%rdx,4)
movslq 0x8d0(%rbx), %rsi
cmpq %rsi, %rdx
jl 0xa0862
movslq 0x64(%r12), %rdi
addq %rsi, %rdi
cmpq %rdi, %rdx
jge 0xa0862
movl 0x934(%r12), %esi
movl %esi, (%rax,%rdx,4)
cmpw $0x1, 0x42(%r12)
jne 0xa088f
movslq 0x8d4(%rbx), %rsi
cmpq %rsi, %rdx
jl 0xa088f
movslq 0x64(%r12), %rdi
addq %rsi, %rdi
cmpq %rdi, %rdx
jge 0xa088f
movl 0x978(%r12), %esi
movl %esi, (%rax,%rdx,4)
cmpw $0x1, 0x44(%r12)
jne 0xa0950
movslq 0x8d8(%rbx), %rsi
cmpq %rsi, %rdx
jl 0xa08c0
movslq 0x64(%r12), %rdi
addq %rsi, %rdi
cmpq %rdi, %rdx
jge 0xa08c0
movl 0x97c(%r12), %esi
movl %esi, (%rax,%rdx,4)
movslq 0x8dc(%rbx), %rsi
cmpq %rsi, %rdx
jl 0xa08e4
movslq 0x64(%r12), %rdi
addq %rsi, %rdi
cmpq %rdi, %rdx
jge 0xa08e4
movl 0x970(%r12), %esi
movl %esi, (%rax,%rdx,4)
movslq 0x8e0(%rbx), %rsi
cmpq %rsi, %rdx
jl 0xa0908
movslq 0x64(%r12), %rdi
addq %rsi, %rdi
cmpq %rdi, %rdx
jge 0xa0908
movl 0x974(%r12), %esi
movl %esi, (%rax,%rdx,4)
movslq 0x8e4(%rbx), %rsi
cmpq %rsi, %rdx
jl 0xa092c
movslq 0x64(%r12), %rdi
addq %rsi, %rdi
cmpq %rdi, %rdx
jge 0xa092c
movl 0x978(%r12), %esi
movl %esi, (%rax,%rdx,4)
movslq 0x8e8(%rbx), %rsi
cmpq %rsi, %rdx
jl 0xa0950
movslq 0x64(%r12), %rdi
addq %rsi, %rdi
cmpq %rdi, %rdx
jge 0xa0950
movl 0x978(%r12), %esi
movl %esi, (%rax,%rdx,4)
cmpw $0x1, 0x2e(%r12)
jne 0xa097d
movslq 0x8c4(%rbx), %rsi
cmpq %rsi, %rdx
jl 0xa097d
movslq 0x64(%r12), %rdi
addq %rsi, %rdi
cmpq %rdi, %rdx
jge 0xa097d
movl 0x978(%r12), %esi
movl %esi, (%rax,%rdx,4)
cmpw $0x1, 0x10(%r12)
jne 0xa09fd
movl 0x850(%r12), %esi
cmpq %rsi, %rbp
jne 0xa09fd
cmpw $0x1, 0x28(%r12)
jne 0xa09c8
movl 0x8ac(%rbx), %esi
cmpq %rsi, %rdx
jne 0xa09b2
movl 0x8cc(%r12), %esi
movl %esi, (%rax,%rdx,4)
movl 0x8b0(%rbx), %esi
cmpq %rsi, %rdx
jne 0xa09c8
movl 0x8d0(%r12), %esi
movl %esi, (%rax,%rdx,4)
cmpw $0x1, 0x2a(%r12)
jne 0xa09fd
movl 0x8b4(%rbx), %esi
cmpq %rsi, %rdx
jne 0xa09e7
movl 0x8d4(%r12), %esi
movl %esi, (%rax,%rdx,4)
movl 0x8b8(%rbx), %esi
cmpq %rsi, %rdx
jne 0xa09fd
movl 0x8d4(%r12), %esi
movl %esi, (%rax,%rdx,4)
cmpw $0x1, 0x12(%r12)
jne 0xa0a67
movl 0x84c(%r12), %esi
cmpq %rsi, %rbp
jne 0xa0a67
cmpw $0x1, 0x28(%r12)
jne 0xa0a32
movl 0x8b0(%rbx), %esi
cmpq %rsi, %rdx
jne 0xa0a32
movl 0x8d0(%r12), %esi
movl %esi, (%rax,%rdx,4)
cmpw $0x1, 0x2a(%r12)
jne 0xa0a67
movl 0x8b4(%rbx), %esi
cmpq %rsi, %rdx
jne 0xa0a51
movl 0x8d4(%r12), %esi
movl %esi, (%rax,%rdx,4)
movl 0x8b8(%rbx), %esi
cmpq %rsi, %rdx
jne 0xa0a67
movl 0x8d4(%r12), %esi
movl %esi, (%rax,%rdx,4)
incq %rdx
jmp 0xa070c
incq %rbp
jmp 0xa06d9
movl (%rcx,%rbp,4), %ecx
shll $0x2, %ecx
leaq 0x44580(%rip), %rsi     # 0xe5004
leaq 0x75574(%rip), %rdx     # 0x115fff
movq %rsp, %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x4458e(%rip), %rsi     # 0xe5034
leaq 0x75565(%rip), %rdx     # 0x116012
movq %rbx, %rdi
movl $0x5e1, %ecx            # imm = 0x5E1
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %r14
movl %r14d, %eax
addq $0x808, %rsp            # imm = 0x808
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq