// File: /workspace/github_c_makefile_star2_O1/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
subq $0x18, %rsp
leaq 0x131b9(%rip), %rax     # 0x190b0
movq %rax, 0x131aa(%rip)     # 0x190a8
movl $0x0, 0x13198(%rip)     # 0x190a0
leaq 0xa0f5(%rip), %rcx      # 0x10004
movb (%rdi), %dl
movzbl %dl, %eax
leal -0x20(%rax), %esi
cmpl $0x7, %esi
ja 0x5f68
movslq (%rcx,%rsi,4), %rsi
addq %rcx, %rsi
jmpq *%rsi
leaq 0x1(%rdi), %r8
movq 0x13178(%rip), %r9      # 0x190a8
movslq 0x13169(%rip), %r10     # 0x190a0
leal 0x1(%r10), %esi
movl %esi, 0x1315f(%rip)     # 0x190a0
movq %r8, (%r9,%r10,8)
movb 0x1(%rdi), %dil
cmpb %dl, %dil
je 0x5f5c
testb %dil, %dil
je 0x5fc4
movb 0x1(%r8), %dil
incq %r8
jmp 0x5f49
movb $0x0, (%r8)
incq %r8
movq %r8, %rdi
jmp 0x5f0f
cmpl $0x9, %eax
je 0x5f73
testl %eax, %eax
jne 0x5f81
jmp 0x5fda
incq %rdi
jmp 0x5f0f
cmpl $0x0, 0x13121(%rip)     # 0x190a0
je 0x5fcb
movq 0x13120(%rip), %rax     # 0x190a8
movslq 0x13111(%rip), %rdx     # 0x190a0
leal 0x1(%rdx), %esi
movl %esi, 0x13108(%rip)     # 0x190a0
movq %rdi, (%rax,%rdx,8)
incq %rdi
movzbl (%rdi), %eax
incq %rdi
testl %eax, %eax
je 0x5fbc
cmpl $0x20, %eax
je 0x5fb3
cmpl $0x9, %eax
jne 0x5f9f
movb $0x0, -0x1(%rdi)
jmp 0x5f0f
decq %rdi
jmp 0x5f0f
movl %eax, %edi
callq 0x3682
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x130c0(%rip), %eax     # 0x190a0
testl %eax, %eax
je 0x5fcb
movl %eax, 0xc(%rsp)
movq 0x130b9(%rip), %rax     # 0x190a8
movq %rax, 0x10(%rsp)
movq (%rax), %rbx
movq 0x12192(%rip), %r15     # 0x18190
testq %r15, %r15
je 0x604b
movq %rbx, %rdi
callq 0x3130
movslq %eax, %r14
xorl %r12d, %r12d
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
leaq 0x1219a(%rip), %rbp     # 0x181b8
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x30a0
testl %eax, %eax
jne 0x6039
cmpl $-0x1, %r13d
movl %r12d, %r13d
jne 0x604b
incl %r12d
movq (%rbp), %r15
addq $0x28, %rbp
testq %r15, %r15
jne 0x601e
jmp 0x6051
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
cmpl $-0x1, %r13d
je 0x6167
movslq %r13d, %rax
leaq (%rax,%rax,4), %r15
leaq 0x12127(%rip), %r12     # 0x18190
movq 0x8(%r12,%r15,8), %rbx
movl $0x0, 0x12f50(%rip)     # 0x18fc8
leaq 0x12f51(%rip), %r14     # 0x18fd0
movl $0xd0, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x3170
testq %rbx, %rbx
je 0x60f2
movl 0x13007(%rip), %edi     # 0x190a0
movq 0x13008(%rip), %rsi     # 0x190a8
movq %rbx, %rdx
callq 0x3280
cmpl $-0x1, %eax
sete %r13b
je 0x6110
movl %eax, %ebp
cmpl $0x3f, %eax
je 0x612b
movq %rbx, %rdi
movl %ebp, %esi
callq 0x3150
testq %rax, %rax
je 0x612b
addl $-0x61, %ebp
movl $0x1, %edx
movl %ebp, %ecx
shll %cl, %edx
orl %edx, 0x12eef(%rip)     # 0x18fc8
cmpb $0x3a, 0x1(%rax)
jne 0x6093
movq 0x11eea(%rip), %rax     # 0x17fd0
movq (%rax), %rax
movslq %ebp, %rcx
movq %rax, (%r14,%rcx,8)
jmp 0x6093
movl 0xc(%rsp), %eax
decl %eax
movl %eax, 0x12fa2(%rip)     # 0x190a0
movq 0x10(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x12f9a(%rip)     # 0x190a8
jmp 0x6142
movq 0x11eb1(%rip), %rax     # 0x17fc8
movslq (%rax), %rax
subl %eax, 0x12f80(%rip)     # 0x190a0
shlq $0x3, %rax
addq %rax, 0x12f7d(%rip)     # 0x190a8
movq 0x11e96(%rip), %rax     # 0x17fc8
movl $0x1, (%rax)
testb $0x1, %r13b
je 0x5fcb
leaq (%r12,%r15,8), %rax
movl 0x12f54(%rip), %ecx     # 0x190a0
cmpl 0x10(%rax), %ecx
jl 0x6190
cmpl 0x14(%rax), %ecx
jg 0x6199
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *0x20(%rax)
movq 0x11e82(%rip), %rax     # 0x17ff0
movq (%rax), %rdi
leaq 0xa6b1(%rip), %rsi      # 0x10829
movq %rbx, %rdx
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31d0
leaq 0xa689(%rip), %rdi      # 0x10820
jmp 0x61a0
leaq 0xa684(%rip), %rdi      # 0x10824
callq 0x36ad
jmp 0x5fcb