// File: /workspace/github_c_makefile_star2_O0/lb3361[P]dosfs/dosfs.c
// Function: main
int main(int argc, const char **argv)
{
  int i, j;
  int nargc = 0;
  const char **nargv = argv;
  const char *progname = 0;
  int cmdno = -1;
  int help = 0;
  FRESULT res;
  
  /* try to make utf8 locale */
#ifdef WIN32
  if (setlocale(LC_CTYPE, ".UTF8"))
    recode_arguments_as_utf8(argc, argv, __wargv);
#else
  setlocale(LC_CTYPE, "");
#endif
  if (mblen("\xc2\xa9", 2) != 2 ||
      mblen("\xe2\x89\xa0", 3) != 3)
    warning("The current locale does not seem to be using UTF-8 encoding.\n");
  /* identify progname */
  if ((progname = strrchr(argv[0], '/')))
    progname += 1;
  else
    progname = argv[0];
  /* default command from progname */
  if (! strncmp(progname, "dos", 3))
    cmdno = search_cmd(progname + 3);

  /* parse common options */
  nargv[nargc++] = progname;
  for (int i = 1; i < argc; i++)
    {
      if (argv[i][0] == '-' && argv[i][1] == '-')
        {
          if (cmdno >= 0)
            warning("Subcommand %s overrides previously selected subcommand --%s\n",
                    argv[i], commands[cmdno].cmd);
          if ((cmdno = search_cmd(argv[i]+2)) < 0)
            fatal("Unrecognized subcommand : %s\n", argv[i]);
          continue;
        }
      if (!strcmp(argv[i], "-f") && i + 1 < argc)
        {
          fn = argv[i + 1];
          sfn = strrchr(fn, '/');
          sfn = (sfn) ? sfn + 1 : fn;
          i += 1;
          continue;
        }
      if (! strcmp(argv[i], "-h"))
        {
          help = 1;
          continue;
        }
#if FF_MULTI_PARTITION
      if (!strcmp(argv[i], "-p") && i + 1 < argc)
        {
          const char *p = argv[i + 1];
          if (p[0] >= '0' && p[0] <= '9' && !p[1])
            VolToPart[0].pt = p[0] - '0';
          else
            fatal("Not a valid partition number: %s\n", p);
          i += 1;
          continue;
        }
#endif
      nargv[nargc++] = argv[i];
    }
  /* Check */
  if (cmdno < 0) {
    common_usage();
    if (help)
      for (i=0; commands[i].cmd; i++) {
        fprintf(stderr,"----------------------------------------\n");
        commands[i].help();
      }
    return EXIT_FAILURE;
  }
  if (help || fn == 0) {
    commands[cmdno].help();
    return EXIT_FAILURE;
  }
  /* Mount, run, unmount */
  if (commands[cmdno].run != dosformat)
    if ((res = f_mount(&vol, "", 1)) != FR_OK)
      fatal_code(res);
  if ((res = commands[cmdno].run(nargc, nargv)) != FR_OK)
    fatal_code(res);
  if ((res = f_mount(NULL, "", 0)) != FR_OK && j >= 0)
    fatal_code(res);
  return EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x38(%rbp)
xorl %edi, %edi
leaq 0xd187(%rip), %rsi      # 0x114eb
callq 0x11c0
leaq 0xdf90(%rip), %rdi      # 0x12300
movl $0x2, %esi
callq 0x1060
cmpl $0x2, %eax
jne 0x4395
leaq 0xdf7d(%rip), %rdi      # 0x12303
movl $0x3, %esi
callq 0x1060
cmpl $0x3, %eax
je 0x43a3
leaq 0xdf6b(%rip), %rdi      # 0x12307
movb $0x0, %al
callq 0x13f0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl $0x2f, %esi
callq 0x10e0
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0x43cc
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x43d7
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
leaq 0xdf63(%rip), %rsi      # 0x12345
movl $0x3, %edx
callq 0x1070
cmpl $0x0, %eax
jne 0x4401
movq -0x30(%rbp), %rdi
addq $0x3, %rdi
callq 0x41e0
movl %eax, -0x34(%rbp)
movq -0x30(%rbp), %rdx
movq -0x28(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x1c(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x1, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x464a
movq -0x10(%rbp), %rax
movslq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x44cc
movq -0x10(%rbp), %rax
movslq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
cmpl $0x2d, %eax
jne 0x44cc
cmpl $0x0, -0x34(%rbp)
jl 0x4490
movq -0x10(%rbp), %rax
movslq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movslq -0x34(%rbp), %rcx
leaq 0x11cc8(%rip), %rax     # 0x16140
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdx
leaq 0xdec0(%rip), %rdi      # 0x12349
movb $0x0, %al
callq 0x13f0
movq -0x10(%rbp), %rax
movslq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0x2, %rdi
callq 0x41e0
movl %eax, -0x34(%rbp)
cmpl $0x0, %eax
jge 0x44c7
movq -0x10(%rbp), %rax
movslq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0xdec6(%rip), %rdi      # 0x12386
movb $0x0, %al
callq 0x1330
jmp 0x463c
movq -0x10(%rbp), %rax
movslq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xdec5(%rip), %rsi      # 0x123a4
callq 0x1140
cmpl $0x0, %eax
jne 0x4563
movl -0x40(%rbp), %eax
addl $0x1, %eax
cmpl -0x8(%rbp), %eax
jge 0x4563
movq -0x10(%rbp), %rax
movl -0x40(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x11d14(%rip)     # 0x16220
movq 0x11d0d(%rip), %rdi     # 0x16220
movl $0x2f, %esi
callq 0x10e0
movq %rax, 0x11d04(%rip)     # 0x16228
cmpq $0x0, 0x11cfc(%rip)     # 0x16228
je 0x453f
movq 0x11cf3(%rip), %rax     # 0x16228
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x454a
movq 0x11cda(%rip), %rax     # 0x16220
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, 0x11cd3(%rip)     # 0x16228
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x463c
movq -0x10(%rbp), %rax
movslq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xde31(%rip), %rsi      # 0x123a7
callq 0x1140
cmpl $0x0, %eax
jne 0x458c
movl $0x1, -0x38(%rbp)
jmp 0x463c
movq -0x10(%rbp), %rax
movslq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xde0b(%rip), %rsi      # 0x123aa
callq 0x1140
cmpl $0x0, %eax
jne 0x461a
movl -0x40(%rbp), %eax
addl $0x1, %eax
cmpl -0x8(%rbp), %eax
jge 0x461a
movq -0x10(%rbp), %rax
movl -0x40(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jl 0x45fd
movq -0x48(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x39, %eax
jg 0x45fd
movq -0x48(%rbp), %rax
cmpb $0x0, 0x1(%rax)
jne 0x45fd
movq -0x48(%rbp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
movb %al, 0x11c52(%rip)      # 0x1624d
jmp 0x460f
movq -0x48(%rbp), %rsi
leaq 0xdda5(%rip), %rdi      # 0x123ad
movb $0x0, %al
callq 0x1330
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x463c
movq -0x10(%rbp), %rax
movslq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x28(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x1c(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x4422
cmpl $0x0, -0x34(%rbp)
jge 0x46c0
callq 0x4260
cmpl $0x0, -0x38(%rbp)
je 0x46b4
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x11ad3(%rip), %rax     # 0x16140
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0x46b2
movq 0x11977(%rip), %rax     # 0x15ff8
movq (%rax), %rdi
leaq 0xdd44(%rip), %rsi      # 0x123cf
movb $0x0, %al
callq 0x1160
movslq -0x14(%rbp), %rcx
leaq 0x11aa3(%rip), %rax     # 0x16140
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
callq *0x10(%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x4662
jmp 0x46b4
movl $0x1, -0x4(%rbp)
jmp 0x4798
cmpl $0x0, -0x38(%rbp)
jne 0x46d0
cmpq $0x0, 0x11b52(%rip)     # 0x16220
jne 0x46f1
movslq -0x34(%rbp), %rcx
leaq 0x11a65(%rip), %rax     # 0x16140
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
callq *0x10(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x4798
movslq -0x34(%rbp), %rcx
leaq 0x11a44(%rip), %rax     # 0x16140
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
leaq -0x85a(%rip), %rcx      # 0x3eb0
cmpq %rcx, 0x8(%rax)
je 0x473a
leaq 0x11b39(%rip), %rdi     # 0x16250
leaq 0xcdcd(%rip), %rsi      # 0x114eb
movl $0x1, %edx
callq 0x47b0
movl %eax, -0x3c(%rbp)
cmpl $0x0, %eax
je 0x4738
movl -0x3c(%rbp), %edi
callq 0x14b0
jmp 0x473a
movslq -0x34(%rbp), %rcx
leaq 0x119fb(%rip), %rax     # 0x16140
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x1c(%rbp), %edi
movq -0x28(%rbp), %rsi
callq *%rax
movl %eax, -0x3c(%rbp)
cmpl $0x0, %eax
je 0x4769
movl -0x3c(%rbp), %edi
callq 0x14b0
xorl %eax, %eax
movl %eax, %edi
leaq 0xcd77(%rip), %rsi      # 0x114eb
xorl %edx, %edx
callq 0x47b0
movl %eax, -0x3c(%rbp)
cmpl $0x0, %eax
je 0x4791
cmpl $0x0, -0x18(%rbp)
jl 0x4791
movl -0x3c(%rbp), %edi
callq 0x14b0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)