// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/dosfs.c
// Function: rattrib
FRESULT rattrib(char *path, char *pattern, BYTE aset, BYTE aclr, int dflag, int sflag, int *pnf)
{
  DIR dir;
  FILINFO info;
  FRESULT res;
  while (path[0] == '/')
    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 (dflag == 1 || !(info.fattrib & AM_DIR)) {
        *pnf += 1;
        if (aset == 0 && aclr == 0)
          {
            printf("%c%c%c%c %s%s/%s\n",
                   (info.fattrib & AM_ARC) ? 'A' : ' ',
                   (info.fattrib & AM_RDO) ? 'R' : ' ',
                   (info.fattrib & AM_SYS) ? 'S' : ' ',
                   (info.fattrib & AM_HID) ? 'H' : ' ',
                   path[0] ? "/" : "", path, info.fname );
          }
        else
          {
            char *fn = strconcat(path, "/", info.fname, 0);
            res = f_chmod(fn, aset, aset | aclr);
            if (res != FR_OK)
              fprintf(stderr, "dosfs: error while processing %s\n", fn);
            free(fn);
            if (res != FR_OK)
              return res;
          }
      }
      res = f_findnext(&dir, &info);
    }
  if (res != FR_OK)
    return res;
  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 *fn = strconcat(path, "/", info.fname, 0);
            res = rattrib(fn, pattern, aset, aclr, dflag, sflag, pnf);
            free(fn);
            if (res != FR_OK)
              return res;
          }
          res = f_findnext(&dir, &info);
        }
      if (res != FR_OK)
          return res;
    }
  return FR_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movl %r9d, %ebx
movl %r8d, %r12d
movl %ecx, %ebp
movl %edx, 0x18(%rsp)
movq %rsi, %r14
movq %rdi, %r15
decq %r15
cmpb $0x2f, 0x1(%r15)
leaq 0x1(%r15), %r15
je 0x4035
leaq 0x148(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x7c69
movl %eax, %r13d
testl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
jne 0x42a5
movl %ebp, 0x14(%rsp)
movq %r14, 0x20(%rsp)
movl %ebx, 0x1c(%rsp)
testl %r13d, %r13d
sete %al
jne 0x41a5
cmpb $0x0, 0x42(%rsp)
je 0x41a5
movl 0x14(%rsp), %eax
movl %eax, %ecx
movl 0x18(%rsp), %eax
orb %al, %cl
movzbl %al, %eax
movl %eax, 0xc(%rsp)
movb %cl, 0x10(%rsp)
movzbl %cl, %eax
movl %eax, 0x8(%rsp)
leaq 0x148(%rsp), %r14
leaq 0x28(%rsp), %rbx
cmpl $0x1, %r12d
je 0x40c6
testb $0x10, 0x34(%rsp)
jne 0x4185
movq 0x1e0(%rsp), %rax
incl (%rax)
cmpb $0x0, 0x10(%rsp)
je 0x4120
movq %r14, %rbp
movl %r12d, %r14d
movq %r15, %rdi
leaq 0x83b9(%rip), %rsi      # 0xc4a0
leaq 0x42(%rsp), %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x2ec4
movq %rax, %r12
movq %rax, %rdi
movl 0xc(%rsp), %esi
movl 0x8(%rsp), %edx
callq 0x88db
testl %eax, %eax
jne 0x42ba
movq %r12, %rdi
callq 0x2030
movl %r14d, %r12d
movq %rbp, %r14
jmp 0x4185
movzbl 0x34(%rsp), %eax
testb $0x20, %al
movl $0x41, %esi
movl $0x20, %edi
cmovel %edi, %esi
testb $0x1, %al
movl $0x52, %edx
cmovel %edi, %edx
testb $0x4, %al
movl $0x53, %ecx
cmovel %edi, %ecx
testb $0x2, %al
movl $0x48, %r8d
cmovel %edi, %r8d
cmpb $0x0, (%r15)
leaq 0x8341(%rip), %r9       # 0xc4a0
leaq 0x8339(%rip), %rax      # 0xc49f
cmoveq %rax, %r9
leaq 0x8dea(%rip), %rdi      # 0xcf5b
xorl %eax, %eax
leaq 0x42(%rsp), %r10
pushq %r10
pushq %r15
callq 0x20e0
addq $0x10, %rsp
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7ab2
movl %eax, %r13d
testl %eax, %eax
sete %al
jne 0x41a5
cmpb $0x0, 0x42(%rsp)
jne 0x40b5
testb %al, %al
movl 0x1c(%rsp), %ebp
je 0x42a5
testl %ebp, %ebp
je 0x42a2
leaq 0x82e2(%rip), %rcx      # 0xc4a2
leaq 0x148(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movq %r15, %rdx
callq 0x7c69
movl %eax, %r13d
testl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
jne 0x42a5
testl %r13d, %r13d
sete %al
jne 0x429e
movl %r12d, 0x10(%rsp)
cmpb $0x0, 0x42(%rsp)
je 0x429e
leaq 0x148(%rsp), %r14
leaq 0x28(%rsp), %rbx
movzbl 0x18(%rsp), %eax
movl %eax, 0xc(%rsp)
movzbl 0x14(%rsp), %eax
movl %eax, 0x8(%rsp)
testb $0x10, 0x34(%rsp)
je 0x4282
movq %r15, %rdi
leaq 0x8271(%rip), %rsi      # 0xc4a0
leaq 0x42(%rsp), %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x2ec4
movq %r14, %r12
movq %rax, %r14
subq $0x8, %rsp
movq %rax, %rdi
movq 0x28(%rsp), %rsi
movl 0x14(%rsp), %edx
movl 0x10(%rsp), %ecx
movl 0x18(%rsp), %r8d
movl %ebp, %r9d
pushq 0x1e8(%rsp)
callq 0x400f
addq $0x10, %rsp
movl %eax, %r13d
movq %r14, %rdi
movq %r12, %r14
callq 0x2030
testl %r13d, %r13d
jne 0x42a5
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7ab2
movl %eax, %r13d
testl %eax, %eax
sete %al
jne 0x429e
cmpb $0x0, 0x42(%rsp)
jne 0x421e
testb %al, %al
je 0x42a5
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %r13d
movq %r12, %rdi
callq 0x295d
jmp 0x42a5