// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/dosfs.c
// Function: dosdir
FRESULT dosdir(int argc, const char **argv)
{
  int i;
  int bflag = 0;
  int sflag = 0;
  int xflag = 0;
  char *path  = "";
  char *pattern = 0;
  char label[40];
  DWORD serial;
  FRESULT res;
  int ndirs = 0;
  int nfiles = 0;
  FSIZE_t sfiles = 0;
  DWORD ncls;
  FATFS *vol;

  for (i=1; i<argc; i++) {
    if (! strcmp(argv[i], "-b"))
      bflag = 1;
    else if (! strcmp(argv[i], "-s"))
      sflag = 1;
    else if (! strcmp(argv[i], "-x"))
      xflag = 1;
    else if (argv[i][0] == '-')
      goto usage;
    else if (!path || !path[0])
      path = fix_path(argv[i]);
    else {
    usage:
      dosdirhelp();
      exit(EXIT_FAILURE);
    }
  }
  pattern = (pattern) ? pattern + 1 : path;
  if (dir_p(path)) {
    pattern = "*";
  } else if ((pattern = strrchr(path, '/'))) {
    *pattern = 0;
    pattern += 1;
  } else {
    pattern = path;
    path = "";
  }
  if (! bflag && f_getlabel("", label, &serial) == FR_OK) {
    if (label[0])
      printf(" Volume label: %s\n", label);
    else
      printf(" Volume has no label\n");
    printf(" Volume Serial Number is %04X-%04X\n", (serial >> 16) & 0xffff, serial & 0xffff);
  }
  res = rdir(path, pattern, sflag, bflag, xflag, &nfiles, &sfiles, &ndirs);
  if (res == FR_OK && ! bflag) {
    if (nfiles + ndirs == 0)
      printf("File not found\n");
    printf("\n");
    f_getfree(path, &ncls, &vol);
    printf("    %8d File(s) %12lld bytes\n", nfiles, (long long)sfiles);
    printf("    %8d Dir(s)  %12lld bytes free\n", ndirs, (long long)ncls * vol->csize * 512);
  }
  return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
xorl %ebx, %ebx
movl %ebx, 0x10(%rsp)
movl %ebx, 0xc(%rsp)
movq $0x0, 0x18(%rsp)
cmpl $0x2, %edi
jl 0x35f4
movq %rsi, %r12
movl %edi, %r13d
xorl %ebp, %ebp
leaq 0x8f28(%rip), %r15      # 0xc49f
movl $0x1, %r14d
movl $0x0, 0x8(%rsp)
xorl %ebx, %ebx
movq (%r12,%r14,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x35c2
cmpb $0x62, 0x1(%rdi)
jne 0x359c
cmpb $0x0, 0x2(%rdi)
je 0x35e3
cmpb $0x73, 0x1(%rdi)
jne 0x35a8
cmpb $0x0, 0x2(%rdi)
je 0x35ea
cmpb $0x78, 0x1(%rdi)
jne 0x3755
movl $0x1, %ebp
cmpb $0x0, 0x2(%rdi)
je 0x35d9
jmp 0x3755
testq %r15, %r15
je 0x35d1
cmpb $0x0, (%r15)
jne 0x3755
callq 0x304e
movq %rax, %r15
incq %r14
cmpq %r14, %r13
jne 0x3587
jmp 0x3605
movl $0x1, %ebx
jmp 0x35d9
movl $0x1, 0x8(%rsp)
jmp 0x35d9
leaq 0x8ea4(%rip), %r15      # 0xc49f
movl $0x0, 0x8(%rsp)
xorl %ebp, %ebp
movq %r15, %rdi
callq 0x30e9
testl %eax, %eax
je 0x361d
movq %r15, %r12
leaq 0x8e87(%rip), %r15      # 0xc4a2
jmp 0x3644
movq %r15, %rdi
movl $0x2f, %esi
callq 0x20f0
testq %rax, %rax
je 0x363d
movb $0x0, (%rax)
incq %rax
movq %r15, %r12
movq %rax, %r15
jmp 0x3644
leaq 0x8e5b(%rip), %r12      # 0xc49f
testl %ebx, %ebx
jne 0x36a2
leaq 0x8e50(%rip), %rdi      # 0xc49f
leaq 0x30(%rsp), %rsi
leaq 0x14(%rsp), %rdx
callq 0x8a9a
testl %eax, %eax
jne 0x36a2
cmpb $0x0, 0x30(%rsp)
je 0x367e
leaq 0x8e34(%rip), %rdi      # 0xc4a4
leaq 0x30(%rsp), %rsi
xorl %eax, %eax
callq 0x20e0
jmp 0x368a
leaq 0x9cea(%rip), %rdi      # 0xd36f
callq 0x2090
movl 0x14(%rsp), %esi
movzwl %si, %edx
shrl $0x10, %esi
leaq 0x8e1c(%rip), %rdi      # 0xc4b7
xorl %eax, %eax
callq 0x20e0
leaq 0x10(%rsp), %rax
leaq 0x18(%rsp), %r10
leaq 0xc(%rsp), %r9
movq %r12, %rdi
movq %r15, %rsi
movl 0x8(%rsp), %edx
movl %ebx, %ecx
movl %ebp, %r8d
pushq %rax
pushq %r10
callq 0x3320
addq $0x10, %rsp
movl %eax, %ebp
orl %ebx, %eax
jne 0x3744
movl 0xc(%rsp), %eax
addl 0x10(%rsp), %eax
jne 0x36e8
leaq 0x9ca1(%rip), %rdi      # 0xd384
callq 0x2090
movl $0xa, %edi
callq 0x2040
leaq 0x24(%rsp), %rbx
leaq 0x28(%rsp), %r14
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x7d21
movl 0xc(%rsp), %esi
movq 0x18(%rsp), %rdx
leaq 0x8dc1(%rip), %rdi      # 0xc4db
xorl %eax, %eax
callq 0x20e0
movl 0x10(%rsp), %esi
movl (%rbx), %eax
movq (%r14), %rcx
movzwl 0xa(%rcx), %edx
imulq %rax, %rdx
shlq $0x9, %rdx
leaq 0x8dbc(%rip), %rdi      # 0xc4f9
xorl %eax, %eax
callq 0x20e0
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x28e0