// File: /workspace/github_c_makefile_star2_O1/PoulinV[P]AxiCLASS/build/../source/output.c
// Function: output_perturbations
int output_perturbations(
                         struct background * pba,
                         struct perturbations * ppt,
                         struct output * pop
                         ) {

  FILE * out;
  FileName file_name;
  int index_ikout, index_md;
  double k;

  for (index_ikout=0; index_ikout<ppt->k_output_values_num; index_ikout++){

    if (ppt->has_scalars == _TRUE_){
      index_md = ppt->index_md_scalars;
      k = ppt->k[index_md][ppt->index_k_output_values[index_md*ppt->k_output_values_num+index_ikout]];
      class_sprintf(file_name,"%s%s%d%s",pop->root,"perturbations_k",index_ikout,"_s.dat");
      class_open(out, file_name, "w", ppt->error_message);
      fprintf(out,"#scalar perturbations for mode k = %.*e Mpc^(-1)\n",_OUTPUTPRECISION_,k);
      output_print_data(out,
                        ppt->scalar_titles,
                        ppt->scalar_perturbations_data[index_ikout],
                        ppt->size_scalar_perturbation_data[index_ikout]);

      fclose(out);
    }
    if (ppt->has_vectors == _TRUE_){
      index_md = ppt->index_md_vectors;
      k = ppt->k[index_md][ppt->index_k_output_values[index_md*ppt->k_output_values_num+index_ikout]];
      class_sprintf(file_name,"%s%s%d%s",pop->root,"perturbations_k",index_ikout,"_v.dat");
      class_open(out, file_name, "w", ppt->error_message);
      fprintf(out,"#vector perturbations for mode k = %.*e Mpc^(-1)\n",_OUTPUTPRECISION_,k);
      output_print_data(out,
                        ppt->vector_titles,
                        ppt->vector_perturbations_data[index_ikout],
                        ppt->size_vector_perturbation_data[index_ikout]);

      fclose(out);
    }
    if (ppt->has_tensors == _TRUE_){
      index_md = ppt->index_md_tensors;
      k = ppt->k[index_md][ppt->index_k_output_values[index_md*ppt->k_output_values_num+index_ikout]];
      class_sprintf(file_name,"%s%s%d%s",pop->root,"perturbations_k",index_ikout,"_t.dat");
      class_open(out, file_name, "w", ppt->error_message);
      fprintf(out,"#tensor perturbations for mode k = %.*e Mpc^(-1)\n",_OUTPUTPRECISION_,k);
      output_print_data(out,
                        ppt->tensor_titles,
                        ppt->tensor_perturbations_data[index_ikout],
                        ppt->size_tensor_perturbation_data[index_ikout]);

      fclose(out);
    }


  }
  return _SUCCESS_;

}

