LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/dos11.c
// Function: dos11CloseFile
static void dos11CloseFile(
  void *filep
)
{
  struct dos11OpenFile *file = filep;
  struct mountedFS *mount = file->mount;

  if (file->mode == M_WR) {
    uint16_t start = (le16toh(file->creation) & UFD_TYPE) == 0 ? 2 : 0;

    /*
     * Flush any partial buffer, pending bitmap updates and update the
     * directory entry.
     */
    if (((le16toh(file->creation) & UFD_TYPE) == 0) ||
        (file->current == le16toh(file->last)))
      file->nfb = htole16(file->nab);
    else file->nfb = htole16(mount->blocksz);

    if (file->nab != start)
      dos11WriteBlock(mount, file->current, file->buffer);
    bitmapFlush(mount);
    dos11UpdateFile(mount, file);
  }

  if (file != NULL) {
    if (file->buffer != NULL)
      free(file->buffer);
    free(file);
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x1, 0x18(%rdi)
jne 0x93eb
movq 0x20(%rbx), %r14
movzwl 0x6(%rbx), %ecx
xorl %eax, %eax
testw %cx, %cx
setns %al
addl %eax, %eax
testw %cx, %cx
jns 0x93b9
movzwl 0x30(%rbx), %ecx
cmpw 0xe(%rbx), %cx
jne 0x9408
movzwl 0x32(%rbx), %ecx
movw %cx, 0x8(%rbx)
movzwl %cx, %ecx
cmpl %ecx, %eax
je 0x93d8
movzwl 0x30(%rbx), %esi
movq 0x28(%rbx), %rdx
movq %r14, %rdi
callq 0x7700
movq %r14, %rdi
callq 0x7bbf
movq %r14, %rdi
movq %rbx, %rsi
callq 0x79a2
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x93f9
callq 0x3050
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3050
movzwl 0x28(%r14), %ecx
movw %cx, 0x8(%rbx)
movzwl 0x32(%rbx), %ecx
jmp 0x93c1
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/dos11.c
// Function: dos11ReadFile
static size_t dos11ReadFile(
  void *filep,
  void *buf,
  size_t buflen
)
{
  struct dos11OpenFile *file = filep;
  char *bufr = buf;

  if (SWISSET('a')) {
    char ch;
    size_t count = 0;

    /*
     * Read a full or partial line from the open file.
     */
    while ((buflen != 0) && (dos11ReadBytes(file, &ch, 1) == 1)) {
      ch &= 0177;
      bufr[count++] = ch;
      buflen--;
      if (ch == '\n')
        break;
    }
    return count;
  }

  return dos11ReadBytes(file, bufr, buflen);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0xfba4(%rip), %rax      # 0x18fd8
testb $0x1, (%rax)
jne 0x944a
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x7f3e
cltq
jmp 0x9498
testq %rbx, %rbx
je 0x9491
decq %rbx
xorl %r13d, %r13d
leaq 0xf(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x7f3e
cmpl $0x1, %eax
jne 0x9495
movb 0xf(%rsp), %cl
andb $0x7f, %cl
movb %cl, 0xf(%rsp)
leaq 0x1(%r13), %rax
movb %cl, (%r14,%r13)
cmpb $0xa, %cl
je 0x9498
cmpq %r13, %rbx
movq %rax, %r13
jne 0x945a
jmp 0x9498
xorl %eax, %eax
jmp 0x9498
movq %r13, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/dos11.c
// Function: dos11DeleteFile
static void dos11DeleteFile(
  void *filep,
  char *UNUSED(fname)
)
{
  struct dos11OpenFile *file = filep;
  struct mountedFS *mount = file->mount;
  struct DOS11data *data = &mount->dos11data;
  uint16_t i, block;

  file->name[0] = 0;
  file->name[1] = 0;
  file->ext = 0;

  dos11UpdateFile(mount, file);

  /*
   * The file has been removed from its UFD, release all disk blocks
   * allocated to the file.
   */
  block = le16toh(file->start);

  if ((le16toh(file->creation) & UFD_TYPE) != 0) {
    /*
     * Contiguous file
     */
    for (i = 0; i < le16toh(file->length); i++)
      if (bitmapReleaseBlock(mount, block + i) == 0)
        return;
  } else {
    /*
     * Linked file
     */
    while (block != 0) {
      if (dos11ReadBlock(mount, block, NULL) == 0)
        return;
      if (bitmapReleaseBlock(mount, block) == 0)
        return;

      block = le16toh(data->buf[FILE_LINK]);
    }
  }
  /*
   * Make sure the bitmaps on disk are up to date.
   */
  bitmapFlush(mount);

  dos11CloseFile(file);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x20(%rdi), %r14
movl $0x0, (%rdi)
movw $0x0, 0x4(%rdi)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x79a2
movzwl 0xa(%rbx), %r15d
cmpw $0x0, 0x6(%rbx)
js 0x950a
testw %r15w, %r15w
je 0x9531
movzwl %r15w, %ebp
movq %r14, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x7621
testl %eax, %eax
je 0x9549
movq %r14, %rdi
movl %ebp, %esi
callq 0x967f
testl %eax, %eax
je 0x9549
movzwl 0x554(%r14), %r15d
jmp 0x94d8
cmpw $0x0, 0xc(%rbx)
je 0x9531
xorl %r12d, %r12d
leal (%r15,%r12), %eax
movzwl %ax, %esi
movq %r14, %rdi
callq 0x967f
testl %eax, %eax
je 0x9549
incl %r12d
cmpw 0xc(%rbx), %r12w
jb 0x9514
movq %r14, %rdi
callq 0x7bbf
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x938b
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/dos11.c
// Function: bitmapLoad
static int bitmapLoad(
  struct mountedFS *mount,
  uint16_t map
)
{
  struct DOS11data *data = &mount->dos11data;

  if (map >= data->bitmaps) {
    ERROR("Invalid bitmap # (%d), max is %d\n", map, data->bitmaps);
    return 0;
  }

  /*
   * If the map is already loaded, nothing to do.
   */
  if (map != data->bmindex) {
    if (data->bmdirty != 0) {
      if (dos11WriteBlock(mount, data->bmblk[data->bmindex], data->bmbuf) == 0)
        return 0;
      data->bmdirty = 0;
    }

    data->bmindex = map;
    if (dos11ReadBlock(mount, data->bmblk[map], data->bmbuf) == 0)
      return 0;
  }

  return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movzwl 0x4c(%rdi), %ecx
cmpw %bx, %cx
jbe 0x95d0
movzwl 0x14e(%r14), %eax
cmpw %bx, %ax
je 0x95c0
cmpb $0x0, 0x152(%r14)
je 0x959c
movzwl 0x4e(%r14,%rax,2), %esi
leaq 0x154(%r14), %rdx
movq %r14, %rdi
callq 0x7700
testl %eax, %eax
je 0x95c7
movb $0x0, 0x152(%r14)
movw %bx, 0x14e(%r14)
movzwl %bx, %eax
movzwl 0x4e(%r14,%rax,2), %esi
leaq 0x154(%r14), %rdx
movq %r14, %rdi
callq 0x7621
testl %eax, %eax
je 0x95c7
movl $0x1, %ebp
jmp 0x95c9
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
movq 0xea19(%rip), %rax      # 0x17ff0
movq (%rax), %rdi
leaq 0x84c3(%rip), %rsi      # 0x11aa4
xorl %ebp, %ebp
movl %ebx, %edx
xorl %eax, %eax
callq 0x31e0
leaq 0xf9d5(%rip), %rax      # 0x18fc8
movq (%rax), %rdi
testq %rdi, %rdi
je 0x95c9
movq 0xe9b6(%rip), %rax      # 0x17fb8
cmpq (%rax), %rdi
je 0x95c9
movzwl 0x4c(%r14), %ecx
leaq 0x8491(%rip), %rsi      # 0x11aa4
xorl %ebp, %ebp
movl %ebx, %edx
xorl %eax, %eax
callq 0x31e0
jmp 0x95c9
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/dos11.c
// Function: bitmapSetBit
static int bitmapSetBit(
  struct mountedFS *mount,
  uint16_t block
)
{
  struct DOS11data *data = &mount->dos11data;
  uint16_t map = block / MAP_BLOCKS;
  uint16_t offset = block % MAP_BLOCKS;
  uint16_t wrd = offset / 16;
  uint16_t bit = offset % 16;

  if (bitmapLoad(mount, map) == 0)
    return 0;

  data->bmbuf[MAP_BMSTART + wrd] =
    htole16(le16toh(data->bmbuf[MAP_BMSTART + wrd]) | bits[bit]);
  data->bmdirty = 1;
  return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
imull $0x8889, %esi, %r14d    # imm = 0x8889
shrl $0x19, %r14d
movl %r14d, %esi
callq 0x9552
testl %eax, %eax
je 0x9678
imull $0x3c0, %r14d, %eax     # imm = 0x3C0
subl %eax, %ebp
movl %ebp, %eax
andl $0xf, %eax
movzwl %bp, %ecx
shrl $0x4, %ecx
addl $0x4, %ecx
leaq 0xee62(%rip), %rdx      # 0x184c0
movzwl (%rdx,%rax,2), %eax
orw %ax, 0x154(%rbx,%rcx,2)
movb $0x1, 0x152(%rbx)
movl $0x1, %eax
jmp 0x967a
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/rt11.c
// Function: rt11MatchRegex
int rt11MatchRegex(
  regex_t *preg,
  uint16_t fname1,
  uint16_t fname2,
  uint16_t ftype
)
{
  char temp[16];
  int i = 5;

  /*
   * Build a filename + type string with no embedded spaces.
   */
  r50Asc(fname1, &temp[0]);
  r50Asc(fname2, &temp[3]);

  while ((i >= 0) && (temp[i] == ' '))
    i--;

  temp[++i] = '.';

  r50Asc(ftype, &temp[++i]);

  i += 2;
  while (temp[i] == ' ')
    i--;

  temp[i + 1] = '\0';

  if (regexec(preg, &temp[0], 0, NULL, 0) == 0)
    return 1;

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebp
movl %edx, %r15d
movq %rdi, %rbx
movq %rsp, %r14
movl %esi, %edi
movq %r14, %rsi
callq 0x658c
leaq 0x3(%rsp), %rsi
movl %r15d, %edi
callq 0x658c
movl $0x5, %eax
movl %eax, %ecx
cmpb $0x20, (%rsp,%rcx)
jne 0x990b
addl $-0x1, %eax
jb 0x98f9
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movslq %eax, %r15
leaq (%r15,%r14), %rsi
addq $0x2, %rsi
movb $0x2e, -0x1(%rsi)
movzwl %bp, %edi
callq 0x658c
leaq (%r15,%r14), %rcx
addq $0x4, %rcx
shlq $0x20, %r15
movabsq $0x600000000, %rax      # imm = 0x600000000
addq %r15, %rax
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
addq %rdx, %rax
cmpb $0x20, (%rcx)
leaq -0x1(%rcx), %rcx
je 0x9945
sarq $0x20, %rax
movb $0x0, (%rsp,%rax)
movq %rsp, %rsi
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x3240
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
movl %ecx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/rt11.c
// Function: rt11MakeDirectoryEntry
int rt11MakeDirectoryEntry(
  struct mountedFS *mount,
  uint16_t entrysz,
  uint16_t offset
)
{
  struct RT11data *data = &mount->rt11data;
  uint16_t off = offset;

  /*
   * Scan forward looking for the end-of-segment marker.
   */
  while (!RT11EOS(le16toh(data->buf[off + RT11_DI_STATUS])) &&
         ((RT11_DS_SIZE - off) >= entrysz))
    off += entrysz;
  
  if ((RT11_DS_SIZE - off) > entrysz) {
    /*
     * There is enough space available for a new directory entry. Slide
     * the existing entries up to make a new one available at the
     * requested position.
     */
    data->buf[off + entrysz + RT11_DI_STATUS] = htole16(RT11_E_EOS);

    while (off != offset) {
      uint16_t i, prev = off - entrysz;

      for (i = RT11_DI_STATUS; i < entrysz; i++)
        data->buf[off + i] = data->buf[prev + i];

      off -= entrysz;
    }
    return 1;
  }
  return 0;
}

// Assembly:
movl %edx, %ecx
subl %esi, %ecx
xorl %r8d, %r8d
movl %edx, %eax
movzwl %ax, %r9d
movl $0x200, %r10d           # imm = 0x200
subl %r9d, %r10d
subl %esi, %r8d
testb $0x8, 0x473(%rdi,%r9,2)
jne 0x9dfd
addl %esi, %eax
cmpl %esi, %r10d
jge 0x9ddb
xorl %eax, %eax
cmpl %esi, %r10d
jle 0x9e72
leal (%rsi,%r8), %r10d
addl %esi, %r9d
movw $0x800, 0x472(%rdi,%r9,2) # imm = 0x800
movl $0x1, %eax
testw %r10w, %r10w
je 0x9e72
pushq %rbp
pushq %rbx
movl %edx, %r9d
subl %esi, %r9d
subl %esi, %r9d
subl %r8d, %r9d
subl %r8d, %ecx
movzwl %si, %r8d
addq $0x472, %rdi            # imm = 0x472
testw %si, %si
je 0x9e66
movzwl %r9w, %r10d
leaq (%rdi,%r10,2), %r10
movzwl %cx, %r11d
leaq (%rdi,%r11,2), %r11
xorl %ebx, %ebx
movzwl (%r10,%rbx,2), %ebp
movw %bp, (%r11,%rbx,2)
incq %rbx
cmpq %rbx, %r8
jne 0x9e54
subl %esi, %ecx
subl %esi, %r9d
cmpw %dx, %cx
jne 0x9e3d
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/rt11.c
// Function: rt11Date
char *rt11Date(
  uint16_t value,
  char *buf
)
{
  sprintf(buf, "%02d-%s-%4d",
          (value & RT11_DW_DAY) >> 5,
          month[((value & RT11_DW_MONTH) >> 10) - 1],
          1972 + (value & RT11_DW_YEAR) + ((value & RT11_DW_AGE) >> 14) * 32);

  return buf;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
movl %edi, %edx
shrl $0x5, %edx
andl $0x1f, %edx
movl %edi, %eax
shrl $0x7, %eax
andl $0x78, %eax
leaq 0xe7c2(%rip), %rcx      # 0x18650
movq -0x8(%rax,%rcx), %rcx
movl %edi, %eax
andl $0x1f, %eax
shrl $0x9, %edi
andl $-0x20, %edi
leal (%rax,%rdi), %r8d
addl $0x7b4, %r8d            # imm = 0x7B4
leaq 0x81b7(%rip), %rsi      # 0x12067
movq %rbx, %rdi
xorl %eax, %eax
callq 0x32b0
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/rt11.c
// Function: rt11DisplayDir
void rt11DisplayDir(
  uint16_t *dir,
  int full
)
{
  char temp[64], creation[16];

  r50Asc(le16toh(dir[RT11_DI_FNAME1]), &temp[0]);
  r50Asc(le16toh(dir[RT11_DI_FNAME2]), &temp[3]);
  temp[6] = '.';
  r50Asc(le16toh(dir[RT11_DI_FTYPE]), &temp[7]);

  if (full)
    sprintf(&temp[10], "  %5u  %s",
            le16toh(dir[RT11_DI_LENGTH]),
            rt11Date(le16toh(dir[RT11_DI_CREATE]), creation));
  else temp[10] ='\0';
  puts(temp);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x50, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movzwl 0x2(%rdi), %edi
movq %rsp, %rsi
callq 0x658c
movzwl 0x4(%rbx), %edi
leaq 0x3(%rsp), %r14
movq %r14, %rsi
callq 0x658c
movb $0x2e, 0x3(%r14)
movzwl 0x6(%rbx), %edi
leaq 0x7(%rsp), %rsi
callq 0x658c
testl %ebp, %ebp
je 0x9f32
leaq 0xa(%rsp), %r14
movzwl 0x8(%rbx), %ebp
movzwl 0xc(%rbx), %edi
leaq 0x40(%rsp), %rbx
movq %rbx, %rsi
callq 0x9e73
leaq 0x8152(%rip), %rsi      # 0x12073
movq %r14, %rdi
movl %ebp, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x32b0
jmp 0x9f37
movb $0x0, 0xa(%rsp)
movq %rsp, %rdi
callq 0x30e0
addq $0x50, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/rt11.c
// Function: rt11UpdateFile
void rt11UpdateFile(
  struct mountedFS *mount,
  uint8_t unit,
  struct rt11OpenFile *file
)
{
  struct RT11data *data = &mount->rt11data;
  uint16_t offset, length, left, entrysz;

  if (rt11ReadDirSegment(mount, unit, file->segment) == 0)
    return;

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

  length = file->current - file->start + 1;
  left = file->length - length;

  /*
   * Fix up the directory entry and the following empty entry
   */
  data->buf[offset + RT11_DI_STATUS] = htole16(RT11_E_PERM);
  data->buf[offset + RT11_DI_LENGTH] = htole16(length);

  data->buf[offset + entrysz + RT11_DI_LENGTH] =
    htole16(le16toh(data->buf[offset + entrysz + RT11_DI_LENGTH]) + left);

  if (le16toh(data->buf[offset + entrysz + RT11_DI_LENGTH]) == 0) {
    /*
     * Remove the now empty directory entry
     */
    uint16_t dest = offset + entrysz;
    uint16_t src = dest + entrysz;

    for (;src < RT11_DS_SIZE;) {
      uint16_t i;

      data->buf[dest + RT11_DI_STATUS] = data->buf[src + RT11_DI_STATUS];

      if (RT11EOS(le16toh(data->buf[dest + RT11_DI_STATUS])) ||
          ((RT11_DS_SIZE - src) < entrysz))
        break;

      for (i = RT11_DI_FNAME1;i < entrysz; i++)
        data->buf[dest + i] = data->buf[src + i];

      dest += entrysz;
      src += entrysz;
    }

    /*
     * Make sure the last entry contains the end-of-segment marker.
     */
    data->buf[dest + RT11_DI_STATUS] = htole16(RT11_E_EOS);
  }

  rt11WriteDirSegment(mount, file->unit, file->segment);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
movzbl 0xc(%rdx), %edx
callq 0x9d20
testl %eax, %eax
je 0xa8ae
movzwl 0x478(%r14), %eax
movl %eax, %ecx
shrl %ecx
movzwl 0xe(%rbx), %edx
movzwl 0x30(%rbx), %esi
subw 0x36(%rbx), %si
incl %esi
movl 0x8(%rbx), %edi
subl %esi, %edi
movw $0x400, 0x472(%r14,%rdx,2) # imm = 0x400
movw %si, 0x47a(%r14,%rdx,2)
addl %ecx, %edx
addl $0x7, %edx
addw %di, 0x47a(%r14,%rdx,2)
jne 0xa897
addl $0x7, %ecx
movl %edx, %esi
addl %ecx, %esi
movzwl %si, %edi
cmpl $0x1ff, %edi            # imm = 0x1FF
ja 0xa889
leaq 0x474(%r14), %rdi
shrl %eax
addq $0x6, %rax
movzwl %dx, %r8d
addl %r8d, %r8d
movzwl %si, %r10d
leal (%r10,%r10), %r9d
movzwl 0x472(%r14,%r9), %r11d
movw %r11w, 0x472(%r14,%r8)
btl $0xb, %r11d
jb 0xa889
movl $0x200, %r11d           # imm = 0x200
subl %r10d, %r11d
cmpl %ecx, %r11d
jb 0xa889
addq %rdi, %r8
addq %rdi, %r9
xorl %r10d, %r10d
movzwl (%r9,%r10,2), %r11d
movw %r11w, (%r8,%r10,2)
incq %r10
cmpq %r10, %rax
jne 0xa866
addl %ecx, %edx
addl %ecx, %esi
movzwl %si, %r8d
cmpl $0x200, %r8d            # imm = 0x200
jb 0xa827
movzwl %dx, %eax
movw $0x800, 0x472(%r14,%rax,2) # imm = 0x800
movzbl 0x20(%rbx), %esi
movzbl 0xc(%rbx), %edx
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x9d79
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/rt11.c
// Function: rt11ReadBytes
int rt11ReadBytes(
  struct rt11OpenFile *file,
  char *buf,
  int len
)
{
  struct mountedFS *mount = file->mount;
  int count = 0;

  if (file->current == 0) {
    file->current = le16toh(file->start);

    if (rt11ReadBlock(mount, file->unit, file->current, file->buffer) == 0)
      return 0;

    file->count = 0;
    file->last = le16toh(file->start) + le16toh(file->length) - 1;
 }

  while (len) {
    if (file->count == RT11_BLOCKSIZE) {
      if (file->current == file->last)
        break;

      file->current++;

      if (rt11ReadBlock(mount, file->unit, file->current, file->buffer) == 0)
        return 0;

      file->count = 0;
    }
    *buf++ = file->buffer[file->count++];
    len--;
    count++;
  }
  return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x18(%rdi), %r15
cmpw $0x0, 0x30(%rdi)
jne 0xa90f
movzwl 0x36(%r14), %edx
movw %dx, 0x30(%r14)
movzbl 0x20(%r14), %esi
movq 0x28(%r14), %rcx
movq %r15, %rdi
callq 0x99c2
testl %eax, %eax
je 0xa977
movw $0x0, 0x34(%r14)
movzwl 0x36(%r14), %eax
addw 0x8(%r14), %ax
decl %eax
movw %ax, 0x32(%r14)
testl %ebp, %ebp
je 0xa977
movl %ebp, %r12d
xorl %r13d, %r13d
movzwl 0x34(%r14), %eax
cmpl $0x200, %eax            # imm = 0x200
jne 0xa954
movzwl 0x30(%r14), %eax
cmpw 0x32(%r14), %ax
je 0xa97b
incl %eax
movw %ax, 0x30(%r14)
movzbl 0x20(%r14), %esi
movzwl %ax, %edx
movq 0x28(%r14), %rcx
movq %r15, %rdi
callq 0x99c2
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
je 0xa97e
movq 0x28(%r14), %rcx
leal 0x1(%rax), %edx
movw %dx, 0x34(%r14)
movzwl %ax, %eax
movb (%rcx,%rax), %al
movb %al, (%rbx,%r13)
incq %r13
cmpl %r13d, %r12d
jne 0xa919
movl %r12d, %eax
jmp 0xa97e
xorl %eax, %eax
jmp 0xa97e
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/rt11.c
// Function: rt11WriteBytes
int rt11WriteBytes(
  struct rt11OpenFile *file,
  char *buf,
  int len
)
{
  int count = 0;

  if (file->current == 0) {
    memset(file->buffer, 0, RT11_BLOCKSIZE);

    file->current = le16toh(file->start);
    file->count = 0;
    file->last = le16toh(file->start) + le16toh(file->length) - 1;
  }

  while (len) {
    if (file->count == RT11_BLOCKSIZE) {
      if (file->current == file->last)
        break;

      if (rt11WriteBlock(file->mount, file->unit, file->current, file->buffer) == 0)
        return 0;

      memset(file->buffer, 0, RT11_BLOCKSIZE);

      file->current++;
      file->count = 0;
    }
    file->buffer[file->count++] = *buf++;
    len--;
    count++;
  }
  return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
cmpw $0x0, 0x30(%rdi)
jne 0xa9d4
movq 0x28(%r14), %rdi
movl $0x200, %edx            # imm = 0x200
xorl %esi, %esi
callq 0x3170
movzwl 0x36(%r14), %eax
movw %ax, 0x30(%r14)
movw $0x0, 0x34(%r14)
addw 0x8(%r14), %ax
decl %eax
movw %ax, 0x32(%r14)
testl %ebp, %ebp
je 0xaa4f
movl %ebp, %r15d
xorl %r12d, %r12d
movzwl 0x34(%r14), %r13d
cmpl $0x200, %r13d           # imm = 0x200
jne 0xaa2d
movzwl 0x30(%r14), %edx
cmpw 0x32(%r14), %dx
je 0xaa54
movzbl 0x20(%r14), %esi
movq 0x18(%r14), %rdi
movq 0x28(%r14), %rcx
callq 0x9b71
testl %eax, %eax
je 0xaa4f
movq 0x28(%r14), %rdi
xorl %r13d, %r13d
movl $0x200, %edx            # imm = 0x200
xorl %esi, %esi
callq 0x3170
incw 0x30(%r14)
movw $0x0, 0x34(%r14)
movb (%rbx,%r12), %al
movq 0x28(%r14), %rcx
leal 0x1(%r13), %edx
movw %dx, 0x34(%r14)
movzwl %r13w, %edx
movb %al, (%rcx,%rdx)
incq %r12
cmpl %r12d, %r15d
jne 0xa9de
jmp 0xaa57
xorl %r15d, %r15d
jmp 0xaa57
movl %r12d, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/rt11.c
// Function: rt11OpenFileW
void *rt11OpenFileW(
  struct mountedFS *mount,
  uint8_t unit,
  char *fname,
  off_t size
)
{
  struct rt11OpenFile *file;
  struct rt11FileSpec spec;
  uint16_t blocks = 0;

  if (size != 0)
    blocks = (size + (RT11_BLOCKSIZE - 1)) / RT11_BLOCKSIZE;

  if (rt11ParseFilespec(fname, &spec, RT11_M_NONE) == 0) {
    fprintf(stderr, "Failed to parse filename \"%s\"\n", fname);
    return NULL;
  }

  if ((file = malloc(sizeof(struct rt11OpenFile))) != NULL) {
    memset(file, 0, sizeof(struct rt11OpenFile));

    if (rt11LookupFile(mount, unit, &spec, file) == 0) {
      /*
       * Allocate local buffer space for the file.
       */
      if ((file->buffer = malloc(mount->blocksz)) != NULL) {
        if (rt11CreateFile(mount, unit, &spec, file, blocks) == 0) {
          ERROR("Failed to create file \"%s\"\n", fname);
          free(file->buffer);
          free(file);
          return NULL;
        } else file->mode = M_WR;
      } else {
        ERROR("Buffer allocation failure for \"%s\"\n", fname);
        free(file);
        return NULL;
      }
    } else {
      ERROR("File \"%s\" already exists\n", fname);
      free(file);
      return NULL;
    }
  } else ERROR("Memory allocation failure\n");
  return file;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r15
testq %rcx, %rcx
je 0xaa9d
addq $0x1ff, %rcx            # imm = 0x1FF
leal 0x1ff(%rcx), %r12d
testq %rcx, %rcx
cmovnsl %ecx, %r12d
shrl $0x9, %r12d
jmp 0xaaa0
xorl %r12d, %r12d
leaq 0x6(%rsp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x96e0
testl %eax, %eax
je 0xab2c
movl $0x1, %edi
movl $0x38, %esi
callq 0x31c0
testq %rax, %rax
je 0xab4c
movq %rax, %r14
movzbl %bpl, %ebp
leaq 0x6(%rsp), %rdx
movq %r15, %rdi
movl %ebp, %esi
movq %rax, %rcx
callq 0xa60f
testl %eax, %eax
jne 0xab5e
movq 0x28(%r15), %rdi
callq 0x3220
movq %rax, 0x28(%r14)
testq %rax, %rax
je 0xab6b
movzwl %r12w, %r8d
leaq 0x6(%rsp), %rdx
movq %r15, %rdi
movl %ebp, %esi
movq %r14, %rcx
callq 0x9f48
testl %eax, %eax
je 0xab78
movl $0x1, 0x10(%r14)
movq %r14, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0xd4bd(%rip), %rax      # 0x17ff0
movq (%rax), %rdi
leaq 0x729a(%rip), %rsi      # 0x11dd7
xorl %r14d, %r14d
movq %rbx, %rdx
xorl %eax, %eax
callq 0x31e0
jmp 0xab1c
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x4274
movq (%rbx), %r14
jmp 0xab1c
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4147
jmp 0xab8a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4213
jmp 0xab8a
movq %r14, %rsi
addq $0x28, %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x41a8
xorl %r14d, %r14d
jmp 0xab1c
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/rt11.c
// Function: rt11Size
static size_t rt11Size(void)
{
  size_t size = (RT11_MAXPARTSZ - 1) * RT11_BLOCKSIZE;

  if (SWISSET('t')) {
    int i = 0;
    char *type = SWGETVAL('t');

    while (rt11DiskSize[i].name != NULL) {
      if (strcmp(rt11DiskSize[i].name, type) == 0) {
        size = rt11DiskSize[i].size;
        break;
      }
      i++;
    }
    if (size == ((RT11_MAXPARTSZ - 1) * RT11_BLOCKSIZE))
      fprintf(stderr,
              "newfs: Invalid device type \"%s\", using default\n", type);
  }
  return size;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
leaq 0xde52(%rip), %rcx      # 0x18fd8
movl $0x1fffe00, %eax        # imm = 0x1FFFE00
testb $0x8, 0x2(%rcx)
je 0xb1f1
leaq 0xde48(%rip), %rax      # 0x18fe0
movq 0x98(%rax), %rbx
leaq 0x715f(%rip), %rdi      # 0x12305
movq %rbx, %rsi
callq 0x31d0
testl %eax, %eax
je 0xb1de
xorl %ecx, %ecx
leaq 0xcb85(%rip), %r14      # 0x17d40
leaq 0x10(%rcx), %r15
cmpq $0x50, %r15
je 0xb1f7
movq 0x10(%rcx,%r14), %rdi
movq %rbx, %rsi
callq 0x31d0
movq %r15, %rcx
testl %eax, %eax
jne 0xb1bb
addq %r15, %r14
jmp 0xb1e5
leaq 0xcb5b(%rip), %r14      # 0x17d40
movq 0x8(%r14), %rax
cmpq $0x1fffe00, %rax        # imm = 0x1FFFE00
je 0xb1f7
popq %rbx
popq %r14
popq %r15
retq
movq 0xcdf2(%rip), %rax      # 0x17ff0
movq (%rax), %rdi
leaq 0x70cd(%rip), %rsi      # 0x122d5
movq %rbx, %rdx
xorl %eax, %eax
callq 0x31e0
movl $0x1fffe00, %eax        # imm = 0x1FFFE00
jmp 0xb1f1
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/rt11.c
// Function: rt11Info
static void rt11Info(
  struct mountedFS *mount,
  uint8_t unit,
  uint8_t present
)
{
  struct RT11data *data = &mount->rt11data;

  if (present) {
    if (RT11_PARTITIONVALID(data, unit))
      info(mount, unit);
  } else {
    uint16_t i, count = data->filesystems;

    /*
     * Display information about all valid partitions
     */
    for (i = 0; (i < 256) && (count != 0); i++)
      if (RT11_PARTITIONVALID(data, i)) {
        info(mount, i);
        count--;
      }
  }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
testl %edx, %edx
je 0xb4af
movl %esi, %eax
movzbl %al, %esi
shrb $0x3, %al
movzbl %al, %eax
andl $0x1e, %eax
movzwl 0x52(%rbx,%rax), %eax
movl %esi, %ecx
andl $0xf, %ecx
btl %ecx, %eax
jae 0xb4f0
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0xbb28
movzwl 0x50(%rbx), %ebp
testw %bp, %bp
je 0xb4f0
xorl %r14d, %r14d
movl %r14d, %eax
shrl $0x4, %eax
movzwl 0x52(%rbx,%rax,2), %eax
movl %r14d, %ecx
andl $0xf, %ecx
btl %ecx, %eax
jae 0xb4df
movzbl %r14b, %esi
movq %rbx, %rdi
callq 0xbb28
decl %ebp
cmpl $0xfe, %r14d
ja 0xb4f0
incl %r14d
testw %bp, %bp
jne 0xb4bb
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/rt11.c
// Function: rt11OpenFileR
static void *rt11OpenFileR(
  struct mountedFS *mount,
  uint8_t unit,
  char *fname
)
{
  struct rt11OpenFile *file;
  struct rt11FileSpec spec;

  if (rt11ParseFilespec(fname, &spec, RT11_M_NONE) == 0) {
    fprintf(stderr, "Failed to parse filename \"%s\"\n", fname);
    return NULL;
  }

  if ((file = malloc(sizeof(struct rt11OpenFile))) != NULL) {
    memset(file, 0, sizeof(struct rt11OpenFile));

    if (rt11LookupFile(mount, unit, &spec, file) != 0) {
      /*
       * Allocate local buffer space for the file.
       */
      if ((file->buffer = malloc(mount->blocksz)) == NULL) {
        free(file);
        return NULL;
      }
      file->mode = M_RD;
    } else {
      free(file);
      return NULL;
    }
  }
  return file;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r15
movl %esi, %ebp
movq %rdi, %r14
leaq 0x6(%rsp), %rsi
movq %rdx, %rdi
xorl %edx, %edx
callq 0x96e0
testl %eax, %eax
je 0xb83d
movl $0x1, %edi
movl $0x38, %esi
callq 0x31c0
testq %rax, %rax
je 0xb82d
movq %rax, %rbx
movzbl %bpl, %esi
leaq 0x6(%rsp), %rdx
movq %r14, %rdi
movq %rax, %rcx
callq 0xa60f
testl %eax, %eax
je 0xb825
movq 0x28(%r14), %rdi
callq 0x3220
movq %rax, 0x28(%rbx)
testq %rax, %rax
je 0xb825
movl $0x0, 0x10(%rbx)
jmp 0xb82f
movq %rbx, %rdi
callq 0x3050
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0xc7ac(%rip), %rax      # 0x17ff0
movq (%rax), %rdi
leaq 0x6589(%rip), %rsi      # 0x11dd7
xorl %ebx, %ebx
movq %r15, %rdx
xorl %eax, %eax
callq 0x31e0
jmp 0xb82f
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/rt11.c
// Function: rt11CloseFile
static void rt11CloseFile(
  void *filep
)
{
  struct rt11OpenFile *file = filep;
  
  if (file->mode == M_WR) {
    if (SWISSET('a') &&
        !SWISSET('p') &&
        (file->count != RT11_BLOCKSIZE)) {
      char ch = '\032';

      rt11WriteBytes(file, &ch, 1);
    }

    if (file->current == 0)
      file->current = le16toh(file->start);

    /*
     * Flush the current buffer
     */
    rt11WriteBlock(file->mount, file->unit, file->current, file->buffer);
    rt11UpdateFile(file->mount, file->unit, file);
  }

  if (file != NULL) {
    if (file->buffer != NULL)
      free(file->buffer);
    free(file);
  }
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
cmpl $0x1, 0x10(%rdi)
jne 0xb8d7
leaq 0xd75f(%rip), %rax      # 0x18fd8
movl $0x8001, %ecx           # imm = 0x8001
andl (%rax), %ecx
cmpl $0x1, %ecx
jne 0xb8a2
cmpw $0x200, 0x34(%rbx)      # imm = 0x200
je 0xb8a2
leaq 0xf(%rsp), %rsi
movb $0x1a, (%rsi)
movq %rbx, %rdi
movl $0x1, %edx
callq 0xa98d
movzwl 0x30(%rbx), %eax
testw %ax, %ax
jne 0xb8b3
movzwl 0x36(%rbx), %eax
movw %ax, 0x30(%rbx)
movzbl 0x20(%rbx), %esi
movzwl %ax, %edx
movq 0x18(%rbx), %rdi
movq 0x28(%rbx), %rcx
callq 0x9b71
movq 0x18(%rbx), %rdi
movzbl 0x20(%rbx), %esi
movq %rbx, %rdx
callq 0xa7a6
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0xb8e5
callq 0x3050
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
jmp 0x3050
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/rt11.c
// Function: rt11ReadFile
static size_t rt11ReadFile(
  void *filep,
  void *buf,
  size_t buflen
)
{
  struct rt11OpenFile *file = filep;
  char *bufr = buf;

  if (SWISSET('a')) {
    char ch;
    size_t count = 0;

    /*
     * Read a full or partial line from the open file.
     */
    while ((buflen != 0) && (rt11ReadBytes(file, &ch, 1) == 1)) {
      if (ch == '\032') {
        /*
         * ^Z indicating EOF
         */
        rt11UngetByte(file);
        break;
      }
      bufr[count++] = ch;
      buflen--;
      if (ch == '\n')
        break;
    }
    return count;
  }

  return rt11ReadBytes(file, bufr, buflen);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0xd6c9(%rip), %rax      # 0x18fd8
testb $0x1, (%rax)
jne 0xb926
movq %rbx, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0xa8b6
cltq
jmp 0xb981
testq %r14, %r14
je 0xb96b
decq %r14
xorl %r13d, %r13d
leaq 0xf(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0xa8b6
cmpl $0x1, %eax
jne 0xb97e
movb 0xf(%rsp), %cl
cmpb $0x1a, %cl
je 0xb96f
leaq 0x1(%r13), %rax
movb %cl, (%r15,%r13)
cmpb $0xa, %cl
je 0xb981
cmpq %r13, %r14
movq %rax, %r13
jne 0xb936
jmp 0xb981
xorl %eax, %eax
jmp 0xb981
movzwl 0x34(%rbx), %eax
testw %ax, %ax
je 0xb97e
decl %eax
movw %ax, 0x34(%rbx)
movq %r13, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/rt11.c
// Function: rt11DeleteFile
static void rt11DeleteFile(
  void *filep,
  char *UNUSED(fname)
)
{
  struct rt11OpenFile *file = filep;
  struct mountedFS *mount = file->mount;
  struct RT11data *data = &mount->rt11data;

  if (rt11ReadDirSegment(mount, file->unit, file->segment) == 0)
    return;

  data->buf[file->offset + RT11_DI_STATUS] = le16toh(RT11_E_MPTY);

  rt11MergeEmptyRegions(mount, file->offset);

  if (rt11WriteDirSegment(mount, file->unit, file->segment) == 0)
    return;

  rt11CloseFile(file);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %r14
movzbl 0x20(%rdi), %esi
movzbl 0xc(%rdi), %edx
movq %r14, %rdi
callq 0x9d20
testl %eax, %eax
je 0xbb20
movzwl 0xe(%rbx), %eax
movw $0x200, 0x472(%r14,%rax,2) # imm = 0x200
movzwl 0xe(%rbx), %r8d
movl %r8d, %edx
movzwl 0x478(%r14), %eax
movl %eax, %ecx
shrl %ecx
addl $0x7, %ecx
movzwl 0x47a(%r14,%r8,2), %edi
movw $0x5, %si
cmpl $0x5, %r8d
je 0xba15
movl %edx, %esi
subl %ecx, %esi
movzwl %si, %r9d
testb $0x2, 0x473(%r14,%r9,2)
jne 0xba0c
movl %edx, %esi
jmp 0xba15
addw 0x47a(%r14,%r9,2), %di
addl %ecx, %r8d
movl $0x200, %r9d            # imm = 0x200
subl %r8d, %r9d
cmpl %ecx, %r9d
jl 0xba44
movzwl %r8w, %r9d
testb $0x2, 0x473(%r14,%r9,2)
je 0xba44
movl %r9d, %edx
addw 0x47a(%r14,%rdx,2), %di
movl %r8d, %edx
cmpw %si, %dx
je 0xbafd
movzwl %si, %r8d
movw %di, 0x47a(%r14,%r8,2)
movl $0x0, 0x474(%r14,%r8,2)
movw $0x0, 0x478(%r14,%r8,2)
addl %ecx, %edx
addl %ecx, %esi
movzwl %dx, %edi
cmpl $0x1ff, %edi            # imm = 0x1FF
ja 0xbaef
shrl %eax
addq $0x6, %rax
leaq 0x474(%r14), %rdi
movzwl %si, %r8d
addl %r8d, %r8d
movzwl %dx, %r10d
leal (%r10,%r10), %r9d
movzwl 0x472(%r14,%r9), %r11d
movw %r11w, 0x472(%r14,%r8)
btl $0xb, %r11d
jb 0xbaef
movl $0x200, %r11d           # imm = 0x200
subl %r10d, %r11d
cmpl %ecx, %r11d
jb 0xbaef
addq %rdi, %r8
addq %rdi, %r9
xorl %r10d, %r10d
movzwl (%r9,%r10,2), %r11d
movw %r11w, (%r8,%r10,2)
incq %r10
cmpq %r10, %rax
jne 0xbacc
addl %ecx, %edx
addl %ecx, %esi
movzwl %dx, %r8d
cmpl $0x1ff, %r8d            # imm = 0x1FF
jbe 0xba8d
movzwl %si, %eax
movw $0x800, 0x472(%r14,%rax,2) # imm = 0x800
movzbl 0x20(%rbx), %esi
movzbl 0xc(%rbx), %edx
movq %r14, %rdi
callq 0x9d79
testl %eax, %eax
je 0xbb20
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xb864
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/dosmt.c
// Function: dosmtSet
static void dosmtSet(
  struct mountedFS *mount,
  uint8_t UNUSED(unit),
  uint8_t UNUSED(present)
)
{
  struct DOSMTdata *data = &mount->dosmtdata;
  int idx = 0;
  uint8_t prog, proj, prot;

  while (setCmds[idx] != NULL) {
    if (strcmp(words[1], setCmds[idx]) == 0) {
      switch (idx) {
        case DOSMTSET_UIC:
          if (args == 3) {
            if (sscanf(words[2], "[%hho,%hho]", &proj, &prog) == 2) {
              data->proj = proj;
              data->prog = prog;
            } else fprintf(stderr,
                           "dosmt: UIC syntax error \"%s\"\n", words[2]);
          } else fprintf(stderr, "dosmt: Invalid syntax for \"set uic\"\n");
          return;

        case DOSMTSET_PROT:
          if (args == 3) {
            if (sscanf(words[2], "<%hho>", &prot) == 1) {
              data->prot = prot;
            } else fprintf(stderr,
                           "dosmt: Protection syntax error \"%s\"\n", words[2]);
          } else fprintf(stderr, "dosmt: Invalid syntax for \"set prot\"\n");
          return;
      }
    }
    idx++;
  }
  fprintf(stderr, "dosmt: Unknown set command \"%s\"\n", words[1]);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0xcd09(%rip), %rax      # 0x190b8
movq (%rax), %r15
movq 0x8(%r15), %r14
leaq 0xb9e3(%rip), %r12      # 0x17da0
xorl %r13d, %r13d
movq (%r12), %rsi
movq %r14, %rdi
callq 0x31d0
testl %eax, %eax
jne 0xc3db
cmpl $0x1, %r13d
je 0xc453
testl %r13d, %r13d
je 0xc410
incq %r13
addq $0x8, %r12
cmpq $0x2, %r13
jne 0xc3c0
movq 0xbc01(%rip), %rax      # 0x17ff0
movq (%rax), %rdi
leaq 0x6139(%rip), %rsi      # 0x12532
movq %r14, %rdx
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x31e0
leaq 0xcc99(%rip), %rax      # 0x190b0
cmpl $0x3, (%rax)
jne 0xc493
movq 0x10(%r15), %rdi
leaq 0x5749(%rip), %rsi      # 0x11b70
leaq 0xe(%rsp), %rdx
leaq 0xf(%rsp), %rcx
xorl %eax, %eax
callq 0x3230
cmpl $0x2, %eax
jne 0xc4a1
movb 0xe(%rsp), %al
movb %al, 0x250(%rbx)
movb 0xf(%rsp), %al
movb %al, 0x251(%rbx)
jmp 0xc485
leaq 0xcc56(%rip), %rax      # 0x190b0
cmpl $0x3, (%rax)
jne 0xc49a
movq 0x10(%r15), %rdi
leaq 0x6076(%rip), %rsi      # 0x124e0
leaq 0xd(%rsp), %rdx
xorl %eax, %eax
callq 0x3230
cmpl $0x1, %eax
jne 0xc4a8
movb 0xd(%rsp), %al
movb %al, 0x252(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
callq 0x4370
jmp 0xc485
callq 0x4328
jmp 0xc485
callq 0x438c
jmp 0xc485
callq 0x4344
jmp 0xc485
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/dosmt.c
// Function: dosmtOpenFileR
static void *dosmtOpenFileR(
  struct mountedFS *mount,
  uint8_t UNUSED(unit),
  char *fname
)
{
  struct dosmtOpenFile *file;
  struct dosmtFileSpec spec;

  if (dosmtParseFilespec(mount, fname, &spec, DOSMT_M_NONAME) == 0) {
    fprintf(stderr, "Failed to parse filename \"%s\"\n", fname);
    return NULL;
  }

  if ((file = malloc(sizeof(struct dosmtOpenFile))) != NULL) {
    if (dosmtLookupFile(mount, &spec, file) != 0) {
      file->mode = M_RD;
      file->nextb = DOSMTRCLNT;
      file->tm = 0;
      file->error = 0;
    } else {
      free(file);
      return NULL;
    }
  }
  return file;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r15
movq %rdi, %r14
leaq 0x4(%rsp), %rdx
movq %r15, %rsi
movl $0x2, %ecx
callq 0xbd08
testl %eax, %eax
je 0xc964
movl $0x218, %edi            # imm = 0x218
callq 0x3220
testq %rax, %rax
je 0xc955
movq %rax, %rbx
leaq 0x4(%rsp), %rsi
movq %r14, %rdi
movq %rax, %rdx
callq 0xc0cd
testl %eax, %eax
je 0xc94d
movl $0x0, (%rbx)
movl $0x200, 0x210(%rbx)     # imm = 0x200
jmp 0xc957
movq %rbx, %rdi
callq 0x3050
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq 0xb685(%rip), %rax      # 0x17ff0
movq (%rax), %rdi
leaq 0x5462(%rip), %rsi      # 0x11dd7
xorl %ebx, %ebx
movq %r15, %rdx
xorl %eax, %eax
callq 0x31e0
jmp 0xc957
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/dosmt.c
// Function: dosmtOpenFileW
static void *dosmtOpenFileW(
  struct mountedFS *mount,
  uint8_t UNUSED(unit),
  char *fname,
  off_t UNUSED(size)
)
{
  struct dosmtOpenFile *file;
  struct dosmtFileSpec spec;
  struct dosmthdr hdr;
  struct tm tm;
  time_t now = time(NULL);
  uint16_t today;

  if (dosmtParseFilespec(mount, fname, &spec, DOSMT_M_NONE) == 0) {
    fprintf(stderr, "Failed to parse filename \"%s\"\n", fname);
    return NULL;
  }

  if ((file = malloc(sizeof(struct dosmtOpenFile))) != NULL) {
    /*
     * Compute a suitable year for file creation date. This year will have
     * the same calendar as the current year but will be in the 20th century
     * so that DOS/BATCH-11 will be able to interpret it correctly.
     */
    localtime_r(&now, &tm);
    tm.tm_year -= 28;

    today = ((tm.tm_year - 70) * 1000) + tm.tm_yday + 1;

    hdr.fname[0] = htole16(spec.name[0]);
    hdr.fname[1] = htole16(spec.name[1]);
    if ((mount->flags & FS_DOSMTEXT) != 0)
      hdr.fname3 = htole16(spec.name[2]);
    else hdr.fname3 = 0;
    hdr.ext = htole16(spec.ext);
    hdr.prog = spec.prog;
    hdr.proj = spec.proj;
    hdr.prot = htole16(mount->dosmtdata.prot);
    hdr.date = htole16(today);

    if (tapeWriteRecord(mount->container, &hdr, sizeof(hdr)) == 0) {
      free(file);
      return NULL;
    }

    file->mode = M_WR;
    file->mount = mount;
    file->nextb = 0;
    file->tm = 0;
    file->error = 0;
  }
  return file;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x60, %rsp
movq %rdx, %r15
movq %rdi, %rbx
xorl %edi, %edi
callq 0x3200
movq %rax, 0x10(%rsp)
leaq 0x4(%rsp), %rdx
movq %rbx, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0xbd08
testl %eax, %eax
je 0xca83
movl $0x218, %edi            # imm = 0x218
callq 0x3220
testq %rax, %rax
je 0xca73
movq %rax, %r14
leaq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %r15
movq %r15, %rsi
callq 0x30b0
movl 0x14(%r15), %eax
movl 0x1c(%r15), %ecx
leal -0x1c(%rax), %edx
movl %edx, 0x14(%r15)
imull $0x3e8, %eax, %eax      # imm = 0x3E8
movl 0x6(%rsp), %edx
leaq 0x18(%rsp), %rsi
movl %edx, (%rsi)
movl 0x30(%rbx), %edx
shll $0x7, %edx
movswl %dx, %edx
shrl $0xf, %edx
andw 0xa(%rsp), %dx
addl %ecx, %eax
addl $0xffff8131, %eax       # imm = 0xFFFF8131
movw %dx, 0xc(%rsi)
movzwl 0xc(%rsp), %ecx
movw %cx, 0x4(%rsi)
movzwl 0xe(%rsp), %ecx
rolw $0x8, %cx
movw %cx, 0x6(%rsi)
movzbl 0x252(%rbx), %ecx
movw %cx, 0x8(%rsi)
movw %ax, 0xa(%rsi)
movq 0x38(%rbx), %rdi
movl $0xe, %edx
callq 0x6bd3
testl %eax, %eax
je 0xca6b
movl $0x1, (%r14)
movq %rbx, 0x8(%r14)
movl $0x0, 0x210(%r14)
jmp 0xca76
movq %r14, %rdi
callq 0x3050
xorl %r14d, %r14d
movq %r14, %rax
addq $0x60, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq 0xb566(%rip), %rax      # 0x17ff0
movq (%rax), %rdi
leaq 0x5343(%rip), %rsi      # 0x11dd7
xorl %r14d, %r14d
movq %r15, %rdx
xorl %eax, %eax
callq 0x31e0
jmp 0xca76
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/dosmt.c
// Function: dosmtCloseFile
static void dosmtCloseFile(
  void *filep
)
{
  struct dosmtOpenFile *file = filep;
  struct mountedFS *mount = file->mount;
  struct DOSMTdata *data = &mount->dosmtdata;
  uint32_t status;

  if (file->mode == M_RD) {
    if (file->tm == 0) {
      /*
       * Tape mark not seen, skip to end of current file.
       */
      do {
        if ((status = tapeReadRecordLength(mount->container)) == ST_FAIL) {
          fprintf(stderr,
                  "Error positioning \"%s\", rewinding\n", mount->name);
          tapeRewind(mount->container);
          status = ST_TM;
        }
      } while ((status != ST_EOM) && (status != ST_TM));

      if (status == ST_EOM)
        tapeSkipRecordR(mount->container);
    }
  } else {
    if (file->nextb != 0) {
      /*
       * The are some pending output byte(s), flush a final record to the tape.
       */
      if (tapeWriteRecord(mount->container, file->buf, DOSMTRCLNT) == 0)
        file->error = 1;
    }
    if (tapeWriteTM(mount->container) == 0)
      file->error = 1;

    data->eot = tapeGetPosition(mount->container);

    if (tapeWriteEOM(mount->container, 1) == 0)
      file->error = 1;

    if (file->error != 0) {
      ERROR("Panic: Error writing on \"%s\"\n", mount->name);
      exit(3);
    }
  }

  free(file);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %r14
cmpl $0x0, (%rdi)
je 0xcb6b
cmpw $0x0, 0x210(%rbx)
je 0xcb2a
movq 0x38(%r14), %rdi
leaq 0x10(%rbx), %rsi
movl $0x200, %edx            # imm = 0x200
callq 0x6bd3
testl %eax, %eax
jne 0xcb2a
movb $0x1, 0x213(%rbx)
movq 0x38(%r14), %rdi
callq 0x6cb4
testl %eax, %eax
jne 0xcb3e
movb $0x1, 0x213(%rbx)
movq 0x38(%r14), %rdi
callq 0x6968
movq %rax, 0x248(%r14)
movq 0x38(%r14), %rdi
movl $0x1, %esi
callq 0x6c56
testl %eax, %eax
je 0xcbb6
cmpb $0x0, 0x213(%rbx)
je 0xcb9c
jmp 0xcbbd
cmpb $0x0, 0x212(%rbx)
jne 0xcb9c
leaq 0x38(%r14), %r15
movq (%r15), %rdi
callq 0x6985
cmpl $0xfefefefe, %eax       # imm = 0xFEFEFEFE
je 0xcba9
leal -0x1(%rax), %ecx
cmpl $-0x2, %ecx
jb 0xcb78
cmpl $-0x1, %eax
jne 0xcb9c
movq (%r15), %rdi
callq 0x6a0b
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x3050
movq %r14, %rdi
movq %r15, %rsi
callq 0x447d
jmp 0xcb9c
movb $0x1, 0x213(%rbx)
movq %r14, %rdi
callq 0x4426
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/local.c
// Function: localFileSize
static off_t localFileSize(
  void *filep
)
{
  FILE *file = filep;
  struct stat stat;

  if (!SWISSET('a'))
    if (fstat(fileno(file), &stat) == 0)
      return stat.st_size;

  return 0;
}

// Assembly:
subq $0x98, %rsp
leaq 0xc282(%rip), %rax      # 0x18fd8
testb $0x1, (%rax)
jne 0xcd70
callq 0x3210
leaq 0x8(%rsp), %rsi
movl %eax, %edi
callq 0x32f0
testl %eax, %eax
je 0xcd7a
xorl %eax, %eax
addq $0x98, %rsp
retq
movq 0x38(%rsp), %rax
jmp 0xcd72
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/local.c
// Function: localReadFile
static size_t localReadFile(
  void *file,
  void *buf,
  size_t buflen
)
{
  if (SWISSET('a')) {
    char *bufr = buf;
    int readlen;

    if (fgets(bufr, buflen - 1, file) == NULL)
      return 0;

    /*
     * Translate terminating \n into \r\n unless it is already there
     */
    if ((readlen = strlen(bufr)) != 0) {
      if (bufr[readlen - 1] == '\n') {
        if ((readlen == 1) || (bufr[readlen - 2] != '\r'))
          strcpy(&bufr[readlen - 1], "\r\n");
      }
    }
    return strlen(bufr);
  }
  return fread(buf, sizeof(char), buflen, file);
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
movq %rdi, %rcx
leaq 0xc244(%rip), %rax      # 0x18fd8
testb $0x1, (%rax)
jne 0xcda7
movl $0x1, %esi
movq %rbx, %rdi
popq %rbx
jmp 0x30f0
decl %edx
movq %rbx, %rdi
movl %edx, %esi
movq %rcx, %rdx
callq 0x31b0
testq %rax, %rax
je 0xce16
movq %rbx, %rdi
callq 0x3130
testl %eax, %eax
je 0xce0d
movq %rax, %rdx
shlq $0x20, %rdx
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
addq %rdx, %rcx
sarq $0x20, %rcx
cmpb $0xa, (%rbx,%rcx)
jne 0xce0d
cmpl $0x1, %eax
je 0xce01
movabsq $-0x200000000, %rax     # imm = 0xFFFFFFFE00000000
addq %rax, %rdx
sarq $0x20, %rdx
cmpb $0xd, (%rbx,%rdx)
je 0xce0d
addq %rbx, %rcx
movb $0x0, 0x2(%rcx)
movw $0xa0d, (%rcx)          # imm = 0xA0D
movq %rbx, %rdi
popq %rbx
jmp 0x3130
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/local.c
// Function: localWriteFile
static size_t localWriteFile(
  void *file,
  void *buf,
  size_t buflen
)
{
  if (SWISSET('a')) {
    char *bufw = buf;

    if (buflen >= 2)
      if ((bufw[buflen - 2] == '\r') && (bufw[buflen - 1] == '\n')) {
        bufw[buflen - 2] = '\n';
        buflen--;
      }
  }
  return fwrite(buf, sizeof(char), buflen, file);
}

// Assembly:
movq %rsi, %rax
movq %rdi, %rcx
cmpq $0x2, %rdx
jb 0xce4a
leaq 0xc1ab(%rip), %rsi      # 0x18fd8
movl (%rsi), %esi
andl $0x1, %esi
je 0xce4a
cmpb $0xd, -0x2(%rax,%rdx)
jne 0xce4a
cmpb $0xa, -0x1(%rax,%rdx)
jne 0xce4a
movb $0xa, -0x2(%rax,%rdx)
decq %rdx
movl $0x1, %esi
movq %rax, %rdi
jmp 0x32d0
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/os8.c
// Function: rk05ReadBlock
static int rk05ReadBlock(
  struct mountedFS *mount,
  uint8_t unit,
  unsigned int block,
  void *buf
)
{
  int status = 0;
  unsigned int base = unit == 0 ? 0 : OS8_RK05FS_BLKS;

  if (block >= OS8_RK05FS_BLKS) {
    ERROR("Attempt to read block (%u) outside file system \"%s%o:\"\n",
          block, mount->name, unit);
    return 0;
  }

  status = FSioReadBlock(mount, base + block, buf);

  if (status == 0)
    ERROR("I/O error on \"%s%o:\"\n", mount->name, unit);

  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r15d
movl %esi, %ebx
movq %rdi, %r14
cmpl $0xcb0, %edx            # imm = 0xCB0
jae 0xcee3
leal 0xcb0(%r15), %esi
testb %bl, %bl
cmovel %r15d, %esi
movq %r14, %rdi
movq %rcx, %rdx
callq 0x61d2
movl %eax, %ebp
testl %eax, %eax
je 0xcf40
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0xb106(%rip), %rax      # 0x17ff0
movq (%rax), %rdi
addq $0x8, %r14
leaq 0x507c(%rip), %rsi      # 0x11f74
xorl %ebp, %ebp
movl %r15d, %edx
movq %r14, %rcx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x31e0
leaq 0xc0b7(%rip), %rax      # 0x18fc8
movq (%rax), %rdi
testq %rdi, %rdi
je 0xced6
movq 0xb098(%rip), %rax      # 0x17fb8
cmpq (%rax), %rdi
je 0xced6
leaq 0x5048(%rip), %rsi      # 0x11f74
xorl %ebp, %ebp
movl %r15d, %edx
movq %r14, %rcx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x31e0
jmp 0xced6
leaq 0x4(%rsp), %r15
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
callq 0x4519
movl (%r15), %ebp
jmp 0xced6
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/os8.c
// Function: rk05WriteBlock
static int rk05WriteBlock(
  struct mountedFS *mount,
  uint8_t unit,
  unsigned int block,
  void *buf
)
{
  int status = 0;
  unsigned int base = unit == 0 ? 0 : OS8_RK05FS_BLKS;

  if (block >= OS8_RK05FS_BLKS) {
    ERROR("Attempt to write block (%u) outside file system \"%s%o:\"\n",
          block, mount->name, unit);
    return 0;
  }

  status = FSioWriteBlock(mount, base + block, buf);

  if (status == 0)
    ERROR("I/O error on \"%s%o:\"\n", mount->name, unit);

  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r15d
movl %esi, %ebx
movq %rdi, %r14
cmpl $0xcb0, %edx            # imm = 0xCB0
jae 0xcf9c
leal 0xcb0(%r15), %esi
testb %bl, %bl
cmovel %r15d, %esi
movq %r14, %rdi
movq %rcx, %rdx
callq 0x621b
movl %eax, %ebp
testl %eax, %eax
je 0xcff9
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0xb04d(%rip), %rax      # 0x17ff0
movq (%rax), %rdi
addq $0x8, %r14
leaq 0x5053(%rip), %rsi      # 0x12004
xorl %ebp, %ebp
movl %r15d, %edx
movq %r14, %rcx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x31e0
leaq 0xbffe(%rip), %rax      # 0x18fc8
movq (%rax), %rdi
testq %rdi, %rdi
je 0xcf8f
movq 0xafdf(%rip), %rax      # 0x17fb8
cmpq (%rax), %rdi
je 0xcf8f
leaq 0x501f(%rip), %rsi      # 0x12004
xorl %ebp, %ebp
movl %r15d, %edx
movq %r14, %rcx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x31e0
jmp 0xcf8f
leaq 0x4(%rsp), %r15
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
callq 0x457c
movl (%r15), %ebp
jmp 0xcf8f