// File: /workspace/github_c_makefile_star2_O2/lesgourg[P]class_public/build/../source/perturbations.c
// Function: perturbations_free
int perturbations_free(
                       struct perturbations * ppt
                       ) {

  int index_md,index_ic,index_tp;
  int filenum;

  perturbations_free_input(ppt);

  if (ppt->has_perturbations == _TRUE_) {

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

      for (index_ic = 0; index_ic < ppt->ic_size[index_md]; index_ic++) {

        for (index_tp = 0; index_tp < ppt->tp_size[index_md]; index_tp++) {

          free(ppt->sources[index_md][index_ic*ppt->tp_size[index_md]+index_tp]);
          if (ppt->ln_tau_size > 1)
            free(ppt->ddlate_sources[index_md][index_ic*ppt->tp_size[index_md]+index_tp]);

        }
      }

      free(ppt->sources[index_md]);
      free(ppt->late_sources[index_md]);
      free(ppt->ddlate_sources[index_md]);

      free(ppt->k[index_md]);

    }

    free(ppt->tau_sampling);
    if (ppt->ln_tau_size > 1)
      free(ppt->ln_tau);

    free(ppt->tp_size);

    free(ppt->ic_size);

    free(ppt->k);

    free(ppt->k_size_cmb);

    free(ppt->k_size_cl);

    free(ppt->k_size);

    free(ppt->sources);
    free(ppt->late_sources);
    free(ppt->ddlate_sources);

    /** Stuff related to perturbations output: */

    /** - Free non-NULL pointers */
    if (ppt->k_output_values_num > 0 )
      free(ppt->index_k_output_values);

    for (filenum = 0; filenum<_MAX_NUMBER_OF_K_FILES_; filenum++){
      if (ppt->scalar_perturbations_data[filenum] != NULL)
        free(ppt->scalar_perturbations_data[filenum]);
      if (ppt->vector_perturbations_data[filenum] != NULL)
        free(ppt->vector_perturbations_data[filenum]);
      if (ppt->tensor_perturbations_data[filenum] != NULL)
        free(ppt->tensor_perturbations_data[filenum]);
    }

  }

  ppt->is_allocated = _FALSE_;
  return _SUCCESS_;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
callq 0x689cd
cmpw $0x1, (%rbx)
jne 0x68bb6
xorl %r14d, %r14d
movslq 0x808(%rbx), %rax
cmpq %rax, %r14
jge 0x68adb
xorl %ebp, %ebp
movq 0x828(%rbx), %rax
cmpl (%rax,%r14,4), %ebp
jge 0x68a93
movslq %ebp, %r15
xorl %r12d, %r12d
movq 0x930(%rbx), %rax
movl (%rax,%r14,4), %eax
cmpl %eax, %r12d
jge 0x68a8f
movq 0x9b8(%rbx), %rcx
movq (%rcx,%r14,8), %rcx
imull %ebp, %eax
addl %r12d, %eax
cltq
movq (%rcx,%rax,8), %rdi
callq 0x8430
cmpl $0x2, 0x9c8(%rbx)
jl 0x68a8a
movq 0x930(%rbx), %rax
movq 0x9d8(%rbx), %rcx
movq (%rcx,%r14,8), %rcx
movslq (%rax,%r14,4), %rax
imulq %r15, %rax
addq %r12, %rax
movq (%rcx,%rax,8), %rdi
callq 0x8430
incq %r12
jmp 0x68a2f
incl %ebp
jmp 0x68a1c
movq 0x9b8(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x8430
movq 0x9d0(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x8430
movq 0x9d8(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x8430
movq 0x958(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x8430
incq %r14
jmp 0x68a0a
movq 0x970(%rbx), %rdi
callq 0x8430
cmpl $0x2, 0x9c8(%rbx)
jl 0x68afc
movq 0x9c0(%rbx), %rdi
callq 0x8430
movq 0x930(%rbx), %rdi
callq 0x8430
movq 0x828(%rbx), %rdi
callq 0x8430
movq 0x958(%rbx), %rdi
callq 0x8430
movq 0x938(%rbx), %rdi
callq 0x8430
movq 0x940(%rbx), %rdi
callq 0x8430
movq 0x950(%rbx), %rdi
callq 0x8430
movq 0x9b8(%rbx), %rdi
callq 0x8430
movq 0x9d0(%rbx), %rdi
callq 0x8430
movq 0x9d8(%rbx), %rdi
callq 0x8430
cmpl $0x0, 0x6cc(%rbx)
jle 0x68b7d
movq 0x9e0(%rbx), %rdi
callq 0x8430
movq $-0xf0, %r14
testq %r14, %r14
je 0x68bb6
movq 0x68a8(%rbx,%r14), %rdi
callq 0x8430
movq 0x6998(%rbx,%r14), %rdi
callq 0x8430
movq 0x6a88(%rbx,%r14), %rdi
callq 0x8430
addq $0x8, %r14
jmp 0x68b84
andw $0x0, 0x73f2(%rbx)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq