// File: /workspace/github_c_makefile_star2_O1/simh[P]simtools/converters/fsio/rt11.c
// Function: info
static void info(
  struct mountedFS *mount,
  uint8_t unit
)
{
  struct RT11data *data = &mount->rt11data;
  uint16_t entrysz, startblk, dsseg = 1;
  char temp[32];

  printf("%s%o:\n\n", mount->name, unit);

  do {
    uint16_t off = RT11_DH_SIZE;

    if (rt11ReadDirSegment(mount, unit, dsseg) == 0)
      return;

    printf("\nDirectory Segment %2d:\n\n", dsseg);
    printf(" File  Type     Date     Status   Class   Length    Disk Region\n\n");

    entrysz = RT11_DI_SIZE + (le16toh(data->buf[RT11_DH_EXTRA]) >> 1);
    startblk = le16toh(data->buf[RT11_DH_START]);

    /*
     * Loop until we see and end-of-segment marker or there is no room for
     * another directory entry.
     */
    while (!RT11EOS(le16toh(data->buf[off + RT11_DI_STATUS])) &&
           ((RT11_DS_SIZE - off) >= entrysz)) {
      uint16_t status = le16toh(data->buf[off + RT11_DI_STATUS]);

      /*
       * Tentative and empty files are reported as "UNUSED"
       */
      if ((status & (RT11_E_TENT | RT11_E_MPTY)) == 0) {
        r50Asc(le16toh(data->buf[off + RT11_DI_FNAME1]), &temp[0]);
        r50Asc(le16toh(data->buf[off + RT11_DI_FNAME2]), &temp[3]);
        temp[6] = '.';
        r50Asc(le16toh(data->buf[off + RT11_DI_FTYPE]), &temp[7]);
        temp[10] = ' ';
        temp[11] = ' ';
        rt11Date(le16toh(data->buf[off + RT11_DI_CREATE]), &temp[12]);

        printf("%s  %07o  %s     %5d     %5d-%5d\n",
               temp, status,
               (status & RT11_E_PRE) != 0 ? "PRE" : "   ",
               le16toh(data->buf[off + RT11_DI_LENGTH]),
               startblk,
               startblk + le16toh(data->buf[off + RT11_DI_LENGTH]) - 1);
      } else {
        printf("< UNUSED >                                %5d     %5d-%5d\n",
               le16toh(data->buf[off + RT11_DI_LENGTH]),
               startblk,
               le16toh(data->buf[off + RT11_DI_LENGTH]) == 0 ? startblk :
                 startblk + le16toh(data->buf[off + RT11_DI_LENGTH]) - 1);
      }
      startblk += le16toh(data->buf[off + RT11_DI_LENGTH]);

      off += entrysz;
    }

    dsseg = le16toh(data->buf[RT11_DH_NEXT]);
  } while (dsseg != 0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x8(%rdi), %rsi
leaq 0x6c86(%rip), %rdi      # 0x12b7b
movl %ebp, %edx
xorl %eax, %eax
callq 0x3160
movw $0x1, %r14w
movzbl %bpl, %eax
movl %eax, 0x10(%rsp)
movzwl %r14w, %ebp
movq %rbx, %rdi
movl 0x10(%rsp), %esi
movl %ebp, %edx
callq 0xa037
testl %eax, %eax
je 0xc09d
movl %eax, 0x14(%rsp)
leaq 0x6429(%rip), %rdi      # 0x12359
movl %ebp, %esi
xorl %eax, %eax
callq 0x3160
leaq 0x64ab(%rip), %rdi      # 0x123eb
callq 0x30e0
movzwl 0x478(%rbx), %edx
movzwl 0x47c(%rbx), %eax
btl $0xb, %eax
setae %cl
movl %edx, %esi
cmpl $0x3ea, %edx            # imm = 0x3EA
setb %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0xc091
shrl %esi
movl $0x1f9, %ecx            # imm = 0x1F9
subl %esi, %ecx
movl %ecx, 0x18(%rsp)
addl $0x7, %esi
movl %esi, 0x1c(%rsp)
movzwl 0x47a(%rbx), %r13d
movl $0x5, %r15d
movzwl %ax, %ebp
movl %r15d, %r14d
movzwl %r13w, %r12d
testl $0x300, %ebp            # imm = 0x300
je 0xbfce
movzwl 0x47a(%rbx,%r14,2), %esi
testl %esi, %esi
leal -0x1(%r12,%rsi), %ecx
cmovel %r12d, %ecx
leaq 0x63da(%rip), %rdi      # 0x12399
movl %r12d, %edx
xorl %eax, %eax
callq 0x3160
jmp 0xc065
movzwl 0x474(%rbx,%r14,2), %edi
leaq 0x20(%rsp), %rsi
callq 0x65fc
movzwl 0x476(%rbx,%r14,2), %edi
leaq 0x23(%rsp), %rsi
callq 0x65fc
movb $0x2e, 0x26(%rsp)
movzwl 0x478(%rbx,%r14,2), %edi
leaq 0x27(%rsp), %rsi
callq 0x65fc
movw $0x2020, 0x2a(%rsp)     # imm = 0x2020
movzwl 0x47e(%rbx,%r14,2), %edi
leaq 0x2c(%rsp), %rsi
callq 0xa18a
testb $0x10, %bpl
leaq 0x6364(%rip), %rcx      # 0x12395
leaq 0x631d(%rip), %rax      # 0x12355
cmoveq %rax, %rcx
movzwl 0x47a(%rbx,%r14,2), %r8d
leal -0x1(%r12,%r8), %eax
movl %eax, (%rsp)
leaq 0x631f(%rip), %rdi      # 0x12373
leaq 0x20(%rsp), %rsi
movl %ebp, %edx
movl %r12d, %r9d
xorl %eax, %eax
callq 0x3160
addl 0x1c(%rsp), %r15d
movzwl %r15w, %r15d
movzwl 0x472(%rbx,%r15,2), %eax
btl $0xb, %eax
jb 0xc091
addw 0x47a(%rbx,%r14,2), %r13w
cmpl 0x18(%rsp), %r15d
jle 0xbf92
movzwl 0x474(%rbx), %r14d
movl 0x14(%rsp), %eax
testl %eax, %eax
je 0xc0ab
testw %r14w, %r14w
jne 0xbf0b
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop