// File: /workspace/github_c_makefile_star2_O3/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 0x13233(%rip), %rax     # 0x190c0
movq %rax, 0x13224(%rip)     # 0x190b8
movl $0x0, 0x13212(%rip)     # 0x190b0
leaq 0xa15f(%rip), %rcx      # 0x10004
movb (%rdi), %dl
movzbl %dl, %eax
leal -0x20(%rax), %esi
cmpl $0x7, %esi
ja 0x5efe
movslq (%rcx,%rsi,4), %rsi
addq %rcx, %rsi
jmpq *%rsi
leaq 0x1(%rdi), %r8
movq 0x131f2(%rip), %r9      # 0x190b8
movslq 0x131e3(%rip), %r10     # 0x190b0
leal 0x1(%r10), %esi
movl %esi, 0x131d9(%rip)     # 0x190b0
movq %r8, (%r9,%r10,8)
movb 0x1(%rdi), %dil
cmpb %dl, %dil
je 0x5ef2
testb %dil, %dil
je 0x5f5c
movb 0x1(%r8), %dil
incq %r8
jmp 0x5edf
movb $0x0, (%r8)
incq %r8
movq %r8, %rdi
jmp 0x5ea5
cmpl $0x9, %eax
je 0x5f0f
testl %eax, %eax
je 0x5f72
movl 0x131a3(%rip), %eax     # 0x190b0
jmp 0x5f1e
incq %rdi
jmp 0x5ea5
movl 0x13196(%rip), %eax     # 0x190b0
testl %eax, %eax
je 0x5f63
movq 0x13193(%rip), %rdx     # 0x190b8
leal 0x1(%rax), %esi
movl %esi, 0x13182(%rip)     # 0x190b0
cltq
movq %rdi, (%rdx,%rax,8)
incq %rdi
movzbl (%rdi), %eax
incq %rdi
testl %eax, %eax
je 0x5f54
cmpl $0x20, %eax
je 0x5f4b
cmpl $0x9, %eax
jne 0x5f37
movb $0x0, -0x1(%rdi)
jmp 0x5ea5
decq %rdi
jmp 0x5ea5
movl %eax, %edi
callq 0x3692
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x13138(%rip), %eax     # 0x190b0
testl %eax, %eax
je 0x5f63
movl %eax, 0xc(%rsp)
movq 0x13131(%rip), %rax     # 0x190b8
movq %rax, 0x10(%rsp)
movq (%rax), %r15
movq 0x1220a(%rip), %r13     # 0x181a0
testq %r13, %r13
je 0x6105
movq %r15, %rdi
callq 0x3130
movslq %eax, %r12
xorl %ebp, %ebp
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
leaq 0x1220f(%rip), %rbx     # 0x181c8
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x30a0
testl %eax, %eax
jne 0x5fd8
cmpl $-0x1, %r14d
movl %ebp, %r14d
jne 0x6105
incl %ebp
movq (%rbx), %r13
addq $0x28, %rbx
testq %r13, %r13
jne 0x5fb9
cmpl $-0x1, %r14d
je 0x6105
movslq %r14d, %rax
leaq (%rax,%rax,4), %r13
leaq 0x121a2(%rip), %r14     # 0x181a0
movq 0x8(%r14,%r13,8), %r15
movl $0x0, 0x12fcb(%rip)     # 0x18fd8
leaq 0x12fcc(%rip), %r12     # 0x18fe0
movl $0xd0, %edx
movq %r12, %rdi
xorl %esi, %esi
callq 0x3170
testq %r15, %r15
je 0x609f
movq 0x11fa1(%rip), %rbp     # 0x17fd0
movl 0xc(%rsp), %edi
movq 0x10(%rsp), %rsi
movq %r15, %rdx
callq 0x3290
cmpl $-0x1, %eax
je 0x60bd
movl %eax, %ebx
cmpl $0x3f, %eax
je 0x608d
movq %r15, %rdi
movl %ebx, %esi
callq 0x3150
testq %rax, %rax
je 0x608d
addl $-0x61, %ebx
movl $0x1, %edx
movl %ebx, %ecx
shll %cl, %edx
orl %edx, 0x12f6b(%rip)     # 0x18fd8
cmpb $0x3a, 0x1(%rax)
jne 0x607e
movq (%rbp), %rax
movslq %ebx, %rcx
movq %rax, (%r12,%rcx,8)
movl 0x1302c(%rip), %edi     # 0x190b0
movq 0x1302d(%rip), %rsi     # 0x190b8
jmp 0x6038
movq 0x11f34(%rip), %rax     # 0x17fc8
movl $0x1, (%rax)
jmp 0x5f63
movl 0xc(%rsp), %edx
decl %edx
movl %edx, 0x13005(%rip)     # 0x190b0
movq 0x10(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x12ffd(%rip)     # 0x190b8
jmp 0x60e6
movq 0x11f04(%rip), %rax     # 0x17fc8
movslq (%rax), %rcx
movl 0x12fe3(%rip), %edx     # 0x190b0
subl %ecx, %edx
movl %edx, 0x12fdb(%rip)     # 0x190b0
shlq $0x3, %rcx
addq %rcx, 0x12fd8(%rip)     # 0x190b8
movl $0x1, (%rax)
leaq (%r14,%r13,8), %rax
cmpl 0x10(%rax), %edx
jl 0x612e
cmpl 0x14(%rax), %edx
jg 0x6137
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *0x20(%rax)
movq 0x11ee4(%rip), %rax     # 0x17ff0
movq (%rax), %rdi
leaq 0xa713(%rip), %rsi      # 0x10829
movq %r15, %rdx
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31e0
leaq 0xa6eb(%rip), %rdi      # 0x10820
jmp 0x613e
leaq 0xa6e6(%rip), %rdi      # 0x10824
callq 0x36bd
jmp 0x5f63