// File: /workspace/github_c_makefile_star2_O2/usgs[P]nshmp-haz-catalogs/src/agrid/adaptive/read_write_params.c
// Function: load_poly_data
void load_poly_data(struct compl_levels* cat_comp)
/*--------------------------------------------------------------------------*/
{
   FILE *fplst, *fppoly;
   int cnt, cnt1, cnt2, nheaders, years_gap;
   char buff[BUFFLEN], nm_tmp[200];
   char polygonFilePath[200];

   if( (fplst = fopen(cat_comp->catalogGapsFile, "r"))==NULL) {
     fprintf(stderr,"Cannot open file with list of polygons, %s\n", cat_comp->catalogGapsFile);
     exit(1);
   }
   fprintf(stderr,"Opened file with list of polygons, %s\n", cat_comp->catalogGapsFile);
// loop through list of all polygon files
   cnt=0;
   while(fgets(buff,BUFFLEN,fplst) ) {
     sscanf(buff,"%s %d %d", nm_tmp, &years_gap, &nheaders);
     sprintf(polygonFilePath, "%s/%s", cat_comp->catalogGapsPolygonPath, nm_tmp);

     if( (fppoly  = fopen(polygonFilePath, "r"))==NULL) {
       fprintf(stderr, "Cannot open polygon file, %s\n", polygonFilePath);
       exit(1);
     }
     for(cnt1=0; cnt1<nheaders; cnt1++) fgets(buff,BUFFLEN,fppoly);
     cat_comp->polygons.elem[cnt].nyears=years_gap;
     cnt2=0;
     while(fgets(buff,BUFFLEN,fppoly) ) {
       sscanf(buff,"%f %f", &(cat_comp->polygons.elem[cnt].lon[cnt2]), &(cat_comp->polygons.elem[cnt].lat[cnt2]) );
       cnt2++;
     }
     cat_comp->polygons.elem[cnt].npts=cnt2;
     fclose(fppoly);
     cnt++;
   }
   cat_comp->polygons.npoly=cnt;
   fprintf(stderr,"Read %d polygons.\n", cat_comp->polygons.npoly);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x318, %rsp            # imm = 0x318
movq %rdi, %r14
leaq 0x130(%rdi), %rbx
leaq 0x5411(%rip), %rsi      # 0x68cb
movq %rbx, %rdi
callq 0x1150
movq 0x8b2f(%rip), %rcx      # 0x9ff8
movq (%rcx), %rdi
movq %rax, 0x30(%rsp)
testq %rax, %rax
je 0x1693
leaq 0x4e7b(%rip), %rsi      # 0x635c
movq %rbx, %rdx
xorl %eax, %eax
callq 0x10f0
leaq 0x1f8(%r14), %rax
movq %rax, 0x28(%rsp)
leaq 0x2983c8(%r14), %rax
movq %rax, 0x20(%rsp)
movq %r14, 0x18(%rsp)
leaq 0x298420(%r14), %rax
movq %rax, 0x10(%rsp)
leaq 0x1e0(%rsp), %r12
leaq 0x5914(%rip), %r14      # 0x6e37
xorl %r13d, %r13d
movq %r12, %rdi
movl $0x12c, %esi            # imm = 0x12C
movq 0x30(%rsp), %rdx
callq 0x10d0
testq %rax, %rax
je 0x1635
movq %r12, %rdi
leaq 0x4e38(%rip), %rsi      # 0x6383
leaq 0x110(%rsp), %rbx
movq %rbx, %rdx
leaq 0x8(%rsp), %rcx
leaq 0xc(%rsp), %r8
xorl %eax, %eax
callq 0x1110
leaq 0x40(%rsp), %r15
movq %r15, %rdi
leaq 0x4e16(%rip), %rsi      # 0x638c
movq 0x28(%rsp), %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1170
movq %r15, %rdi
leaq 0x533c(%rip), %rsi      # 0x68cb
callq 0x1150
testq %rax, %rax
je 0x166e
movq %rax, %r15
xorl %ebx, %ebx
cmpl 0xc(%rsp), %ebx
jge 0x15bc
movq %r12, %rdi
movl $0x12c, %esi            # imm = 0x12C
movq %r15, %rdx
callq 0x10d0
incl %ebx
jmp 0x15a2
movl 0x8(%rsp), %eax
movq %r13, 0x38(%rsp)
imulq $0xa8, %r13, %rcx
movq 0x20(%rsp), %rdx
leaq (%rdx,%rcx), %rbp
movl %eax, 0x4(%rdx,%rcx)
xorl %r13d, %r13d
movq 0x10(%rsp), %rbx
movq %r12, %rdi
movl $0x12c, %esi            # imm = 0x12C
movq %r15, %rdx
callq 0x10d0
testq %rax, %rax
je 0x1613
leaq -0x50(%rbx), %rdx
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1110
incl %r13d
addq $0x4, %rbx
jmp 0x15e1
movl %r13d, (%rbp)
movq %r15, %rdi
callq 0x1080
movq 0x38(%rsp), %r13
incq %r13
addq $0xa8, 0x10(%rsp)
jmp 0x1526
movq 0x18(%rsp), %rax
movl %r13d, 0x2983c4(%rax)
movq 0x89b0(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
leaq 0x4d5e(%rip), %rsi      # 0x63b0
movl %r13d, %edx
xorl %eax, %eax
callq 0x10f0
addq $0x318, %rsp            # imm = 0x318
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8983(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
leaq 0x4d13(%rip), %rsi      # 0x6392
leaq 0x40(%rsp), %rdx
xorl %eax, %eax
callq 0x10f0
pushq $0x1
popq %rdi
callq 0x1180
leaq 0x4c96(%rip), %rsi      # 0x6330
movq %rbx, %rdx
jmp 0x1684