// File: /workspace/github_c_makefile_star2_O2/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 $0x1a8, %rsp            # imm = 0x1A8
movq %rsi, %r15
movslq %edi, %rax
pushq $0x1
popq %rcx
movl $0x0, 0xc(%rsp)
pushq $0x1
popq %rdx
movl %ecx, %r12d
cmpq %rax, %rdx
jge 0x3a11
movq (%r15,%rdx,8), %rsi
cmpb $0x2d, (%rsi)
jne 0x3a02
cmpb $0x71, 0x1(%rsi)
jne 0x3be1
cmpb $0x0, 0x2(%rsi)
movl %ecx, 0xc(%rsp)
je 0x3a0c
jmp 0x3be1
movslq %r12d, %rdi
incl %r12d
movq %rsi, (%r15,%rdi,8)
incq %rdx
jmp 0x39db
cmpl $0x2, %r12d
jle 0x3be1
movq -0x8(%r15,%rax,8), %rdi
callq 0x2b76
movq %rax, %r14
movq %rax, %rdi
callq 0x2c11
movl %eax, %ebp
testl %eax, %eax
jne 0x3a51
cmpl $0x3, %r12d
jne 0x3bee
movq 0x8(%r15), %rdi
callq 0x2bcd
testl %eax, %eax
jne 0x3bee
decl %r12d
pushq $0x1
popq %rax
movq %r15, 0x18(%rsp)
movq %r12, 0x10(%rsp)
cmpq %r12, %rax
jae 0x3bcb
movq %rax, 0x20(%rsp)
movq (%r15,%rax,8), %rdi
callq 0x2b76
movq %rax, %rbx
movq %rax, %rdi
pushq $0x2f
popq %rsi
callq 0x20f0
testq %rax, %rax
je 0x3a99
movb $0x0, (%rax)
incq %rax
movq %rbx, %r12
movq %rax, %rbx
jmp 0x3aa0
leaq 0x79ff(%rip), %r12      # 0xb49f
leaq 0x79f9(%rip), %r15      # 0xb4a0
leaq 0x28(%rsp), %rdi
leaq 0x88(%rsp), %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x75e1
movl %eax, %ebx
testl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
jne 0x3bcd
testl %ebx, %ebx
jne 0x3ba5
cmpb $0x0, 0xa2(%rsp)
je 0x3ba5
movq %r12, %rdi
movq %r15, %rsi
leaq 0xa2(%rsp), %rbx
movq %rbx, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x29f0
movq %rax, %r13
movq %r14, %rdi
testl %ebp, %ebp
je 0x3b17
movq %r15, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x29f0
jmp 0x3b1c
callq 0x2240
movq %rax, %r15
decq %r15
cmpb $0x2f, 0x1(%r15)
leaq 0x1(%r15), %r15
je 0x3b22
movq %r15, %rdi
callq 0x2be6
testl %eax, %eax
je 0x3b64
cmpl $0x0, 0xc(%rsp)
jne 0x3b5c
movq 0xd6f1(%rip), %rsi      # 0x11238
leaq 0x81b8(%rip), %rdi      # 0xbd06
movq %r15, %rdx
xorl %eax, %eax
callq 0x2568
testl %eax, %eax
je 0x3b64
movq %r15, %rdi
callq 0x793d
movq %r13, %rdi
movq %r15, %rsi
callq 0x7db6
movl %eax, %ebx
movq %r13, %rdi
callq 0x2030
movq %r15, %rdi
callq 0x2030
testl %ebx, %ebx
jne 0x3ba5
leaq 0x28(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x7470
movl %eax, %ebx
leaq 0x7900(%rip), %r15      # 0xb4a0
jmp 0x3acc
leaq 0x28(%rsp), %rdi
callq 0x6e38
movq 0x20(%rsp), %rax
incq %rax
testl %ebx, %ebx
movq 0x18(%rsp), %r15
movq 0x10(%rsp), %r12
je 0x3a61
jmp 0x3bcd
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x396d
pushq $0x1
popq %rdi
callq 0x2220
leaq 0x80cf(%rip), %rdi      # 0xbcc4
xorl %eax, %eax
callq 0x234c