LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/fsio.c
// Function: doSkipForw
static void doSkipForw(void)
{
  struct mountedFS *mount;
  char *fname;
  uint8_t unit, present;

  if ((mount = findMount("skipf", words[0], &unit, &present, &fname)) != NULL) {
    if ((mount->filesys->flags & FS_TAPE) == 0) {
      fprintf(stderr, "skipf: Command only valid on magtapes\n");
      return;
    }

    if (*fname == '\0') {
      char *endptr;
      unsigned long count = strtoul(words[1], &endptr, 10);

      if (*endptr != '\0') {
        fprintf(stderr, "skipf: Invalid character in count\n");
        return;
      }

      if (count != 0)
        (*mount->filesys->skipforw)(mount, count);
    } else fprintf(stderr, "skipf: Does not expect a file name\n");
  }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq 0x1358e(%rip), %rax     # 0x190b8
movq (%rax), %rsi
leaq 0xa56b(%rip), %rdi      # 0x1009f
leaq 0x7(%rsp), %rdx
leaq 0x6(%rsp), %rcx
leaq 0x8(%rsp), %r8
callq 0x636e
testq %rax, %rax
je 0x5b9e
movq %rax, %rbx
movq 0x20(%rax), %rax
testb $0x2, 0x18(%rax)
je 0x5ba6
movq 0x8(%rsp), %rax
cmpb $0x0, (%rax)
jne 0x5bad
movq 0x1354d(%rip), %rax     # 0x190b8
movq 0x8(%rax), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
movl $0xa, %edx
callq 0x32a0
movq (%r14), %rcx
cmpb $0x0, (%rcx)
jne 0x5bb4
testq %rax, %rax
je 0x5b9e
movq 0x20(%rbx), %rcx
movq %rbx, %rdi
movq %rax, %rsi
callq *0xa8(%rcx)
addq $0x18, %rsp
popq %rbx
popq %r14
retq
callq 0x359c
jmp 0x5b9e
callq 0x3564
jmp 0x5b9e
callq 0x3580
jmp 0x5b9e
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/fsio.c
// Function: doSkipRev
static void doSkipRev(void)
{
  struct mountedFS *mount;
  char *fname;
  uint8_t unit, present;

  if ((mount = findMount("skipf", words[0], &unit, &present, &fname)) != NULL) {
    if ((mount->filesys->flags & FS_TAPE) == 0) {
      fprintf(stderr, "skipr: Command only valid on magtapes\n");
      return;
    }

    if (*fname == '\0') {
      char *endptr;
      unsigned long count = strtoul(words[1], &endptr, 10);

      if (*endptr != '\0') {
        fprintf(stderr, "skipr: Invalid character in count\n");
        return;
      }

      if (count != 0)
        (*mount->filesys->skiprev)(mount, count);
    } else fprintf(stderr, "skipr: Does not expect a file name\n");
  }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq 0x134ef(%rip), %rax     # 0x190b8
movq (%rax), %rsi
leaq 0xa4cc(%rip), %rdi      # 0x1009f
leaq 0x7(%rsp), %rdx
leaq 0x6(%rsp), %rcx
leaq 0x8(%rsp), %r8
callq 0x636e
testq %rax, %rax
je 0x5c3d
movq %rax, %rbx
movq 0x20(%rax), %rax
testb $0x2, 0x18(%rax)
je 0x5c45
movq 0x8(%rsp), %rax
cmpb $0x0, (%rax)
jne 0x5c4c
movq 0x134ae(%rip), %rax     # 0x190b8
movq 0x8(%rax), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
movl $0xa, %edx
callq 0x32a0
movq (%r14), %rcx
cmpb $0x0, (%rcx)
jne 0x5c53
testq %rax, %rax
je 0x5c3d
movq 0x20(%rbx), %rcx
movq %rbx, %rdi
movq %rax, %rsi
callq *0xb0(%rcx)
addq $0x18, %rsp
popq %rbx
popq %r14
retq
callq 0x35f0
jmp 0x5c3d
callq 0x35b8
jmp 0x5c3d
callq 0x35d4
jmp 0x5c3d
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/fsio.c
// Function: main
int main(
  int argc,
  char **argv
)
{
  FILE *commands = stdin;
  int ch;

  FSioInit();

  /*
   * Process command line switches
   */
  while ((ch = getopt(argc, argv, "qv")) != -1) {
    switch (ch) {
      case 'q':
        quiet = 1;
        break;

      case 'v':
        verbose = 1;
        break;

      default:
        Usage();
    }
  }

  argc -= optind;
  argv += optind;

#if !defined(__linux__)
  optreset = 1;
#endif
  optind = 1;

  if (argc <= 1) {
    if (argc == 1) {
      commands = fopen(argv[0], "r");
      if (commands == NULL) {
        fprintf(stderr, "Failed to open \"%s\": %s\n",
                argv[0], strerror(errno));
        exit(2);
      }
    }
    FSioCommands(commands);
  } else Usage();

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movl %edi, %ebp
movq 0x12324(%rip), %rax     # 0x17fc0
movq (%rax), %rbx
leaq 0x14422(%rip), %rax     # 0x1a0c8
movl $0x61636f6c, 0x8(%rax)  # imm = 0x61636F6C
movw $0x6c, 0xc(%rax)
leaq 0x1305e(%rip), %rcx     # 0x18d18
movq %rcx, 0x20(%rax)
xorl %edx, %edx
movq %rdx, 0x28(%rax)
movq %rdx, 0x38(%rax)
movq %rdx, (%rax)
movq %rax, 0x143ee(%rip)     # 0x1a0c0
movq 0x132f7(%rip), %rax     # 0x18fd0
movq %rax, (%rcx)
leaq 0x12e0d(%rip), %rax     # 0x18af0
movq %rcx, (%rax)
leaq 0x12ebb(%rip), %rcx     # 0x18ba8
movq %rax, (%rcx)
leaq 0x12f69(%rip), %rax     # 0x18c60
movq %rcx, (%rax)
leaq 0x131ef(%rip), %rcx     # 0x18ef0
movq %rax, (%rcx)
movq %rcx, 0x132c5(%rip)     # 0x18fd0
leaq 0xa3b0(%rip), %r15      # 0x100c2
leaq 0x132ab(%rip), %r12     # 0x18fc4
leaq 0x132a0(%rip), %r13     # 0x18fc0
movl %ebp, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x3290
movq %r12, %rcx
cmpl $0x71, %eax
je 0x5d3d
cmpl $0x76, %eax
jne 0x5d45
movq %r13, %rcx
movl $0x1, (%rcx)
jmp 0x5d20
cmpl $-0x1, %eax
jne 0x5d97
movq 0x12277(%rip), %rcx     # 0x17fc8
movslq (%rcx), %rax
subl %eax, %ebp
movl $0x1, (%rcx)
cmpl $0x1, %ebp
jg 0x5d9c
jne 0x5d7e
leaq (%r14,%rax,8), %r14
movq (%r14), %rdi
leaq 0xb882(%rip), %rsi      # 0x115f3
callq 0x3280
movq %rax, %rbx
testq %rax, %rax
je 0x5da1
movq %rbx, %rdi
callq 0x5da9
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x366d
callq 0x360c
movq %r14, %rdi
callq 0x3631
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/fsio.c
// Function: FSioReadBlock
int FSioReadBlock(
  struct mountedFS *mount,
  unsigned int block,
  void *buf
)
{
  off_t offset = block * mount->blocksz;

  if (fseeko(mount->container, offset + mount->skip, SEEK_SET) == 0)
    return fread(buf, mount->blocksz, 1, mount->container);

  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl %esi, %esi
imulq 0x28(%rdi), %rsi
movq %rdx, %r14
movq 0x38(%rdi), %rdi
addq 0x40(%rbx), %rsi
xorl %r15d, %r15d
xorl %edx, %edx
callq 0x3270
testl %eax, %eax
jne 0x6212
movq 0x28(%rbx), %rsi
movq 0x38(%rbx), %rcx
movl $0x1, %edx
movq %r14, %rdi
callq 0x30f0
movq %rax, %r15
movl %r15d, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/fsio.c
// Function: FSioWriteBlock
int FSioWriteBlock(
  struct mountedFS *mount,
  unsigned int block,
  void *buf
)
{
  off_t offset = block * mount->blocksz;

  if (fseeko(mount->container, offset + mount->skip, SEEK_SET) == 0)
    return fwrite(buf, mount->blocksz, 1, mount->container);

  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl %esi, %esi
imulq 0x28(%rdi), %rsi
movq %rdx, %r14
movq 0x38(%rdi), %rdi
addq 0x40(%rbx), %rsi
xorl %r15d, %r15d
xorl %edx, %edx
callq 0x3270
testl %eax, %eax
jne 0x625b
movq 0x28(%rbx), %rsi
movq 0x38(%rbx), %rcx
movl $0x1, %edx
movq %r14, %rdi
callq 0x32d0
movq %rax, %r15
movl %r15d, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/fsio.c
// Function: FSioWriteSector
int FSioWriteSector(
  struct mountedFS *mount,
  unsigned int sector,
  unsigned int size,
  void *buf
)
{
  off_t offset = sector * size;

  if (fseeko(mount->container, offset + mount->skip, SEEK_SET) == 0)
    return fwrite(buf, size, 1, mount->container);

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %rbx
movl %edx, %ebp
movq %rdi, %r14
imull %edx, %esi
movq 0x38(%rdi), %rdi
addq 0x40(%r14), %rsi
xorl %r15d, %r15d
xorl %edx, %edx
callq 0x3270
testl %eax, %eax
jne 0x62ee
movl %ebp, %esi
movq 0x38(%r14), %rcx
movl $0x1, %edx
movq %rbx, %rdi
callq 0x32d0
movq %rax, %r15
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/fsio.c
// Function: checkDev
static int checkDev(
  char *dev
)
{
  unsigned int i;

  /*
   * Remove any trailing ':' characters
   */
  while ((strlen(dev) != 0) && (dev[strlen(dev) - 1] == ':'))
    dev[strlen(dev) - 1] = '\0';

  for (i = 0; i < strlen(dev); i++)
    if (!isalpha(dev[i])) {
      fprintf(stderr,
              "%s: Device name contains non-alpha character\n", wds[0]);
      return 0;
    }
  return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x3130
movl $0x1, %ebp
testq %rax, %rax
je 0x635e
movq %rax, %r14
cmpb $0x3a, -0x1(%rbx,%r14)
jne 0x6335
movb $0x0, -0x1(%rbx,%r14)
movq %rbx, %rdi
callq 0x3130
movq %rax, %r14
testq %rax, %rax
jne 0x6315
jmp 0x635e
callq 0x3300
movq (%rax), %rax
movl $0x1, %ecx
xorl %edx, %edx
movsbq (%rbx,%rdx), %rdx
testb $0x4, 0x1(%rax,%rdx,2)
je 0x6365
movl %ecx, %edx
incl %ecx
cmpq %rdx, %r14
ja 0x6344
movl $0x1, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
callq 0x36df
xorl %ebp, %ebp
jmp 0x635e
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/declib.c
// Function: r50Asc
void r50Asc(
  uint16_t value,
  char *outbuf
)
{
  outbuf[2] = rad50[value % 050];
  value /= 050;
  outbuf[1] = rad50[value % 050];
  outbuf[0] = rad50[value / 050];
}

// Assembly:
imull $0xcccd, %edi, %eax     # imm = 0xCCCD
shrl $0x15, %eax
leal (,%rax,8), %ecx
leal (%rcx,%rcx,4), %ecx
movl %edi, %edx
subl %ecx, %edx
movl $0xffff, %ecx           # imm = 0xFFFF
andl %ecx, %edx
leaq 0x1206f(%rip), %r8      # 0x18620
movb (%rdx,%r8), %dl
movb %dl, 0x2(%rsi)
imull $0x667, %eax, %edx      # imm = 0x667
shrl $0xd, %edx
andl $-0x8, %edx
leal (%rdx,%rdx,4), %edx
subl %edx, %eax
andl %ecx, %eax
movb (%rax,%r8), %al
movb %al, 0x1(%rsi)
shrl $0x6, %edi
imull $0xa3e, %edi, %eax      # imm = 0xA3E
shrl $0x10, %eax
movb (%rax,%r8), %al
movb %al, (%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/declib.c
// Function: r50AscNoSpace
void r50AscNoSpace(
  uint16_t value,
  char *outbuf
)
{
  uint16_t value2 = value / 050;

  /*
   * The rad50 representation of ' ' is zero.
   */
  if ((value2 / 050) != 0)
    *outbuf++ = rad50[value2 / 050];
  if ((value2 % 050) != 0)
    *outbuf++ = rad50[value2 % 050];
  if ((value % 050) != 0)
    *outbuf++ = rad50[value % 050];
}

// Assembly:
imull $0xcccd, %edi, %ecx     # imm = 0xCCCD
shrl $0x15, %ecx
movl %ecx, %eax
shll $0x3, %eax
leal (%rax,%rax,4), %edx
movl %edi, %eax
subl %edx, %eax
cmpl $0x640, %edi            # imm = 0x640
jb 0x6620
movzwl %di, %edx
shrl $0x6, %edx
imull $0xa3e, %edx, %edx      # imm = 0xA3E
shrl $0x10, %edx
leaq 0x12008(%rip), %rdi     # 0x18620
movb (%rdx,%rdi), %dl
movb %dl, (%rsi)
incq %rsi
movzwl %cx, %ecx
imull $0x667, %ecx, %edx      # imm = 0x667
shrl $0xd, %edx
andl $-0x8, %edx
leal (%rdx,%rdx,4), %edx
subw %dx, %cx
je 0x6649
movzwl %cx, %ecx
leaq 0x11fdf(%rip), %rdx     # 0x18620
movb (%rcx,%rdx), %cl
movb %cl, (%rsi)
incq %rsi
testw %ax, %ax
je 0x665d
movzwl %ax, %eax
leaq 0x11fc8(%rip), %rcx     # 0x18620
movb (%rax,%rcx), %al
movb %al, (%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/declib.c
// Function: ascR50
uint16_t ascR50(
  char *inbuf
)
{
  uint16_t value;
  char *ptr;

  if ((ptr = strchr(rad50, toupper(*inbuf++))) == NULL)
    ptr = strchr(rad50, '%');

  value = (ptr - rad50) * 03100;

  if ((ptr = strchr(rad50, toupper(*inbuf++))) == NULL)
    ptr = strchr(rad50, '%');

  value += (ptr - rad50) * 050;

  if ((ptr = strchr(rad50, toupper(*inbuf++))) == NULL)
    ptr = strchr(rad50, '%');

  value += ptr - rad50;

  return value;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
callq 0x3030
movq (%rax), %r12
movsbq (%r14), %rax
movl (%r12,%rax,4), %esi
leaq 0x11fa0(%rip), %rdi     # 0x18620
callq 0x3150
movq %rax, %rbx
testq %rax, %rax
jne 0x66a1
leaq 0x11f8c(%rip), %rdi     # 0x18620
movl $0x25, %esi
callq 0x3150
movq %rax, %rbx
movsbq 0x1(%r14), %rax
movl (%r12,%rax,4), %esi
leaq 0x11f6f(%rip), %rdi     # 0x18620
callq 0x3150
movq %rax, %r15
testq %rax, %rax
jne 0x66d2
leaq 0x11f5b(%rip), %rdi     # 0x18620
movl $0x25, %esi
callq 0x3150
movq %rax, %r15
movsbq 0x2(%r14), %rax
movl (%r12,%rax,4), %esi
leaq 0x11f3e(%rip), %rdi     # 0x18620
callq 0x3150
testq %rax, %rax
jne 0x66fd
leaq 0x11f2d(%rip), %rdi     # 0x18620
movl $0x25, %esi
callq 0x3150
leaq 0x11f1c(%rip), %rcx     # 0x18620
subl %ecx, %ebx
imull $0x640, %ebx, %edx      # imm = 0x640
subl %ecx, %r15d
shll $0x3, %r15d
leal (%r15,%r15,4), %esi
subl %ecx, %edx
addl %esi, %eax
addl %edx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/declib.c
// Function: dos11Date
char *dos11Date(
  uint16_t value,
  char *buf
)
{
  unsigned short year, doyr, leapyr;
  unsigned short *table;

  /*
   * The DOS/BATCH-11 date format is documented as having 3 reserved bit.
   * Version 9.20C (and later?) makes use of these bits to allow dates up
   * to 2035. Unfortunately, the date input routine only allows up to 1999!
   */
  year = 1970 + value / 1000;
  doyr = value % 1000;
  leapyr = ((year % 4) == 0) && (year != 2000);

  table = leapyr ? mnthl : mnth;

  /*
   * Check for valid day of year.
   */
  if (doyr < (leapyr ? 366 : 365)) {
    int i = 0;

    while (doyr > table[i])
      doyr -= table[i++];

    sprintf(buf, "%2d-%s-%4d", doyr, month[i], year);
  } else strcpy(buf, "xx-yyy-xxxx");
  return buf;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
movl %edi, %eax
shrl $0x3, %eax
imull $0x20c5, %eax, %r8d     # imm = 0x20C5
shrl $0x14, %r8d
imull $0x3e8, %r8d, %eax      # imm = 0x3E8
addl $0x7b2, %r8d            # imm = 0x7B2
subl %eax, %edi
testb $0x3, %r8b
sete %al
cmpl $0x7d0, %r8d            # imm = 0x7D0
setne %cl
andb %al, %cl
leaq 0x11f69(%rip), %rdx     # 0x186d0
leaq 0x11f42(%rip), %rax     # 0x186b0
cmovneq %rdx, %rax
movzwl %di, %edx
movzbl %cl, %ecx
addl $0x16d, %ecx            # imm = 0x16D
cmpl %edx, %ecx
jbe 0x67bc
movzwl (%rax), %esi
xorl %ecx, %ecx
cmpw %si, %di
jbe 0x679e
subl %esi, %edi
movzwl 0x2(%rax,%rcx,2), %esi
incq %rcx
cmpw %si, %di
ja 0x678c
movzwl %di, %edx
leaq 0x11eab(%rip), %rax     # 0x18650
movq (%rax,%rcx,8), %rcx
leaq 0xb065(%rip), %rsi      # 0x11815
movq %rbx, %rdi
xorl %eax, %eax
callq 0x32b0
jmp 0x67d0
movabsq $0x782d7979792d7878, %rax # imm = 0x782D7979792D7878
movq %rax, (%rbx)
movl $0x787878, 0x8(%rbx)    # imm = 0x787878
movq %rbx, %rax
popq %rbx
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/tape.c
// Function: tapeReadRecordLength
uint32_t tapeReadRecordLength(
  FILE *container
)
{
  off_t pos = ftello(container);
  uint32_t meta, bc, erflag;

  if (fread(&meta, sizeof(meta), 1, container) != 1)
    return ST_FAIL;

  bc = le32toh(meta);

  switch (bc) {
    case ST_EOM:
    case ST_TM:
      return bc;

    default:
      erflag = bc & ST_ERROR;
      bc &= ST_LENGTH;

      /*
       * Now position the file after this record.
       */
      pos += RECLEN(bc) + (2 * sizeof(meta));
      if (fseeko(container, pos, SEEK_SET) != 0)
        return ST_FAIL;

      return erflag | bc;
  }
  return ST_FAIL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
callq 0x30d0
movq %rax, %r15
leaq 0xc(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x30f0
movl $0xfefefefe, %r14d      # imm = 0xFEFEFEFE
cmpq $0x1, %rax
jne 0x69fe
movl 0xc(%rsp), %r14d
leal 0x1(%r14), %eax
cmpl $0x2, %eax
jb 0x69fe
movl %r14d, %eax
andl $0xffffff, %eax         # imm = 0xFFFFFF
incl %eax
andl $-0x2, %eax
leaq (%rax,%r15), %rsi
addq $0x8, %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x3270
andl $0x80ffffff, %r14d      # imm = 0x80FFFFFF
testl %eax, %eax
movl $0xfefefefe, %eax       # imm = 0xFEFEFEFE
cmovel %r14d, %eax
movl %eax, %r14d
movl %r14d, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/tape.c
// Function: tapeReadRecordLengthReverse
uint32_t tapeReadRecordLengthReverse(
  FILE *container
)
{
  uint32_t meta, bc, erflag;
  off_t delta;

  if ((fseeko(container, -sizeof(meta), SEEK_CUR) != 0) ||
      (fread(&meta, sizeof(meta), 1, container) != 1))
    return ST_FAIL;

  bc = le32toh(meta);

  switch (bc) {
    case ST_EOM:
    case ST_TM:
      if (fseeko(container, -sizeof(meta), SEEK_CUR) != 0)
        return ST_FAIL;
      return bc;

    default:
      erflag = bc & ST_ERROR;
      bc &= ST_LENGTH;

      /*
       * Now position the file before this record.
       */
      delta = RECLEN(bc) + (2 * sizeof(meta));
      if (fseeko(container, -delta, SEEK_CUR) != 0)
        return ST_FAIL;

      return erflag | bc;
  }
  return ST_FAIL;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq $-0x4, %rsi
movl $0x1, %edx
callq 0x3270
movl $0xfefefefe, %ebp       # imm = 0xFEFEFEFE
testl %eax, %eax
jne 0x6aac
leaq 0xc(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x30f0
cmpq $0x1, %rax
jne 0x6aac
movl 0xc(%rsp), %r14d
leal 0x1(%r14), %eax
cmpl $0x1, %eax
ja 0x6a76
movq %rbx, %rdi
movq $-0x4, %rsi
movl $0x1, %edx
callq 0x3270
jmp 0x6aa1
movl %r14d, %eax
andl $0xffffff, %eax         # imm = 0xFFFFFF
incl %eax
andl $-0x2, %eax
movq $-0x8, %rsi
subq %rax, %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x3270
andl $0x80ffffff, %r14d      # imm = 0x80FFFFFF
testl %eax, %eax
movl $0xfefefefe, %ebp       # imm = 0xFEFEFEFE
cmovel %r14d, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/tape.c
// Function: tapePeekRecordLength
uint32_t tapePeekRecordLength(
  FILE *container
)
{
  off_t pos = ftello(container);
  uint32_t meta;

  if ((fread(&meta, sizeof(meta), 1, container) != 1) ||
      (fseeko(container, pos, SEEK_SET) != 0))
    return ST_FAIL;

  return le32toh(meta);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x30d0
movq %rax, %r14
leaq 0x4(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x30f0
movq %rax, %rcx
movl $0xfefefefe, %eax       # imm = 0xFEFEFEFE
cmpq $0x1, %rcx
jne 0x6b07
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3270
movl %eax, %ecx
movl $0xfefefefe, %eax       # imm = 0xFEFEFEFE
testl %ecx, %ecx
jne 0x6b07
movl 0x4(%rsp), %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/tape.c
// Function: tapeReadRecord
uint32_t tapeReadRecord(
  FILE *container,
  void *buf,
  int len
)
{
  off_t pos = ftello(container);
  uint32_t meta, bc, erflag, length;

  if (fread(&meta, sizeof(meta), 1, container) != 1)
    return ST_FAIL;

  bc = le32toh(meta);

  switch (bc) {
    case ST_EOM:
    case ST_TM:
      return bc;

    default:
      erflag = bc & ST_ERROR;
      bc &= ST_LENGTH;

      length = (uint32_t)len;
      if (bc < length)
        length = bc;

      if (fread(buf, sizeof(uint8_t), length, container) != length)
        return ST_FAIL;

      /*
       * Now position the file after this record.
       */
      pos += RECLEN(bc) + (2 * sizeof(meta));
      if (fseeko(container, pos, SEEK_SET) != 0)
        return ST_FAIL;

      return erflag | length;
  }
  return ST_FAIL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebx
movq %rsi, %r12
movq %rdi, %r14
callq 0x30d0
movq %rax, %r15
leaq 0xc(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x30f0
movl $0xfefefefe, %ebp       # imm = 0xFEFEFEFE
cmpq $0x1, %rax
jne 0x6b60
movl 0xc(%rsp), %r13d
leal 0x1(%r13), %eax
cmpl $0x2, %eax
jae 0x6b71
movl %r13d, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, 0x10(%rsp)
movl %r13d, %r15d
andl $0xffffff, %r15d        # imm = 0xFFFFFF
cmpl %ebx, %r15d
cmovbl %r15d, %ebx
movl $0x1, %esi
movq %r12, %rdi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x30f0
cmpq %rbx, %rax
jne 0x6b60
andl $0x80000000, %r13d      # imm = 0x80000000
incl %r15d
andl $-0x2, %r15d
movq 0x10(%rsp), %rax
leaq (%r15,%rax), %rsi
addq $0x8, %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x3270
orl %r13d, %ebx
testl %eax, %eax
movl $0xfefefefe, %ebp       # imm = 0xFEFEFEFE
cmovel %ebx, %ebp
jmp 0x6b60
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/tape.c
// Function: tapeWriteRecord
int tapeWriteRecord(
  FILE *container,
  void *buf,
  int len
)
{
  uint32_t meta = htole16(len);
  int datalen = (len + 1) & ~1;

  if ((fwrite(&meta, sizeof(meta), 1, container) != 1) ||
      (fwrite(buf, datalen, 1, container) != 1) ||
      (fwrite(&meta, sizeof(meta), 1, container) != 1))
    return 0;

  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
movzwl %r15w, %eax
leaq 0x4(%rsp), %rdi
movl %eax, (%rdi)
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x32d0
xorl %ebp, %ebp
cmpq $0x1, %rax
jne 0x6c49
incl %r15d
andl $-0x2, %r15d
movslq %r15d, %rsi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x32d0
cmpq $0x1, %rax
jne 0x6c49
leaq 0x4(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x32d0
xorl %ebp, %ebp
cmpq $0x1, %rax
sete %bpl
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/tape.c
// Function: tapeWriteEOM
int tapeWriteEOM(
  FILE *container,
  int backup
)
{
  uint32_t eom = htole32(ST_EOM);

  if (fwrite(&eom, sizeof(eom), 1, container) != 1)
    return 0;

  if (backup)
    if (fseeko(container, -sizeof(eom), SEEK_CUR) != 0)
      return 0;

  return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebp
movq %rdi, %r14
leaq 0xc(%rsp), %rdi
movl $0xffffffff, (%rdi)     # imm = 0xFFFFFFFF
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x32d0
xorl %ebx, %ebx
cmpq $0x1, %rax
jne 0x6ca9
testl %ebp, %ebp
je 0x6ca4
movq %r14, %rdi
movq $-0x4, %rsi
movl $0x1, %edx
callq 0x3270
testl %eax, %eax
jne 0x6ca9
movl $0x1, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/tape.c
// Function: tapeEOM
int tapeEOM(
  FILE *container,
  off_t *eot
)
{
  int whence = eot == NULL ? SEEK_END : SEEK_SET;
  off_t pos = eot == NULL ? 0 : *eot;
  uint32_t bc1, bc2;

  /*
   * Move to the end of the tape and then look backwards to see how it is
   * terminated.
   */
  if (fseeko(container, pos, whence) == 0) {
    if (ftello(container) == 0) {
      /*
       * Empty file, we are correctly positioned.
       */
      return 1;
    }

    if ((bc1 = tapeReadRecordLengthReverse(container)) == ST_FAIL)
      return 0;

    if ((bc1 == ST_EOM) || (bc1 == ST_TM)) {
      if (ftello(container) == 0) {
        /*
         * Only ST_EOM or ST_TM present, we are correctly positioned.
         */
        return 1;
      }

      if ((bc2 = tapeReadRecordLengthReverse(container)) == ST_FAIL)
        return 0;

      if (bc2 == ST_TM) {
        if (ftello(container) == 0) {
          /*
           * Only ST_TM followed by ST_TM or ST_EOM, we are correctly
           * positioned
           */
          return 1;
        }
      
        /*
         * ST_TM followed by ST_TM or ST_EOM with at least one data block
         * present, skip over the initial ST_TM.
         */
        if (fseeko(container, sizeof(uint32_t), SEEK_CUR) == 0)
          return 1;
      } else {
        /*
         * Only a single ST_TM at the end of the container file. This
         * indicates that there is a missing ST_TM or ST_EOM. Position
         * the tape at the logical end-of-tape so that any subsequent file
         * write will fix the problem.
         */
        if (fseeko(container, pos, whence) == 0)
          return 1;
      }
    }
  }
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %ebp, %ebp
testq %rsi, %rsi
sete %bpl
addl %ebp, %ebp
testq %rsi, %rsi
je 0x6cfe
movq (%rsi), %r14
jmp 0x6d01
xorl %r14d, %r14d
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x3270
testl %eax, %eax
je 0x6d23
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x30d0
testq %rax, %rax
je 0x6d90
movq %rbx, %rdi
callq 0x6a10
xorl %r15d, %r15d
cmpl $0xfefefefe, %eax       # imm = 0xFEFEFEFE
je 0x6d15
incl %eax
cmpl $0x1, %eax
ja 0x6d12
movq %rbx, %rdi
callq 0x30d0
testq %rax, %rax
je 0x6d90
movq %rbx, %rdi
callq 0x6a10
cmpl $0xfefefefe, %eax       # imm = 0xFEFEFEFE
je 0x6d15
testl %eax, %eax
jne 0x6d9b
movq %rbx, %rdi
callq 0x30d0
movl $0x1, %r15d
testq %rax, %rax
je 0x6d15
movl $0x4, %esi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x3270
jmp 0x6dae
movl $0x1, %r15d
jmp 0x6d15
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x3270
movl $0x1, %r15d
testl %eax, %eax
jne 0x6d12
jmp 0x6d15
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/tape.c
// Function: tapeSkipForward
int tapeSkipForward(
  FILE *container,
  unsigned long count
)
{
  unsigned long i;
  uint32_t bc;

  for (i = 0; i < count; i++) {
    /*
     * Peek at the next record. If it's a tape mark or end-of-media there
     * are not more files to skip.
     */
    switch (tapePeekRecordLength(container)) {
      case ST_FAIL:
        return 0;

      case ST_TM:
      case ST_EOM:
        return 1;
    }
    /*
     * Skip forward over 1 file.
     */
    do {
      switch (bc = tapeReadRecordLength(container)) {
        case ST_FAIL:
          return 0;

        case ST_EOM:
          if (fseeko(container, -sizeof(uint32_t), SEEK_CUR) != 0)
            return 0;
          break;
      }
    } while ((bc != ST_TM) && (bc != ST_EOM));
  }
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x6e39
movq %rsi, %r14
movq %rdi, %r15
xorl %r12d, %r12d
movl $0x1, %ebx
movq %r15, %rdi
callq 0x6ab7
leal 0x1(%rax), %ecx
cmpl $0x2, %ecx
jb 0x6e3e
cmpl $0xfefefefe, %eax       # imm = 0xFEFEFEFE
je 0x6e35
movq %r15, %rdi
callq 0x6985
cmpl $0xfefefefe, %eax       # imm = 0xFEFEFEFE
je 0x6e35
cmpl $-0x1, %eax
je 0x6e13
decl %eax
cmpl $-0x2, %eax
jb 0x6df6
jmp 0x6e2b
movq %r15, %rdi
movq $-0x4, %rsi
movl $0x1, %edx
callq 0x3270
testl %eax, %eax
jne 0x6e35
incq %r12
cmpq %r14, %r12
jne 0x6ddf
jmp 0x6e3e
xorl %ebx, %ebx
jmp 0x6e3e
movl $0x1, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/tape.c
// Function: tapeSkipReverse
int tapeSkipReverse(
  FILE *container,
  unsigned long count
)
{
  unsigned long i;
  uint32_t bc;

  for (i = 0; i < count; i++) {
    /*
     * If we are at beginning-of-tape, there are no more files to skip.
     */
    if (ftello(container) == 0)
      return 1;

    /*
     * If we are not at the beginning of tape, the previous record should
     * be a tape mark.
     */
    if (tapeReadRecordLengthReverse(container) != ST_TM)
      return 0;

    /*
     * Now skip over the remainder of the file.
     */
    do {
      if ((bc = tapeReadRecordLengthReverse(container)) == ST_FAIL)
        return 0;
    } while ((bc != ST_TM) && (ftello(container) != 0));

    /*
     * Skip over the tape mark since it marks the end of the previous file.
     */
    if (bc == ST_TM) {
      if (fseeko(container, sizeof(uint32_t), SEEK_CUR) != 0)
        return 0;
    }
  }
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x6ebc
movq %rsi, %rbx
movq %rdi, %r14
xorl %r15d, %r15d
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x30d0
testq %rax, %rax
je 0x6ebc
movq %r14, %rdi
callq 0x6a10
testl %eax, %eax
jne 0x6ec1
movq %r14, %rdi
callq 0x6a10
cmpl $0xfefefefe, %eax       # imm = 0xFEFEFEFE
je 0x6ec1
testl %eax, %eax
je 0x6e9e
movq %r14, %rdi
callq 0x30d0
testq %rax, %rax
jne 0x6e7c
jmp 0x6eb4
movl $0x4, %esi
movq %r14, %rdi
movl $0x1, %edx
callq 0x3270
testl %eax, %eax
jne 0x6ec1
incq %r15
cmpq %rbx, %r15
jne 0x6e63
movl $0x1, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/dos11.c
// Function: dos11DisplayDir
void dos11DisplayDir(
  uint16_t *dir,
  int full
)
{
  char temp[64], creation[16];

  r50Asc(le16toh(dir[UFD_FILENAME]), &temp[0]);
  r50Asc(le16toh(dir[UFD_FILENAME + 1]), &temp[3]);
  if (le16toh(dir[UFD_EXTENSION]) != 0) {
    temp[6] = '.';
    r50Asc(le16toh(dir[UFD_EXTENSION]), &temp[7]);
  } else {
    temp[6] = ' ';
    temp[7] = ' ';
    temp[8] = ' ';
    temp[9] = ' ';
  }

  if (full) {
    sprintf(&temp[10], "  %5u%c    %s   <%03o>",
            le16toh(dir[UFD_FILELENGTH]),
            (le16toh(dir[UFD_CREATION]) & UFD_TYPE) ? 'C' : ' ',
            dos11Date(le16toh(dir[UFD_CREATION]) & UFD_DATE, creation),
            le16toh(dir[UFD_LUP]) & UFD_PROT);
  } else temp[10] ='\0';
  puts(temp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x58, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movzwl (%rdi), %edi
movq %rsp, %rsi
callq 0x658c
movzwl 0x2(%rbx), %edi
leaq 0x3(%rsp), %rsi
callq 0x658c
movzwl 0x4(%rbx), %eax
testw %ax, %ax
je 0x6f14
leaq 0x7(%rsp), %rsi
movb $0x2e, -0x1(%rsi)
movzwl %ax, %edi
callq 0x658c
jmp 0x6f1c
movl $0x20202020, 0x6(%rsp)  # imm = 0x20202020
testl %ebp, %ebp
je 0x6f6f
leaq 0xa(%rsp), %r14
movzwl 0xc(%rbx), %ebp
movzwl 0x6(%rbx), %edi
testw %di, %di
movl $0x20, %eax
movl $0x43, %r15d
cmovnsl %eax, %r15d
andl $0x7fff, %edi           # imm = 0x7FFF
leaq 0x40(%rsp), %rsi
callq 0x6729
movzbl 0x10(%rbx), %r9d
leaq 0xa925(%rip), %rsi      # 0x11880
movq %r14, %rdi
movl %ebp, %edx
movl %r15d, %ecx
movq %rax, %r8
xorl %eax, %eax
callq 0x32b0
jmp 0x6f74
movb $0x0, 0xa(%rsp)
movq %rsp, %rdi
callq 0x30e0
addq $0x58, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/dos11.c
// Function: dos11ReadBlock
int dos11ReadBlock(
  struct mountedFS *mount,
  unsigned int block,
  void *buf
)
{
  struct DOS11data *data = &mount->dos11data;
  void *buffer = buf == NULL ? data->buf : buf;
  int status;

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

#ifdef DEBUG
  if ((mount->flags & FS_DEBUG) != 0)
    fprintf(DEBUGout, ">> %s: (dos11) Reading logical block %o\n",
            mount->name, block);
#endif

  status = FSioReadBlock(mount, block, buffer);

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

  return status;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x554(%rdi), %r14
testq %rdx, %rdx
cmovneq %rdx, %r14
cmpl %esi, 0x48(%rdi)
jbe 0x767f
testb $0x2, 0x30(%rbx)
je 0x7665
leaq 0x1197a(%rip), %rax     # 0x18fc8
movq (%rax), %rdi
leaq 0x8(%rbx), %rdx
leaq 0xa2ea(%rip), %rsi      # 0x11946
movl %ebp, %ecx
xorl %eax, %eax
callq 0x31e0
movq %rbx, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x61d2
testl %eax, %eax
je 0x7693
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x383a
jmp 0x76a3
leaq 0xc(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x389d
movl (%r14), %eax
jmp 0x7676
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/dos11.c
// Function: dos11XtndDirectory
uint16_t dos11XtndDirectory(
  struct mountedFS *mount
)
{
  uint16_t buf[512], ufdblk;

  memset(buf, 0, sizeof(buf));

  if ((ufdblk = bitmapAllocBlock(mount)) != 0) {
    if (dos11WriteBlock(mount, ufdblk, buf) == 0)
      return 0;

    if (bitmapFlush(mount) == 0)
      return 0;
  }
  return ufdblk;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rdi, %r14
movq %rsp, %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x3170
movq %r14, %rdi
callq 0x7ac2
movl %eax, %ebx
testw %ax, %ax
je 0x76f3
movzwl %bx, %esi
movq %rsp, %rdx
movq %r14, %rdi
callq 0x7700
testl %eax, %eax
je 0x76f1
movq %r14, %rdi
callq 0x7bbf
testl %eax, %eax
jne 0x76f3
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/dos11.c
// Function: dos11WriteBlock
int dos11WriteBlock(
  struct mountedFS *mount,
  unsigned int block,
  void *buf
)
{
  struct DOS11data *data = &mount->dos11data;
  void *buffer = buf == NULL ? data->buf : buf;
  int status;

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

#ifdef DEBUG
  if ((mount->flags & FS_DEBUG) != 0)
    fprintf(DEBUGout, ">> %s: (dos11) Writing logical block %o\n",
            mount->name, block);
#endif

  status = FSioWriteBlock(mount, block, buffer);

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

  return status;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x554(%rdi), %r14
testq %rdx, %rdx
cmovneq %rdx, %r14
cmpl %esi, 0x48(%rdi)
jbe 0x775e
testb $0x2, 0x30(%rbx)
je 0x7744
leaq 0x1189b(%rip), %rax     # 0x18fc8
movq (%rax), %rdi
leaq 0x8(%rbx), %rdx
leaq 0xa27d(%rip), %rsi      # 0x119b8
movl %ebp, %ecx
xorl %eax, %eax
callq 0x31e0
movq %rbx, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x621b
testl %eax, %eax
je 0x7772
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x38fd
jmp 0x7782
leaq 0xc(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3960
movl (%r14), %eax
jmp 0x7755
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/dos11.c
// Function: dos11UpdateFile
void dos11UpdateFile(
  struct mountedFS *mount,
  struct dos11OpenFile *file
)
{
  struct DOS11data *data = &mount->dos11data;

  if (dos11ReadBlock(mount, file->ufdblk, NULL) == 0)
    return;

  /*
   * Update the directory entry.
   */
  data->buf[file->ufdoffset + UFD_FILENAME] = file->name[0];
  data->buf[file->ufdoffset + UFD_FILENAME + 1] = file->name[1];
  data->buf[file->ufdoffset + UFD_EXTENSION] = file->ext;
  data->buf[file->ufdoffset + UFD_CREATION] = file->creation;
  data->buf[file->ufdoffset + UFD_NEXTFREEBYTE] = file->nfb;
  data->buf[file->ufdoffset + UFD_FILESTART] = file->start;
  data->buf[file->ufdoffset + UFD_FILELENGTH] = file->length;
  data->buf[file->ufdoffset + UFD_LASTBLOCKWRITTEN] = file->last;
  data->buf[file->ufdoffset + UFD_LUP] = file->lup & ~htole16(UFD_LOCK);;

#ifdef DEBUG
  if ((mount->flags & FS_DEBUG) != 0) {
    if (file->ufdoffset != 1)
      dos11DisplayDir(&data->buf[file->ufdoffset - UFD_LEN], 1);
    dos11DisplayDir(&data->buf[file->ufdoffset], 1);
  }
#endif

  dos11WriteBlock(mount, file->ufdblk, NULL);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movzwl 0x12(%rsi), %esi
xorl %edx, %edx
callq 0x7621
testl %eax, %eax
je 0x7abc
movzwl (%r14), %eax
movzwl 0x14(%r14), %ecx
movw %ax, 0x554(%rbx,%rcx,2)
movzwl 0x2(%r14), %eax
movzwl 0x14(%r14), %ecx
movw %ax, 0x556(%rbx,%rcx,2)
movzwl 0x4(%r14), %eax
movzwl 0x14(%r14), %ecx
movw %ax, 0x558(%rbx,%rcx,2)
movzwl 0x6(%r14), %eax
movzwl 0x14(%r14), %ecx
movw %ax, 0x55a(%rbx,%rcx,2)
movzwl 0x8(%r14), %eax
movzwl 0x14(%r14), %ecx
movw %ax, 0x55c(%rbx,%rcx,2)
movzwl 0xa(%r14), %eax
movzwl 0x14(%r14), %ecx
movw %ax, 0x55e(%rbx,%rcx,2)
movzwl 0xc(%r14), %eax
movzwl 0x14(%r14), %ecx
movw %ax, 0x560(%rbx,%rcx,2)
movzwl 0xe(%r14), %eax
movzwl 0x14(%r14), %ecx
movw %ax, 0x562(%rbx,%rcx,2)
movzwl 0x10(%r14), %eax
andl $0x7fff, %eax           # imm = 0x7FFF
movzwl 0x14(%r14), %ecx
movw %ax, 0x564(%rbx,%rcx,2)
testb $0x2, 0x30(%rbx)
je 0x7aa8
leaq 0x554(%rbx), %r15
movzwl 0x14(%r14), %ecx
movl $0x1, %eax
cmpq $0x1, %rcx
je 0x7a9a
leaq (%r15,%rcx,2), %rdi
addq $-0x12, %rdi
movl $0x1, %esi
callq 0x6ed0
movzwl 0x14(%r14), %eax
leaq (%r15,%rax,2), %rdi
movl $0x1, %esi
callq 0x6ed0
movzwl 0x12(%r14), %esi
movq %rbx, %rdi
xorl %edx, %edx
popq %rbx
popq %r14
popq %r15
jmp 0x7700
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/dos11.c
// Function: bitmapAllocBlock
static uint16_t bitmapAllocBlock(
  struct mountedFS *mount
)
{
  struct DOS11data *data = &mount->dos11data;
  uint16_t map = data->bmscan / MAP_BLOCKS;
  uint16_t offset = data->bmscan % MAP_BLOCKS;

  /*
   * Iterate across all available bitmaps.
   */
  while (map < data->bitmaps) {
    uint16_t wrd = offset / 16;
    uint16_t bit = offset % 16;

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

    /*
     * Iterate across a single bitmap.
     */
    while (wrd < MAP_LEN) {
      uint16_t val = le16toh(data->bmbuf[MAP_BMSTART + wrd]);

      if (val != 0177777) {
        data->bmscan = (map * MAP_BLOCKS) + (wrd * 16);

        while (bit < 16) {
          if ((val & bits[bit]) == 0) {
            val |= bits[bit];
            data->bmbuf[MAP_BMSTART + wrd] = htole16(val);
            data->bmdirty = 1;
            return (map * MAP_BLOCKS) + (wrd * 16) + bit;
          }
          bit++;
        }
      }
      wrd++;
      bit = 0;
    }
    map++;
    offset = 0;
  }
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movzwl 0x150(%rdi), %ebp
imull $0x8889, %ebp, %r14d    # imm = 0x8889
shrl $0x19, %r14d
cmpw 0x4c(%rdi), %r14w
jae 0x7b99
movq %rdi, %rbx
imull $0x3c0, %r14d, %eax     # imm = 0x3C0
subl %eax, %ebp
movzwl %r14w, %eax
imull $0xfffffc40, %eax, %r15d # imm = 0xFFFFFC40
leaq 0x109bb(%rip), %r12     # 0x184c0
movzwl %r14w, %esi
movq %rbx, %rdi
callq 0x9552
testl %eax, %eax
je 0x7b99
movl %ebp, %eax
andl $0xf, %eax
movzwl %bp, %ecx
imull $0x3c0, %r14d, %edx     # imm = 0x3C0
shrl $0x4, %ecx
andl $-0x10, %ebp
movl %r15d, %esi
subl %ebp, %esi
movzwl %si, %esi
movzwl 0x15c(%rbx,%rcx,2), %edi
cmpw $-0x1, %di
je 0x7b6a
movl %ecx, %r8d
shll $0x4, %r8d
addl %edx, %r8d
movw %r8w, 0x150(%rbx)
movzwl (%r12,%rax,2), %r8d
testw %di, %r8w
je 0x7b9d
incq %rax
cmpq $0x10, %rax
jne 0x7b56
leaq 0x1(%rcx), %rdi
addq $-0x10, %rsi
movl $0x0, %eax
cmpq $0x3b, %rcx
movq %rdi, %rcx
jb 0x7b36
incl %r14d
addl $0xfffffc40, %r15d      # imm = 0xFFFFFC40
xorl %ebp, %ebp
cmpw 0x4c(%rbx), %r14w
jb 0x7b05
jmp 0x7bb4
xorl %ebp, %ebp
jmp 0x7bb4
orl %edi, %r8d
movw %r8w, 0x15c(%rbx,%rcx,2)
movb $0x1, 0x152(%rbx)
subl %esi, %eax
movl %eax, %ebp
movl %ebp, %eax
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: dos11ReadBytes
int dos11ReadBytes(
  struct dos11OpenFile *file,
  char *buf,
  int len
)
{
  int count = 0;

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

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

    file->nab = (le16toh(file->creation) & UFD_TYPE) == 0 ? 2 : 0;
    file->eob = file->current == le16toh(file->last) ?
      le16toh(file->nfb) : file->mount->blocksz;
  }

  while (len) {
    if (file->nab == file->eob) {
      if (file->current == le16toh(file->last))
        break;

      if ((le16toh(file->creation) & UFD_TYPE) == 0)
        file->current = le16toh(*((uint16_t *)(file->buffer)));
      else file->current++;

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

      file->nab = (le16toh(file->creation) & UFD_TYPE) == 0 ? 2 : 0;
      file->eob = file->current == le16toh(file->last) ?
        le16toh(file->nfb) : file->mount->blocksz;
      continue;
    }
    *buf++ = file->buffer[file->nab++];
    len--;
    count++;
  }
  return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
cmpw $0x0, 0x30(%rdi)
jne 0x7fa6
movzwl 0xa(%r15), %esi
movw %si, 0x30(%r15)
movq 0x20(%r15), %rdi
movq 0x28(%r15), %rdx
callq 0x7621
testl %eax, %eax
je 0x8059
movzwl 0x6(%r15), %eax
notl %eax
shrl $0xe, %eax
andl $0x2, %eax
movw %ax, 0x32(%r15)
movzwl 0x30(%r15), %eax
cmpw 0xe(%r15), %ax
jne 0x7f99
movzwl 0x8(%r15), %eax
jmp 0x7fa1
movq 0x20(%r15), %rax
movzwl 0x28(%rax), %eax
movw %ax, 0x34(%r15)
testl %ebx, %ebx
je 0x8059
xorl %ebp, %ebp
movl %ebx, %r12d
movzwl 0x32(%r15), %eax
cmpw 0x34(%r15), %ax
jne 0x8032
movzwl 0x30(%r15), %eax
cmpw 0xe(%r15), %ax
je 0x805b
cmpw $0x0, 0x6(%r15)
js 0x7fe0
movq 0x28(%r15), %rdx
movzwl (%rdx), %eax
jmp 0x7fe6
incl %eax
movq 0x28(%r15), %rdx
movw %ax, 0x30(%r15)
movq 0x20(%r15), %rdi
movzwl %ax, %esi
callq 0x7621
testl %eax, %eax
je 0x8059
movzwl 0x6(%r15), %eax
notl %eax
shrl $0xe, %eax
andl $0x2, %eax
movw %ax, 0x32(%r15)
movzwl 0x30(%r15), %ecx
cmpw 0xe(%r15), %cx
jne 0x8020
movzwl 0x8(%r15), %ecx
jmp 0x8028
movq 0x20(%r15), %rcx
movzwl 0x28(%rcx), %ecx
movw %cx, 0x34(%r15)
cmpw %cx, %ax
je 0x7fbf
movq 0x28(%r15), %rcx
leal 0x1(%rax), %edx
movw %dx, 0x32(%r15)
movzwl %ax, %eax
movb (%rcx,%rax), %al
movb %al, (%r14)
incq %r14
incl %ebp
decl %r12d
jne 0x7fb3
movl %ebx, %ebp
jmp 0x805b
xorl %ebp, %ebp
movl %ebp, %eax
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: dos11WriteFile
size_t dos11WriteFile(
  void *filep,
  void *buf,
  size_t buflen
)
{
  struct dos11OpenFile *file = filep;
  char *bufw = buf;

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

    /*
     * Write a line, terminated by <CRLF>, to the open file.
     */
    while (buflen != 0) {
      char ch;

      ch = bufw[count++] & 0177;
      buflen--;
      if (dos11WriteBytes(file, &ch, 1) == 0)
        break;
    }
    return count;
  }
  return dos11WriteBytes(file, bufw, 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 0x10dc5(%rip), %rax     # 0x18fd8
testb $0x1, (%rax)
jne 0x822a
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x8066
movslq %eax, %r12
jmp 0x825d
xorl %r12d, %r12d
leaq 0xf(%rsp), %r13
cmpq %r12, %rbx
je 0x825a
movb (%r14,%r12), %al
incq %r12
andb $0x7f, %al
movb %al, 0xf(%rsp)
movq %r15, %rdi
movq %r13, %rsi
movl $0x1, %edx
callq 0x8066
testl %eax, %eax
jne 0x8232
jmp 0x825d
movq %rbx, %r12
movq %r12, %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: dos11OpenFileR
static void *dos11OpenFileR(
  struct mountedFS *mount,
  uint8_t UNUSED(unit),
  char *fname
)
{
  struct DOS11data *data = &mount->dos11data;
  struct dos11OpenFile *file;
  struct dos11FileSpec spec;
  uint8_t user = data->user;
  uint8_t group = data->group;

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

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

    if (dos11LookupFile(mount, &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 %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r15
movq %rdi, %r14
movzbl 0x955(%rdi), %edx
movzbl 0x954(%rdi), %ecx
leaq 0x6(%rsp), %rsi
movq %r15, %rdi
xorl %r8d, %r8d
callq 0x7c06
testl %eax, %eax
je 0x9235
movl $0x1, %edi
movl $0x38, %esi
callq 0x31c0
testq %rax, %rax
je 0x9226
movq %rax, %rbx
leaq 0x6(%rsp), %rsi
movq %r14, %rdi
movq %rax, %rdx
callq 0x7787
testl %eax, %eax
je 0x921e
movq 0x28(%r14), %rdi
callq 0x3220
movq %rax, 0x28(%rbx)
testq %rax, %rax
je 0x921e
movl $0x0, 0x18(%rbx)
jmp 0x9228
movq %rbx, %rdi
callq 0x3050
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq 0xedb4(%rip), %rax      # 0x17ff0
movq (%rax), %rdi
leaq 0x8b91(%rip), %rsi      # 0x11dd7
xorl %ebx, %ebx
movq %r15, %rdx
xorl %eax, %eax
callq 0x31e0
jmp 0x9228
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/converters/fsio/dos11.c
// Function: dos11OpenFileW
static void *dos11OpenFileW(
  struct mountedFS *mount,
  uint8_t UNUSED(unit),
  char *fname,
  off_t size
)
{
  struct DOS11data *data = &mount->dos11data;
  struct dos11OpenFile *file;
  struct dos11FileSpec spec;
  unsigned long contig = (size + mount->blocksz - 1) / mount->blocksz;
  uint8_t user = data->user;
  uint8_t group = data->group;

  if (SWISSET('c') && (contig == 0)) {
      fprintf(stderr,"DOS-11 contiguous files must be at least 1 block\n");
      return NULL;
  }

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

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

    if (dos11LookupFile(mount, &spec, file) == 0) {
      /*
       * Allocate local bufferspace for the file.
       */
      if ((file->buffer = malloc(mount->blocksz)) != NULL) {
        if (dos11CreateFile(mount, &spec, file, contig) == 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 fprintf(stderr, "Memory allocation failure\n");
  return file;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rdi, %r15
movq 0x28(%rdi), %rsi
decq %rcx
leaq (%rcx,%rsi), %rax
xorl %edx, %edx
divq %rsi
movq %rax, %r12
addq %rsi, %rcx
jae 0x928f
leaq 0xfd54(%rip), %rax      # 0x18fd8
movl (%rax), %eax
andl $0x4, %eax
jne 0x9311
movzbl 0x954(%r15), %ecx
movzbl 0x955(%r15), %edx
leaq 0xe(%rsp), %rsi
movq %rbx, %rdi
xorl %r8d, %r8d
callq 0x7c06
testl %eax, %eax
je 0x9318
movl $0x1, %edi
movl $0x38, %esi
callq 0x31c0
testq %rax, %rax
je 0x9338
movq %rax, %r14
leaq 0xe(%rsp), %rsi
movq %r15, %rdi
movq %rax, %rdx
callq 0x7787
testl %eax, %eax
jne 0x933f
movq 0x28(%r15), %rdi
callq 0x3220
movq %rax, 0x28(%r14)
testq %rax, %rax
je 0x934c
leaq 0xe(%rsp), %rsi
movq %r15, %rdi
movq %r14, %rdx
movq %r12, %rcx
callq 0x6f87
testl %eax, %eax
je 0x9359
movl $0x1, 0x18(%r14)
jmp 0x936e
callq 0x3dae
jmp 0x936b
movq 0xecd1(%rip), %rax      # 0x17ff0
movq (%rax), %rdi
leaq 0x8aae(%rip), %rsi      # 0x11dd7
xorl %r14d, %r14d
movq %rbx, %rdx
xorl %eax, %eax
callq 0x31e0
jmp 0x936e
callq 0x3d92
jmp 0x936b
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3c68
jmp 0x936b
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3d32
jmp 0x936b
movq %r14, %rsi
addq $0x28, %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x3cc8
xorl %r14d, %r14d
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq