// File: /workspace/github_c_makefile_star2_O2/yhg926[P]public_kssd/global_basic.c
// Function: organize_infile_list
infile_tab_t * organize_infile_list(char* list_path, int fmt_ck)
{
  infile_tab_t *infile_stat = malloc(sizeof(infile_tab_t));
  int alloc_usize = 1024;
  infile_stat->organized_infile_tab = malloc( sizeof(infile_entry_t) * alloc_usize );
    struct stat path_stat;
    FILE * list;
    list = fopen(list_path,"r");
    if(!list) err(errno,"can't open file %s",list_path);
    char *buf = malloc( LMAX * sizeof(char));
    int file_num = 0;
  if(fmt_ck){
     while ( (fgets(buf,LMAX,list))!=NULL){
    while(isspace(*buf)) buf++;
       buf[strcspn(buf, "\r\n")] = 0;
       if( strlen(buf) < 1 )
         continue;
       if( strlen(buf) > PATHLEN )
         err(errno,"the input list: %s\n %dth line:  %s  has %lu characters exceed the maximal allowed length %d",
            list_path,file_num, buf,strlen(buf),PATHLEN);
       memset(&path_stat, 0, sizeof path_stat);
       stat(buf, &path_stat) ;
       if(!S_ISREG(path_stat.st_mode))
          err(errno,"%dth line: %s",file_num, buf);
    else if(!isOK_fmt_infile(buf,acpt_infile_fmt,ACPT_FMT_SZ)){
      printf ("isOK_fmt_infile(): wrong format %dth line: %s\nSupported format are:\n",file_num, buf);
      for(int i=0; acpt_infile_fmt[i]!=NULL;i++)
       printf(".%s ",acpt_infile_fmt[i]);
      printf("\n");
       err(errno,"program exit");
    }
    else {
     infile_stat->organized_infile_tab[file_num].fsize = path_stat.st_size;
     infile_stat->organized_infile_tab[file_num].fpath = malloc(PATHLEN * sizeof(char) );
     strcpy(infile_stat->organized_infile_tab[file_num].fpath, buf);
     file_num++;
     if( file_num >= alloc_usize){
         alloc_usize+=alloc_usize;
          infile_stat->organized_infile_tab
                = realloc(infile_stat->organized_infile_tab, sizeof(infile_entry_t) * alloc_usize );
         }
    }
     };
  }
  else{
   while ( (fgets(buf,LMAX,list))!=NULL){
        while(isspace(*buf)) buf++;
        buf[strcspn(buf, "\r\n")] = 0;
        if( strlen(buf) < 1 )
          continue;
        if( strlen(buf) > PATHLEN )
          err(errno,"the input list: %s\n %dth line:  %s  has %lu characters exceed the maximal allowed length %d",
            list_path,file_num, buf,strlen(buf),PATHLEN);
    infile_stat->organized_infile_tab[file_num].fsize = 0;
    infile_stat->organized_infile_tab[file_num].fpath = malloc(PATHLEN * sizeof(char) );
    strcpy(infile_stat->organized_infile_tab[file_num].fpath, buf);
    file_num++;
    if( file_num >= alloc_usize){
            alloc_usize+=alloc_usize;
            infile_stat->organized_infile_tab
                = realloc(infile_stat->organized_infile_tab, sizeof(infile_entry_t) * alloc_usize );
       }
  }
 }
    infile_stat->infile_num = file_num ;
    fclose(list);
  free(buf);
    return infile_stat;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movl %esi, %ebp
movq %rdi, %rbx
pushq $0x10
popq %rdi
callq 0x3340
movq %rax, %r15
movl $0x4000, %edi           # imm = 0x4000
callq 0x3340
movq %rax, 0x8(%r15)
leaq 0x5671(%rip), %rsi      # 0x15dbe
movq %rbx, %rdi
callq 0x33a0
testq %rax, %rax
je 0x109c6
movq %rax, %r13
movq %rbx, 0x18(%rsp)
movl $0x1000, %edi           # imm = 0x1000
callq 0x3340
movq %rax, %rbx
testl %ebp, %ebp
movq %r15, 0x20(%rsp)
je 0x108bb
movl $0x400, 0xc(%rsp)       # imm = 0x400
movq $0x0, 0x10(%rsp)
leaq 0x65d6(%rip), %r14      # 0x16d6e
leaq 0xc7e1(%rip), %rbp      # 0x1cf80
movq %rbx, %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %r13, %rdx
callq 0x3290
testq %rax, %rax
je 0x10999
callq 0x34d0
movq (%rax), %rax
decq %rbx
movsbq 0x1(%rbx), %rcx
incq %rbx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x107c3
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3260
movb $0x0, (%rbx,%rax)
movq %rbx, %rdi
callq 0x3130
testq %rax, %rax
je 0x1079f
movq %rax, %r12
cmpq $0x101, %rax            # imm = 0x101
jae 0x109de
movl $0x90, %edx
leaq 0x28(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
callq 0x3210
movq %rbx, %rdi
movq %r12, %rsi
callq 0x32e0
movl 0x40(%rsp), %eax
movl $0xf000, %ecx           # imm = 0xF000
andl %ecx, %eax
cmpl $0x8000, %eax           # imm = 0x8000
jne 0x10a0a
movq %rbx, %rdi
movq %rbp, %rsi
pushq $0x7
popq %rdx
callq 0x10a80
testl %eax, %eax
je 0x10a27
movq 0x58(%rsp), %rax
movq 0x8(%r15), %r12
movq 0x10(%rsp), %rbp
movq %rbp, %r15
shlq $0x4, %r15
movq %rax, (%r12,%r15)
movl $0x100, %edi            # imm = 0x100
callq 0x3340
movq %rax, 0x8(%r12,%r15)
movq 0x20(%rsp), %r15
movq %rax, %rdi
movq %rbx, %rsi
callq 0x3080
incq %rbp
movq %rbp, 0x10(%rsp)
cmpl %ebp, 0xc(%rsp)
leaq 0xc6ed(%rip), %rbp      # 0x1cf80
jg 0x1079f
movl 0xc(%rsp), %eax
addl %eax, %eax
movl %eax, 0xc(%rsp)
movslq %eax, %rsi
shlq $0x4, %rsi
movq %r12, %rdi
callq 0x3350
movq %rax, 0x8(%r15)
jmp 0x1079f
movl $0x400, %ebp            # imm = 0x400
movq $0x0, 0x10(%rsp)
leaq 0x649e(%rip), %r14      # 0x16d6e
movq %rbx, %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %r13, %rdx
callq 0x3290
testq %rax, %rax
je 0x10999
callq 0x34d0
movq (%rax), %rax
decq %rbx
movsbq 0x1(%rbx), %rcx
incq %rbx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x108f4
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3260
movb $0x0, (%rbx,%rax)
movq %rbx, %rdi
callq 0x3130
testq %rax, %rax
je 0x108d0
movq %rax, %r12
movl %ebp, 0xc(%rsp)
cmpq $0x101, %rax            # imm = 0x101
jae 0x109de
movq 0x8(%r15), %r12
movq 0x10(%rsp), %r15
movq %r15, %rbp
shlq $0x4, %rbp
andq $0x0, (%r12,%rbp)
movl $0x100, %edi            # imm = 0x100
callq 0x3340
movq %rax, 0x8(%r12,%rbp)
movq %r15, %rbp
movq 0x20(%rsp), %r15
movq %rax, %rdi
movq %rbx, %rsi
callq 0x3080
incq %rbp
movq %rbp, 0x10(%rsp)
movl 0xc(%rsp), %eax
cmpl %ebp, %eax
movl %eax, %ebp
jg 0x108d0
addl %ebp, %ebp
movslq %ebp, %rsi
shlq $0x4, %rsi
movq %r12, %rdi
callq 0x3350
movq %rax, 0x8(%r15)
jmp 0x108d0
movq 0x10(%rsp), %rax
movl %eax, (%r15)
movq %r13, %rdi
callq 0x3100
movq %rbx, %rdi
callq 0x3040
movq %r15, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3060
movl (%rax), %edi
leaq 0x6387(%rip), %rsi      # 0x16d5b
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3330
callq 0x3060
movl (%rax), %edi
movl $0x100, (%rsp)          # imm = 0x100
leaq 0x637e(%rip), %rsi      # 0x16d71
movq 0x18(%rsp), %rdx
movq 0x10(%rsp), %rcx
movq %rbx, %r8
movq %r12, %r9
xorl %eax, %eax
callq 0x3330
callq 0x3060
movl (%rax), %edi
leaq 0x63b5(%rip), %rsi      # 0x16dcd
movq 0x10(%rsp), %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x3330
leaq 0x63ad(%rip), %rdi      # 0x16ddb
movq 0x10(%rsp), %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3170
leaq 0x63dc(%rip), %rbx      # 0x16e20
leaq 0xc535(%rip), %r14      # 0x1cf80
movq (%r14), %rsi
testq %rsi, %rsi
je 0x10a63
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3170
addq $0x8, %r14
jmp 0x10a4b
pushq $0xa
popq %rdi
callq 0x3050
callq 0x3060
movl (%rax), %edi
leaq 0x63ac(%rip), %rsi      # 0x16e25
xorl %eax, %eax
callq 0x3330