// Assembly:
movl 0x6d4(%rsi), %eax
testl %eax, %eax
jle 0xee5eb
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x938, %rsp            # imm = 0x938
movq %rdx, %r14
movq %rsi, %rbx
leaq 0xa80(%rsi), %rcx
movq %rcx, 0x28(%rsp)
leaq 0x29c0(%rsi), %rcx
movq %rcx, 0x20(%rsp)
leaq 0x4900(%rsi), %rcx
movq %rcx, 0x18(%rsp)
xorl %r15d, %r15d
cmpw $0x1, 0xe(%rbx)
jne 0xee3ef
movslq 0x848(%rbx), %rcx
movq 0x9d0(%rbx), %rdx
movq 0xa78(%rbx), %rsi
movq (%rdx,%rcx,8), %rdx
cltq
imulq %rcx, %rax
addq %r15, %rax
movslq (%rsi,%rax,4), %rax
movsd (%rdx,%rax,8), %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0x44f90(%rip), %rbp     # 0x1332d6
movq %rbp, (%rsp)
xorl %edi, %edi
xorl %esi, %esi
leaq 0x44f68(%rip), %r13     # 0x1332bd
movq %r13, %rdx
movq %r14, %rcx
leaq 0x44f64(%rip), %r12     # 0x1332c6
movq %r12, %r8
movl %r15d, %r9d
xorl %eax, %eax
callq 0x8550
incl %eax
movslq %eax, %rsi
movq %rbp, (%rsp)
leaq 0x30(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rdx
movq %r14, %rcx
movq %r12, %r8
movl %r15d, %r9d
xorl %eax, %eax
callq 0x8550
movq %rbp, %rdi
leaq 0x6074(%rip), %rsi      # 0xf4411
callq 0x8400
testq %rax, %rax
je 0xee5ee
movq %rax, %rbp
movq %rax, %rdi
leaq 0x44f3a(%rip), %rsi     # 0x1332f2
movl $0xc, %edx
movsd 0x10(%rsp), %xmm0
movb $0x1, %al
callq 0x84e0
movq 0x6850(%rbx,%r15,8), %rdx
movl 0x6b20(%rbx,%r15,4), %ecx
movq %rbp, %rdi
movq 0x28(%rsp), %rsi
callq 0xf0579
movq %rbp, %rdi
callq 0x83a0
cmpw $0x1, 0x10(%rbx)
jne 0xee4e0
movslq 0x850(%rbx), %rax
movq 0x9d0(%rbx), %rcx
movq 0xa78(%rbx), %rdx
movq (%rcx,%rax,8), %rcx
movslq 0x6d4(%rbx), %rsi
imulq %rax, %rsi
addq %r15, %rsi
movslq (%rdx,%rsi,4), %rax
movsd (%rcx,%rax,8), %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0x44eed(%rip), %rbp     # 0x133324
movq %rbp, (%rsp)
xorl %edi, %edi
xorl %esi, %esi
leaq 0x44e77(%rip), %r13     # 0x1332bd
movq %r13, %rdx
movq %r14, %rcx
leaq 0x44e73(%rip), %r12     # 0x1332c6
movq %r12, %r8
movl %r15d, %r9d
xorl %eax, %eax
callq 0x8550
incl %eax
movslq %eax, %rsi
movq %rbp, (%rsp)
leaq 0x30(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rdx
movq %r14, %rcx
movq %r12, %r8
movl %r15d, %r9d
xorl %eax, %eax
callq 0x8550
movq %rbp, %rdi
leaq 0x5f83(%rip), %rsi      # 0xf4411
callq 0x8400
testq %rax, %rax
je 0xee63c
movq %rax, %rbp
movq %rax, %rdi
leaq 0x44e82(%rip), %rsi     # 0x13332b
movl $0xc, %edx
movsd 0x10(%rsp), %xmm0
movb $0x1, %al
callq 0x84e0
movq 0x6940(%rbx,%r15,8), %rdx
movl 0x6b98(%rbx,%r15,4), %ecx
movq %rbp, %rdi
movq 0x20(%rsp), %rsi
callq 0xf0579
movq %rbp, %rdi
callq 0x83a0
cmpw $0x1, 0x12(%rbx)
jne 0xee5d1
movslq 0x84c(%rbx), %rax
movq 0x9d0(%rbx), %rcx
movq 0xa78(%rbx), %rdx
movq (%rcx,%rax,8), %rcx
movslq 0x6d4(%rbx), %rsi
imulq %rax, %rsi
addq %r15, %rsi
movslq (%rdx,%rsi,4), %rax
movsd (%rcx,%rax,8), %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0x44e35(%rip), %rbp     # 0x13335d
movq %rbp, (%rsp)
xorl %edi, %edi
xorl %esi, %esi
leaq 0x44d86(%rip), %r13     # 0x1332bd
movq %r13, %rdx
movq %r14, %rcx
leaq 0x44d82(%rip), %r12     # 0x1332c6
movq %r12, %r8
movl %r15d, %r9d
xorl %eax, %eax
callq 0x8550
incl %eax
movslq %eax, %rsi
movq %rbp, (%rsp)
leaq 0x30(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rdx
movq %r14, %rcx
movq %r12, %r8
movl %r15d, %r9d
xorl %eax, %eax
callq 0x8550
movq %rbp, %rdi
leaq 0x5e92(%rip), %rsi      # 0xf4411
callq 0x8400
testq %rax, %rax
je 0xee687
movq %rax, %rbp
movq %rax, %rdi
leaq 0x44dca(%rip), %rsi     # 0x133364
movl $0xc, %edx
movsd 0x10(%rsp), %xmm0
movb $0x1, %al
callq 0x84e0
movq 0x6a30(%rbx,%r15,8), %rdx
movl 0x6c10(%rbx,%r15,4), %ecx
movq %rbp, %rdi
movq 0x18(%rsp), %rsi
callq 0xf0579
movq %rbp, %rdi
callq 0x83a0
incq %r15
movslq 0x6d4(%rbx), %rax
cmpq %rax, %r15
jl 0xee303
xorl %eax, %eax
jmp 0xee6df
xorl %eax, %eax
retq
leaq 0x53e3(%rip), %rsi      # 0xf39d8
leaq 0x8b7a(%rip), %rdx      # 0xf7176
leaq 0x1ee01(%rip), %r8      # 0x10d404
leaq 0x130(%rsp), %r14
leaq 0x30(%rsp), %rcx
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x6c8a, %rbx           # imm = 0x6C8A
leaq 0x2a0c(%rip), %rsi      # 0xf1034
leaq 0x44cae(%rip), %rdx     # 0x1332dd
movq %rbx, %rdi
movl $0x50f, %ecx            # imm = 0x50F
jmp 0xee6d0
leaq 0x5395(%rip), %rsi      # 0xf39d8
leaq 0x8b2c(%rip), %rdx      # 0xf7176
leaq 0x1edb3(%rip), %r8      # 0x10d404
leaq 0x130(%rsp), %r14
leaq 0x30(%rsp), %rcx
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x6c8a, %rbx           # imm = 0x6C8A
leaq 0x29be(%rip), %rsi      # 0xf1034
leaq 0x44c60(%rip), %rdx     # 0x1332dd
movq %rbx, %rdi
movl $0x51c, %ecx            # imm = 0x51C
jmp 0xee6d0
leaq 0x534a(%rip), %rsi      # 0xf39d8
leaq 0x8ae1(%rip), %rdx      # 0xf7176
leaq 0x1ed68(%rip), %r8      # 0x10d404
leaq 0x130(%rsp), %r14
leaq 0x30(%rsp), %rcx
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
addq $0x6c8a, %rbx           # imm = 0x6C8A
leaq 0x2973(%rip), %rsi      # 0xf1034
leaq 0x44c15(%rip), %rdx     # 0x1332dd
movq %rbx, %rdi
movl $0x529, %ecx            # imm = 0x529
movq %r14, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %eax
addq $0x938, %rsp            # imm = 0x938
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq