// File: /workspace/github_c_makefile_star2_O3/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, %r12
movq %rdi, %r13
decq %r13
cmpb $0x2f, 0x1(%r13)
leaq 0x1(%r13), %r13
je 0x3349
testl %r14d, %r14d
jne 0x3371
movq 0xded8(%rip), %rsi      # 0x11238
leaq 0x911f(%rip), %rdi      # 0xc486
movq %r13, %rdx
xorl %eax, %eax
callq 0x20e0
leaq 0x18(%rsp), %rdi
leaq 0x78(%rsp), %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x7c69
movl %eax, %r15d
testl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
jne 0x3529
movq %r12, 0x10(%rsp)
testl %r15d, %r15d
jne 0x3448
cmpb $0x0, 0x92(%rsp)
je 0x3448
leaq 0x78(%rsp), %r12
leaq 0x18(%rsp), %rbp
testb $0x10, 0x84(%rsp)
jne 0x340d
incl (%rbx)
movq 0x78(%rsp), %rax
movq 0x1d0(%rsp), %rcx
addq %rax, (%rcx)
testl %r14d, %r14d
je 0x341c
cmpb $0x0, (%r13)
leaq 0x90b9(%rip), %rsi      # 0xc4a0
leaq 0x90b1(%rip), %rax      # 0xc49f
cmoveq %rax, %rsi
leaq 0x9b6b(%rip), %rdi      # 0xcf64
movq %r13, %rdx
leaq 0x92(%rsp), %rcx
xorl %eax, %eax
callq 0x20e0
jmp 0x3428
movq 0x1d8(%rsp), %rax
incl (%rax)
testl %r14d, %r14d
jne 0x3428
movq %r12, %rdi
movl 0xc(%rsp), %esi
callq 0x3210
movq %rbp, %rdi
movq %r12, %rsi
callq 0x7ab2
movl %eax, %r15d
testl %eax, %eax
jne 0x3448
cmpb $0x0, 0x92(%rsp)
jne 0x33ba
leaq 0x18(%rsp), %rdi
callq 0x73f8
cmpl $0x0, 0x8(%rsp)
je 0x351f
leaq 0x903e(%rip), %rcx      # 0xc4a2
leaq 0x18(%rsp), %rdi
leaq 0x78(%rsp), %rsi
movq %r13, %rdx
callq 0x7c69
movl %eax, %r15d
testl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
jne 0x3529
testl %r15d, %r15d
jne 0x351f
cmpb $0x0, 0x92(%rsp)
je 0x351f
leaq 0x18(%rsp), %r12
leaq 0x78(%rsp), %rbp
testb $0x10, 0x84(%rsp)
je 0x3503
movq %r13, %rdi
leaq 0x8fe7(%rip), %rsi      # 0xc4a0
leaq 0x92(%rsp), %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x2ec4
movq %rax, %r15
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 0x3320
addq $0x10, %rsp
movq %r15, %rdi
callq 0x2030
movq %r12, %rdi
movq %rbp, %rsi
callq 0x7ab2
movl %eax, %r15d
testl %eax, %eax
jne 0x351f
cmpb $0x0, 0x92(%rsp)
jne 0x34a5
leaq 0x18(%rsp), %rdi
callq 0x73f8
movl %r15d, %eax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq