// File: /workspace/github_c_makefile_star2_O1/simh[P]simtools/converters/fsio/fsio.c
// Function: doDump
static void doDump(void)
{
  struct mountedFS *mount;
  char *fname;
  void *file;
  uint8_t unit, present;

  if ((mount = findMount("dump", words[0], &unit, &present, &fname)) != NULL) {
    if ((file = (*mount->filesys->openFileR)(mount, unit, fname)) != NULL) {
      unsigned int offset = 0, datasz = 2;
      uint8_t data1;
      uint16_t data2;
      uint32_t data4;
      char output[128];

      if (SWISSET('b') || SWISSET('c'))
        datasz = 1;
      else if (SWISSET('d'))
        datasz = 4;
      else if (SWISSET('w'))
        datasz = 2;

      output[0] = '\0';

      switch (datasz) {
        case 1:
          while ((*mount->filesys->readFile)(file, &data1, 1) != 0) {
            if (SWISSET('b'))
              sprintf(&output[strlen(output)],
                      SWISSET('x') ? " 0x%02X" : " 0%03o", data1);
            else sprintf(&output[strlen(output)], " %s ", Ascii[data1 & 0177]);

            if ((offset & 07) == 07) {
              if (mount->blocksz != 0)
                printf("%s%011o %s\n",
                       ((offset & ~07) % mount->blocksz) == 0 ? "\n" : "",
                       offset & ~07, output);
              else printf("%011o %s\n", offset & ~07, output);
              output[0] = '\0';
            }
            offset++;
          }

          if (output[0] != '\0')
            printf("%011o %s\n", offset & ~07, output);
          break;

        case 2:
          while ((*mount->filesys->readFile)(file, &data2, 2) != 0) {
            sprintf(&output[strlen(output)],
                    SWISSET('x') ? " 0x%04X" : " %07o", data2);

            if ((offset & 017) == 016) {
              if (mount->blocksz != 0)
                printf("%s%011o %s\n",
                       ((offset & ~017) % mount->blocksz) == 0 ? "\n" : "",
                       offset & ~017, output);
              else printf("%011o %s\n", offset & ~017, output);
              output[0] = '\0';
            }
            offset += 2;
            data2 = 0;
          }

          if (output[0] != '\0')
            printf("%011o %s\n", offset & ~07, output);
          break;

        case 4:
          while ((*mount->filesys->readFile)(file, &data4, 4) != 0) {
            sprintf(&output[strlen(output)],
                    SWISSET('x') ? " 0x%08X" : " %011o", data2);

            if ((offset & 017) == 014) {
              if (mount->blocksz != 0)
                printf("%s%011o %s\n",
                       ((offset & ~017) % mount->blocksz) == 0 ? "\n" : "",
                       offset & ~017, output);
              else printf("%011o %s\n", offset & ~017, output);
              output[0] = '\0';
            }
            offset += 4;
            data2 = 0;
          }

          if (output[0] != '\0')
            printf("%011o %s\n", offset & ~07, output);
          break;
      }
      /*
       * Close the file
       */
      (*mount->filesys->closeFile)(file);
    } else fprintf(stderr, "dump: \"%s\" no such file\n", fname);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq 0x13f45(%rip), %rax     # 0x190a8
movq (%rax), %rsi
leaq 0xaee3(%rip), %rdi      # 0x10050
leaq 0xf(%rsp), %rdx
leaq 0x17(%rsp), %rcx
leaq 0x18(%rsp), %r8
callq 0x63c4
testq %rax, %rax
je 0x54fc
movq %rax, %rbx
movq 0x20(%rax), %rax
movzbl 0xf(%rsp), %esi
movq 0x18(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rdx
callq *0x60(%rax)
testq %rax, %rax
je 0x550e
movq %rax, %r14
movl 0x13e12(%rip), %eax     # 0x18fc8
movl %eax, %ecx
andl $0x8, %ecx
shrl $0x2, %ecx
addl $0x2, %ecx
testb $0x6, %al
movl $0x1, %eax
cmovel %ecx, %eax
movb $0x0, 0x20(%rsp)
cmpl $0x1, %eax
je 0x53c5
cmpl $0x2, %eax
je 0x52d8
cmpl $0x4, %eax
jne 0x54f2
movq 0x20(%rbx), %rax
leaq 0x10(%rsp), %rsi
movl $0x4, %edx
movq %r14, %rdi
callq *0x80(%rax)
testq %rax, %rax
je 0x54d4
leaq 0x20(%rsp), %r15
leaq 0xb2c0(%rip), %r13      # 0x104d7
leaq 0x10(%rsp), %r12
xorl %ebp, %ebp
movq %r15, %rdi
callq 0x3130
btl $0x17, 0x13d9a(%rip)    # 0x18fc8
movq %r13, %rsi
jae 0x523a
leaq 0xb295(%rip), %rsi      # 0x104cf
leaq (%rsp,%rax), %rdi
addq $0x20, %rdi
movzwl 0xc(%rsp), %edx
xorl %eax, %eax
callq 0x32a0
movl %ebp, %eax
notl %eax
testb $0xc, %al
jne 0x52ab
movq 0x28(%rbx), %rsi
movl %ebp, %ecx
andl $-0x10, %ecx
testq %rsi, %rsi
je 0x5293
movl %ecx, %eax
xorl %edx, %edx
divq %rsi
leaq 0xd80d(%rip), %rsi      # 0x12a7f
testq %rdx, %rdx
je 0x527e
leaq 0xd802(%rip), %rsi      # 0x12a80
leaq 0xb230(%rip), %rdi      # 0x104b5
movl %ecx, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0x3160
jmp 0x52a6
leaq 0xb21d(%rip), %rdi      # 0x104b7
movl %ecx, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x3160
movb $0x0, 0x20(%rsp)
addl $0x4, %ebp
movw $0x0, 0xc(%rsp)
movq 0x20(%rbx), %rax
movl $0x4, %edx
movq %r14, %rdi
movq %r12, %rsi
callq *0x80(%rax)
testq %rax, %rax
jne 0x521e
jmp 0x54cf
movq 0x20(%rbx), %rax
leaq 0xc(%rsp), %rsi
movl $0x2, %edx
movq %r14, %rdi
callq *0x80(%rax)
testq %rax, %rax
je 0x54d4
leaq 0x20(%rsp), %r15
leaq 0xb1c5(%rip), %r13      # 0x104c9
leaq 0xc(%rsp), %r12
xorl %ebp, %ebp
movq %r15, %rdi
callq 0x3130
btl $0x17, 0x13cad(%rip)    # 0x18fc8
movq %r13, %rsi
jae 0x5327
leaq 0xb19a(%rip), %rsi      # 0x104c1
leaq (%rsp,%rax), %rdi
addq $0x20, %rdi
movzwl 0xc(%rsp), %edx
xorl %eax, %eax
callq 0x32a0
movl %ebp, %eax
notl %eax
testb $0xe, %al
jne 0x5398
movq 0x28(%rbx), %rsi
movl %ebp, %ecx
andl $-0x10, %ecx
testq %rsi, %rsi
je 0x5380
movl %ecx, %eax
xorl %edx, %edx
divq %rsi
leaq 0xd720(%rip), %rsi      # 0x12a7f
testq %rdx, %rdx
je 0x536b
leaq 0xd715(%rip), %rsi      # 0x12a80
leaq 0xb143(%rip), %rdi      # 0x104b5
movl %ecx, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0x3160
jmp 0x5393
leaq 0xb130(%rip), %rdi      # 0x104b7
movl %ecx, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x3160
movb $0x0, 0x20(%rsp)
addl $0x2, %ebp
movw $0x0, 0xc(%rsp)
movq 0x20(%rbx), %rax
movl $0x2, %edx
movq %r14, %rdi
movq %r12, %rsi
callq *0x80(%rax)
testq %rax, %rax
jne 0x530b
jmp 0x54cf
movq 0x20(%rbx), %rax
leaq 0x10(%rsp), %rsi
movl $0x1, %edx
movq %r14, %rdi
callq *0x80(%rax)
testq %rax, %rax
je 0x54d4
leaq 0x20(%rsp), %r15
leaq 0x10(%rsp), %r13
xorl %ebp, %ebp
movl 0x13bd0(%rip), %r12d    # 0x18fc8
movq %r15, %rdi
callq 0x3130
leaq (%rsp,%rax), %rdi
addq $0x20, %rdi
testb $0x2, %r12b
jne 0x5431
movzbl 0x10(%rsp), %eax
andl $0x7f, %eax
leaq 0x132c3(%rip), %rcx     # 0x186e0
movq (%rcx,%rax,8), %rdx
leaq 0xb088(%rip), %rsi      # 0x104b0
xorl %eax, %eax
callq 0x32a0
jmp 0x5452
btl $0x17, %r12d
leaq 0xb06c(%rip), %rsi      # 0x104a9
jae 0x5446
leaq 0xb05b(%rip), %rsi      # 0x104a1
movzbl 0x10(%rsp), %edx
xorl %eax, %eax
callq 0x32a0
movl %ebp, %eax
notl %eax
testb $0x7, %al
jne 0x54af
movq 0x28(%rbx), %rsi
movl %ebp, %ecx
andl $-0x8, %ecx
testq %rsi, %rsi
je 0x5497
movl %ecx, %eax
xorl %edx, %edx
divq %rsi
leaq 0xd609(%rip), %rsi      # 0x12a7f
testq %rdx, %rdx
je 0x5482
leaq 0xd5fe(%rip), %rsi      # 0x12a80
leaq 0xb02c(%rip), %rdi      # 0x104b5
movl %ecx, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0x3160
jmp 0x54aa
leaq 0xb019(%rip), %rdi      # 0x104b7
movl %ecx, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x3160
movb $0x0, 0x20(%rsp)
incl %ebp
movq 0x20(%rbx), %rax
movl $0x1, %edx
movq %r14, %rdi
movq %r13, %rsi
callq *0x80(%rax)
testq %rax, %rax
jne 0x53f1
andl $-0x8, %ebp
jmp 0x54d6
xorl %ebp, %ebp
cmpb $0x0, 0x20(%rsp)
je 0x54f2
leaq 0xafd3(%rip), %rdi      # 0x104b7
leaq 0x20(%rsp), %rdx
movl %ebp, %esi
xorl %eax, %eax
callq 0x3160
movq 0x20(%rbx), %rax
movq %r14, %rdi
callq *0x78(%rax)
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x12adb(%rip), %rax     # 0x17ff0
movq (%rax), %rdi
leaq 0xafbf(%rip), %rsi      # 0x104de
movq %r15, %rdx
xorl %eax, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31d0