// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/dosfs.c
// Function: dosattrib
FRESULT dosattrib(int argc, const char **argv)
{
  FRESULT res;
  BYTE aset = 0;
  BYTE aclr = 0;
  int dflag = 0;
  int sflag = 0;
  int na = 0;
  int nf = 0;
  int i;

  for (i=1; i < argc; i++)
    {
      BYTE *pflag = 0;
      if (argv[i][0] == '+')
        pflag = &aset;
      else if (argv[i][0] == '-')
        pflag = &aclr;
      if (pflag) {
        if (!strcmp(argv[i],"-d"))
          dflag = 1;
        else if (!strcmp(argv[i],"-s"))
          sflag = 1;
        else if (argv[i][2]) {
        usage:
          dosattribhelp();
          exit(EXIT_FAILURE);
        } else {
          switch(argv[i][1]) {
          case 'A': *pflag |= AM_ARC; break;
          case 'R': *pflag |= AM_RDO; break;
          case 'H': *pflag |= AM_HID; break;
          case 'S': *pflag |= AM_SYS; break;
          default: goto usage;
          }
        }
      } else {
        char *path = fix_path(argv[i]);
        char *pattern = strrchr(path, '/');
        if (dir_p(path) && dflag != 1 && (aset | aclr) == 0) {
          pattern = "*";
        } else if (pattern) {
          *pattern = 0;
          pattern += 1;
        } else {
          pattern = path;
          path = "";
        }
        na += 1;
        res = rattrib(path, pattern, aset, aclr, dflag, sflag, &nf);
        if (res != FR_OK)
          return res;
      }
    }
  if (na == 0 && (aset | aclr) == 0) {
    res = rattrib("", "*", aset, aclr, dflag, sflag, &nf);
    if (res != FR_OK)
      return res;
  }
  if (nf == 0)
    fatal("File not found\n");
  return FR_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
xorl %eax, %eax
movb %al, 0x13(%rsp)
movl $0x0, 0x18(%rsp)
movb %al, 0x12(%rsp)
movl $0x0, 0x1c(%rsp)
movl $0x0, 0x14(%rsp)
cmpl $0x2, %edi
jl 0x445c
movq %rsi, %r13
movl %edi, %r9d
xorl %ebp, %ebp
movl $0x1, %ebx
leaq 0x13(%rsp), %r14
movl $0x0, 0x18(%rsp)
movl $0x0, 0x14(%rsp)
movq %r9, 0x20(%rsp)
movq (%r13,%rbx,8), %rdi
movzbl (%rdi), %ecx
movq %r14, %rax
cmpl $0x2b, %ecx
je 0x4361
cmpl $0x2d, %ecx
jne 0x4388
cmpb $0x64, 0x1(%rdi)
jne 0x434c
cmpb $0x0, 0x2(%rdi)
je 0x43fc
cmpb $0x73, 0x1(%rdi)
leaq 0x12(%rsp), %rax
jne 0x4361
cmpb $0x0, 0x2(%rdi)
je 0x444e
cmpb $0x0, 0x2(%rdi)
jne 0x44b4
movzbl 0x1(%rdi), %ecx
cmpl $0x51, %ecx
jg 0x43db
movb $0x20, %dl
cmpl $0x41, %ecx
je 0x43ef
cmpl $0x48, %ecx
jne 0x44b4
movb $0x2, %dl
jmp 0x43ef
callq 0x304e
movq %rax, %r15
movq %rax, %rdi
movl $0x2f, %esi
callq 0x20f0
movq %rax, %r12
movq %r15, %rdi
callq 0x30e9
testl %eax, %eax
setne %al
cmpl $0x1, 0x14(%rsp)
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x43c6
movb 0x12(%rsp), %al
orb 0x13(%rsp), %al
je 0x4406
testq %r12, %r12
je 0x43f3
movb $0x0, (%r12)
incq %r12
movq %r15, %rdi
movq %r12, %r15
jmp 0x4410
cmpl $0x53, %ecx
je 0x43ed
cmpl $0x52, %ecx
jne 0x44b4
movb $0x1, %dl
jmp 0x43ef
movb $0x4, %dl
orb %dl, (%rax)
jmp 0x4440
leaq 0x80a5(%rip), %rdi      # 0xc49f
jmp 0x4410
movl $0x1, 0x14(%rsp)
jmp 0x4440
movq %r15, %rdi
leaq 0x8092(%rip), %r15      # 0xc4a2
movzbl 0x13(%rsp), %edx
movzbl 0x12(%rsp), %ecx
leaq 0x1c(%rsp), %rax
movq %rax, (%rsp)
movq %r15, %rsi
movl 0x14(%rsp), %r8d
movl 0x18(%rsp), %r9d
callq 0x400f
testl %eax, %eax
jne 0x4473
incl %ebp
movq 0x20(%rsp), %r9
incq %rbx
cmpq %rbx, %r9
jne 0x4327
jmp 0x4458
movl $0x1, 0x18(%rsp)
jmp 0x4440
testl %ebp, %ebp
jne 0x446a
movb 0x13(%rsp), %al
movb 0x12(%rsp), %cl
movl %ecx, %edx
orb %al, %dl
je 0x4482
xorl %eax, %eax
cmpl $0x0, 0x1c(%rsp)
je 0x44b9
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1c(%rsp), %rdx
movq %rdx, (%rsp)
movzbl %al, %edx
movzbl %cl, %ecx
leaq 0x8007(%rip), %rdi      # 0xc49f
leaq 0x8003(%rip), %rsi      # 0xc4a2
movl 0x14(%rsp), %r8d
movl 0x18(%rsp), %r9d
callq 0x400f
testl %eax, %eax
jne 0x4473
jmp 0x446a
callq 0x2986
leaq 0x7bf0(%rip), %rdi      # 0xc0b0
xorl %eax, %eax
callq 0x2b2c