// File: /workspace/github_c_makefile_star2_O1/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
movq %rsi, 0x8(%rsp)
cmpl $0x2, %edi
movl %edi, 0x10(%rsp)
jl 0x3ed1
movl %edi, %r13d
xorl %ebp, %ebp
movl $0x1, %r12d
movl $0x1, %ebx
leaq 0x88c4(%rip), %r14      # 0xc74c
movq 0x8(%rsp), %rax
movq (%rax,%rbx,8), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x2170
testl %eax, %eax
je 0x3ebb
cmpb $0x2d, (%r15)
je 0x410c
movslq %r12d, %rax
incl %r12d
movq 0x8(%rsp), %rcx
movq %r15, (%rcx,%rax,8)
jmp 0x3ec0
movl $0x1, %ebp
incq %rbx
cmpq %rbx, %r13
jne 0x3e88
testl %ebp, %ebp
sete 0x7(%rsp)
jmp 0x3edc
movl $0x1, %r12d
movb $0x1, 0x7(%rsp)
cmpl $0x2, %r12d
jle 0x410c
movslq 0x10(%rsp), %rax
movq 0x8(%rsp), %rcx
movq -0x8(%rcx,%rax,8), %rdi
callq 0x3020
movq %rax, 0x10(%rsp)
movq %rax, %rdi
callq 0x30bb
movl %eax, %ebp
testl %eax, %eax
jne 0x3f35
cmpl $0x3, %r12d
jne 0x4111
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x82fb(%rip), %rsi      # 0xc222
callq 0x21e0
testq %rax, %rax
jne 0x4111
leaq 0xa2(%rsp), %r13
cmpl $0x4, %r12d
movl $0x3, %eax
cmovgel %r12d, %eax
decl %eax
movq %rax, 0x20(%rsp)
movl $0x1, %r14d
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %rdi
callq 0x3020
movq %rax, %r15
movq %rax, %rdi
movl $0x2f, %esi
callq 0x2100
testq %rax, %rax
je 0x3f88
movb $0x0, (%rax)
incq %rax
movq %r15, %rbx
movq %rax, %r15
jmp 0x3f8f
leaq 0x8510(%rip), %rbx      # 0xc49f
leaq 0x28(%rsp), %rdi
leaq 0x88(%rsp), %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x7f6a
movl %eax, %r15d
testl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
je 0x3fdd
xorl %eax, %eax
jmp 0x40dd
movq 0xd279(%rip), %rsi      # 0x11238
leaq 0x8d58(%rip), %rdi      # 0xcd1e
movq %r15, %rdx
xorl %eax, %eax
callq 0x2348
testl %eax, %eax
jne 0x406e
jmp 0x4076
testl %r15d, %r15d
jne 0x40c2
cmpb $0x0, 0xa2(%rsp)
je 0x40c2
movq %rbx, %rdi
leaq 0x84a2(%rip), %r15      # 0xc4a0
movq %r15, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x2e96
movq %rax, %r12
testl %ebp, %ebp
je 0x402a
movq 0x10(%rsp), %rdi
movq %r15, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x2e96
jmp 0x4034
movq 0x10(%rsp), %rdi
callq 0x2250
movq %rax, %r15
decq %r15
cmpb $0x2f, 0x1(%r15)
leaq 0x1(%r15), %r15
je 0x403a
movq %r15, %rdi
leaq 0x1a8(%rsp), %rsi
callq 0x7f9e
testl %eax, %eax
jne 0x4076
testb $0x10, 0x1b4(%rsp)
jne 0x4076
cmpb $0x0, 0x7(%rsp)
jne 0x3fb8
movq %r15, %rdi
callq 0x82fc
movq %r12, %rdi
movq %r15, %rsi
callq 0x883a
movl %eax, %r13d
movq %r12, %rdi
callq 0x2030
movq %r15, %rdi
callq 0x2030
movl %r13d, %r15d
testl %r13d, %r13d
jne 0x40b1
leaq 0x28(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x7dad
movl %eax, %r15d
testl %r13d, %r13d
leaq 0xa2(%rsp), %r13
je 0x3fdd
leaq 0x28(%rsp), %rdi
callq 0x7653
testl %r15d, %r15d
sete %al
movl 0x1c(%rsp), %ecx
cmovnel %r15d, %ecx
movl %ecx, %r15d
testb %al, %al
je 0x40f7
movl %r15d, 0x1c(%rsp)
incq %r14
cmpq 0x20(%rsp), %r14
jne 0x3f57
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x2c8, %rsp            # imm = 0x2C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2933
leaq 0x8bc4(%rip), %rdi      # 0xccdc
xorl %eax, %eax
callq 0x2aec