// File: /workspace/github_c_makefile_star2_O1/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, %ebp
movl %ecx, %r12d
movl %edx, 0x18(%rsp)
movq %rsi, %r14
movq %rdi, %r15
decq %r15
cmpb $0x2f, 0x1(%r15)
leaq 0x1(%r15), %r15
je 0x4146
leaq 0x148(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x7f6a
testl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
je 0x418a
movl %eax, 0x4(%rsp)
movl 0x4(%rsp), %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r12d, 0x10(%rsp)
movq %r14, 0x20(%rsp)
movl %ebx, 0x14(%rsp)
testl %eax, %eax
sete %cl
jne 0x42f5
cmpb $0x0, 0x42(%rsp)
je 0x42f5
movl 0x10(%rsp), %eax
movl %eax, %ecx
movl 0x18(%rsp), %eax
orb %al, %cl
movzbl %al, %eax
movl %eax, 0x8(%rsp)
movb %cl, 0xc(%rsp)
movzbl %cl, %eax
movl %eax, 0x1c(%rsp)
leaq 0x148(%rsp), %r14
leaq 0x28(%rsp), %r12
cmpl $0x1, %ebp
je 0x41e9
testb $0x10, 0x34(%rsp)
jne 0x42b1
movq 0x1e0(%rsp), %rax
incl (%rax)
cmpb $0x0, 0xc(%rsp)
je 0x424c
movl %ebp, %ebx
movq %r14, %rbp
movq %r15, %rdi
leaq 0x8297(%rip), %rsi      # 0xc4a0
leaq 0x42(%rsp), %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x2e96
movq %rax, %r14
movq %rax, %rdi
movl 0x8(%rsp), %esi
movl 0x1c(%rsp), %edx
callq 0x8ba3
movl %eax, %r13d
testl %eax, %eax
jne 0x42d0
movq %r14, %rdi
callq 0x2030
testl %r13d, %r13d
movq %rbp, %r14
movl %ebx, %ebp
je 0x42b1
jmp 0x4174
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 0x8215(%rip), %r9       # 0xc4a0
leaq 0x820d(%rip), %rax      # 0xc49f
cmoveq %rax, %r9
leaq 0x8cd6(%rip), %rdi      # 0xcf73
xorl %eax, %eax
leaq 0x42(%rsp), %r10
pushq %r10
pushq %r15
callq 0x20f0
addq $0x10, %rsp
movq %r14, %rdi
movq %r12, %rsi
callq 0x7dad
testl %eax, %eax
sete %cl
jne 0x42f5
cmpb $0x0, 0x42(%rsp)
jne 0x41d9
jmp 0x42f5
movq 0xcd21(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
leaq 0x87ca(%rip), %rsi      # 0xcaab
movq %r14, %rdx
xorl %eax, %eax
callq 0x2190
movl %r13d, 0x4(%rsp)
jmp 0x4235
movl 0x4(%rsp), %r14d
movl %eax, 0x4(%rsp)
testb %cl, %cl
je 0x4174
cmpl $0x0, 0x14(%rsp)
je 0x440f
leaq 0x818a(%rip), %rcx      # 0xc4a2
leaq 0x148(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movq %r15, %rdx
callq 0x7f6a
testl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
jne 0x4170
testl %eax, %eax
sete %cl
jne 0x4403
cmpb $0x0, 0x42(%rsp)
je 0x4403
leaq 0x148(%rsp), %r13
leaq 0x28(%rsp), %r12
movzbl 0x18(%rsp), %eax
movl %eax, 0xc(%rsp)
movzbl 0x10(%rsp), %eax
movl %eax, 0x8(%rsp)
movl %r14d, 0x4(%rsp)
testb $0x10, 0x34(%rsp)
je 0x43e6
movq %r15, %rdi
leaq 0x811d(%rip), %rsi      # 0xc4a0
leaq 0x42(%rsp), %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x2e96
movq %rax, %r14
subq $0x8, %rsp
movq %rax, %rdi
movq 0x28(%rsp), %rsi
movl 0x14(%rsp), %edx
movl 0x10(%rsp), %ecx
movl %ebp, %r8d
movl 0x1c(%rsp), %r9d
pushq 0x1e8(%rsp)
callq 0x411f
addq $0x10, %rsp
movq %r12, %rbx
movl %eax, %r12d
movq %r14, %rdi
callq 0x2030
testl %r12d, %r12d
movl 0x4(%rsp), %eax
cmovnel %r12d, %eax
movq %rbx, %r12
movl %eax, 0x4(%rsp)
jne 0x4174
movq %r13, %rdi
movq %r12, %rsi
callq 0x7dad
testl %eax, %eax
sete %cl
jne 0x4403
cmpb $0x0, 0x42(%rsp)
jne 0x4372
movl %eax, 0x4(%rsp)
testb %cl, %cl
je 0x4174
movl $0x0, 0x4(%rsp)
jmp 0x4174