// File: /workspace/github_c_makefile_star2_O0/simh[P]simtools/converters/fsio/dos11.c
// Function: dos11Info
static void dos11Info(
  struct mountedFS *mount,
  uint8_t UNUSED(unit),
  uint8_t UNUSED(present)
)
{
  struct DOS11data *data = &mount->dos11data;
  struct tm tm;
  char datetime[32], temp[32];
  time_t now = time(NULL);
  unsigned int mfd2blk, mfdblk, ufdblk, mapblk, i, j;
  uint16_t buf[512];

  localtime_r(&now, &tm);
  strftime(datetime, sizeof(datetime), "%d-%b-%C at %I:%M:%S", &tm);

  printf("* * * * * * Listing of MFD for %s * * * * * * on %s\n",
         mount->name, datetime);
  printf("      UIC  First UFD Block  UFD Entry Size\n\n");

  if (dos11ReadBlock(mount, MFD1_BLOCK, NULL) == 0)
    return;

  /*
   * Get some useful block addresses
   */
  mfd2blk = le16toh(data->buf[MFD1_MFD2BLOCK]);
  mapblk = le16toh(data->buf[MFD1_BMSTART]);

  /*
   * Display the MFD entries
   */
  mfdblk = mfd2blk;
  do {
    if (dos11ReadBlock(mount, mfdblk, NULL) == 0)
      return;

    for (i = MFD2_HEADER; i < EODIR(mount, MFD2_SIZE); i += MFD2_SIZE)
      if (le16toh(data->buf[i + MFD2_UFDUIC]) != 0) {
        printf("[%3o,%3o]            %5o          %5d.\n",
               (le16toh(data->buf[i + MFD2_UFDUIC]) >> 8) & 0377,
               le16toh(data->buf[i + MFD2_UFDUIC]) & 0377,
               le16toh(data->buf[i + MFD2_UFDSTART]),
               le16toh(data->buf[i + MFD2_UFDSIZE]));
      }
    mfdblk = le16toh(data->buf[MFD2_LINK]);
  } while (mfdblk != 0);

  printf("\n");

  /*
   * Display the individual UFD entries
   */
  mfdblk = mfd2blk;
  do {
    if (dos11ReadBlock(mount, mfdblk, NULL) == 0)
      return;

    for (i = MFD2_HEADER; i < EODIR(mount, MFD2_SIZE); i += MFD2_SIZE)
      if (le16toh(data->buf[i + MFD2_UFDUIC]) != 0) {
        unsigned int entrysz = le16toh(data->buf[i + MFD2_UFDSIZE]);

        printf("* * * Listing of [%3o,%3o] User Directory * * *\n\n",
               (le16toh(data->buf[i + MFD2_UFDUIC]) >> 8) & 0377,
               le16toh(data->buf[i + MFD2_UFDUIC]) & 0377);
        printf("  File Ext         Date  Type  Usage  Lock   Start  Length      End  Prot    EBP\n\n");

        if ((ufdblk = le16toh(data->buf[i + MFD2_UFDSTART])) != 0) {
          do {
            if (dos11ReadBlock(mount, ufdblk, buf) == 0)
              return;

            for (j = UFD_HEADER; j < EODIR(mount, entrysz); j += entrysz) {
              /*
               * Skip over deleted files
               */
              if ((le16toh(buf[j + UFD_FILENAME]) == 0) &&
                  (le16toh(buf[j + UFD_FILENAME + 1]) == 0) &&
                  (le16toh(buf[j + UFD_EXTENSION]) == 0))
                continue;

              r50Asc(le16toh(buf[j + UFD_FILENAME]), &temp[0]);
              r50Asc(le16toh(buf[j + UFD_FILENAME + 1]), &temp[3]);
              temp[6] = '.';
              r50Asc(le16toh(buf[j + UFD_EXTENSION]), &temp[7]);
              temp[10] = ' ';
              temp[11] = ' ';
              dos11Date(le16toh(buf[j + UFD_CREATION]) & UFD_DATE, &temp[12]);
              temp[25] = '\0';

              printf("%s     %c    %3o     %c  %6o  %5u.   %6o   %3o %6o\n",
                     temp,
                     (le16toh(buf[j + UFD_CREATION]) & UFD_TYPE) ? 'C' : 'L',
                     (le16toh(buf[j + UFD_LUP]) & UFD_USAGE) >> 8,
                     (le16toh(buf[j + UFD_LUP]) & UFD_LOCK) ? '1' : '0',
                     le16toh(buf[j + UFD_FILESTART]),
                     le16toh(buf[j + UFD_FILELENGTH]),
                     le16toh(buf[j + UFD_LASTBLOCKWRITTEN]),
                     le16toh(buf[j + UFD_LUP]) & UFD_PROT,
                     le16toh(buf[j + UFD_NEXTFREEBYTE]));
            }
            ufdblk = le16toh(buf[UFD_LINK]);
          } while (ufdblk != 0);
          printf("\n");
        }
      }
    mfdblk = le16toh(data->buf[MFD2_LINK]);
  } while (mfdblk != 0);

  /*
   * Display bitmap information
   */
  printf("* * * * * * Map Verification * * * * * *\n\n");
  do {
    if (dos11ReadBlock(mount, mapblk, buf) == 0)
      return;

    printf("* * * * * * Map Header Information * * * * * *\n");
    printf("Link = %6o\n", le16toh(buf[MAP_LINK]));
    printf("Map Number = %2u.\n", le16toh(buf[MAP_MAP]));
    printf("Words In Map = %3u.\n", le16toh(buf[MAP_WORDS]));
    printf("Link To First Map = %6o\n\n", le16toh(buf[MAP_FIRST]));

    for (i = 0; i < le16toh(buf[MAP_WORDS]); i++)
      printf(" %6o%c",
             le16toh(buf[MAP_BMSTART + i]),
             ((i + 1) % 8) == 0 ? '\n' : ' ');
    printf("\n\n");

    mapblk = le16toh(buf[MAP_LINK]);
  } while (mapblk != 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x518, %rsp            # imm = 0x518
movb %dl, %al
movb %sil, %cl
movq %rdi, -0x10(%rbp)
movb %cl, -0x11(%rbp)
movb %al, -0x12(%rbp)
movq -0x10(%rbp), %rax
addq $0x48, %rax
movq %rax, -0x20(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x31e0
movq %rax, -0xa8(%rbp)
leaq -0xa8(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x30a0
leaq -0x80(%rbp), %rdi
movl $0x20, %esi
leaq 0x10098(%rip), %rdx     # 0x19c9f
leaq -0x58(%rbp), %rcx
callq 0x3230
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
leaq -0x80(%rbp), %rdx
leaq 0x10091(%rip), %rdi     # 0x19cb4
movb $0x0, %al
callq 0x3160
leaq 0x100b8(%rip), %rdi     # 0x19ce9
movb $0x0, %al
callq 0x3160
movq -0x10(%rbp), %rdi
movl $0x1, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x7380
cmpl $0x0, %eax
jne 0x9c54
jmp 0xa44e
movq -0x20(%rbp), %rax
movzwl 0x50c(%rax), %edi
callq 0x6c50
movzwl %ax, %eax
movl %eax, -0xac(%rbp)
movq -0x20(%rbp), %rax
movzwl 0x510(%rax), %edi
callq 0x6c50
movzwl %ax, %eax
movl %eax, -0xb8(%rbp)
movl -0xac(%rbp), %eax
movl %eax, -0xb0(%rbp)
movq -0x10(%rbp), %rdi
movl -0xb0(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x7380
cmpl $0x0, %eax
jne 0x9caf
jmp 0xa44e
movl $0x1, -0xbc(%rbp)
movl -0xbc(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
shrq %rcx
subq $0x3, %rcx
cmpq %rcx, %rax
jae 0x9dd1
movq -0x20(%rbp), %rax
movl -0xbc(%rbp), %ecx
addl $0x0, %ecx
movl %ecx, %ecx
movzwl 0x50c(%rax,%rcx,2), %edi
callq 0x6c50
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x9dbb
movq -0x20(%rbp), %rax
movl -0xbc(%rbp), %ecx
addl $0x0, %ecx
movl %ecx, %ecx
movzwl 0x50c(%rax,%rcx,2), %edi
callq 0x6c50
movzwl %ax, %eax
sarl $0x8, %eax
andl $0xff, %eax
movl %eax, -0x4d0(%rbp)
movq -0x20(%rbp), %rax
movl -0xbc(%rbp), %ecx
addl $0x0, %ecx
movl %ecx, %ecx
movzwl 0x50c(%rax,%rcx,2), %edi
callq 0x6c50
movzwl %ax, %eax
andl $0xff, %eax
movl %eax, -0x4cc(%rbp)
movq -0x20(%rbp), %rax
movl -0xbc(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movzwl 0x50c(%rax,%rcx,2), %edi
callq 0x6c50
movzwl %ax, %eax
movl %eax, -0x4c8(%rbp)
movq -0x20(%rbp), %rax
movl -0xbc(%rbp), %ecx
addl $0x2, %ecx
movl %ecx, %ecx
movzwl 0x50c(%rax,%rcx,2), %edi
callq 0x6c50
movl -0x4d0(%rbp), %esi
movl -0x4cc(%rbp), %edx
movl -0x4c8(%rbp), %ecx
movzwl %ax, %r8d
leaq 0xff62(%rip), %rdi      # 0x19d16
movb $0x0, %al
callq 0x3160
jmp 0x9dbd
movl -0xbc(%rbp), %eax
addl $0x4, %eax
movl %eax, -0xbc(%rbp)
jmp 0x9cb9
movq -0x20(%rbp), %rax
movzwl 0x50c(%rax), %edi
callq 0x6c50
movzwl %ax, %eax
movl %eax, -0xb0(%rbp)
cmpl $0x0, -0xb0(%rbp)
jne 0x9c92
leaq 0x10ba1(%rip), %rdi     # 0x1a99f
movb $0x0, %al
callq 0x3160
movl -0xac(%rbp), %eax
movl %eax, -0xb0(%rbp)
movq -0x10(%rbp), %rdi
movl -0xb0(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x7380
cmpl $0x0, %eax
jne 0x9e2e
jmp 0xa44e
movl $0x1, -0xbc(%rbp)
movl -0xbc(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
shrq %rcx
subq $0x3, %rcx
cmpq %rcx, %rax
jae 0xa2c0
movq -0x20(%rbp), %rax
movl -0xbc(%rbp), %ecx
addl $0x0, %ecx
movl %ecx, %ecx
movzwl 0x50c(%rax,%rcx,2), %edi
callq 0x6c50
movzwl %ax, %eax
cmpl $0x0, %eax
je 0xa2aa
movq -0x20(%rbp), %rax
movl -0xbc(%rbp), %ecx
addl $0x2, %ecx
movl %ecx, %ecx
movzwl 0x50c(%rax,%rcx,2), %edi
callq 0x6c50
movzwl %ax, %eax
movl %eax, -0x4c4(%rbp)
movq -0x20(%rbp), %rax
movl -0xbc(%rbp), %ecx
addl $0x0, %ecx
movl %ecx, %ecx
movzwl 0x50c(%rax,%rcx,2), %edi
callq 0x6c50
movzwl %ax, %eax
sarl $0x8, %eax
andl $0xff, %eax
movl %eax, -0x4d4(%rbp)
movq -0x20(%rbp), %rax
movl -0xbc(%rbp), %ecx
addl $0x0, %ecx
movl %ecx, %ecx
movzwl 0x50c(%rax,%rcx,2), %edi
callq 0x6c50
movl -0x4d4(%rbp), %esi
movzwl %ax, %edx
andl $0xff, %edx
leaq 0xfe3c(%rip), %rdi      # 0x19d3e
movb $0x0, %al
callq 0x3160
leaq 0xfe60(%rip), %rdi      # 0x19d70
movb $0x0, %al
callq 0x3160
movq -0x20(%rbp), %rax
movl -0xbc(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movzwl 0x50c(%rax,%rcx,2), %edi
callq 0x6c50
movzwl %ax, %eax
movl %eax, -0xb4(%rbp)
cmpl $0x0, %eax
je 0xa2a8
jmp 0x9f47
movq -0x10(%rbp), %rdi
movl -0xb4(%rbp), %esi
leaq -0x4c0(%rbp), %rdx
callq 0x7380
cmpl $0x0, %eax
jne 0x9f67
jmp 0xa44e
movl $0x1, -0xc0(%rbp)
movl -0xc0(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
shrq %rcx
movl -0x4c4(%rbp), %edx
subl $0x1, %edx
movl %edx, %edx
subq %rdx, %rcx
cmpq %rcx, %rax
jae 0xa278
movl -0xc0(%rbp), %eax
addl $0x0, %eax
movl %eax, %eax
movzwl -0x4c0(%rbp,%rax,2), %edi
callq 0x6c50
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0xa001
movl -0xc0(%rbp), %eax
addl $0x0, %eax
addl $0x1, %eax
movl %eax, %eax
movzwl -0x4c0(%rbp,%rax,2), %edi
callq 0x6c50
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0xa001
movl -0xc0(%rbp), %eax
addl $0x2, %eax
movl %eax, %eax
movzwl -0x4c0(%rbp,%rax,2), %edi
callq 0x6c50
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0xa001
jmp 0xa261
movl -0xc0(%rbp), %eax
addl $0x0, %eax
movl %eax, %eax
movzwl -0x4c0(%rbp,%rax,2), %edi
callq 0x6c50
leaq -0xa0(%rbp), %rsi
movzwl %ax, %edi
callq 0x5bf0
movl -0xc0(%rbp), %eax
addl $0x0, %eax
addl $0x1, %eax
movl %eax, %eax
movzwl -0x4c0(%rbp,%rax,2), %edi
callq 0x6c50
leaq -0xa0(%rbp), %rsi
addq $0x3, %rsi
movzwl %ax, %edi
callq 0x5bf0
movb $0x2e, -0x9a(%rbp)
movl -0xc0(%rbp), %eax
addl $0x2, %eax
movl %eax, %eax
movzwl -0x4c0(%rbp,%rax,2), %edi
callq 0x6c50
leaq -0xa0(%rbp), %rsi
addq $0x7, %rsi
movzwl %ax, %edi
callq 0x5bf0
movb $0x20, -0x96(%rbp)
movb $0x20, -0x95(%rbp)
movl -0xc0(%rbp), %eax
addl $0x3, %eax
movl %eax, %eax
movzwl -0x4c0(%rbp,%rax,2), %edi
callq 0x6c50
movzwl %ax, %eax
andl $0x7fff, %eax           # imm = 0x7FFF
leaq -0xa0(%rbp), %rsi
addq $0xc, %rsi
movzwl %ax, %edi
callq 0x5e90
movb $0x0, -0x87(%rbp)
leaq -0xa0(%rbp), %rax
movq %rax, -0x4f8(%rbp)
movl -0xc0(%rbp), %eax
addl $0x3, %eax
movl %eax, %eax
movzwl -0x4c0(%rbp,%rax,2), %edi
callq 0x6c50
movzwl %ax, %edx
andl $0x8000, %edx           # imm = 0x8000
movl $0x4c, %eax
movl $0x43, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x4ec(%rbp)
movl -0xc0(%rbp), %eax
addl $0x8, %eax
movl %eax, %eax
movzwl -0x4c0(%rbp,%rax,2), %edi
callq 0x6c50
movzwl %ax, %eax
andl $0x7f00, %eax           # imm = 0x7F00
sarl $0x8, %eax
movl %eax, -0x4e8(%rbp)
movl -0xc0(%rbp), %eax
addl $0x8, %eax
movl %eax, %eax
movzwl -0x4c0(%rbp,%rax,2), %edi
callq 0x6c50
movzwl %ax, %edx
andl $0x8000, %edx           # imm = 0x8000
movl $0x30, %eax
movl $0x31, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x4e4(%rbp)
movl -0xc0(%rbp), %eax
addl $0x5, %eax
movl %eax, %eax
movzwl -0x4c0(%rbp,%rax,2), %edi
callq 0x6c50
movzwl %ax, %eax
movl %eax, -0x4e0(%rbp)
movl -0xc0(%rbp), %eax
addl $0x6, %eax
movl %eax, %eax
movzwl -0x4c0(%rbp,%rax,2), %edi
callq 0x6c50
movzwl %ax, %ebx
movl -0xc0(%rbp), %eax
addl $0x7, %eax
movl %eax, %eax
movzwl -0x4c0(%rbp,%rax,2), %edi
callq 0x6c50
movzwl %ax, %eax
movl %eax, -0x4dc(%rbp)
movl -0xc0(%rbp), %eax
addl $0x8, %eax
movl %eax, %eax
movzwl -0x4c0(%rbp,%rax,2), %edi
callq 0x6c50
movzwl %ax, %eax
andl $0xff, %eax
movl %eax, -0x4d8(%rbp)
movl -0xc0(%rbp), %eax
addl $0x4, %eax
movl %eax, %eax
movzwl -0x4c0(%rbp,%rax,2), %edi
callq 0x6c50
movq -0x4f8(%rbp), %rsi
movl -0x4ec(%rbp), %edx
movl -0x4e8(%rbp), %ecx
movl -0x4e4(%rbp), %r8d
movl -0x4e0(%rbp), %r9d
movl -0x4dc(%rbp), %r11d
movl -0x4d8(%rbp), %r10d
movzwl %ax, %eax
leaq 0xfb7a(%rip), %rdi      # 0x19dc3
movl %ebx, (%rsp)
movl %r11d, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movl %eax, 0x18(%rsp)
movb $0x0, %al
callq 0x3160
movl -0x4c4(%rbp), %eax
addl -0xc0(%rbp), %eax
movl %eax, -0xc0(%rbp)
jmp 0x9f71
movzwl -0x4c0(%rbp), %edi
callq 0x6c50
movzwl %ax, %eax
movl %eax, -0xb4(%rbp)
cmpl $0x0, -0xb4(%rbp)
jne 0x9f47
leaq 0x106fe(%rip), %rdi     # 0x1a99f
movb $0x0, %al
callq 0x3160
jmp 0xa2aa
jmp 0xa2ac
movl -0xbc(%rbp), %eax
addl $0x4, %eax
movl %eax, -0xbc(%rbp)
jmp 0x9e38
movq -0x20(%rbp), %rax
movzwl 0x50c(%rax), %edi
callq 0x6c50
movzwl %ax, %eax
movl %eax, -0xb0(%rbp)
cmpl $0x0, -0xb0(%rbp)
jne 0x9e11
leaq 0xfb0a(%rip), %rdi      # 0x19df7
movb $0x0, %al
callq 0x3160
movq -0x10(%rbp), %rdi
movl -0xb8(%rbp), %esi
leaq -0x4c0(%rbp), %rdx
callq 0x7380
cmpl $0x0, %eax
jne 0xa314
jmp 0xa44e
leaq 0xfb07(%rip), %rdi      # 0x19e22
movb $0x0, %al
callq 0x3160
movzwl -0x4c0(%rbp), %edi
callq 0x6c50
movzwl %ax, %esi
leaq 0xfb1a(%rip), %rdi      # 0x19e52
movb $0x0, %al
callq 0x3160
movzwl -0x4be(%rbp), %edi
callq 0x6c50
movzwl %ax, %esi
leaq 0xfb09(%rip), %rdi      # 0x19e5e
movb $0x0, %al
callq 0x3160
movzwl -0x4bc(%rbp), %edi
callq 0x6c50
movzwl %ax, %esi
leaq 0xfaff(%rip), %rdi      # 0x19e71
movb $0x0, %al
callq 0x3160
movzwl -0x4ba(%rbp), %edi
callq 0x6c50
movzwl %ax, %esi
leaq 0xfaf7(%rip), %rdi      # 0x19e86
movb $0x0, %al
callq 0x3160
movl $0x0, -0xbc(%rbp)
movl -0xbc(%rbp), %eax
movl %eax, -0x4fc(%rbp)
movzwl -0x4bc(%rbp), %edi
callq 0x6c50
movw %ax, %cx
movl -0x4fc(%rbp), %eax
movzwl %cx, %ecx
cmpl %ecx, %eax
jae 0xa41e
movl -0xbc(%rbp), %eax
addl $0x4, %eax
movl %eax, %eax
movzwl -0x4c0(%rbp,%rax,2), %edi
callq 0x6c50
movzwl %ax, %esi
movl -0xbc(%rbp), %ecx
addl $0x1, %ecx
andl $0x7, %ecx
movl $0x20, %edx
movl $0xa, %eax
cmpl $0x0, %ecx
cmovel %eax, %edx
leaq 0xfa9a(%rip), %rdi      # 0x19ea0
movb $0x0, %al
callq 0x3160
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0xa3a0
leaq 0x10579(%rip), %rdi     # 0x1a99e
movb $0x0, %al
callq 0x3160
movzwl -0x4c0(%rbp), %edi
callq 0x6c50
movzwl %ax, %eax
movl %eax, -0xb8(%rbp)
cmpl $0x0, -0xb8(%rbp)
jne 0xa2f4
addq $0x518, %rsp            # imm = 0x518
popq %rbx
popq %rbp
retq
nopl (%rax,%rax)