// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x938, %rsp            # imm = 0x938
movq %rdx, 0x10(%rsp)
movq %rsi, %rbx
leaq 0xa80(%rsi), %rax
movq %rax, 0x28(%rsp)
leaq 0x29c0(%rsi), %rax
movq %rax, 0x20(%rsp)
leaq 0x4900(%rsi), %rax
movq %rax, 0x18(%rsp)
leaq 0x4495e(%rip), %rbp     # 0x127166
leaq 0x30(%rsp), %r13
xorl %r12d, %r12d
movslq 0x6d4(%rbx), %rax
cmpq %rax, %r12
jge 0xe2afa
cmpw $0x1, 0xe(%rbx)
jne 0xe2914
movslq 0x848(%rbx), %rcx
movq 0x9d0(%rbx), %rdx
movq 0xa78(%rbx), %rsi
movq (%rdx,%rcx,8), %rdx
imulq %rcx, %rax
addq %r12, %rax
movslq (%rsi,%rax,4), %rax
movsd (%rdx,%rax,8), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x44915(%rip), %rax     # 0x127176
movq %rax, (%rsp)
xorl %edi, %edi
xorl %esi, %esi
movq 0x10(%rsp), %r14
movq %r13, %r15
movq %rbp, %r13
leaq 0x448e2(%rip), %rbp     # 0x12715d
movq %rbp, %rdx
movq %r14, %rcx
movq %r13, %r8
movl %r12d, %r9d
xorl %eax, %eax
callq 0x8580
incl %eax
movslq %eax, %rsi
leaq 0x448dc(%rip), %rax     # 0x127176
movq %rax, (%rsp)
movq %r15, %rdi
movq %rbp, %rdx
movq %r13, %rbp
movq %r15, %r13
movq %r14, %rcx
movq %rbp, %r8
movl %r12d, %r9d
xorl %eax, %eax
callq 0x8580
movq %r15, %rdi
leaq 0x5b1d(%rip), %rsi      # 0xe83e1
callq 0x8420
testq %rax, %rax
je 0xe2b01
movq %rax, %r14
movq %rax, %rdi
leaq 0x448b3(%rip), %rsi     # 0x127192
pushq $0xc
popq %rdx
movsd 0x8(%rsp), %xmm0
movb $0x1, %al
callq 0x8510
movq 0x6850(%rbx,%r12,8), %rdx
movl 0x6b20(%rbx,%r12,4), %ecx
movq %r14, %rdi
movq 0x28(%rsp), %rsi
callq 0xe4991
movq %r14, %rdi
callq 0x83c0
cmpw $0x1, 0x10(%rbx)
jne 0xe2a03
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 %r12, %rsi
movslq (%rdx,%rsi,4), %rax
movsd (%rcx,%rax,8), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x44868(%rip), %rax     # 0x1271c4
movq %rax, (%rsp)
xorl %edi, %edi
xorl %esi, %esi
leaq 0x447f2(%rip), %r14     # 0x12715d
movq %r14, %rdx
movq 0x10(%rsp), %r15
movq %r15, %rcx
movq %rbp, %r8
movl %r12d, %r9d
xorl %eax, %eax
callq 0x8580
incl %eax
movslq %eax, %rsi
leaq 0x44835(%rip), %rax     # 0x1271c4
movq %rax, (%rsp)
movq %r13, %rdi
movq %r14, %rdx
movq %r15, %rcx
movq %rbp, %r8
movl %r12d, %r9d
xorl %eax, %eax
callq 0x8580
movq %r13, %rdi
leaq 0x5a2e(%rip), %rsi      # 0xe83e1
callq 0x8420
testq %rax, %rax
je 0xe2b4f
movq %rax, %r14
movq %rax, %rdi
leaq 0x447fd(%rip), %rsi     # 0x1271cb
pushq $0xc
popq %rdx
movsd 0x8(%rsp), %xmm0
movb $0x1, %al
callq 0x8510
movq 0x6940(%rbx,%r12,8), %rdx
movl 0x6b98(%rbx,%r12,4), %ecx
movq %r14, %rdi
movq 0x20(%rsp), %rsi
callq 0xe4991
movq %r14, %rdi
callq 0x83c0
cmpw $0x1, 0x12(%rbx)
jne 0xe2af2
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 %r12, %rsi
movslq (%rdx,%rsi,4), %rax
movsd (%rcx,%rax,8), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x447b2(%rip), %rax     # 0x1271fd
movq %rax, (%rsp)
xorl %edi, %edi
xorl %esi, %esi
leaq 0x44703(%rip), %r14     # 0x12715d
movq %r14, %rdx
movq 0x10(%rsp), %r15
movq %r15, %rcx
movq %rbp, %r8
movl %r12d, %r9d
xorl %eax, %eax
callq 0x8580
incl %eax
movslq %eax, %rsi
leaq 0x4477f(%rip), %rax     # 0x1271fd
movq %rax, (%rsp)
movq %r13, %rdi
movq %r14, %rdx
movq %r15, %rcx
movq %rbp, %r8
movl %r12d, %r9d
xorl %eax, %eax
callq 0x8580
movq %r13, %rdi
leaq 0x593f(%rip), %rsi      # 0xe83e1
callq 0x8420
testq %rax, %rax
je 0xe2b9a
movq %rax, %r14
movq %rax, %rdi
leaq 0x44747(%rip), %rsi     # 0x127204
pushq $0xc
popq %rdx
movsd 0x8(%rsp), %xmm0
movb $0x1, %al
callq 0x8510
movq 0x6a30(%rbx,%r12,8), %rdx
movl 0x6c10(%rbx,%r12,4), %ecx
movq %r14, %rdi
movq 0x18(%rsp), %rsi
callq 0xe4991
movq %r14, %rdi
callq 0x83c0
incq %r12
jmp 0xe2810
xorl %eax, %eax
jmp 0xe2bf0
leaq 0x4ea0(%rip), %rsi      # 0xe79a8
leaq 0x8557(%rip), %rdx      # 0xeb066
leaq 0x1e7de(%rip), %r8      # 0x1012f4
leaq 0x130(%rsp), %r14
leaq 0x30(%rsp), %rcx
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x6c8a, %rbx           # imm = 0x6C8A
leaq 0x24f9(%rip), %rsi      # 0xe5034
leaq 0x4463b(%rip), %rdx     # 0x12717d
movq %rbx, %rdi
movl $0x50f, %ecx            # imm = 0x50F
jmp 0xe2be3
leaq 0x4e52(%rip), %rsi      # 0xe79a8
leaq 0x8509(%rip), %rdx      # 0xeb066
leaq 0x1e790(%rip), %r8      # 0x1012f4
leaq 0x130(%rsp), %r14
leaq 0x30(%rsp), %rcx
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x6c8a, %rbx           # imm = 0x6C8A
leaq 0x24ab(%rip), %rsi      # 0xe5034
leaq 0x445ed(%rip), %rdx     # 0x12717d
movq %rbx, %rdi
movl $0x51c, %ecx            # imm = 0x51C
jmp 0xe2be3
leaq 0x4e07(%rip), %rsi      # 0xe79a8
leaq 0x84be(%rip), %rdx      # 0xeb066
leaq 0x1e745(%rip), %r8      # 0x1012f4
leaq 0x130(%rsp), %r14
leaq 0x30(%rsp), %rcx
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
addq $0x6c8a, %rbx           # imm = 0x6C8A
leaq 0x2460(%rip), %rsi      # 0xe5034
leaq 0x445a2(%rip), %rdx     # 0x12717d
movq %rbx, %rdi
movl $0x529, %ecx            # imm = 0x529
movq %r14, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rax
addq $0x938, %rsp            # imm = 0x938
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq