// File: /workspace/github_c_makefile_star2_O0/PoulinV[P]AxiCLASS/build/../source/perturbations.c
// Function: perturbations_output_data_at_z
int perturbations_output_data_at_z(
                                   struct background * pba,
                                   struct perturbations * ppt,
                                   enum file_format output_format,
                                   double z,
                                   int number_of_titles,
                                   double *data
                                   ) {

  double * tkfull=NULL;  /* array with argument tkfull[(index_k * ppt->ic_size[index_md] + index_ic) * ppt->tp_size[index_md] + index_tp] */

  double * pvecsources;

  double tau;

  int index_md = ppt->index_md_scalars;
  int index_ic;
  int index_k;
  int index_tp;

  /** - allocate tkfull */

  if (ppt->k_size[index_md]*ppt->ic_size[index_md]*ppt->tp_size[index_md] > 0) {
    class_alloc(tkfull,
                ppt->k_size[index_md]*ppt->ic_size[index_md]*ppt->tp_size[index_md]*sizeof(double),
                ppt->error_message);
  }

  /** - compute \f$T_i(k)\f$ for each k (if several ic's, compute it
        for each ic; if z_pk = 0, this is done by directly reading
        inside the pre-computed table; if not, this is done by
        interpolating the table at the correct value of tau. */

  /* if z_pk = 0, no interpolation needed */

  if (z == 0.) {

    for (index_k=0; index_k<ppt->k_size[index_md]; index_k++) {
      for (index_tp=0; index_tp<ppt->tp_size[index_md]; index_tp++) {
        for (index_ic=0; index_ic<ppt->ic_size[index_md]; index_ic++) {
          tkfull[(index_k * ppt->ic_size[index_md] + index_ic) * ppt->tp_size[index_md] + index_tp]
            = ppt->sources[index_md][index_ic * ppt->tp_size[index_md] + index_tp][(ppt->tau_size-1) * ppt->k_size[index_md] + index_k];
        }
      }
    }
  }

  /* if 0 <= z_pk <= z_max_pk, interpolation needed, */
  else {

    /* check the time corresponding to the highest redshift requested in output plus one */
    class_call(background_tau_of_z(pba,
                                   z,
                                   &tau),
               pba->error_message,
               ppt->error_message);

    class_test(log(tau) < ppt->ln_tau[0],
               "Asking sources at a z bigger than z_max_pk, something probably went wrong",
               ppt->error_message);

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


    for (index_tp=0; index_tp<ppt->tp_size[index_md]; index_tp++) {
      for (index_ic=0; index_ic<ppt->ic_size[index_md]; index_ic++) {
	class_call(perturbations_sources_at_tau(ppt,
						index_md,
						index_ic,
						index_tp,
						tau,
						pvecsources),
		   ppt->error_message,
		   ppt->error_message);
	for (index_k=0; index_k<ppt->k_size[index_md]; index_k++) {

          tkfull[(index_k * ppt->ic_size[index_md] + index_ic) * ppt->tp_size[index_md] + index_tp] =
            pvecsources[index_k];
        }
      }
    }
    free(pvecsources);
  }

  /** - store data */

  class_call(perturbations_output_data(pba,ppt,output_format,tkfull,number_of_titles,data),
             ppt->error_message,
             ppt->error_message);

  /** - free tkfull */
  // condition necessary because the size could be zero (if ppt->tp_size is zero)
  if (tkfull != NULL)
    free(tkfull);

  return _SUCCESS_;
}

// Assembly:
subq $0x3878, %rsp           # imm = 0x3878
movq %rdi, 0x3868(%rsp)
movq %rsi, 0x3860(%rsp)
movl %edx, 0x385c(%rsp)
movsd %xmm0, 0x3850(%rsp)
movl %ecx, 0x384c(%rsp)
movq %r8, 0x3840(%rsp)
movq $0x0, 0x3838(%rsp)
movq 0x3860(%rsp), %rax
movl 0x848(%rax), %eax
movl %eax, 0x3824(%rsp)
movq 0x3860(%rsp), %rax
movq 0x9c8(%rax), %rax
movslq 0x3824(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movq 0x3860(%rsp), %rcx
movq 0x870(%rcx), %rcx
movslq 0x3824(%rsp), %rdx
imull (%rcx,%rdx,4), %eax
movq 0x3860(%rsp), %rcx
movq 0x998(%rcx), %rcx
movslq 0x3824(%rsp), %rdx
imull (%rcx,%rdx,4), %eax
cmpl $0x0, %eax
jle 0xc8297
movq 0x3860(%rsp), %rax
movq 0x9c8(%rax), %rax
movslq 0x3824(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movq 0x3860(%rsp), %rcx
movq 0x870(%rcx), %rcx
movslq 0x3824(%rsp), %rdx
imull (%rcx,%rdx,4), %eax
movq 0x3860(%rsp), %rcx
movq 0x998(%rcx), %rcx
movslq 0x3824(%rsp), %rdx
imull (%rcx,%rdx,4), %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x8460
movq %rax, 0x3838(%rsp)
cmpq $0x0, 0x3838(%rsp)
jne 0xc8295
movq 0x3860(%rsp), %rax
movq 0x9c8(%rax), %rax
movslq 0x3824(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movq 0x3860(%rsp), %rcx
movq 0x870(%rcx), %rcx
movslq 0x3824(%rsp), %rdx
imull (%rcx,%rdx,4), %eax
movq 0x3860(%rsp), %rcx
movq 0x998(%rcx), %rcx
movslq 0x3824(%rsp), %rdx
imull (%rcx,%rdx,4), %eax
cltq
shlq $0x3, %rax
movl %eax, 0x3814(%rsp)
leaq 0x3010(%rsp), %rdi
movl 0x3814(%rsp), %ecx
leaq 0x109dbe(%rip), %rsi    # 0x1d2004
leaq 0x12eb56(%rip), %rdx    # 0x1f6da3
movb $0x0, %al
callq 0x5b9c0
movq 0x3860(%rsp), %rdi
addq $0x6c8a, %rdi           # imm = 0x6C8A
leaq 0x3010(%rsp), %r8
leaq 0x109dc2(%rip), %rsi    # 0x1d2034
leaq 0x12eb31(%rip), %rdx    # 0x1f6daa
movl $0x110, %ecx            # imm = 0x110
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3874(%rsp)
jmp 0xc892b
jmp 0xc8297
movsd 0x3850(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xc8475
jp 0xc8475
movl $0x0, 0x381c(%rsp)
movl 0x381c(%rsp), %eax
movq 0x3860(%rsp), %rcx
movq 0x9c8(%rcx), %rcx
movslq 0x3824(%rsp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xc8470
movl $0x0, 0x3818(%rsp)
movl 0x3818(%rsp), %eax
movq 0x3860(%rsp), %rcx
movq 0x998(%rcx), %rcx
movslq 0x3824(%rsp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xc8458
movl $0x0, 0x3820(%rsp)
movl 0x3820(%rsp), %eax
movq 0x3860(%rsp), %rcx
movq 0x870(%rcx), %rcx
movslq 0x3824(%rsp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xc8440
movq 0x3860(%rsp), %rax
movq 0xa38(%rax), %rax
movslq 0x3824(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x3820(%rsp), %ecx
movq 0x3860(%rsp), %rdx
movq 0x998(%rdx), %rdx
movslq 0x3824(%rsp), %rsi
imull (%rdx,%rsi,4), %ecx
addl 0x3818(%rsp), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq 0x3860(%rsp), %rcx
movl 0x9f8(%rcx), %ecx
subl $0x1, %ecx
movq 0x3860(%rsp), %rdx
movq 0x9c8(%rdx), %rdx
movslq 0x3824(%rsp), %rsi
imull (%rdx,%rsi,4), %ecx
addl 0x381c(%rsp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x3838(%rsp), %rax
movl 0x381c(%rsp), %ecx
movq 0x3860(%rsp), %rdx
movq 0x870(%rdx), %rdx
movslq 0x3824(%rsp), %rsi
imull (%rdx,%rsi,4), %ecx
addl 0x3820(%rsp), %ecx
movq 0x3860(%rsp), %rdx
movq 0x998(%rdx), %rdx
movslq 0x3824(%rsp), %rsi
imull (%rdx,%rsi,4), %ecx
addl 0x3818(%rsp), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x3820(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3820(%rsp)
jmp 0xc8322
jmp 0xc8442
movl 0x3818(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3818(%rsp)
jmp 0xc82f0
jmp 0xc845a
movl 0x381c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x381c(%rsp)
jmp 0xc82be
jmp 0xc886f
movq 0x3868(%rsp), %rdi
movsd 0x3850(%rsp), %xmm0
leaq 0x3828(%rsp), %rsi
callq 0x9ee00
cmpl $0x1, %eax
jne 0xc8505
leaq 0x2810(%rsp), %rdi
movq 0x3868(%rsp), %rcx
addq $0xd1c, %rcx            # imm = 0xD1C
leaq 0x109f22(%rip), %rsi    # 0x1d23d8
leaq 0x12d8a8(%rip), %rdx    # 0x1f5d65
movb $0x0, %al
callq 0x5b9c0
movq 0x3860(%rsp), %rdi
addq $0x6c8a, %rdi           # imm = 0x6C8A
leaq 0x2810(%rsp), %r8
leaq 0x109b52(%rip), %rsi    # 0x1d2034
leaq 0x12e8c1(%rip), %rdx    # 0x1f6daa
movl $0x12e, %ecx            # imm = 0x12E
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3874(%rsp)
jmp 0xc892b
movsd 0x3828(%rsp), %xmm0
callq 0x82f0
movaps %xmm0, %xmm1
movq 0x3860(%rsp), %rax
movq 0xa58(%rax), %rax
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xc85ab
leaq 0x2010(%rsp), %rdi
movq 0x3860(%rsp), %rsi
addq $0x6c8a, %rsi           # imm = 0x6C8A
movb $0x0, %al
callq 0x5b9c0
leaq 0x1810(%rsp), %rdi
leaq 0x2010(%rsp), %rcx
leaq 0x109b1e(%rip), %rsi    # 0x1d2082
leaq 0x12e85e(%rip), %rdx    # 0x1f6dc9
movb $0x0, %al
callq 0x5b9c0
leaq 0x1810(%rsp), %r8
leaq 0x12e862(%rip), %rdi    # 0x1f6de3
leaq 0x109aac(%rip), %rsi    # 0x1d2034
leaq 0x12e81b(%rip), %rdx    # 0x1f6daa
movl $0x132, %ecx            # imm = 0x132
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3874(%rsp)
jmp 0xc892b
movq 0x3860(%rsp), %rax
movq 0x9c8(%rax), %rax
movslq 0x3824(%rsp), %rcx
movslq (%rax,%rcx,4), %rdi
shlq $0x3, %rdi
callq 0x8460
movq %rax, 0x3830(%rsp)
cmpq $0x0, 0x3830(%rsp)
jne 0xc8671
movq 0x3860(%rsp), %rax
movq 0x9c8(%rax), %rax
movslq 0x3824(%rsp), %rcx
movslq (%rax,%rcx,4), %rax
shlq $0x3, %rax
movl %eax, 0x180c(%rsp)
leaq 0x1000(%rsp), %rdi
movl 0x180c(%rsp), %ecx
leaq 0x1099e2(%rip), %rsi    # 0x1d2004
leaq 0x12e804(%rip), %rdx    # 0x1f6e2d
movb $0x0, %al
callq 0x5b9c0
movq 0x3860(%rsp), %rdi
addq $0x6c8a, %rdi           # imm = 0x6C8A
leaq 0x1000(%rsp), %r8
leaq 0x1099e6(%rip), %rsi    # 0x1d2034
leaq 0x12e755(%rip), %rdx    # 0x1f6daa
movl $0x136, %ecx            # imm = 0x136
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3874(%rsp)
jmp 0xc892b
movl $0x0, 0x3818(%rsp)
movl 0x3818(%rsp), %eax
movq 0x3860(%rsp), %rcx
movq 0x998(%rcx), %rcx
movslq 0x3824(%rsp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xc8862
movl $0x0, 0x3820(%rsp)
movl 0x3820(%rsp), %eax
movq 0x3860(%rsp), %rcx
movq 0x870(%rcx), %rcx
movslq 0x3824(%rsp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xc884a
movq 0x3860(%rsp), %rdi
movl 0x3824(%rsp), %esi
movl 0x3820(%rsp), %edx
movl 0x3818(%rsp), %ecx
movsd 0x3828(%rsp), %xmm0
movq 0x3830(%rsp), %r8
callq 0xc7720
cmpl $0x1, %eax
jne 0xc877a
leaq 0x800(%rsp), %rdi
movq 0x3860(%rsp), %rcx
addq $0x6c8a, %rcx           # imm = 0x6C8A
leaq 0x109cad(%rip), %rsi    # 0x1d23d8
leaq 0x12e707(%rip), %rdx    # 0x1f6e39
movb $0x0, %al
callq 0x5b9c0
movq 0x3860(%rsp), %rdi
addq $0x6c8a, %rdi           # imm = 0x6C8A
leaq 0x800(%rsp), %r8
leaq 0x1098dd(%rip), %rsi    # 0x1d2034
leaq 0x12e64c(%rip), %rdx    # 0x1f6daa
movl $0x142, %ecx            # imm = 0x142
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3874(%rsp)
jmp 0xc892b
movl $0x0, 0x381c(%rsp)
movl 0x381c(%rsp), %eax
movq 0x3860(%rsp), %rcx
movq 0x9c8(%rcx), %rcx
movslq 0x3824(%rsp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0xc8832
movq 0x3830(%rsp), %rax
movslq 0x381c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x3838(%rsp), %rax
movl 0x381c(%rsp), %ecx
movq 0x3860(%rsp), %rdx
movq 0x870(%rdx), %rdx
movslq 0x3824(%rsp), %rsi
imull (%rdx,%rsi,4), %ecx
addl 0x3820(%rsp), %ecx
movq 0x3860(%rsp), %rdx
movq 0x998(%rdx), %rdx
movslq 0x3824(%rsp), %rsi
imull (%rdx,%rsi,4), %ecx
addl 0x3818(%rsp), %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x381c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x381c(%rsp)
jmp 0xc8785
jmp 0xc8834
movl 0x3820(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3820(%rsp)
jmp 0xc86ae
jmp 0xc884c
movl 0x3818(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3818(%rsp)
jmp 0xc867c
movq 0x3830(%rsp), %rdi
callq 0x8420
movq 0x3868(%rsp), %rdi
movq 0x3860(%rsp), %rsi
movl 0x385c(%rsp), %edx
movq 0x3838(%rsp), %rcx
movl 0x384c(%rsp), %r8d
movq 0x3840(%rsp), %r9
callq 0xc8940
cmpl $0x1, %eax
jne 0xc8908
movq %rsp, %rdi
movq 0x3860(%rsp), %rcx
addq $0x6c8a, %rcx           # imm = 0x6C8A
leaq 0x109b17(%rip), %rsi    # 0x1d23d8
leaq 0x12e5c3(%rip), %rdx    # 0x1f6e8b
movb $0x0, %al
callq 0x5b9c0
movq 0x3860(%rsp), %rdi
addq $0x6c8a, %rdi           # imm = 0x6C8A
movq %rsp, %r8
leaq 0x10974c(%rip), %rsi    # 0x1d2034
leaq 0x12e4bb(%rip), %rdx    # 0x1f6daa
movl $0x151, %ecx            # imm = 0x151
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x3874(%rsp)
jmp 0xc892b
cmpq $0x0, 0x3838(%rsp)
je 0xc8920
movq 0x3838(%rsp), %rdi
callq 0x8420
movl $0x0, 0x3874(%rsp)
movl 0x3874(%rsp), %eax
addq $0x3878, %rsp           # imm = 0x3878
retq
nopw (%rax,%rax)