// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/dosfs.c
// Function: dosmove
FRESULT dosmove(int argc, const char **argv)
{
  int i;
  int qflag = 0;
  int nargc = 0;
  int dirp = 0;
  char *dest = 0;
  FRESULT res;
  FILINFO info;
  DIR dir;

  for (i = nargc = 1; i < argc; i++)
    if (! strcmp(argv[i], "-q"))
      qflag = 1;
    else if (argv[i][0] == '-')
      goto usage;
    else 
      argv[nargc++] = argv[i];
  if (nargc < 3) {
  usage:
    dosmovehelp();
    exit(EXIT_FAILURE);
  }
  dest = fix_path(argv[argc-1]);
  if (! (dirp = dir_p(dest)))
    if (nargc > 3 || pattern_p(argv[1]))
      fatal("Moving multiple files: Destination must be an existing directory\n");
  for (i = 1; i < nargc - 1; i++) {
    char *src = fix_path(argv[i]);
    char *pattern = strrchr(src, '/');
    if (pattern) {
      *pattern = 0;
      pattern ++;
    } else {
      pattern = src;
      src = "";
    }
    res = f_findfirst(&dir, &info, src, pattern);
    if (res != FR_OK && res != FR_NO_FILE)
      return res;
    while (res == FR_OK && info.fname[0])
      {
        char *from = strconcat(src, "/", info.fname, 0);
        char *to = (dirp) ? strconcat(dest, "/", info.fname, 0) : strdup(dest);
        while (to[0] == '/')
          to += 1;
        if (file_p(to))
          if (qflag || prompt("[%s]:/%s, Replace", sfn, to))
            f_unlink(to);
        res = f_rename(from, to);
        free(from);
        free(to);
        if (res != FR_OK)
          break;
        res = f_findnext(&dir, &info);
      }
    f_closedir(&dir);
    if (res != FR_OK)
      return res;
  }
  return FR_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2c8, %rsp            # imm = 0x2C8
cmpl $0x2, %edi
jl 0x3ffc
movq %rsi, %r15
movl %edi, %eax
xorl %ebx, %ebx
movl $0x1, %ebp
movl $0x1, %ecx
movq (%r15,%rcx,8), %rdx
cmpb $0x2d, (%rdx)
jne 0x3ddc
cmpb $0x71, 0x1(%rdx)
jne 0x3ffc
movl $0x1, %ebx
cmpb $0x0, 0x2(%rdx)
je 0x3de5
jmp 0x3ffc
movslq %ebp, %rsi
incl %ebp
movq %rdx, (%r15,%rsi,8)
incq %rcx
cmpq %rcx, %rax
jne 0x3db9
cmpl $0x2, %ebp
jle 0x3ffc
movq -0x8(%r15,%rax,8), %rdi
callq 0x304e
movq %rax, 0x10(%rsp)
movq %rax, %rdi
callq 0x30e9
movl %eax, 0xc(%rsp)
testl %eax, %eax
jne 0x3e37
cmpl $0x3, %ebp
jne 0x4001
movq 0x8(%r15), %rdi
leaq 0x83f9(%rip), %rsi      # 0xc222
callq 0x21d0
testq %rax, %rax
jne 0x4001
leaq 0xa2(%rsp), %r13
decl %ebp
movl $0x1, %eax
movq %r15, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movq (%r15,%rax,8), %rdi
callq 0x304e
movq %rax, %r14
movq %rax, %rdi
movl $0x2f, %esi
callq 0x20f0
testq %rax, %rax
je 0x3e7c
movb $0x0, (%rax)
incq %rax
movq %r14, %r12
movq %rax, %r14
jmp 0x3e83
leaq 0x861c(%rip), %r12      # 0xc49f
leaq 0x28(%rsp), %rdi
leaq 0x88(%rsp), %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x7c69
movl %eax, %r14d
testl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
jne 0x3fe7
testl %r14d, %r14d
jne 0x3fb8
cmpb $0x0, 0xa2(%rsp)
je 0x3fb8
movq %r12, %rdi
leaq 0x85d6(%rip), %r14      # 0xc4a0
movq %r14, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x2ec4
movq %rax, %r15
cmpl $0x0, 0xc(%rsp)
je 0x3ef9
movq 0x10(%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x2ec4
jmp 0x3f03
movq 0x10(%rsp), %rdi
callq 0x2240
movq %rax, %r13
decq %r13
cmpb $0x2f, 0x1(%r13)
leaq 0x1(%r13), %r13
je 0x3f09
movq %r13, %rdi
leaq 0x1a8(%rsp), %rsi
callq 0x7c9d
testl %eax, %eax
jne 0x3f3e
testb $0x10, 0x1b4(%rsp)
jne 0x3f3e
testl %ebx, %ebx
je 0x3f92
movq %r13, %rdi
callq 0x800d
movq %r15, %rdi
movq %r13, %rsi
callq 0x8588
movl %eax, %r14d
movq %r15, %rdi
callq 0x2030
movq %r13, %rdi
callq 0x2030
leaq 0x28(%rsp), %rdi
testl %r14d, %r14d
jne 0x3fe2
leaq 0x88(%rsp), %rsi
callq 0x7ab2
movl %eax, %r14d
testl %eax, %eax
jne 0x3fb0
cmpb $0x0, 0xa2(%rsp)
leaq 0xa2(%rsp), %r13
jne 0x3ec0
jmp 0x3fb8
movq 0xd29f(%rip), %rsi      # 0x11238
leaq 0x8d66(%rip), %rdi      # 0xcd06
movq %r13, %rdx
xorl %eax, %eax
callq 0x2338
testl %eax, %eax
jne 0x3f36
jmp 0x3f3e
leaq 0xa2(%rsp), %r13
leaq 0x28(%rsp), %rdi
callq 0x73f8
testl %r14d, %r14d
jne 0x3fe7
movq 0x20(%rsp), %rax
incq %rax
cmpq %rbp, %rax
movq 0x18(%rsp), %r15
jne 0x3e4b
xorl %r14d, %r14d
jmp 0x3fe7
callq 0x73f8
movl %r14d, %eax
addq $0x2c8, %rsp            # imm = 0x2C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x294f
leaq 0x8cbc(%rip), %rdi      # 0xccc4
xorl %eax, %eax
callq 0x2b2c