// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x10050, %rsp          # imm = 0x10050
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x10028(%rbp)
movl $0x0, -0x1003c(%rbp)
movl $0x0, -0x10040(%rbp)
leaq -0x10038(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1100
movb $0x7, -0x10038(%rbp)
movb $0x2, -0x10037(%rbp)
movl $0x1, -0x10044(%rbp)
movl -0x10044(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x40b6
movq -0x10(%rbp), %rax
movslq -0x10044(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xd5c2(%rip), %rsi      # 0x114f3
callq 0x1140
cmpl $0x0, %eax
jne 0x3f61
movl $0x1, -0x10040(%rbp)
cmpb $0x0, 0x12301(%rip)     # 0x1624d
je 0x3f5c
leaq 0xe245(%rip), %rdi      # 0x1219a
movb $0x0, %al
callq 0x1330
jmp 0x40a0
movq -0x10(%rbp), %rax
movslq -0x10044(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xe248(%rip), %rsi      # 0x121bf
callq 0x1140
cmpl $0x0, %eax
jne 0x404e
movl -0x10044(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10044(%rbp)
cmpl -0x8(%rbp), %eax
jl 0x3fa7
leaq 0xe222(%rip), %rdi      # 0x121c2
movb $0x0, %al
callq 0x1330
movq -0x10(%rbp), %rax
movslq -0x10044(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xe22e(%rip), %rsi      # 0x121eb
callq 0x1040
cmpl $0x0, %eax
jne 0x3fd8
movl -0x1003c(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x1003c(%rbp)
jmp 0x404c
movq -0x10(%rbp), %rax
movslq -0x10044(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xe1f5(%rip), %rsi      # 0x121e3
callq 0x1040
cmpl $0x0, %eax
jne 0x4009
movl -0x1003c(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x1003c(%rbp)
jmp 0x404a
movq -0x10(%rbp), %rax
movslq -0x10044(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xe1ca(%rip), %rsi      # 0x121e9
callq 0x1040
cmpl $0x0, %eax
jne 0x403a
movl -0x1003c(%rbp), %eax
orl $0x4, %eax
movl %eax, -0x1003c(%rbp)
jmp 0x4048
leaq 0xe1ae(%rip), %rdi      # 0x121ef
movb $0x0, %al
callq 0x1330
jmp 0x404a
jmp 0x404c
jmp 0x409e
movq -0x10(%rbp), %rax
movslq -0x10044(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x4067
jmp 0x408b
cmpq $0x0, -0x10028(%rbp)
jne 0x4089
movq -0x10(%rbp), %rax
movslq -0x10044(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x10028(%rbp)
jmp 0x409a
jmp 0x408b
callq 0x3e70
movl $0x1, %edi
callq 0x1200
jmp 0x409c
jmp 0x409e
jmp 0x40a0
jmp 0x40a2
movl -0x10044(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10044(%rbp)
jmp 0x3f0c
cmpl $0x0, -0x1003c(%rbp)
je 0x40cd
movl -0x1003c(%rbp), %eax
movl %eax, -0x10048(%rbp)
jmp 0x40da
movl $0x7, %eax
movl %eax, -0x10048(%rbp)
jmp 0x40da
movl -0x10048(%rbp), %eax
movb %al, -0x10038(%rbp)
cmpl $0x0, -0x10040(%rbp)
je 0x40ff
movzbl -0x10038(%rbp), %eax
orl $0x8, %eax
movb %al, -0x10038(%rbp)
cmpb $0x0, 0x12147(%rip)     # 0x1624d
je 0x4137
movzbl 0x1213e(%rip), %esi     # 0x1624d
movq 0x12112(%rip), %rdx     # 0x16228
leaq 0xe106(%rip), %rdi      # 0x12223
movb $0x0, %al
callq 0x15b0
cmpl $0x0, %eax
jne 0x4135
movl $0x0, -0x4(%rbp)
jmp 0x41d3
jmp 0x415c
movq 0x120ea(%rip), %rsi     # 0x16228
leaq 0xe0f9(%rip), %rdi      # 0x1223e
movb $0x0, %al
callq 0x15b0
cmpl $0x0, %eax
jne 0x415a
movl $0x0, -0x4(%rbp)
jmp 0x41d3
jmp 0x415c
leaq -0x10020(%rbp), %rdx
leaq 0xd381(%rip), %rdi      # 0x114eb
leaq -0x10038(%rbp), %rsi
movl $0x10000, %ecx          # imm = 0x10000
callq 0xb3d0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x418c
movl -0x14(%rbp), %edi
callq 0x14b0
leaq 0x120bd(%rip), %rdi     # 0x16250
leaq 0xd351(%rip), %rsi      # 0x114eb
movl $0x1, %edx
callq 0x47b0
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
je 0x41b4
movl -0x14(%rbp), %edi
callq 0x14b0
cmpq $0x0, -0x10028(%rbp)
je 0x41cd
movq -0x10028(%rbp), %rdi
callq 0xa980
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10050, %rsp          # imm = 0x10050
popq %rbp
retq
nop