// File: /workspace/github_c_makefile_star2_O1/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 0xa89da
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
xorl %r13d, %r13d
movq 0x8f0(%rbx), %rax
movslq (%rax,%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 0xa89de
testl %ecx, %ecx
jle 0xa89ce
movzwl 0xe(%r15), %ecx
movzwl 0x10(%r15), %esi
movzwl 0x12(%r15), %edi
xorl %r8d, %r8d
cmpw $0x1, %cx
jne 0xa88b0
movl 0x848(%r15), %r9d
cmpq %r9, %r13
jne 0xa88b0
movzwl 0x28(%r15), %r9d
cmpw $0x1, %r9w
jne 0xa868f
movl 0x8a8(%rbx), %r10d
cmpq %r10, %r8
jne 0xa8653
movl 0x8c8(%r15), %r10d
movl %r10d, (%rax,%r8,4)
cmpw $0x1, %r9w
jne 0xa868f
movl 0x8ac(%rbx), %r10d
cmpq %r10, %r8
jne 0xa8671
movl 0x8cc(%r15), %r10d
movl %r10d, (%rax,%r8,4)
cmpw $0x1, %r9w
jne 0xa868f
movl 0x8b0(%rbx), %r9d
cmpq %r9, %r8
jne 0xa868f
movl 0x8d0(%r15), %r9d
movl %r9d, (%rax,%r8,4)
cmpw $0x1, 0x2a(%r15)
jne 0xa86ae
movl 0x8b4(%rbx), %r9d
cmpq %r9, %r8
jne 0xa86ae
movl 0x8d4(%r15), %r9d
movl %r9d, (%rax,%r8,4)
cmpw $0x1, 0x2c(%r15)
jne 0xa86cd
movl 0x8bc(%rbx), %r9d
cmpq %r9, %r8
jne 0xa86cd
movl 0x978(%r15), %r9d
movl %r9d, (%rax,%r8,4)
cmpw $0x1, 0x3e(%r15)
jne 0xa86f8
movslq 0x8c0(%rbx), %r9
cmpq %r9, %r8
jl 0xa86f8
movslq 0x64(%r15), %r10
addq %r9, %r10
cmpq %r10, %r8
jge 0xa86f8
movl 0x8d8(%r15), %r9d
movl %r9d, (%rax,%r8,4)
movzwl 0x40(%r15), %r9d
cmpw $0x1, %r9w
jne 0xa877b
movslq 0x8c8(%rbx), %r10
cmpq %r10, %r8
jl 0xa8727
movslq 0x64(%r15), %r11
addq %r10, %r11
cmpq %r11, %r8
jge 0xa8727
movl 0x934(%r15), %r10d
movl %r10d, (%rax,%r8,4)
cmpw $0x1, %r9w
jne 0xa877b
movslq 0x8cc(%rbx), %r10
cmpq %r10, %r8
jl 0xa8751
movslq 0x64(%r15), %r11
addq %r10, %r11
cmpq %r11, %r8
jge 0xa8751
movl 0x934(%r15), %r10d
movl %r10d, (%rax,%r8,4)
cmpw $0x1, %r9w
jne 0xa877b
movslq 0x8d0(%rbx), %r9
cmpq %r9, %r8
jl 0xa877b
movslq 0x64(%r15), %r10
addq %r9, %r10
cmpq %r10, %r8
jge 0xa877b
movl 0x934(%r15), %r9d
movl %r9d, (%rax,%r8,4)
cmpw $0x1, 0x42(%r15)
jne 0xa87a6
movslq 0x8d4(%rbx), %r9
cmpq %r9, %r8
jl 0xa87a6
movslq 0x64(%r15), %r10
addq %r9, %r10
cmpq %r10, %r8
jge 0xa87a6
movl 0x978(%r15), %r9d
movl %r9d, (%rax,%r8,4)
movzwl 0x44(%r15), %r9d
cmpw $0x1, %r9w
jne 0xa8885
movslq 0x8d8(%rbx), %r10
cmpq %r10, %r8
jl 0xa87d9
movslq 0x64(%r15), %r11
addq %r10, %r11
cmpq %r11, %r8
jge 0xa87d9
movl 0x97c(%r15), %r10d
movl %r10d, (%rax,%r8,4)
cmpw $0x1, %r9w
jne 0xa8885
movslq 0x8dc(%rbx), %r10
cmpq %r10, %r8
jl 0xa8807
movslq 0x64(%r15), %r11
addq %r10, %r11
cmpq %r11, %r8
jge 0xa8807
movl 0x970(%r15), %r10d
movl %r10d, (%rax,%r8,4)
cmpw $0x1, %r9w
jne 0xa8885
movslq 0x8e0(%rbx), %r10
cmpq %r10, %r8
jl 0xa8831
movslq 0x64(%r15), %r11
addq %r10, %r11
cmpq %r11, %r8
jge 0xa8831
movl 0x974(%r15), %r10d
movl %r10d, (%rax,%r8,4)
cmpw $0x1, %r9w
jne 0xa8885
movslq 0x8e4(%rbx), %r10
cmpq %r10, %r8
jl 0xa885b
movslq 0x64(%r15), %r11
addq %r10, %r11
cmpq %r11, %r8
jge 0xa885b
movl 0x978(%r15), %r10d
movl %r10d, (%rax,%r8,4)
cmpw $0x1, %r9w
jne 0xa8885
movslq 0x8e8(%rbx), %r9
cmpq %r9, %r8
jl 0xa8885
movslq 0x64(%r15), %r10
addq %r9, %r10
cmpq %r10, %r8
jge 0xa8885
movl 0x978(%r15), %r9d
movl %r9d, (%rax,%r8,4)
cmpw $0x1, 0x2e(%r15)
jne 0xa88b0
movslq 0x8c4(%rbx), %r9
cmpq %r9, %r8
jl 0xa88b0
movslq 0x64(%r15), %r10
addq %r9, %r10
cmpq %r10, %r8
jge 0xa88b0
movl 0x978(%r15), %r9d
movl %r9d, (%rax,%r8,4)
cmpw $0x1, %si
jne 0xa894c
movl 0x850(%r15), %r9d
cmpq %r9, %r13
jne 0xa894c
movzwl 0x28(%r15), %r9d
cmpw $0x1, %r9w
jne 0xa890b
movl 0x8ac(%rbx), %r10d
cmpq %r10, %r8
jne 0xa88ed
movl 0x8cc(%r15), %r10d
movl %r10d, (%rax,%r8,4)
cmpw $0x1, %r9w
jne 0xa890b
movl 0x8b0(%rbx), %r9d
cmpq %r9, %r8
jne 0xa890b
movl 0x8d0(%r15), %r9d
movl %r9d, (%rax,%r8,4)
movzwl 0x2a(%r15), %r9d
cmpw $0x1, %r9w
jne 0xa894c
movl 0x8b4(%rbx), %r10d
cmpq %r10, %r8
jne 0xa892e
movl 0x8d4(%r15), %r10d
movl %r10d, (%rax,%r8,4)
cmpw $0x1, %r9w
jne 0xa894c
movl 0x8b8(%rbx), %r9d
cmpq %r9, %r8
jne 0xa894c
movl 0x8d4(%r15), %r9d
movl %r9d, (%rax,%r8,4)
cmpw $0x1, %di
jne 0xa89be
movl 0x84c(%r15), %r9d
cmpq %r9, %r13
jne 0xa89be
cmpw $0x1, 0x28(%r15)
jne 0xa897d
movl 0x8b0(%rbx), %r9d
cmpq %r9, %r8
jne 0xa897d
movl 0x8d0(%r15), %r9d
movl %r9d, (%rax,%r8,4)
movzwl 0x2a(%r15), %r9d
cmpw $0x1, %r9w
jne 0xa89be
movl 0x8b4(%rbx), %r10d
cmpq %r10, %r8
jne 0xa89a0
movl 0x8d4(%r15), %r10d
movl %r10d, (%rax,%r8,4)
cmpw $0x1, %r9w
jne 0xa89be
movl 0x8b8(%rbx), %r9d
cmpq %r9, %r8
jne 0xa89be
movl 0x8d4(%r15), %r9d
movl %r9d, (%rax,%r8,4)
incq %r8
movslq (%rdx,%r13,4), %r9
cmpq %r9, %r8
jl 0xa8616
incq %r13
cmpq %r12, %r13
jne 0xa85d0
xorl %eax, %eax
jmp 0xa8a28
shll $0x2, %ecx
leaq 0x4861c(%rip), %rsi     # 0xf1004
leaq 0x79740(%rip), %rdx     # 0x12212f
movq %rsp, %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x96a, %rbx            # imm = 0x96A
leaq 0x4862a(%rip), %rsi     # 0xf1034
leaq 0x79731(%rip), %rdx     # 0x122142
movq %rbx, %rdi
movl $0x5e1, %ecx            # imm = 0x5E1
movq %r14, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %eax
addq $0x800, %rsp            # imm = 0x800
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq