// File: /workspace/github_c_makefile_star2_O1/mabdi[P]bunney/bunny-flow.c
// Function: reload_config
static void reload_config(void) {
  DIR* d;
  struct dirent* dent;
  _u32 i;
   
  for (i=0;i<infcount;i++) {
    free(infile[i].fname);
    if (infile[i].data) free(infile[i].data);
  }
  
  if (infile) free(infile);

  infcount = 0;
  infile   = 0;
  orig_fuzzable = 0;
  
  if (chdir(indir) || !(d = opendir(".")))
    pfatal("cannot open '%s' for reading",indir);
    
  while ((dent = readdir(d))) {
    struct stat st;
    _u8* x;
    
    if (dent->d_name[0] == '.') continue;
    
    x = strrchr(dent->d_name,'.');
    
    infile = realloc(infile,(infcount + 1) * sizeof(struct file_record));
    if (!infile) fatal("out of memory");
    
    infile[infcount].asis = (x && !strcmp(x,".keep"));

    infile[infcount].fname = strdup(dent->d_name);
    if (!infile[infcount].fname) fatal("out of memory");
    
    infile[infcount].data  = 0;
    infile[infcount].dirty = 0;
    
    if (access(dent->d_name,R_OK) || stat(dent->d_name,&st))
      pfatal("unable to access '%s/%s'",indir,dent->d_name);
      
    if (!S_ISREG(st.st_mode))
      fatal("'%s/%s' is not a regular file",indir,dent->d_name);

    /* 4 GB total oughta be enough for everybody... */
    infile[infcount].orig_len   = st.st_size;
    infile[infcount].cur_len    = st.st_size;
    if (!infile[infcount].asis) orig_fuzzable += st.st_size;
    
    infcount++;
  }

  closedir(d);
  
  if (!orig_fuzzable)
    fatal("directory '%s' contains no fuzzable entries",indir);

  if (infcount > 1)
    qsort(infile,infcount,sizeof(struct file_record),inf_sorter);

  debug("Loaded directory '%s': %u entries, %u bytes to fuzz\n",indir,infcount,orig_fuzzable);

  if (chdir(workdir))
    pfatal("unable to go back to work directory");

  cur_fuzzable = orig_fuzzable;
  
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl 0x4eba(%rip), %ebx      # 0x8190
testq %rbx, %rbx
je 0x330a
movq 0x4eb6(%rip), %r14      # 0x8198
shlq $0x5, %rbx
xorl %r15d, %r15d
movq (%r14,%r15), %rdi
callq 0x1170
movq 0x8(%r14,%r15), %rdi
testq %rdi, %rdi
je 0x3301
callq 0x1170
addq $0x20, %r15
cmpq %r15, %rbx
jne 0x32e9
movq 0x4e87(%rip), %rdi      # 0x8198
testq %rdi, %rdi
je 0x331b
callq 0x1170
xorl %eax, %eax
movl %eax, 0x4e6d(%rip)      # 0x8190
movq $0x0, 0x4e6a(%rip) # 0x8198
movl %eax, 0x4e6c(%rip)      # 0x81a0
movq 0x3e45(%rip), %rdi      # 0x7180
callq 0x11e0
testl %eax, %eax
jne 0x34e0
leaq 0xeb8(%rip), %rdi       # 0x4207
callq 0x1200
testq %rax, %rax
je 0x34e0
movq %rax, %rbx
movq %rax, %rdi
callq 0x1210
testq %rax, %rax
je 0x349e
movq %rax, %r12
leaq 0x8(%rsp), %r14
cmpb $0x2e, 0x13(%r12)
je 0x348a
addq $0x13, %r12
movq %r12, %rdi
movl $0x2e, %esi
callq 0x1130
movq %rax, %rbp
movq 0x4df8(%rip), %rdi      # 0x8198
movl 0x4de9(%rip), %r15d     # 0x8190
leal 0x1(%r15), %esi
shlq $0x5, %rsi
callq 0x1250
movq %rax, 0x4ddd(%rip)      # 0x8198
testq %rax, %rax
je 0x34ce
movq %rax, %r13
testq %rbp, %rbp
je 0x33e2
movq %rbp, %rdi
leaq 0xe99(%rip), %rsi       # 0x426f
callq 0x11a0
testl %eax, %eax
sete %al
jmp 0x33e4
xorl %eax, %eax
shlq $0x5, %r15
movb %al, 0x10(%r13,%r15)
movq %r12, %rdi
callq 0x1270
movq %rax, (%r13,%r15)
testq %rax, %rax
je 0x34d3
movq %r13, %rax
addq %r15, %rax
movq $0x0, 0x8(%rax)
movb $0x0, 0x1c(%r13,%r15)
movq %r12, %rdi
movl $0x4, %esi
callq 0x1260
testl %eax, %eax
jne 0x34c6
movq %r12, %rdi
movq %r14, %rsi
callq 0x1110
testl %eax, %eax
jne 0x34c6
movl 0x20(%rsp), %eax
movl $0xf000, %ecx           # imm = 0xF000
andl %ecx, %eax
cmpl $0x8000, %eax           # imm = 0x8000
jne 0x34d8
movl 0x38(%rsp), %ecx
movq 0x4d38(%rip), %rdx      # 0x8198
movl 0x4d2a(%rip), %eax      # 0x8190
movq %rax, %rsi
shlq $0x5, %rsi
movl %ecx, 0x14(%rdx,%rsi)
movl %ecx, 0x18(%rdx,%rsi)
cmpb $0x0, 0x10(%rdx,%rsi)
jne 0x3482
addl %ecx, 0x4d1e(%rip)      # 0x81a0
incl %eax
movl %eax, 0x4d06(%rip)      # 0x8190
movq %rbx, %rdi
callq 0x1210
movq %rax, %r12
testq %rax, %rax
jne 0x3379
movq %rbx, %rdi
callq 0x1230
cmpl $0x0, 0x4cf3(%rip)      # 0x81a0
je 0x34e5
callq 0x1edc
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
callq 0x1da2
callq 0x1e94
callq 0x1e4c
movq %r12, %rdi
callq 0x1dfc
callq 0x1fe4
callq 0x1f97