// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x800, %rsp            # imm = 0x800
movslq 0x8a4(%rsi), %r12
testq %r12, %r12
jle 0xa5a5e
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movq 0x8f0(%rsi), %rdx
xorl %r13d, %r13d
movslq (%rdx,%r13,4), %rdi
shlq $0x2, %rdi
callq 0x8460
movq %rax, (%r14,%r13,8)
movq 0x8f0(%rbx), %rdx
movl (%rdx,%r13,4), %ecx
testq %rax, %rax
je 0xa5a62
testl %ecx, %ecx
jle 0xa5a52
movzwl 0xe(%r15), %ecx
movzwl 0x10(%r15), %esi
movzwl 0x12(%r15), %edi
xorl %r8d, %r8d
cmpw $0x1, %cx
jne 0xa595d
movl 0x848(%r15), %r9d
cmpq %r9, %r13
jne 0xa595d
cmpw $0x1, 0x28(%r15)
jne 0xa5772
movl 0x8a8(%rbx), %r9d
cmpq %r9, %r8
jne 0xa5744
movl 0x8c8(%r15), %r9d
movl %r9d, (%rax,%r8,4)
movl 0x8ac(%rbx), %r9d
cmpq %r9, %r8
jne 0xa575b
movl 0x8cc(%r15), %r9d
movl %r9d, (%rax,%r8,4)
movl 0x8b0(%rbx), %r9d
cmpq %r9, %r8
jne 0xa5772
movl 0x8d0(%r15), %r9d
movl %r9d, (%rax,%r8,4)
cmpw $0x1, 0x2a(%r15)
jne 0xa5791
movl 0x8b4(%rbx), %r9d
cmpq %r9, %r8
jne 0xa5791
movl 0x8d4(%r15), %r9d
movl %r9d, (%rax,%r8,4)
cmpw $0x1, 0x2c(%r15)
jne 0xa57b0
movl 0x8bc(%rbx), %r9d
cmpq %r9, %r8
jne 0xa57b0
movl 0x978(%r15), %r9d
movl %r9d, (%rax,%r8,4)
cmpw $0x1, 0x3e(%r15)
jne 0xa57db
movslq 0x8c0(%rbx), %r9
cmpq %r9, %r8
jl 0xa57db
movslq 0x64(%r15), %r10
addq %r9, %r10
cmpq %r10, %r8
jge 0xa57db
movl 0x8d8(%r15), %r9d
movl %r9d, (%rax,%r8,4)
cmpw $0x1, 0x40(%r15)
jne 0xa584c
movslq 0x8c8(%rbx), %r9
cmpq %r9, %r8
jl 0xa5806
movslq 0x64(%r15), %r10
addq %r9, %r10
cmpq %r10, %r8
jge 0xa5806
movl 0x934(%r15), %r9d
movl %r9d, (%rax,%r8,4)
movslq 0x8cc(%rbx), %r9
cmpq %r9, %r8
jl 0xa5829
movslq 0x64(%r15), %r10
addq %r9, %r10
cmpq %r10, %r8
jge 0xa5829
movl 0x934(%r15), %r9d
movl %r9d, (%rax,%r8,4)
movslq 0x8d0(%rbx), %r9
cmpq %r9, %r8
jl 0xa584c
movslq 0x64(%r15), %r10
addq %r9, %r10
cmpq %r10, %r8
jge 0xa584c
movl 0x934(%r15), %r9d
movl %r9d, (%rax,%r8,4)
cmpw $0x1, 0x42(%r15)
jne 0xa5877
movslq 0x8d4(%rbx), %r9
cmpq %r9, %r8
jl 0xa5877
movslq 0x64(%r15), %r10
addq %r9, %r10
cmpq %r10, %r8
jge 0xa5877
movl 0x978(%r15), %r9d
movl %r9d, (%rax,%r8,4)
cmpw $0x1, 0x44(%r15)
jne 0xa5932
movslq 0x8d8(%rbx), %r9
cmpq %r9, %r8
jl 0xa58a6
movslq 0x64(%r15), %r10
addq %r9, %r10
cmpq %r10, %r8
jge 0xa58a6
movl 0x97c(%r15), %r9d
movl %r9d, (%rax,%r8,4)
movslq 0x8dc(%rbx), %r9
cmpq %r9, %r8
jl 0xa58c9
movslq 0x64(%r15), %r10
addq %r9, %r10
cmpq %r10, %r8
jge 0xa58c9
movl 0x970(%r15), %r9d
movl %r9d, (%rax,%r8,4)
movslq 0x8e0(%rbx), %r9
cmpq %r9, %r8
jl 0xa58ec
movslq 0x64(%r15), %r10
addq %r9, %r10
cmpq %r10, %r8
jge 0xa58ec
movl 0x974(%r15), %r9d
movl %r9d, (%rax,%r8,4)
movslq 0x8e4(%rbx), %r9
cmpq %r9, %r8
jl 0xa590f
movslq 0x64(%r15), %r10
addq %r9, %r10
cmpq %r10, %r8
jge 0xa590f
movl 0x978(%r15), %r9d
movl %r9d, (%rax,%r8,4)
movslq 0x8e8(%rbx), %r9
cmpq %r9, %r8
jl 0xa5932
movslq 0x64(%r15), %r10
addq %r9, %r10
cmpq %r10, %r8
jge 0xa5932
movl 0x978(%r15), %r9d
movl %r9d, (%rax,%r8,4)
cmpw $0x1, 0x2e(%r15)
jne 0xa595d
movslq 0x8c4(%rbx), %r9
cmpq %r9, %r8
jl 0xa595d
movslq 0x64(%r15), %r10
addq %r9, %r10
cmpq %r10, %r8
jge 0xa595d
movl 0x978(%r15), %r9d
movl %r9d, (%rax,%r8,4)
cmpw $0x1, %si
jne 0xa59db
movl 0x850(%r15), %r9d
cmpq %r9, %r13
jne 0xa59db
cmpw $0x1, 0x28(%r15)
jne 0xa59a5
movl 0x8ac(%rbx), %r9d
cmpq %r9, %r8
jne 0xa598e
movl 0x8cc(%r15), %r9d
movl %r9d, (%rax,%r8,4)
movl 0x8b0(%rbx), %r9d
cmpq %r9, %r8
jne 0xa59a5
movl 0x8d0(%r15), %r9d
movl %r9d, (%rax,%r8,4)
cmpw $0x1, 0x2a(%r15)
jne 0xa59db
movl 0x8b4(%rbx), %r9d
cmpq %r9, %r8
jne 0xa59c4
movl 0x8d4(%r15), %r9d
movl %r9d, (%rax,%r8,4)
movl 0x8b8(%rbx), %r9d
cmpq %r9, %r8
jne 0xa59db
movl 0x8d4(%r15), %r9d
movl %r9d, (%rax,%r8,4)
cmpw $0x1, %di
jne 0xa5a42
movl 0x84c(%r15), %r9d
cmpq %r9, %r13
jne 0xa5a42
cmpw $0x1, 0x28(%r15)
jne 0xa5a0c
movl 0x8b0(%rbx), %r9d
cmpq %r9, %r8
jne 0xa5a0c
movl 0x8d0(%r15), %r9d
movl %r9d, (%rax,%r8,4)
cmpw $0x1, 0x2a(%r15)
jne 0xa5a42
movl 0x8b4(%rbx), %r9d
cmpq %r9, %r8
jne 0xa5a2b
movl 0x8d4(%r15), %r9d
movl %r9d, (%rax,%r8,4)
movl 0x8b8(%rbx), %r9d
cmpq %r9, %r8
jne 0xa5a42
movl 0x8d4(%r15), %r9d
movl %r9d, (%rax,%r8,4)
incq %r8
movslq (%rdx,%r13,4), %r9
cmpq %r9, %r8
jl 0xa570b
incq %r13
cmpq %r12, %r13
jne 0xa56cc
xorl %eax, %eax
jmp 0xa5aac
shll $0x2, %ecx
leaq 0x48598(%rip), %rsi     # 0xee004
leaq 0x796fc(%rip), %rdx     # 0x11f16f
movq %rsp, %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x485a6(%rip), %rsi     # 0xee034
leaq 0x796ed(%rip), %rdx     # 0x11f182
movq %rbx, %rdi
movl $0x5e1, %ecx            # imm = 0x5E1
movq %r14, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %eax
addq $0x800, %rsp            # imm = 0x800
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq