// File: /workspace/github_c_makefile_star2_O0/usgs[P]nshmp-haz-catalogs/src/agrid/adaptive/calc_agrid_seis_rates.c
// Function: main
int main (int argc, char *argv[])
/*--------------------------------------------------------------------------*/
{
  int stop_run=0, fnew=0;
//  float magv;
  float atotal[NV];
  char paramf[200], paramf_format[200], summf[200], outf[200];
  struct compl_levels cat_compl;
  struct boundaries region;
  struct catalog cat;
  struct smoothp smoothing_params;
  struct rates seis_rates;
  struct eqcat eq_catalog;


// check input arguments and assign command line arguments for parameter file, file formatting, summary file
  if ( check_args(argc,argv,paramf,summf,paramf_format,&stop_run,&fnew) ) exit(1);
  
// initialize parameters, then open and read parameters file
  initialize_params(&cat_compl, &region, &cat, &smoothing_params);
  if( ! read_params_new_old(paramf, &cat_compl, &region, &cat, &smoothing_params, outf,fnew) ) exit(1);
fprintf(stderr,"outfnm: %s\n", outf);
  write_params(&cat_compl, &region, &cat, &smoothing_params, outf);
  write_params_to_file(summf, &cat_compl, &region, &cat, &smoothing_params, outf);
  if ( stop_run == 1 ) exit(1);

// get source region parameters
  fprintf(stderr,"Number of source points: %d (%d x %d)\n",region.nsrc, region.nsx, region.nsy);
  if (region.nsrc > NV ) {
    fprintf(stderr,"nsrc (%d) > NV (%d)\n", region.nsrc, NV); exit(1);
  }

// initialize distances to neighbors and seismicity rate variables
  init_dist_rates(&eq_catalog,atotal,&seis_rates);

// read earthquakes from catalog and assign to grid cells
  if ( ! get_eqs_fm_catalog(cat.catnm, &eq_catalog, &cat_compl, &region, &seis_rates) ) {
    fprintf(stderr,"Error getting earthquakes from catalog. Exiting ...\n"); exit(1);
  }
  seis_rates.nv=region.nsrc;

// get distances from all earthquakes to 10-nearest neighbors
  get_eq_neighbor_dists(&eq_catalog);

// smooth seismicity rates, if smoothing is specified
  smooth_seis_rates(&seis_rates, &smoothing_params, &eq_catalog, &region, &cat_compl, &cat);
  write_eq_neighbor_dists(&eq_catalog, &smoothing_params);
// convert from earthquake numbers in each bin to earthquake rates, adjust completeness, if required
  convert_eq_nos_rates(&seis_rates, &cat_compl, &smoothing_params, &cat, &region);

// write results to file
//fprintf(stdout,"call to write_results_to_file - %s\n", outf);
  write_results_to_file(&smoothing_params, &seis_rates, &cat, &region, outf);

// code completion steps
  fprintf(stdout,"\nSummary of processing written to file, %s\n", summf);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x728570, %rsp         # imm = 0x728570
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq -0xa6130(%rbp), %rdx
leaq -0xa62d0(%rbp), %rcx
leaq -0xa6200(%rbp), %r8
leaq -0x14(%rbp), %r9
leaq -0x18(%rbp), %rax
movq %rax, (%rsp)
callq 0x6660
cmpl $0x0, %eax
je 0x69f3
movl $0x1, %edi
callq 0x1160
leaq -0x33f488(%rbp), %rdi
leaq -0x33f4ac(%rbp), %rsi
leaq -0x33f584(%rbp), %rdx
leaq -0x33f5b4(%rbp), %rcx
callq 0x6c90
leaq -0xa6130(%rbp), %rdi
leaq -0xa63a0(%rbp), %r9
movl -0x18(%rbp), %eax
leaq -0x33f488(%rbp), %rsi
leaq -0x33f4ac(%rbp), %rdx
leaq -0x33f584(%rbp), %rcx
leaq -0x33f5b4(%rbp), %r8
movl %eax, (%rsp)
callq 0x1720
cmpl $0x0, %eax
jne 0x6a58
movl $0x1, %edi
callq 0x1160
movq 0x5599(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq -0xa63a0(%rbp), %rdx
leaq 0x2e49(%rip), %rsi      # 0x98b9
movb $0x0, %al
callq 0x10e0
leaq -0xa63a0(%rbp), %r8
leaq -0x33f488(%rbp), %rdi
leaq -0x33f4ac(%rbp), %rsi
leaq -0x33f584(%rbp), %rdx
leaq -0x33f5b4(%rbp), %rcx
callq 0x2510
leaq -0xa62d0(%rbp), %rdi
leaq -0xa63a0(%rbp), %r9
leaq -0x33f488(%rbp), %rsi
leaq -0x33f4ac(%rbp), %rdx
leaq -0x33f584(%rbp), %rcx
leaq -0x33f5b4(%rbp), %r8
callq 0x28e0
cmpl $0x1, -0x14(%rbp)
jne 0x6ade
movl $0x1, %edi
callq 0x1160
movq 0x5513(%rip), %rax      # 0xbff8
movq (%rax), %rdi
movl -0x33f4a4(%rbp), %edx
movl -0x33f4ac(%rbp), %ecx
movl -0x33f4a8(%rbp), %r8d
leaq 0x2dc3(%rip), %rsi      # 0x98c5
movb $0x0, %al
callq 0x10e0
cmpl $0x29810, -0x33f4a4(%rbp) # imm = 0x29810
jle 0x6b42
movq 0x54dc(%rip), %rax      # 0xbff8
movq (%rax), %rdi
movl -0x33f4a4(%rbp), %edx
leaq 0x2dc0(%rip), %rsi      # 0x98ec
movl $0x29810, %ecx          # imm = 0x29810
movb $0x0, %al
callq 0x10e0
movl $0x1, %edi
callq 0x1160
leaq -0xa6060(%rbp), %rsi
leaq -0x72855c(%rbp), %rdi
leaq -0x5d76b8(%rbp), %rdx
callq 0x2c40
leaq -0x33f584(%rbp), %rdi
addq $0x10, %rdi
leaq -0x72855c(%rbp), %rsi
leaq -0x33f488(%rbp), %rdx
leaq -0x33f4ac(%rbp), %rcx
leaq -0x5d76b8(%rbp), %r8
callq 0x30d0
cmpl $0x0, %eax
jne 0x6baf
movq 0x5464(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x2d63(%rip), %rsi      # 0x9901
movb $0x0, %al
callq 0x10e0
movl $0x1, %edi
callq 0x1160
movl -0x33f4a4(%rbp), %eax
movl %eax, -0x33f5b8(%rbp)
leaq -0x72855c(%rbp), %rdi
callq 0x3560
leaq -0x5d76b8(%rbp), %rdi
leaq -0x33f5b4(%rbp), %rsi
leaq -0x72855c(%rbp), %rdx
leaq -0x33f4ac(%rbp), %rcx
leaq -0x33f488(%rbp), %r8
leaq -0x33f584(%rbp), %r9
callq 0x4b30
leaq -0x72855c(%rbp), %rdi
leaq -0x33f5b4(%rbp), %rsi
callq 0x3e50
leaq -0x5d76b8(%rbp), %rdi
leaq -0x33f488(%rbp), %rsi
leaq -0x33f5b4(%rbp), %rdx
leaq -0x33f584(%rbp), %rcx
leaq -0x33f4ac(%rbp), %r8
callq 0x4100
leaq -0xa63a0(%rbp), %r8
leaq -0x33f5b4(%rbp), %rdi
leaq -0x5d76b8(%rbp), %rsi
leaq -0x33f584(%rbp), %rdx
leaq -0x33f4ac(%rbp), %rcx
callq 0x6850
movq 0x5378(%rip), %rax      # 0xbfd8
movq (%rax), %rdi
leaq -0xa62d0(%rbp), %rdx
leaq 0x2cc5(%rip), %rsi      # 0x9936
movb $0x0, %al
callq 0x10e0
xorl %eax, %eax
addq $0x728570, %rsp         # imm = 0x728570
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)