// File: /workspace/github_c_makefile_star2_O0/zhou-lab[P]tbmate/view.c
// Function: parse_tbf_from_argument
static void parse_tbf_from_argument(
  int argc, char **argv, int optind,
  tbf_t **tbfs, int *n_tbfs) {
  
  int i;
  struct dirent *dir;
  char *fname;
  for(i=0; optind < argc; optind++, i++) {
    /* if it's a directory then list all the .tbk files inside */
    DIR* d = opendir(argv[optind]);
    if (d) { /* Directory exists */
      while ((dir = readdir(d)) != NULL) {
        if (strlen(dir->d_name) > 4 &&
            strcmp(dir->d_name + strlen(dir->d_name) - 4, ".tbk")==0) {

          /* identify actual file name */
          fname = malloc(strlen(argv[optind]) + strlen(dir->d_name) + 5);
          strcpy(fname, argv[optind]);
          strcat(fname, "/");
          strcat(fname, dir->d_name);

          (*tbfs) = realloc((*tbfs), (++(*n_tbfs)) * sizeof(tbf_t));
          tbf_open1(fname, &(*tbfs)[*n_tbfs-1], NULL);
          free(fname);
        }
      }
      closedir(d);
    } else {
      (*tbfs) = realloc((*tbfs), (++(*n_tbfs)) * sizeof(tbf_t));
      tbf_open1(argv[optind], &(*tbfs)[*n_tbfs-1], NULL);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x5398
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x33c0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x5329
jmp 0x51ef
movq -0x48(%rbp), %rdi
callq 0x3450
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x531e
movq -0x38(%rbp), %rdi
addq $0x13, %rdi
callq 0x3380
cmpq $0x4, %rax
jbe 0x5319
movq -0x38(%rbp), %rax
addq $0x13, %rax
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rdi
addq $0x13, %rdi
callq 0x3380
movq -0x50(%rbp), %rdi
addq %rax, %rdi
addq $-0x4, %rdi
leaq 0x70635(%rip), %rsi     # 0x7587d
callq 0x3620
cmpl $0x0, %eax
jne 0x5319
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3380
movq %rax, -0x58(%rbp)
movq -0x38(%rbp), %rdi
addq $0x13, %rdi
callq 0x3380
movq -0x58(%rbp), %rdi
addq %rax, %rdi
addq $0x5, %rdi
callq 0x3250
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x3660
movq -0x40(%rbp), %rdi
leaq 0x73998(%rip), %rsi     # 0x78c44
callq 0x3500
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
addq $0x13, %rsi
callq 0x3500
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rcx
movl (%rcx), %eax
addl $0x1, %eax
movl %eax, (%rcx)
movslq %eax, %rsi
shlq $0x5, %rsi
callq 0x37c0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rsi
movq -0x28(%rbp), %rax
movl (%rax), %eax
subl $0x1, %eax
cltq
shlq $0x5, %rax
addq %rax, %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x5da0
movq -0x40(%rbp), %rdi
callq 0x3370
jmp 0x51ef
movq -0x48(%rbp), %rdi
callq 0x3730
jmp 0x537f
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rcx
movl (%rcx), %eax
addl $0x1, %eax
movl %eax, (%rcx)
movslq %eax, %rsi
shlq $0x5, %rsi
callq 0x37c0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rsi
movq -0x28(%rbp), %rax
movl (%rax), %eax
subl $0x1, %eax
cltq
shlq $0x5, %rax
addq %rax, %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x5da0
jmp 0x5381
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x51c1
addq $0x60, %rsp
popq %rbp
retq
nop