// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
movb %cl, %al
movb %dl, %cl
movq 0x10(%rbp), %rdx
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movb %cl, -0x19(%rbp)
movb %al, -0x1a(%rbp)
movl %r8d, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
jne 0x3803
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x37e9
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
leaq -0x88(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
callq 0x8fc0
movl %eax, -0x1ac(%rbp)
cmpl $0x0, -0x1ac(%rbp)
je 0x3844
cmpl $0x4, -0x1ac(%rbp)
je 0x3844
movl -0x1ac(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x3b7e
jmp 0x3846
xorl %eax, %eax
cmpl $0x0, -0x1ac(%rbp)
movb %al, -0x1c1(%rbp)
jne 0x386a
movsbl -0x18e(%rbp), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x1c1(%rbp)
movb -0x1c1(%rbp), %al
testb $0x1, %al
jne 0x3879
jmp 0x3a20
cmpl $0x1, -0x20(%rbp)
je 0x3892
movzbl -0x19c(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
jne 0x3a02
movq 0x10(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movzbl -0x19(%rbp), %eax
cmpl $0x0, %eax
jne 0x3968
movzbl -0x1a(%rbp), %eax
cmpl $0x0, %eax
jne 0x3968
movzbl -0x19c(%rbp), %ecx
andl $0x20, %ecx
movl $0x20, %esi
movl $0x41, %eax
cmpl $0x0, %ecx
cmovnel %eax, %esi
movzbl -0x19c(%rbp), %ecx
andl $0x1, %ecx
movl $0x20, %edx
movl $0x52, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edx
movzbl -0x19c(%rbp), %edi
andl $0x4, %edi
movl $0x20, %ecx
movl $0x53, %eax
cmpl $0x0, %edi
cmovnel %eax, %ecx
movzbl -0x19c(%rbp), %edi
andl $0x2, %edi
movl $0x20, %r8d
movl $0x48, %eax
cmpl $0x0, %edi
cmovnel %eax, %r8d
movq -0x10(%rbp), %rax
movsbl (%rax), %edi
leaq 0xdbbc(%rip), %r9       # 0x114eb
leaq 0xdbb6(%rip), %rax      # 0x114ec
cmpl $0x0, %edi
cmovneq %rax, %r9
movq -0x10(%rbp), %r10
leaq -0x1a8(%rbp), %rax
addq $0x1a, %rax
leaq 0xe682(%rip), %rdi      # 0x11fd5
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x10d0
jmp 0x3a00
movq -0x10(%rbp), %rdi
leaq -0x1a8(%rbp), %rdx
addq $0x1a, %rdx
leaq 0xdb6e(%rip), %rsi      # 0x114ec
xorl %ecx, %ecx
movb $0x0, %al
callq 0x1c90
movq %rax, -0x1b8(%rbp)
movq -0x1b8(%rbp), %rdi
movb -0x19(%rbp), %cl
movzbl -0x19(%rbp), %eax
movzbl -0x1a(%rbp), %edx
orl %edx, %eax
movzbl %cl, %esi
movzbl %al, %edx
callq 0xa0f0
movl %eax, -0x1ac(%rbp)
cmpl $0x0, -0x1ac(%rbp)
je 0x39db
movq 0x12635(%rip), %rax     # 0x15ff8
movq (%rax), %rdi
movq -0x1b8(%rbp), %rdx
leaq 0xe139(%rip), %rsi      # 0x11b0d
movb $0x0, %al
callq 0x1160
movq -0x1b8(%rbp), %rdi
callq 0x1030
cmpl $0x0, -0x1ac(%rbp)
je 0x39fe
movl -0x1ac(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x3b7e
jmp 0x3a00
jmp 0x3a02
leaq -0x88(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
callq 0x8da0
movl %eax, -0x1ac(%rbp)
jmp 0x3846
cmpl $0x0, -0x1ac(%rbp)
je 0x3a37
movl -0x1ac(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x3b7e
cmpl $0x0, -0x24(%rbp)
je 0x3b77
movq -0x10(%rbp), %rdx
leaq -0x88(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
leaq 0xda94(%rip), %rcx      # 0x114ee
callq 0x8fc0
movl %eax, -0x1ac(%rbp)
cmpl $0x0, -0x1ac(%rbp)
je 0x3a85
cmpl $0x4, -0x1ac(%rbp)
je 0x3a85
movl -0x1ac(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x3b7e
jmp 0x3a87
xorl %eax, %eax
cmpl $0x0, -0x1ac(%rbp)
movb %al, -0x1c2(%rbp)
jne 0x3aab
movsbl -0x18e(%rbp), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x1c2(%rbp)
movb -0x1c2(%rbp), %al
testb $0x1, %al
jne 0x3aba
jmp 0x3b61
movzbl -0x19c(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x3b43
movq -0x10(%rbp), %rdi
leaq -0x1a8(%rbp), %rdx
addq $0x1a, %rdx
leaq 0xda0d(%rip), %rsi      # 0x114ec
xorl %ecx, %ecx
movb $0x0, %al
callq 0x1c90
movq %rax, -0x1c0(%rbp)
movq -0x1c0(%rbp), %rdi
movq -0x18(%rbp), %rsi
movb -0x19(%rbp), %dl
movb -0x1a(%rbp), %cl
movl -0x20(%rbp), %r8d
movl -0x24(%rbp), %r9d
movq 0x10(%rbp), %rax
movzbl %dl, %edx
movzbl %cl, %ecx
movq %rax, (%rsp)
callq 0x37c0
movl %eax, -0x1ac(%rbp)
movq -0x1c0(%rbp), %rdi
callq 0x1030
cmpl $0x0, -0x1ac(%rbp)
je 0x3b41
movl -0x1ac(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x3b7e
jmp 0x3b43
leaq -0x88(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
callq 0x8da0
movl %eax, -0x1ac(%rbp)
jmp 0x3a87
cmpl $0x0, -0x1ac(%rbp)
je 0x3b75
movl -0x1ac(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x3b7e
jmp 0x3b77
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
nopw (%rax,%rax)