// File: /workspace/github_c_makefile_star2_O1/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 0x332e
testl %r14d, %r14d
jne 0x3356
movq 0xdef3(%rip), %rsi      # 0x11238
leaq 0x913a(%rip), %rdi      # 0xc486
movq %r13, %rdx
xorl %eax, %eax
callq 0x20f0
leaq 0x18(%rsp), %rdi
leaq 0x78(%rsp), %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x7f6a
movl %eax, %r15d
testl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
jne 0x3510
movq %r12, 0x10(%rsp)
testl %r15d, %r15d
jne 0x342f
cmpb $0x0, 0x92(%rsp)
je 0x342f
leaq 0x78(%rsp), %r12
leaq 0x18(%rsp), %rbp
movb 0x84(%rsp), %al
testb $0x10, %al
jne 0x33be
incl (%rbx)
movq 0x78(%rsp), %rcx
movq 0x1d0(%rsp), %rdx
addq %rcx, (%rdx)
jmp 0x33c8
movq 0x1d8(%rsp), %rcx
incl (%rcx)
testl %r14d, %r14d
je 0x3403
testb $0x10, %al
jne 0x340f
cmpb $0x0, (%r13)
leaq 0x90c3(%rip), %rsi      # 0xc4a0
leaq 0x90bb(%rip), %rax      # 0xc49f
cmoveq %rax, %rsi
leaq 0x9b8d(%rip), %rdi      # 0xcf7c
movq %r13, %rdx
leaq 0x92(%rsp), %rcx
xorl %eax, %eax
callq 0x20f0
jmp 0x340f
movq %r12, %rdi
movl 0xc(%rsp), %esi
callq 0x31f5
movq %rbp, %rdi
movq %r12, %rsi
callq 0x7dad
movl %eax, %r15d
testl %eax, %eax
jne 0x342f
cmpb $0x0, 0x92(%rsp)
jne 0x339f
leaq 0x18(%rsp), %rdi
callq 0x7653
cmpl $0x0, 0x8(%rsp)
je 0x3506
leaq 0x9057(%rip), %rcx      # 0xc4a2
leaq 0x18(%rsp), %rdi
leaq 0x78(%rsp), %rsi
movq %r13, %rdx
callq 0x7f6a
movl %eax, %r15d
testl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
jne 0x3510
testl %r15d, %r15d
jne 0x3506
cmpb $0x0, 0x92(%rsp)
je 0x3506
leaq 0x18(%rsp), %r12
leaq 0x78(%rsp), %rbp
testb $0x10, 0x84(%rsp)
je 0x34ea
movq %r13, %rdi
leaq 0x9000(%rip), %rsi      # 0xc4a0
leaq 0x92(%rsp), %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x2e96
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 0x3305
addq $0x10, %rsp
movq %r15, %rdi
callq 0x2030
movq %r12, %rdi
movq %rbp, %rsi
callq 0x7dad
movl %eax, %r15d
testl %eax, %eax
jne 0x3506
cmpb $0x0, 0x92(%rsp)
jne 0x348c
leaq 0x18(%rsp), %rdi
callq 0x7653
movl %r15d, %eax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq