// File: /workspace/github_c_makefile_star2_O2/lb3361[P]dosfs/dosfs.c
// Function: dosformat
FRESULT dosformat(int argc, const char **argv)
{
  FRESULT res;
  char buffer[64*1024];
  const char *label = 0;
  MKFS_PARM parm;
  int fflag = 0;
  int sflag = 0;
  int i;
  
  memset(&parm, 0, sizeof(parm));
  parm.fmt = FM_ANY;
  parm.n_fat = 2;
  for (i=1; i<argc; i++)
    {
      if (!strcmp(argv[i], "-s")) {
        sflag = 1;
        if (VolToPart[0].pt)
          fatal("Options -s and -p are incompatible.\n");
      } else if (!strcmp(argv[i], "-F")) {
        if (++i >= argc)
          fatal("Option -F requires an argument.\n");
        if (!strcasecmp(argv[i],"fat"))
          fflag |= FM_FAT;
        else if (!strcasecmp(argv[i],"fat32"))
          fflag |= FM_FAT32;
        else if (!strcasecmp(argv[i],"exfat"))
          fflag |= FM_EXFAT;
        else
          fatal("Valid arguments for option -f are: fat fat32 exfat\n");
      } else if (argv[i][0] == '-') {
        goto usage;
      } else if (! label) {
        label = argv[i];
      } else {
      usage:
        dosformathelp();
        exit(EXIT_FAILURE);
      }
    }
  parm.fmt = (fflag) ? fflag : FM_ANY;
  if (sflag)
    parm.fmt |= FM_SFD;

  if (VolToPart[0].pt) {
    if (! prompt("Erase partition %d in [%s]", VolToPart[0].pt, sfn))
      return FR_OK;
  } else {
    if (! prompt("Erase everything in [%s]", sfn))
      return FR_OK;
  }
  res = f_mkfs("", &parm, buffer, sizeof(buffer));
  if (res != FR_OK)
    fatal_code(res);
  if ((res = f_mount(&vol, "", 1)) != FR_OK)
    fatal_code(res);
  if (label)
    res = f_setlabel(label);
  return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10028, %rsp          # imm = 0x10028
movq %rsi, %r14
movl %edi, %r15d
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movb $0x2, 0x11(%rsp)
movzbl 0xd139(%rip), %eax      # 0x1125d
movl %eax, 0xc(%rsp)
pushq $0x1
popq %r12
xorl %ebx, %ebx
xorl %ebp, %ebp
movl $0x0, 0x8(%rsp)
cmpl %r15d, %r12d
jge 0x41f7
movslq %r12d, %rax
movq (%r14,%rax,8), %rax
cmpb $0x2d, (%rax)
jne 0x41c6
cmpb $0x73, 0x1(%rax)
jne 0x415d
cmpb $0x0, 0x2(%rax)
je 0x41dd
cmpb $0x46, 0x1(%rax)
jne 0x42b4
cmpb $0x0, 0x2(%rax)
jne 0x42b4
incl %r12d
cmpl %r15d, %r12d
jge 0x42c1
movslq %r12d, %rax
movq (%r14,%rax,8), %r13
movq %r13, %rdi
leaq 0x7fe0(%rip), %rsi      # 0xc16e
callq 0x2050
testl %eax, %eax
je 0x41d3
movq %r13, %rdi
leaq 0x7fc5(%rip), %rsi      # 0xc166
callq 0x2050
testl %eax, %eax
je 0x41d8
movq %r13, %rdi
leaq 0x7fb8(%rip), %rsi      # 0xc16c
callq 0x2050
testl %eax, %eax
jne 0x42ca
orl $0x4, %ebp
jmp 0x41ef
testq %rbx, %rbx
movq %rax, %rbx
je 0x41ef
jmp 0x42b4
orl $0x1, %ebp
jmp 0x41ef
orl $0x2, %ebp
jmp 0x41ef
pushq $0x1
popq %rax
movl %eax, 0x8(%rsp)
cmpl $0x0, 0xc(%rsp)
jne 0x42d3
incl %r12d
jmp 0x4138
testl %ebp, %ebp
pushq $0x7
popq %rax
cmovnel %ebp, %eax
movl %eax, %ecx
orb $0x8, %cl
cmpl $0x0, 0x8(%rsp)
movzbl %cl, %ecx
cmovel %eax, %ecx
movb %cl, 0x10(%rsp)
movl 0xc(%rsp), %esi
testl %esi, %esi
je 0x4235
movq 0xd016(%rip), %rdx      # 0x11238
leaq 0x7f7d(%rip), %rdi      # 0xc1a6
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x2568
jmp 0x424d
movq 0xcffc(%rip), %rsi      # 0x11238
leaq 0x7f7e(%rip), %rdi      # 0xc1c1
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x2568
testl %eax, %eax
je 0x429f
leaq 0x7247(%rip), %rdi      # 0xb49f
leaq 0x10(%rsp), %rsi
leaq 0x20(%rsp), %rdx
movl $0x10000, %ecx          # imm = 0x10000
callq 0x8a91
testl %eax, %eax
jne 0x42e1
leaq 0xcfe9(%rip), %rdi      # 0x11260
leaq 0x7221(%rip), %rsi      # 0xb49f
pushq $0x1
popq %rdx
callq 0x468c
testl %eax, %eax
jne 0x42e1
testq %rbx, %rbx
je 0x429c
movq %rbx, %rdi
callq 0x84cc
movl %eax, %r14d
jmp 0x429f
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x10028, %rsp          # imm = 0x10028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x40b3
pushq $0x1
popq %rdi
callq 0x2220
leaq 0x7e7d(%rip), %rdi      # 0xc145
jmp 0x42da
leaq 0x7ea1(%rip), %rdi      # 0xc172
jmp 0x42da
leaq 0x7e46(%rip), %rdi      # 0xc120
xorl %eax, %eax
callq 0x234c
movl %eax, %edi
callq 0x24bb