// File: /workspace/github_c_makefile_star2_O3/sc932[P]ALE/src/ALEhelpers.c
// Function: saveLibraryParameters
void saveLibraryParameters(libraryParametersT *libParams, char aleFile[256]){
  char paramFile[256];
  int j;
  strcpy(paramFile, aleFile);
  strcat(paramFile, ".param");
  FILE *out = fopen(paramFile, "w");
  fprintf(out, "#ALE_library_parameter_file,_see_doc\n");
  for(j=0; j < MATE_ORIENTATION_MAX; j++) {
      fprintf(out, "%lf\n", libParams->mateParameters[j].insertLength);
      fprintf(out, "%lf\n", libParams->mateParameters[j].insertStd);
      fprintf(out, "%lf\n", libParams->mateParameters[j].libraryFraction);
      fprintf(out, "%ld\n", libParams->mateParameters[j].count);
      fprintf(out, "%ld\n", libParams->mateParameters[j].mapped);
      // placed is always calculated
      fprintf(out, "%d\n", libParams->mateParameters[j].isValid);
  }
  fprintf(out, "%ld\n", libParams->avgReadSize);
  fprintf(out, "%ld\n", libParams->numReads);
  fprintf(out, "%lf\n", libParams->totalValidSingleFraction);
  fprintf(out, "%lf\n", libParams->totalValidMateFraction);
  fprintf(out, "%lf\n", libParams->totalChimerMateFraction);
  fprintf(out, "%lf\n", libParams->totalUnmappedFraction);
  fprintf(out, "%d\n", libParams->qOff);
  fprintf(out, "%d\n", libParams->isSortedByName);
  fprintf(out, "%d\n", libParams->primaryOrientation);
  fclose(out);
  printf("Saved library parameters to %s\n", paramFile);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdi, %rbx
movq %rsp, %r14
movq %r14, %rdi
callq 0x30e0
movq %r14, %rdi
callq 0x31e0
movl $0x7261702e, (%rsp,%rax) # imm = 0x7261702E
movl $0x6d6172, 0x3(%rsp,%rax) # imm = 0x6D6172
leaq 0x1099b(%rip), %rsi     # 0x1d185
movq %r14, %rdi
callq 0x3530
movq %rax, %r14
leaq 0x17999(%rip), %rdi     # 0x24195
movl $0x25, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x35e0
movl $0x38, %ebp
leaq 0x1787d(%rip), %r15     # 0x24097
leaq 0x15d9f(%rip), %r12     # 0x225c0
leaq 0x187bd(%rip), %r13     # 0x24fe5
movsd -0x38(%rbx,%rbp), %xmm0
movq %r14, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x3350
movsd -0x30(%rbx,%rbp), %xmm0
movq %r14, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x3350
movsd -0x20(%rbx,%rbp), %xmm0
movq %r14, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x3350
movq -0x18(%rbx,%rbp), %rdx
movq %r14, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x3350
movq -0x10(%rbx,%rbp), %rdx
movq %r14, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x3350
movl (%rbx,%rbp), %edx
movq %r14, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x3350
addq $0x40, %rbp
cmpq $0x3b8, %rbp            # imm = 0x3B8
jne 0xc828
movq 0x380(%rbx), %rdx
leaq 0x15d10(%rip), %r15     # 0x225c0
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x3350
movq 0x388(%rbx), %rdx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x3350
movsd 0x390(%rbx), %xmm0
leaq 0x177b7(%rip), %r15     # 0x24097
movq %r14, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x3350
movsd 0x398(%rbx), %xmm0
movq %r14, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x3350
movsd 0x3a0(%rbx), %xmm0
movq %r14, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x3350
movsd 0x3a8(%rbx), %xmm0
movq %r14, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x3350
movl 0x3b0(%rbx), %edx
leaq 0x186ac(%rip), %r15     # 0x24fe5
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x3350
movl 0x3b4(%rbx), %edx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x3350
movl 0x3b8(%rbx), %edx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x3350
movq %r14, %rdi
callq 0x31c0
leaq 0x17840(%rip), %rdi     # 0x241bb
movq %rsp, %rsi
xorl %eax, %eax
callq 0x3210
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq