// File: /workspace/github_c_makefile_star2_O2/lb3361[P]dosfs/dosfs.c
// Function: rdir
FRESULT rdir(char *path, char *pattern, int sflag, int bflag, int xflag,
             int *pnfiles, FSIZE_t *psfiles, int *pndirs)
{
  int ndirs;
  DIR dir;
  FILINFO info;
  FRESULT res;

  while (path[0] == '/')
    path += 1;
  if (! bflag)
    printf("\n Directory of [%s]:/%s\n\n", sfn, path);
  res = f_findfirst(&dir, &info, path, pattern);
  if (res != FR_OK && res != FR_NO_FILE)
    return res;
  while (res == FR_OK && info.fname[0])
    {
      if (info.fattrib & AM_DIR) {
        *pndirs += 1;
      } else {
        *pnfiles += 1;
        *psfiles += info.fsize;
      }
      if (bflag) {
        if (! (info.fattrib & AM_DIR))
          printf("%s%s/%s\n", path[0] ? "/" : "", path, info.fname);
      } else {
        print_filinfo(&info, xflag);
      }
      res = f_findnext(&dir, &info);
    }
  f_closedir(&dir);
  if (sflag) {
    res = f_findfirst(&dir, &info, path, "*");
    if (res != FR_OK && res != FR_NO_FILE)
      return res;
    while (res == FR_OK && info.fname[0]) {
      if (info.fattrib & AM_DIR) {
        char *npath = strconcat(path, "/", info.fname, 0);
        rdir(npath, pattern, sflag, bflag, xflag, pnfiles, psfiles, pndirs);
        free(npath);
      }
      res = f_findnext(&dir, &info);
    }
  }
  f_closedir(&dir);
  return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %r9, %rbx
movl %r8d, 0xc(%rsp)
movl %ecx, %r14d
movl %edx, 0x8(%rsp)
movq %rsi, %r15
movq %rdi, %r13
decq %r13
cmpb $0x2f, 0x1(%r13)
leaq 0x1(%r13), %r13
je 0x2e43
testl %r14d, %r14d
jne 0x2e6b
movq 0xe3de(%rip), %rsi      # 0x11238
leaq 0x8625(%rip), %rdi      # 0xb486
movq %r13, %rdx
xorl %eax, %eax
callq 0x20e0
leaq 0x18(%rsp), %rdi
leaq 0x78(%rsp), %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x75e1
movl %eax, %r12d
testl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
jne 0x3000
movq %r15, 0x10(%rsp)
leaq 0x78(%rsp), %r15
leaq 0x18(%rsp), %rbp
testl %r12d, %r12d
jne 0x2f35
cmpb $0x0, 0x92(%rsp)
je 0x2f35
testb $0x10, 0x84(%rsp)
jne 0x2f07
incl (%rbx)
movq 0x78(%rsp), %rax
movq 0x1d0(%rsp), %rcx
addq %rax, (%rcx)
testl %r14d, %r14d
je 0x2f16
cmpb $0x0, (%r13)
leaq 0x85bf(%rip), %rsi      # 0xb4a0
leaq 0x85b7(%rip), %rax      # 0xb49f
cmoveq %rax, %rsi
leaq 0x9071(%rip), %rdi      # 0xbf64
movq %r13, %rdx
leaq 0x92(%rsp), %rcx
xorl %eax, %eax
callq 0x20e0
jmp 0x2f22
movq 0x1d8(%rsp), %rax
incl (%rax)
testl %r14d, %r14d
jne 0x2f22
movq %r15, %rdi
movl 0xc(%rsp), %esi
callq 0x2d31
movq %rbp, %rdi
movq %r15, %rsi
callq 0x7470
movl %eax, %r12d
jmp 0x2e9d
leaq 0x18(%rsp), %rdi
callq 0x6e38
cmpl $0x0, 0x8(%rsp)
je 0x2ff6
leaq 0x8551(%rip), %rcx      # 0xb4a2
leaq 0x18(%rsp), %rdi
leaq 0x78(%rsp), %rsi
movq %r13, %rdx
callq 0x75e1
movl %eax, %r12d
testl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
jne 0x3000
leaq 0x18(%rsp), %r15
leaq 0x78(%rsp), %rbp
testl %r12d, %r12d
jne 0x2ff6
cmpb $0x0, 0x92(%rsp)
je 0x2ff6
testb $0x10, 0x84(%rsp)
je 0x2fe6
movq %r13, %rdi
leaq 0x8502(%rip), %rsi      # 0xb4a0
leaq 0x92(%rsp), %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x29f0
movq %rax, %r12
movq %rax, %rdi
movq 0x10(%rsp), %rsi
movl 0x8(%rsp), %edx
movl %r14d, %ecx
movl 0xc(%rsp), %r8d
movq %rbx, %r9
pushq 0x1d8(%rsp)
pushq 0x1d8(%rsp)
callq 0x2e1a
popq %rcx
popq %rdx
movq %r12, %rdi
callq 0x2030
movq %r15, %rdi
movq %rbp, %rsi
callq 0x7470
movl %eax, %r12d
jmp 0x2f7b
leaq 0x18(%rsp), %rdi
callq 0x6e38
movl %r12d, %eax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq