// File: /workspace/github_c_makefile_star2_O3/usgs[P]nshmp-haz-catalogs/src/agrid/adaptive/read_write_params.c
// Function: write_params_to_file
void write_params_to_file(char *fnm, struct compl_levels* cat_comp, struct boundaries* reg, 
  struct catalog* cat, struct smoothp* smp1, char *outfnm) 
/*--------------------------------------------------------------------------*/
{
  FILE *fpout;
  int cnt;
  
// open summary file for writing
  fpout=fopen(fnm,"w");
  fprintf(fpout,"----------------------------------------------------------\n");
  fprintf(fpout,"---------  Summary of processing steps -------------------\n");
  fprintf(fpout,"----------------------------------------------------------\n\n");
  
// write out parameters
  fprintf(fpout,"Latitudes: %.2f %.2f\n", reg->minlat, reg->maxlat);
  fprintf(fpout,"Longitudes: %.2f %.2f\n", reg->minlon, reg->maxlon);
  fprintf(fpout,"dlat, dlon: %.2f %.2f\n", reg->dlat, reg->dlon);
// completeness levels
  fprintf(fpout,"Number of magnitude completeness levels: %d\n  M yr\n", cat_comp->nlevels);
  for (cnt=0; cnt<cat_comp->nlevels; cnt++) {
    fprintf(fpout,"  %.2f %d\n", cat_comp->mag_comp[cnt], cat_comp->yr_comp[cnt]);
  }
// catalog end year, name, and min-magnitude/d-mag/b-value
  fprintf(fpout,"Last year of catalog: %d\n", cat->end_yr);
  fprintf(fpout,"Name of catalog file: %s\n", cat->catnm);
  fprintf(fpout,"Minimum-M/dM/b-value: %.2f %.2f %.3f\n", cat->minMag, cat->dMag, cat->bval);
// effective/actual numbers earthquakes
  if (smp1->use_neff) {
    fprintf(fpout,"Using effective numbers of earthquakes: N>=1.\n");
  }
  else {
    fprintf(fpout,"Using actual numbers of earthquakes (not effective-numbers): N=1.\n");
  }
// smoothing parameters
  if (smp1->cumul_rates) {
    fprintf(fpout,"Output cumulative rates.\n");
  }
  else {
    fprintf(fpout,"Output incremental rates.\n");
  }
  if (smp1->adj_compl) {
    fprintf(fpout,"Adjust completeness levels.\n");
  }
  else {
    fprintf(fpout,"Don't adjust completeness levels.\n");
  }
  if (smp1->apply_sm) {
    fprintf(fpout,"Apply smoothing to seismicity rates... ");
// gauss/power-law
    if ( smp1->gauss_kern ) {
      fprintf(fpout,"  gaussian kernel ... ");
    }
    else {
      fprintf(fpout,"  power-law kernel ... ");
    }
    if (smp1->adapt_sm) {
      fprintf(fpout," adaptive smoothing - ");
      if (smp1->nnum2_log == 0) {
        fprintf(fpout,"neighbor number %d\n", smp1->nnum);
      }
      else {
        fprintf(fpout,"average of neighbor numbers %d, %d\n", smp1->nnum, smp1->nnum2);
      }
    }
    else {
      fprintf(fpout,"  fixed-radius smoothing: %.1f km\n", smp1->sigfix);
    }
  }
  else {
    fprintf(fpout,"Don't apply smoothing to seismicity rates.\n");
  }
  fprintf(fpout,"Seismicity rates (10^a) written to files, %s[_M0/3/4/5.out]\n", outfnm); 
  
  fclose(fpout);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, (%rsp)
movq %r8, %r15
movq %rcx, %r12
movq %rdx, %rbp
movq %rsi, %r13
leaq 0x3808(%rip), %rsi      # 0x660f
callq 0x1160
movq %rax, %r14
leaq 0x3e2e(%rip), %rdi      # 0x6c44
movl $0x3b, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x11a0
leaq 0x3e51(%rip), %rdi      # 0x6c80
movl $0x3b, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x11a0
leaq 0x3e74(%rip), %rdi      # 0x6cbc
movl $0x3c, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x11a0
cvtss2sd 0x14(%rbp), %xmm0
cvtss2sd 0x18(%rbp), %xmm1
leaq 0x3ab0(%rip), %rsi      # 0x691b
movq %r14, %rdi
movb $0x2, %al
callq 0x1100
xorps %xmm0, %xmm0
cvtss2sd 0xc(%rbp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x10(%rbp), %xmm1
leaq 0x3aa5(%rip), %rsi      # 0x6931
movq %r14, %rdi
movb $0x2, %al
callq 0x1100
xorps %xmm0, %xmm0
cvtss2sd 0x20(%rbp), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x1c(%rbp), %xmm1
leaq 0x3a9b(%rip), %rsi      # 0x6948
movq %r14, %rdi
movb $0x2, %al
callq 0x1100
movl 0xc(%r13), %edx
leaq 0x3a9d(%rip), %rsi      # 0x695f
movq %r14, %rdi
xorl %eax, %eax
callq 0x1100
cmpl $0x0, 0xc(%r13)
jle 0x2f04
xorl %ebx, %ebx
leaq 0x3ab7(%rip), %rbp      # 0x6993
xorps %xmm0, %xmm0
cvtss2sd 0x3c(%r13,%rbx,4), %xmm0
movl 0x14(%r13,%rbx,4), %edx
movq %r14, %rdi
movq %rbp, %rsi
movb $0x1, %al
callq 0x1100
incq %rbx
movslq 0xc(%r13), %rax
cmpq %rax, %rbx
jl 0x2edc
movl (%r12), %edx
leaq 0x3a8f(%rip), %rsi      # 0x699e
movq %r14, %rdi
xorl %eax, %eax
callq 0x1100
leaq 0x10(%r12), %rdx
leaq 0x3a93(%rip), %rsi      # 0x69b8
movq %r14, %rdi
xorl %eax, %eax
callq 0x1100
xorps %xmm0, %xmm0
cvtss2sd 0x4(%r12), %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x8(%r12), %xmm1
cvtss2sd 0xc(%r12), %xmm2
leaq 0x3a81(%rip), %rsi      # 0x69d2
movq %r14, %rdi
movb $0x3, %al
callq 0x1100
cmpl $0x0, 0x14(%r15)
je 0x2f70
leaq 0x3ae5(%rip), %rdi      # 0x6a4e
movl $0x2e, %esi
jmp 0x2f7c
leaq 0x3b06(%rip), %rdi      # 0x6a7d
movl $0x42, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x11a0
cmpl $0x0, (%r15)
je 0x2f9d
leaq 0x3b2a(%rip), %rdi      # 0x6ac0
movl $0x19, %esi
jmp 0x2fa9
leaq 0x3b36(%rip), %rdi      # 0x6ada
movl $0x1a, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x11a0
cmpl $0x0, 0x4(%r15)
je 0x2fcb
leaq 0x3b31(%rip), %rdi      # 0x6af5
movl $0x1c, %esi
jmp 0x2fd7
leaq 0x3b40(%rip), %rdi      # 0x6b12
movl $0x22, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x11a0
cmpl $0x0, 0x8(%r15)
je 0x3019
leaq 0x3b43(%rip), %rdi      # 0x6b35
movl $0x27, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x11a0
cmpl $0x0, 0x20(%r15)
je 0x3037
leaq 0x3b4b(%rip), %rdi      # 0x6b5d
movl $0x16, %esi
jmp 0x3043
leaq 0x3bbb(%rip), %rdi      # 0x6bdb
movl $0x2b, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x11a0
jmp 0x30bf
leaq 0x3b36(%rip), %rdi      # 0x6b74
movl $0x17, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x11a0
cmpl $0x0, 0xc(%r15)
je 0x3092
leaq 0x3b2e(%rip), %rdi      # 0x6b8c
movl $0x16, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x11a0
cmpl $0x0, 0x10(%r15)
movl 0x18(%r15), %edx
je 0x30ae
movl 0x1c(%r15), %ecx
leaq 0x3b31(%rip), %rsi      # 0x6bb7
movq %r14, %rdi
xorl %eax, %eax
callq 0x1100
jmp 0x30bf
xorps %xmm0, %xmm0
cvtss2sd 0x2c(%r15), %xmm0
leaq 0x3c57(%rip), %rsi      # 0x6cf9
movq %r14, %rdi
movb $0x1, %al
callq 0x1100
jmp 0x30bf
leaq 0x3aee(%rip), %rsi      # 0x6ba3
movq %r14, %rdi
xorl %eax, %eax
callq 0x1100
leaq 0x3b41(%rip), %rsi      # 0x6c07
movq %r14, %rdi
movq (%rsp), %rdx
xorl %eax, %eax
callq 0x1100
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1080
nop