// File: /workspace/github_c_makefile_star2_O0/usgs[P]nshmp-haz-catalogs/src/agrid/adaptive/read_write_params.c
// Function: read_params_new
int read_params_new(char *parf, struct compl_levels* cat_comp, struct boundaries* reg, 
  struct catalog* cat, struct smoothp* smp, char *outfnm) 
/*--------------------------------------------------------------------------*/
{
  FILE *fpparam;
  int cnt;
//  char buff[BUFFLEN];
  char parseaux[256], gauss_plaw[10];
  
// open file
  if( (fpparam = fopen(parf, "r"))==NULL) {
    fprintf(stderr,"Parameter file not found, %s\n", parf);
    return 0;
  }
  fprintf(stderr,"Reading from parameter file, %s - new formatting style.\n", parf);

// read parameters
  Parse_Text(fpparam, "Min_Lat",'f', &(reg->minlat) );
  Parse_Text(fpparam, "Max_Lat",'f', &(reg->maxlat) );
  Parse_Text(fpparam, "Min_Lon",'f', &(reg->minlon) );
  Parse_Text(fpparam, "Max_Lon",'f', &(reg->maxlon) );
  Parse_Text(fpparam, "Inc_Lat",'f', &(reg->dlat) );
  Parse_Text(fpparam, "Inc_Lon",'f', &(reg->dlon) );
  Parse_Text(fpparam, "Correct_Area_for_Latitude",'i', &(cat_comp->correctAreaForLat) );
  Parse_Text(fpparam, "Variable_Completeness",'i', &(cat_comp->variableCompleteness) );
  if ( (cat_comp->variableCompleteness) == 1 ) {
    Parse_Text(fpparam, "Completeness_File",'s', &(cat_comp->completenessFile) );
  }
  Parse_Text(fpparam, "Catalog_Gaps",'i', &(cat_comp->catalogGaps) );
  if ( (cat_comp->catalogGaps) == 1 ) {
    Parse_Text(fpparam, "Catalog_Gaps_File",'s', &(cat_comp->catalogGapsFile) );
    Parse_Text(fpparam, "Polygons_for_Gaps_Path", 's', &(cat_comp->catalogGapsPolygonPath));
    load_poly_data(cat_comp);
  }
  Parse_Text(fpparam, "N_Completeness_Levels",'i', &(cat_comp->nlevels) );
  for (cnt=0; cnt<cat_comp->nlevels; cnt++) {
    sprintf(parseaux,"Completeness_Level_yr_%d", cnt+1);
    Parse_Text(fpparam,parseaux,'i', &(cat_comp->yr_comp[cnt]) );
    sprintf(parseaux,"Completeness_Level_M_%d", cnt+1);
    Parse_Text(fpparam,parseaux,'f', &(cat_comp->mag_comp[cnt]) );
  }
  Parse_Text(fpparam, "End_yr_Catalog",'i', &(cat->end_yr) );
  Parse_Text(fpparam, "Catalog_Name",'s', &(cat->catnm) );
  Parse_Text(fpparam, "Output_Name",'s', outfnm);
  Parse_Text(fpparam, "Min_Magnitude",'f', &(cat->minMag) );
  Parse_Text(fpparam, "b_Value",'f', &(cat->bval) );
  Parse_Text(fpparam, "dMag_value",'f', &(cat->dMag) );
// logical values
  Parse_Text(fpparam, "logical_Effective_Num_Eqs",'i', &(smp->use_neff) );
  Parse_Text(fpparam, "logical_Cumulative_rates",'i', &(smp->cumul_rates) );
  Parse_Text(fpparam, "logical_Apply_smoothing",'i', &(smp->apply_sm) );
  if ( (smp->apply_sm) == 1 ) {
    Parse_Text(fpparam, "logical_Adjust_completeness",'i', &(smp->adj_compl) );
    Parse_Text(fpparam, "Gauss_PowerLaw_Kernel",'s', gauss_plaw);
    if ( STREQ(gauss_plaw,"gauss") ) {
      smp->gauss_kern=1;
    }
    else if ( STREQ(gauss_plaw,"powerLaw") ) {
      smp->gauss_kern=0;
    }
    else {
      fprintf(stderr,"No kernel option for %s. User must enter gauss or powerLaw for kernel-type.\n", gauss_plaw);
      exit(1);
    }
    Parse_Text(fpparam, "logical_Adaptive_smoothing",'i', &(smp->adapt_sm) );
    if ( (smp->adapt_sm) ) {
      Parse_Text(fpparam, "Adaptive_Neighbor_Number",'i', &(smp->nnum) );
      Parse_Text(fpparam, "Sigma_Min",'f', &(smp->sigmin) );
      Parse_Text(fpparam, "Sigma_Max",'f', &(smp->sigmax) );
      Parse_Text(fpparam, "logical_Avg_Neighbor",'i', &(smp->nnum2_log) );
      if (smp->nnum2_log) {
        Parse_Text(fpparam, "Adaptive_Neighbor_Number_2",'i', &(smp->nnum2) );
      }
    }
    else {
      Parse_Text(fpparam, "Sigma_Fix",'f', &(smp->sigfix) );
    }
  }
  fclose(fpparam);

// get numbers of points in x-, y-directions
  reg->nsx=(int)( (reg->maxlon-reg->minlon)/reg->dlon +1);
  reg->nsy=(int)( (reg->maxlat-reg->minlat)/reg->dlat +1 );
  reg->nsrc=reg->nsx*reg->nsy;

  return 1;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x7049(%rip), %rsi      # 0x88b7
callq 0x1130
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
jne 0x18a5
movq 0xa774(%rip), %rax      # 0xbff8
movq (%rax), %rdi
movq -0x10(%rbp), %rdx
leaq 0x6d1d(%rip), %rsi      # 0x85af
movb $0x0, %al
callq 0x10e0
movl $0x0, -0x4(%rbp)
jmp 0x1e27
movq 0xa74c(%rip), %rax      # 0xbff8
movq (%rax), %rdi
movq -0x10(%rbp), %rdx
leaq 0x6ddd(%rip), %rsi      # 0x8697
movb $0x0, %al
callq 0x10e0
movq -0x40(%rbp), %rdi
movq -0x20(%rbp), %rcx
addq $0x14, %rcx
leaq 0x6dfc(%rip), %rsi      # 0x86d0
movl $0x66, %edx
callq 0x6df0
movq -0x40(%rbp), %rdi
movq -0x20(%rbp), %rcx
addq $0x18, %rcx
leaq 0x6de7(%rip), %rsi      # 0x86d8
movl $0x66, %edx
callq 0x6df0
movq -0x40(%rbp), %rdi
movq -0x20(%rbp), %rcx
addq $0xc, %rcx
leaq 0x6dd2(%rip), %rsi      # 0x86e0
movl $0x66, %edx
callq 0x6df0
movq -0x40(%rbp), %rdi
movq -0x20(%rbp), %rcx
addq $0x10, %rcx
leaq 0x6dbd(%rip), %rsi      # 0x86e8
movl $0x66, %edx
callq 0x6df0
movq -0x40(%rbp), %rdi
movq -0x20(%rbp), %rcx
addq $0x20, %rcx
leaq 0x6da8(%rip), %rsi      # 0x86f0
movl $0x66, %edx
callq 0x6df0
movq -0x40(%rbp), %rdi
movq -0x20(%rbp), %rcx
addq $0x1c, %rcx
leaq 0x6d93(%rip), %rsi      # 0x86f8
movl $0x66, %edx
callq 0x6df0
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rcx
addq $0x8, %rcx
leaq 0x6d7e(%rip), %rsi      # 0x8700
movl $0x69, %edx
callq 0x6df0
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rcx
leaq 0x6d7f(%rip), %rsi      # 0x871a
movl $0x69, %edx
callq 0x6df0
movq -0x18(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x19cb
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rcx
addq $0x68, %rcx
leaq 0x6d6f(%rip), %rsi      # 0x8730
movl $0x73, %edx
callq 0x6df0
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rcx
addq $0x4, %rcx
leaq 0x6d64(%rip), %rsi      # 0x8742
movl $0x69, %edx
callq 0x6df0
movq -0x18(%rbp), %rax
cmpl $0x1, 0x4(%rax)
jne 0x1a3b
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rcx
addq $0x130, %rcx            # imm = 0x130
leaq 0x6d47(%rip), %rsi      # 0x874f
movl $0x73, %edx
callq 0x6df0
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rcx
addq $0x1f8, %rcx            # imm = 0x1F8
leaq 0x6d39(%rip), %rsi      # 0x8761
movl $0x73, %edx
callq 0x6df0
movq -0x18(%rbp), %rdi
callq 0x1480
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rcx
addq $0xc, %rcx
leaq 0x6d2a(%rip), %rsi      # 0x8778
movl $0x69, %edx
callq 0x6df0
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x1b03
leaq -0x150(%rbp), %rdi
movl -0x44(%rbp), %edx
addl $0x1, %edx
leaq 0x6d0b(%rip), %rsi      # 0x878e
movb $0x0, %al
callq 0x1150
movq -0x40(%rbp), %rdi
leaq -0x150(%rbp), %rsi
movq -0x18(%rbp), %rcx
addq $0x14, %rcx
movslq -0x44(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rcx
movl $0x69, %edx
callq 0x6df0
leaq -0x150(%rbp), %rdi
movl -0x44(%rbp), %edx
addl $0x1, %edx
leaq 0x6ce1(%rip), %rsi      # 0x87a7
movb $0x0, %al
callq 0x1150
movq -0x40(%rbp), %rdi
leaq -0x150(%rbp), %rsi
movq -0x18(%rbp), %rcx
addq $0x3c, %rcx
movslq -0x44(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rcx
movl $0x66, %edx
callq 0x6df0
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x1a5f
movq -0x40(%rbp), %rdi
movq -0x28(%rbp), %rcx
leaq 0x6cad(%rip), %rsi      # 0x87bf
movl $0x69, %edx
callq 0x6df0
movq -0x40(%rbp), %rdi
movq -0x28(%rbp), %rcx
addq $0x10, %rcx
leaq 0x6c9f(%rip), %rsi      # 0x87ce
movl $0x73, %edx
callq 0x6df0
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rcx
leaq 0x6c93(%rip), %rsi      # 0x87db
movl $0x73, %edx
callq 0x6df0
movq -0x40(%rbp), %rdi
movq -0x28(%rbp), %rcx
addq $0x4, %rcx
leaq 0x6c82(%rip), %rsi      # 0x87e7
movl $0x66, %edx
callq 0x6df0
movq -0x40(%rbp), %rdi
movq -0x28(%rbp), %rcx
addq $0xc, %rcx
leaq 0x6c73(%rip), %rsi      # 0x87f5
movl $0x66, %edx
callq 0x6df0
movq -0x40(%rbp), %rdi
movq -0x28(%rbp), %rcx
addq $0x8, %rcx
leaq 0x6c5e(%rip), %rsi      # 0x87fd
movl $0x66, %edx
callq 0x6df0
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rcx
addq $0x14, %rcx
leaq 0x6c4c(%rip), %rsi      # 0x8808
movl $0x69, %edx
callq 0x6df0
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rcx
leaq 0x6c4d(%rip), %rsi      # 0x8822
movl $0x69, %edx
callq 0x6df0
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rcx
addq $0x8, %rcx
leaq 0x6c49(%rip), %rsi      # 0x883b
movl $0x69, %edx
callq 0x6df0
movq -0x30(%rbp), %rax
cmpl $0x1, 0x8(%rax)
jne 0x1d9f
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rcx
addq $0x4, %rcx
leaq 0x6c36(%rip), %rsi      # 0x8853
movl $0x69, %edx
callq 0x6df0
movq -0x40(%rbp), %rdi
leaq -0x15a(%rbp), %rcx
leaq 0x6c36(%rip), %rsi      # 0x886f
movl $0x73, %edx
callq 0x6df0
leaq -0x15a(%rbp), %rdi
leaq 0x699d(%rip), %rsi      # 0x85ee
callq 0x10d0
cmpl $0x0, %eax
jne 0x1c68
movq -0x30(%rbp), %rax
movl $0x1, 0x20(%rax)
jmp 0x1cb8
leaq -0x15a(%rbp), %rdi
leaq 0x697e(%rip), %rsi      # 0x85f4
callq 0x10d0
cmpl $0x0, %eax
jne 0x1c8d
movq -0x30(%rbp), %rax
movl $0x0, 0x20(%rax)
jmp 0x1cb6
movq 0xa364(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq -0x15a(%rbp), %rdx
leaq 0x6958(%rip), %rsi      # 0x85fd
movb $0x0, %al
callq 0x10e0
movl $0x1, %edi
callq 0x1160
jmp 0x1cb8
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rcx
addq $0xc, %rcx
leaq 0x6bba(%rip), %rsi      # 0x8885
movl $0x69, %edx
callq 0x6df0
movq -0x30(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x1d80
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rcx
addq $0x18, %rcx
leaq 0x6baa(%rip), %rsi      # 0x88a0
movl $0x69, %edx
callq 0x6df0
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rcx
addq $0x24, %rcx
leaq 0x6ba6(%rip), %rsi      # 0x88b9
movl $0x66, %edx
callq 0x6df0
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rcx
addq $0x28, %rcx
leaq 0x6b93(%rip), %rsi      # 0x88c3
movl $0x66, %edx
callq 0x6df0
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rcx
addq $0x10, %rcx
leaq 0x6b80(%rip), %rsi      # 0x88cd
movl $0x69, %edx
callq 0x6df0
movq -0x30(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0x1d7e
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rcx
addq $0x1c, %rcx
leaq 0x6b6e(%rip), %rsi      # 0x88e2
movl $0x69, %edx
callq 0x6df0
jmp 0x1d9d
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rcx
addq $0x2c, %rcx
leaq 0x6b6a(%rip), %rsi      # 0x88fd
movl $0x66, %edx
callq 0x6df0
jmp 0x1d9f
movq -0x40(%rbp), %rdi
callq 0x1080
movq -0x20(%rbp), %rax
movss 0x10(%rax), %xmm0
movq -0x20(%rbp), %rax
subss 0xc(%rax), %xmm0
movq -0x20(%rbp), %rax
divss 0x1c(%rax), %xmm0
movss 0x654d(%rip), %xmm1     # 0x8318
addss %xmm1, %xmm0
cvttss2si %xmm0, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movss 0x18(%rax), %xmm0
movq -0x20(%rbp), %rax
subss 0x14(%rax), %xmm0
movq -0x20(%rbp), %rax
divss 0x20(%rax), %xmm0
movss 0x651c(%rip), %xmm1     # 0x8318
addss %xmm1, %xmm0
cvttss2si %xmm0, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x20(%rbp), %rax
movl (%rax), %ecx
movq -0x20(%rbp), %rax
imull 0x4(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x8(%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
nopw %cs:(%rax,%rax)