// File: /workspace/github_c_makefile_star2_O3/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 0x4eb4(%rip), %r14d     # 0x8190
movq 0x4eb5(%rip), %rbx      # 0x8198
testq %r14, %r14
jne 0x32ef
testq %rbx, %rbx
jne 0x3317
jmp 0x331f
shlq $0x5, %r14
xorl %r15d, %r15d
movq (%rbx,%r15), %rdi
callq 0x1170
movq 0x8(%rbx,%r15), %rdi
testq %rdi, %rdi
je 0x330e
callq 0x1170
addq $0x20, %r15
cmpq %r15, %r14
jne 0x32f6
movq %rbx, %rdi
callq 0x1170
xorl %eax, %eax
movl %eax, 0x4e69(%rip)      # 0x8190
movq $0x0, 0x4e66(%rip) # 0x8198
movl %eax, 0x4e68(%rip)      # 0x81a0
movq 0x3e41(%rip), %rdi      # 0x7180
callq 0x11e0
testl %eax, %eax
jne 0x34e5
leaq 0xeb4(%rip), %rdi       # 0x4207
callq 0x1200
testq %rax, %rax
je 0x34e5
movq %rax, %rbx
movq %rax, %rdi
callq 0x1210
testq %rax, %rax
je 0x34a2
movq %rax, %r12
leaq 0x8(%rsp), %r14
cmpb $0x2e, 0x13(%r12)
je 0x348e
addq $0x13, %r12
movq %r12, %rdi
movl $0x2e, %esi
callq 0x1130
movq %rax, %rbp
movq 0x4df4(%rip), %rdi      # 0x8198
movl 0x4de5(%rip), %r15d     # 0x8190
leal 0x1(%r15), %esi
shlq $0x5, %rsi
callq 0x1250
movq %rax, 0x4dd9(%rip)      # 0x8198
testq %rax, %rax
je 0x34d3
movq %rax, %r13
testq %rbp, %rbp
je 0x33e6
movq %rbp, %rdi
leaq 0xe95(%rip), %rsi       # 0x426f
callq 0x11a0
testl %eax, %eax
sete %al
jmp 0x33e8
xorl %eax, %eax
shlq $0x5, %r15
movb %al, 0x10(%r13,%r15)
movq %r12, %rdi
callq 0x1270
movq %rax, (%r13,%r15)
testq %rax, %rax
je 0x34d8
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 0x34cb
movq %r12, %rdi
movq %r14, %rsi
callq 0x1110
testl %eax, %eax
jne 0x34cb
movl 0x20(%rsp), %eax
movl $0xf000, %ecx           # imm = 0xF000
andl %ecx, %eax
cmpl $0x8000, %eax           # imm = 0x8000
jne 0x34dd
movl 0x38(%rsp), %ecx
movq 0x4d34(%rip), %rdx      # 0x8198
movl 0x4d26(%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 0x3486
addl %ecx, 0x4d1a(%rip)      # 0x81a0
incl %eax
movl %eax, 0x4d02(%rip)      # 0x8190
movq %rbx, %rdi
callq 0x1210
movq %rax, %r12
testq %rax, %rax
jne 0x337d
movq %rbx, %rdi
callq 0x1230
movl 0x4cf0(%rip), %edi      # 0x81a0
testl %edi, %edi
je 0x34ea
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 0x1fed
callq 0x1fa0