// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/converters/fsio/fsio.c
// Function: FSioExecute
static void FSioExecute(
  char *in
)
{
  char quote;

  words = wds;
  args = 0;

  /*
   * Split the command line into individual words
   */
  while (*in != '\0') {
    switch (*in) {
      case ' ':
      case '\t':
        in++;
        continue;

      case '\'':
      case '\"':
        quote = *in++;
        words[args++] = in;
        while (*in != quote) {
          if (*in == '\0') {
            fprintf(stderr, "Missing terminating quote - %c%s\n",
                    quote, words[args - 1]);
            return;
          }
          in++;
        }
        *in++ = '\0';
        break;
        
      case '#':
        if (args == 0)
          return;
        /* FALLTHROUGH */

      default:
        words[args++] = in++;
        while ((*in != ' ') && (*in != '\t') && (*in != '\0'))
          in++;

        if (*in != '\0')
          *in++ = '\0';
        break;
    }
  }

  if (args != 0) {
    struct command *cmds = cmdTable;
    int i, len, idx = -1;

    len = strlen(words[0]);

    for (cmds = cmdTable, i = 0; cmds->name != NULL; cmds++, i++) {
      if (strncmp(cmds->name, words[0], len) == 0) {
        if (idx != -1) {
          idx = -1;
          break;
        }
        idx = i;
      }
    }

    if (idx != -1) {
      char *switches = cmdTable[idx].switches;

      swPresent = 0;
      for (i = 0; i < 26; i++)
        swValue[i] = NULL;

      /*
       * Parse any switches associated with the command
       */
      if (switches != NULL) {
        int ch;
        char *ptr;

        while ((ch = getopt(args, words, switches)) != -1) {
          if ((ch == '?') || ((ptr = strchr(switches, ch)) == NULL)) {
#if !defined(__linux__)
            optreset = 1;
#endif
            optind = 1;
            return;
          }
          SWSET(ch);

          if (ptr[1] == ':')
            SWSETVAL(ch, optarg);
        }
        args -= optind;
        words += optind;

        /*
         * Reset getopt() for subsequent uses.
         */
#if !defined(__linux__)
        optreset = 1;
#endif
        optind = 1;
      } else args--, words++;

      if ((args < cmdTable[idx].minargs) || (args > cmdTable[idx].maxargs)) {
        fprintf(stderr, "%s: Too %s arguments\n",
                wds[0], args < cmdTable[idx].minargs ? "few" : "many");
        return;
      }

      /*
       * Execute the command.
       */
      (*cmdTable[idx].func)();
    } else fprintf(stderr, "Unknown command \"%s\"\n", words[0]);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x13814(%rip), %rax     # 0x180c0
movq %rax, 0x13805(%rip)     # 0x180b8
andl $0x0, 0x137f6(%rip)     # 0x180b0
leaq 0xa743(%rip), %rax      # 0xf004
movzbl (%rdi), %ecx
leal -0x20(%rcx), %edx
cmpl $0x7, %edx
ja 0x4910
movslq (%rax,%rdx,4), %rdx
addq %rax, %rdx
jmpq *%rdx
movsbl %cl, %edx
leaq 0x1(%rdi), %r8
movq 0x137d5(%rip), %r9      # 0x180b8
movslq 0x137c6(%rip), %rsi     # 0x180b0
leal 0x1(%rsi), %r10d
movl %r10d, 0x137bb(%rip)    # 0x180b0
movq %r8, (%r9,%rsi,8)
addq $0x2, %rdi
movb -0x1(%rdi), %r8b
cmpb %cl, %r8b
je 0x4966
testb %r8b, %r8b
je 0x4977
incq %rdi
jmp 0x48fd
cmpl $0x9, %ecx
je 0x4925
testl %ecx, %ecx
je 0x49a8
movl 0x1378d(%rip), %ecx     # 0x180b0
jmp 0x4938
incq %rdi
jmp 0x48c1
movl 0x13780(%rip), %ecx     # 0x180b0
testl %ecx, %ecx
je 0x4ac8
movq 0x13779(%rip), %rdx     # 0x180b8
leal 0x1(%rcx), %esi
movl %esi, 0x13768(%rip)     # 0x180b0
movslq %ecx, %rcx
movq %rdi, (%rdx,%rcx,8)
incq %rdi
movzbl (%rdi), %ecx
incq %rdi
testl %ecx, %ecx
je 0x496f
cmpl $0x20, %ecx
je 0x4966
cmpl $0x9, %ecx
jne 0x4952
movb $0x0, -0x1(%rdi)
jmp 0x48c1
decq %rdi
jmp 0x48c1
movq 0x1267a(%rip), %rax     # 0x16ff8
movq (%rax), %rdi
movq 0x13730(%rip), %rax     # 0x180b8
movq (%rax,%rsi,8), %rcx
leaq 0xae55(%rip), %rsi      # 0xf7e8
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31e0
movl 0x13702(%rip), %ebx     # 0x180b0
testl %ebx, %ebx
je 0x4ac8
movq 0x136fb(%rip), %rax     # 0x180b8
movq %rax, (%rsp)
movq (%rax), %r15
movq %r15, %rdi
callq 0x3130
movslq %eax, %r12
leaq 0x127ca(%rip), %r13     # 0x171a0
pushq $-0x1
popq %r14
xorl %ebp, %ebp
movq (%r13), %rdi
testq %rdi, %rdi
je 0x4a09
movq %r15, %rsi
movq %r12, %rdx
callq 0x30a0
testl %eax, %eax
jne 0x4a01
cmpl $-0x1, %r14d
movl %ebp, %r14d
jne 0x4b37
addq $0x28, %r13
incl %ebp
jmp 0x49dc
cmpl $-0x1, %r14d
je 0x4b37
movslq %r14d, %rax
imulq $0x28, %rax, %rax
leaq 0x1277f(%rip), %rcx     # 0x171a0
andl $0x0, 0x135b0(%rip)     # 0x17fd8
leaq (%rcx,%rax), %rdx
movq 0x8(%rax,%rcx), %r15
xorl %eax, %eax
leaq 0x135a6(%rip), %r12     # 0x17fe0
cmpq $0xd0, %rax
je 0x4a4d
andq $0x0, (%rax,%r12)
addq $0x8, %rax
jmp 0x4a3a
testq %r15, %r15
je 0x4ad7
movq %rdx, %r14
pushq $0x1
popq %rbp
movq 0x12575(%rip), %r13     # 0x16fd8
movq (%rsp), %rsi
movl %ebx, %edi
movq %r15, %rdx
callq 0x3290
cmpl $-0x1, %eax
je 0x4af0
movl %eax, %ebx
cmpl $0x3f, %eax
je 0x4abb
movq %r15, %rdi
movl %ebx, %esi
callq 0x3150
testq %rax, %rax
je 0x4abb
addl $-0x61, %ebx
movl %ebp, %edx
movl %ebx, %ecx
shll %cl, %edx
orl %edx, 0x1353d(%rip)     # 0x17fd8
cmpb $0x3a, 0x1(%rax)
jne 0x4aac
movq (%r13), %rax
movslq %ebx, %rcx
movq %rax, (%r12,%rcx,8)
movl 0x135fe(%rip), %ebx     # 0x180b0
movq 0x135ff(%rip), %rsi     # 0x180b8
jmp 0x4a67
movq 0x1250e(%rip), %rax     # 0x16fd0
movl $0x1, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
decl %ebx
movl %ebx, 0x135d1(%rip)     # 0x180b0
movq (%rsp), %rax
addq $0x8, %rax
movq %rax, 0x135ca(%rip)     # 0x180b8
jmp 0x4b1c
movq 0x124d9(%rip), %rax     # 0x16fd0
movslq (%rax), %rcx
movl 0x135b0(%rip), %ebx     # 0x180b0
subl %ecx, %ebx
movl %ebx, 0x135a8(%rip)     # 0x180b0
shlq $0x3, %rcx
addq %rcx, 0x135a5(%rip)     # 0x180b8
movl $0x1, (%rax)
movq %r14, %rdx
cmpl 0x10(%rdx), %ebx
jl 0x4b60
cmpl 0x14(%rdx), %ebx
jg 0x4b69
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *0x20(%rdx)
movq 0x124ba(%rip), %rax     # 0x16ff8
movq (%rax), %rdi
leaq 0xace1(%rip), %rsi      # 0xf829
movq %r15, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31e0
leaq 0xacb9(%rip), %rcx      # 0xf820
jmp 0x4b70
leaq 0xacb4(%rip), %rcx      # 0xf824
movq 0x12481(%rip), %rax     # 0x16ff8
movq (%rax), %rdi
movq 0x1353f(%rip), %rdx     # 0x180c0
leaq 0xac82(%rip), %rsi      # 0xf80a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31e0