// File: /workspace/github_c_makefile_star2_O2/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
movq %rsi, %rbp
xorl %eax, %eax
leaq 0x13(%rsp), %rbx
movb %al, (%rbx)
leaq 0x12(%rsp), %rcx
movl $0x0, 0x14(%rsp)
movb %al, (%rcx)
leaq 0x1c(%rsp), %rax
andl $0x0, (%rax)
movslq %edi, %r8
pushq $0x1
popq %r15
movl $0x0, 0x18(%rsp)
xorl %r14d, %r14d
movq %r8, 0x20(%rsp)
cmpq %r8, %r15
jge 0x403b
movq (%rbp,%r15,8), %rdi
movzbl (%rdi), %ecx
movq %rbx, %rax
cmpl $0x2b, %ecx
je 0x3f54
cmpl $0x2d, %ecx
jne 0x3f7e
cmpb $0x64, 0x1(%rdi)
jne 0x3f3f
cmpb $0x0, 0x2(%rdi)
je 0x3fe6
cmpb $0x73, 0x1(%rdi)
leaq 0x12(%rsp), %rax
jne 0x3f54
cmpb $0x0, 0x2(%rdi)
je 0x4032
cmpb $0x0, 0x2(%rdi)
jne 0x4098
movzbl 0x1(%rdi), %ecx
cmpl $0x41, %ecx
je 0x3fd3
cmpl $0x48, %ecx
je 0x3fd7
cmpl $0x53, %ecx
je 0x3fcf
cmpl $0x52, %ecx
jne 0x4098
movb $0x1, %cl
jmp 0x3fd9
callq 0x2b76
movq %rax, %r12
movq %rax, %rdi
pushq $0x2f
popq %rsi
callq 0x20f0
movq %rax, %r13
movq %r12, %rdi
callq 0x2c11
testl %eax, %eax
setne %al
cmpl $0x1, 0x14(%rsp)
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x3fba
movb 0x12(%rsp), %al
orb 0x13(%rsp), %al
je 0x3fef
testq %r13, %r13
je 0x3fdd
movb $0x0, (%r13)
incq %r13
movq %r12, %rdi
movq %r13, %r12
jmp 0x3ff9
movb $0x4, %cl
jmp 0x3fd9
movb $0x20, %cl
jmp 0x3fd9
movb $0x2, %cl
orb %cl, (%rax)
jmp 0x402a
leaq 0x74bb(%rip), %rdi      # 0xb49f
jmp 0x3ff9
pushq $0x1
popq %rax
movl %eax, 0x14(%rsp)
jmp 0x402a
movq %r12, %rdi
leaq 0x74a9(%rip), %r12      # 0xb4a2
movzbl 0x13(%rsp), %edx
movzbl 0x12(%rsp), %ecx
leaq 0x1c(%rsp), %rax
movq %rax, (%rsp)
movq %r12, %rsi
movl 0x14(%rsp), %r8d
movl 0x18(%rsp), %r9d
callq 0x3c44
testl %eax, %eax
jne 0x4057
incl %r14d
movq 0x20(%rsp), %r8
incq %r15
jmp 0x3f11
pushq $0x1
popq %rax
movl %eax, 0x18(%rsp)
jmp 0x402a
testl %r14d, %r14d
jne 0x404e
movb 0x13(%rsp), %al
movb 0x12(%rsp), %cl
movl %ecx, %edx
orb %al, %dl
je 0x4066
xorl %eax, %eax
cmpl $0x0, 0x1c(%rsp)
je 0x40a5
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 0x7423(%rip), %rdi      # 0xb49f
leaq 0x741f(%rip), %rsi      # 0xb4a2
movl 0x14(%rsp), %r8d
movl 0x18(%rsp), %r9d
callq 0x3c44
testl %eax, %eax
jne 0x4057
jmp 0x404e
callq 0x3bfc
pushq $0x1
popq %rdi
callq 0x2220
leaq 0x7004(%rip), %rdi      # 0xb0b0
xorl %eax, %eax
callq 0x234c