// File: /workspace/github_c_makefile_star2_O2/yhg926[P]public_kssd/global_basic.c
// Function: organize_infile_frm_arg
infile_tab_t * organize_infile_frm_arg (int num_remaining_args, char ** remaining_args,int fmt_ck)
{
 infile_tab_t *infile_stat = malloc(sizeof(infile_tab_t));
 int file_num = 0;
 struct stat path_stat;
 DIR *dirp;
 struct dirent *dirent;
 char fullpath[PATHLEN];
 int alloc_usize = 1024;
 infile_stat->organized_infile_tab = malloc( sizeof(infile_entry_t) * alloc_usize );
if(fmt_ck) {
 for(int i=0;i<num_remaining_args;i++){
  stat(remaining_args[i],&path_stat);
  if( S_ISDIR(path_stat.st_mode)){
    if (( dirp = opendir(remaining_args[i]) ) == NULL)
     err(errno, "%dth argument: can't open %s",i+1, remaining_args[i] );
    while ((dirent = readdir(dirp)) != NULL){
     if(strlen(remaining_args[i]) + strlen(dirent->d_name) + 1 >PATHLEN)
      err(errno,"path: %s/%s exceed maximal path lenth %d",remaining_args[i], dirent->d_name,PATHLEN);
     sprintf(fullpath, "%s/%s", remaining_args[i], dirent->d_name);
     stat(fullpath,&path_stat);
        if(isOK_fmt_infile(fullpath,acpt_infile_fmt,ACPT_FMT_SZ)){
      infile_stat->organized_infile_tab[file_num].fsize = path_stat.st_size;
      infile_stat->organized_infile_tab[file_num].fpath = malloc(PATHLEN * sizeof(char));
      sprintf(infile_stat->organized_infile_tab[file_num].fpath, "%s/%s", remaining_args[i], dirent->d_name);
      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 );
      }
     }
    }
    closedir(dirp);
  }
  else if(isOK_fmt_infile(remaining_args[i],acpt_infile_fmt,ACPT_FMT_SZ)){
   stat(remaining_args[i],&path_stat);
   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, remaining_args[i]);
   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{
   printf ("wrong format %dth argument: %s\nSupported format are:\n",i+1,remaining_args[i]);
      for(int i=0; acpt_infile_fmt[i]!=NULL;i++)
       printf(".%s ",acpt_infile_fmt[i]);
      printf("\n");
      err(errno,"program exit");
  }
 };
}
else{
 for(int i=0;i<num_remaining_args;i++){
  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, remaining_args[i]);
  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 ;
 return infile_stat;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movl %edx, %ebp
movq %rsi, 0x8(%rsp)
movl %edi, %r15d
pushq $0x10
popq %rdi
callq 0x3340
movq %rax, %rbx
movl $0x4000, %edi           # imm = 0x4000
callq 0x3340
movq %rax, %r12
movq %rbx, 0x20(%rsp)
movq %rax, 0x8(%rbx)
testl %ebp, %ebp
je 0x10dff
movq %r12, 0x10(%rsp)
xorl %eax, %eax
testl %r15d, %r15d
cmovlel %eax, %r15d
movq %r15, 0x28(%rsp)
movl $0x400, %r15d           # imm = 0x400
leaq 0xc0(%rsp), %r12
xorl %r13d, %r13d
movq $0x0, 0x18(%rsp)
cmpq 0x28(%rsp), %r13
je 0x10de0
movq 0x8(%rsp), %rbx
movq (%rbx,%r13,8), %rdi
leaq 0x30(%rsp), %rsi
callq 0x32e0
movl 0x48(%rsp), %eax
movl $0xf000, %ecx           # imm = 0xF000
andl %ecx, %eax
movq (%rbx,%r13,8), %rdi
cmpl $0x4000, %eax           # imm = 0x4000
jne 0x10d2a
callq 0x3110
movq %rax, %r14
testq %rax, %rax
je 0x10eed
movl %r15d, 0x4(%rsp)
movq %r14, %rdi
callq 0x3320
testq %rax, %rax
je 0x10dcb
movq %rax, %r15
movq 0x8(%rsp), %rax
movq (%rax,%r13,8), %rbp
movq %rbp, %rdi
callq 0x3130
movq %rax, %rbx
addq $0x13, %r15
movq %r15, %rdi
callq 0x3130
addq %rbx, %rax
addq $-0x100, %rax
cmpq $-0x102, %rax           # imm = 0xFEFE
jbe 0x10e6e
movq %r12, %rdi
leaq 0x372a(%rip), %rsi      # 0x14393
movq %rbp, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x3430
movq %r12, %rdi
leaq 0x30(%rsp), %rsi
callq 0x32e0
movq %r12, %rdi
leaq 0xc2f3(%rip), %rsi      # 0x1cf80
pushq $0x7
popq %rdx
callq 0x10a80
testl %eax, %eax
je 0x10c16
movq 0x60(%rsp), %rax
movq 0x18(%rsp), %rbp
movslq %ebp, %rbp
movq %rbp, %rbx
shlq $0x4, %rbx
movq 0x10(%rsp), %rcx
movq %rax, (%rcx,%rbx)
movl $0x100, %edi            # imm = 0x100
callq 0x3340
movq 0x10(%rsp), %rcx
movq %rax, 0x8(%rcx,%rbx)
movq 0x8(%rsp), %rcx
movq (%rcx,%r13,8), %rdx
movq %rax, %rdi
leaq 0x36b2(%rip), %rsi      # 0x14393
movq %r15, %rcx
xorl %eax, %eax
callq 0x3430
incl %ebp
movq %rbp, 0x18(%rsp)
movl 0x4(%rsp), %r15d
cmpl %r15d, %ebp
jl 0x10c16
addl %r15d, %r15d
movslq %r15d, %rsi
shlq $0x4, %rsi
movq 0x10(%rsp), %rdi
callq 0x3350
movq %rax, %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x10(%rsp)
movq %rcx, 0x8(%rax)
jmp 0x10c11
movl %r15d, 0x4(%rsp)
leaq 0xc24a(%rip), %rsi      # 0x1cf80
pushq $0x7
popq %rdx
callq 0x10a80
testl %eax, %eax
je 0x10e8f
movq 0x8(%rsp), %r14
movq (%r14,%r13,8), %rdi
leaq 0x30(%rsp), %rsi
callq 0x32e0
movq 0x60(%rsp), %rax
movq 0x18(%rsp), %r15
movslq %r15d, %r15
movq %r15, %rbx
shlq $0x4, %rbx
movq 0x10(%rsp), %rbp
movq %rax, (%rbp,%rbx)
movl $0x100, %edi            # imm = 0x100
callq 0x3340
movq %rax, 0x8(%rbp,%rbx)
movq (%r14,%r13,8), %rsi
movq %rax, %rdi
callq 0x3080
incl %r15d
movq %r15, 0x18(%rsp)
movl 0x4(%rsp), %eax
cmpl %eax, %r15d
movl %eax, %r15d
jl 0x10dd8
addl %r15d, %r15d
movslq %r15d, %rsi
shlq $0x4, %rsi
movq %rbp, %rdi
callq 0x3350
movq %rax, %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x10(%rsp)
movq %rcx, 0x8(%rax)
jmp 0x10dd8
movq %r14, %rdi
callq 0x3240
movl 0x4(%rsp), %r15d
incq %r13
jmp 0x10bc8
movq 0x18(%rsp), %r15
movq 0x20(%rsp), %rax
movl %r15d, (%rax)
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
testl %r15d, %r15d
cmovlel %ebx, %r15d
movl $0x400, %ebp            # imm = 0x400
movq %rbx, %rax
shlq $0x4, %rax
leaq (%r12,%rax), %r14
addq $0x8, %r14
cmpq %rbx, %r15
je 0x10de5
andq $0x0, -0x8(%r14)
movl $0x100, %edi            # imm = 0x100
callq 0x3340
movq %rax, (%r14)
movq 0x8(%rsp), %rcx
movq (%rcx,%rbx,8), %rsi
movq %rax, %rdi
callq 0x3080
incq %rbx
addq $0x10, %r14
cmpl %ebx, %ebp
jg 0x10e1c
addl %ebp, %ebp
movslq %ebp, %rsi
shlq $0x4, %rsi
movq %r12, %rdi
callq 0x3350
movq %rax, %r12
movq 0x20(%rsp), %rax
movq %r12, 0x8(%rax)
jmp 0x10e0d
callq 0x3060
movl (%rax), %edi
leaq 0x5fd3(%rip), %rsi      # 0x16e4f
movq %rbp, %rdx
movq %r15, %rcx
movl $0x100, %r8d            # imm = 0x100
xorl %eax, %eax
callq 0x3330
leal 0x1(%r13), %esi
movq 0x8(%rsp), %rax
movq (%rax,%r13,8), %rdx
leaq 0x5fd5(%rip), %rdi      # 0x16e78
xorl %eax, %eax
callq 0x3170
leaq 0x5f6f(%rip), %rbx      # 0x16e20
leaq 0xc0c8(%rip), %r14      # 0x1cf80
movq (%r14), %rsi
testq %rsi, %rsi
je 0x10ed0
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3170
addq $0x8, %r14
jmp 0x10eb8
pushq $0xa
popq %rdi
callq 0x3050
callq 0x3060
movl (%rax), %edi
leaq 0x5f3f(%rip), %rsi      # 0x16e25
xorl %eax, %eax
callq 0x3330
callq 0x3060
movl (%rax), %edi
leal 0x1(%r13), %edx
movq 0x8(%rsp), %rax
movq (%rax,%r13,8), %rcx
leaq 0x5f2a(%rip), %rsi      # 0x16e32
xorl %eax, %eax
callq 0x3330