// File: /workspace/github_c_makefile_star2_O1/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 %ebx, %ebx
movb %bl, 0xb(%rsp)
movb %bl, 0xa(%rsp)
movl $0x0, 0x10(%rsp)
movb $0x1, %al
movl $0x0, 0xc(%rsp)
cmpl $0x2, %edi
jl 0x45f8
movq %rsi, %r14
movl %edi, %eax
movq %rax, 0x20(%rsp)
movq $0x0, 0x18(%rsp)
movl $0x1, %r15d
movl $0x0, 0xc(%rsp)
xorl %ebx, %ebx
movq (%r14,%r15,8), %r13
movzbl (%r13), %eax
leaq 0xb(%rsp), %rbp
cmpl $0x2b, %eax
je 0x4493
cmpl $0x2d, %eax
jne 0x4491
leaq 0xa(%rsp), %rbp
jmp 0x4493
xorl %ebp, %ebp
testq %rbp, %rbp
je 0x44fd
movq %r13, %rdi
leaq 0x82d2(%rip), %rsi      # 0xc774
callq 0x2170
movb $0x1, %r12b
testl %eax, %eax
je 0x4551
movq %r13, %rdi
leaq 0x7feb(%rip), %rsi      # 0xc4a7
callq 0x2170
testl %eax, %eax
je 0x4558
cmpb $0x0, 0x2(%r13)
jne 0x4652
movzbl 0x1(%r13), %eax
cmpl $0x51, %eax
jg 0x4562
cmpl $0x41, %eax
je 0x45de
cmpl $0x48, %eax
jne 0x4652
orb $0x2, (%rbp)
jmp 0x45c9
movq %r13, %rdi
callq 0x3020
movq %rax, %r12
movq %rax, %rdi
movl $0x2f, %esi
callq 0x2100
movq %rax, %r13
movq %r12, %rdi
callq 0x30bb
testl %eax, %eax
setne %al
cmpl $0x1, %ebx
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x453c
movb 0xa(%rsp), %al
orb 0xb(%rsp), %al
je 0x457f
testq %r13, %r13
je 0x4576
movb $0x0, (%r13)
incq %r13
movq %r12, %rdi
movq %r13, %r12
jmp 0x4589
movl $0x1, %ebx
jmp 0x45c9
movl $0x1, 0xc(%rsp)
jmp 0x45c9
cmpl $0x52, %eax
je 0x45e4
cmpl $0x53, %eax
jne 0x4652
orb $0x4, (%rbp)
jmp 0x45c9
leaq 0x7f22(%rip), %rdi      # 0xc49f
jmp 0x4589
movq %r12, %rdi
leaq 0x7f19(%rip), %r12      # 0xc4a2
movq 0x18(%rsp), %rax
incl %eax
movq %rax, 0x18(%rsp)
movzbl 0xb(%rsp), %edx
movzbl 0xa(%rsp), %ecx
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq %r12, %rsi
movl %ebx, %r8d
movl 0xc(%rsp), %r9d
callq 0x411f
testl %eax, %eax
sete %r12b
movl 0x14(%rsp), %ecx
cmovnel %eax, %ecx
movl %ecx, 0x14(%rsp)
testb %r12b, %r12b
je 0x45ea
incq %r15
cmpq %r15, 0x20(%rsp)
jne 0x4472
jmp 0x45f0
orb $0x20, (%rbp)
jmp 0x45c9
orb $0x1, (%rbp)
jmp 0x45c9
movl 0x14(%rsp), %eax
jmp 0x4613
cmpl $0x0, 0x18(%rsp)
sete %al
testb %al, %al
je 0x460a
movb 0xb(%rsp), %al
movb 0xa(%rsp), %cl
movl %ecx, %edx
orb %al, %dl
je 0x4622
xorl %eax, %eax
cmpl $0x0, 0x10(%rsp)
je 0x4657
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x10(%rsp), %rdx
movq %rdx, (%rsp)
movzbl %al, %edx
movzbl %cl, %ecx
leaq 0x7e67(%rip), %rdi      # 0xc49f
leaq 0x7e63(%rip), %rsi      # 0xc4a2
movl %ebx, %r8d
movl 0xc(%rsp), %r9d
callq 0x411f
testl %eax, %eax
jne 0x4613
jmp 0x460a
callq 0x2941
leaq 0x7a52(%rip), %rdi      # 0xc0b0
xorl %eax, %eax
callq 0x2aec