// File: /workspace/github_c_makefile_star2_O0/mrkite[P]regs/src/dsk.cc
// Function: catalog(unsigned char, unsigned char, std::shared_ptr<TheHandle>, int)
static void catalog(uint8_t track, uint8_t sector, Handle h, int depth) {
  h->seek(track * 16 * 256 + sector * 256 + 1);
  auto nextTrack = h->r8();
  auto nextSector = h->r8();
  h->skip(8);
  auto ofs = h->tell();
  for (auto i = 0; i < 7; i++) {
    h->seek(ofs + i * 35);
    auto ftrack = h->r8();
    auto fsector = h->r8();
    auto type = h->r8() & 0x7f;
    auto name = readFilename(h, 30);
    auto length = h->r16();
    if (ftrack != 0xff && ftrack != 0x00) {
      if (depth < 0) {
        doFile(ftrack, fsector, type, name, length, h);
      } else {
        std::cout << name << std::endl << "Type: ";
        if (type < numTypes && types[type] != nullptr) {
          std::cout << types[type] << std::endl;
        } else {
          std::cout << static_cast<int>(type);
          if (type == 0x04) {  // binary
            std::cout << std::hex << "("
                      << doFile(ftrack, fsector, type, "", length, h)
                      << ")" << std::dec << std::endl;
          }
        }
        std::cout << "Blocks: " << length << std::endl;
      }
    }
  }
  if (nextTrack != 0) {
    catalog(nextTrack, nextSector, h, depth);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movq %rdx, -0xf0(%rbp)
movl %edi, %edx
movq -0xf0(%rbp), %rdi
movb %sil, %al
movb %dl, -0x1(%rbp)
movb %al, -0x2(%rbp)
movq %rdi, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
callq 0x4aa0
movq %rax, %rdi
movzbl -0x1(%rbp), %eax
shll $0x4, %eax
shll $0x8, %eax
movzbl -0x2(%rbp), %ecx
shll $0x8, %ecx
addl %ecx, %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x7380
movq -0xf0(%rbp), %rdi
callq 0x4aa0
movq %rax, %rdi
callq 0x7130
movq -0xf0(%rbp), %rdi
movb %al, -0x15(%rbp)
callq 0x4aa0
movq %rax, %rdi
callq 0x7130
movq -0xf0(%rbp), %rdi
movb %al, -0x16(%rbp)
callq 0x4aa0
movq %rax, %rdi
movl $0x8, %esi
callq 0x73a0
movq -0xf0(%rbp), %rdi
callq 0x4aa0
movq %rax, %rdi
callq 0x6fe0
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
cmpl $0x7, -0x24(%rbp)
jge 0x3f37
movq -0xf0(%rbp), %rdi
callq 0x4aa0
movq %rax, %rdi
movq -0x20(%rbp), %rsi
movl -0x24(%rbp), %eax
imull $0x23, %eax, %eax
cltq
addq %rax, %rsi
callq 0x7380
movq -0xf0(%rbp), %rdi
callq 0x4aa0
movq %rax, %rdi
callq 0x7130
movq -0xf0(%rbp), %rdi
movb %al, -0x25(%rbp)
callq 0x4aa0
movq %rax, %rdi
callq 0x7130
movq -0xf0(%rbp), %rdi
movb %al, -0x26(%rbp)
callq 0x4aa0
movq %rax, %rdi
callq 0x7130
movq -0xf0(%rbp), %rsi
movzbl %al, %eax
andl $0x7f, %eax
movl %eax, -0x2c(%rbp)
leaq -0x60(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x4ac0
movq -0xf8(%rbp), %rsi
leaq -0x50(%rbp), %rdi
movl $0x1e, %edx
callq 0x4070
jmp 0x3afd
leaq -0x60(%rbp), %rdi
callq 0x4af0
movq -0xf0(%rbp), %rdi
callq 0x4aa0
movq %rax, %rdi
callq 0x70e0
movw %ax, -0xfa(%rbp)
jmp 0x3b23
movw -0xfa(%rbp), %ax
movw %ax, -0x6e(%rbp)
movzbl -0x25(%rbp), %eax
cmpl $0xff, %eax
je 0x3f12
movzbl -0x25(%rbp), %eax
cmpl $0x0, %eax
je 0x3f12
cmpl $0x0, -0x14(%rbp)
jge 0x3c4d
movb -0x25(%rbp), %al
movb %al, -0xfd(%rbp)
movb -0x26(%rbp), %al
movb %al, -0xfc(%rbp)
movb -0x2c(%rbp), %al
movb %al, -0xfb(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x30d0
jmp 0x3b81
movq -0xf0(%rbp), %rsi
movzwl -0x6e(%rbp), %eax
movl %eax, -0x10c(%rbp)
leaq -0xa0(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x4ac0
movb -0xfd(%rbp), %dl
movb -0xfc(%rbp), %cl
movb -0xfb(%rbp), %al
movl -0x10c(%rbp), %r8d
movq -0x108(%rbp), %r9
movzbl %dl, %edi
movzbl %cl, %esi
movzbl %al, %edx
leaq -0x90(%rbp), %rcx
callq 0x41b0
jmp 0x3bdc
leaq -0xa0(%rbp), %rdi
callq 0x4af0
leaq -0x90(%rbp), %rdi
callq 0x3110
jmp 0x3f10
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x4af0
jmp 0x3fbc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x3f29
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x4af0
leaq -0x90(%rbp), %rdi
callq 0x3110
jmp 0x3f29
movq 0x837c(%rip), %rdi      # 0xbfd0
leaq -0x50(%rbp), %rsi
callq 0x31a0
movq %rax, -0x118(%rbp)
jmp 0x3c66
movq -0x118(%rbp), %rdi
movq 0x833c(%rip), %rsi      # 0xbfb0
callq 0x3200
movq %rax, -0x120(%rbp)
jmp 0x3c82
movq -0x120(%rbp), %rdi
leaq 0x43fd(%rip), %rsi      # 0x808d
callq 0x31b0
jmp 0x3c97
movslq -0x2c(%rbp), %rax
cmpq $0x11, %rax
jae 0x3cf1
movslq -0x2c(%rbp), %rcx
leaq 0x8664(%rip), %rax      # 0xc310
cmpq $0x0, (%rax,%rcx,8)
je 0x3cf1
movslq -0x2c(%rbp), %rcx
leaq 0x8652(%rip), %rax      # 0xc310
movq (%rax,%rcx,8), %rsi
movq 0x8307(%rip), %rdi      # 0xbfd0
callq 0x31b0
movq %rax, -0x128(%rbp)
jmp 0x3cd7
movq -0x128(%rbp), %rdi
movq 0x82cb(%rip), %rsi      # 0xbfb0
callq 0x3200
jmp 0x3cec
jmp 0x3ec4
movl -0x2c(%rbp), %esi
movq 0x82d5(%rip), %rdi      # 0xbfd0
callq 0x33a0
jmp 0x3d02
cmpl $0x4, -0x2c(%rbp)
jne 0x3ec2
movq 0x82bd(%rip), %rdi      # 0xbfd0
leaq 0x1216(%rip), %rsi      # 0x4f30
callq 0x30a0
movq %rax, -0x130(%rbp)
jmp 0x3d28
movq -0x130(%rbp), %rdi
leaq 0x435e(%rip), %rsi      # 0x8094
callq 0x31b0
movq %rax, -0x138(%rbp)
jmp 0x3d44
movb -0x25(%rbp), %al
movb %al, -0x143(%rbp)
movb -0x26(%rbp), %al
movb %al, -0x142(%rbp)
movb -0x2c(%rbp), %al
movb %al, -0x141(%rbp)
leaq -0xc1(%rbp), %rdi
movq %rdi, -0x140(%rbp)
callq 0x33e0
movq -0x140(%rbp), %rdx
leaq 0x42e2(%rip), %rsi      # 0x8062
leaq -0xc0(%rbp), %rdi
callq 0x4be0
jmp 0x3d8e
movq -0xf0(%rbp), %rsi
movzwl -0x6e(%rbp), %eax
movl %eax, -0x154(%rbp)
leaq -0xd8(%rbp), %rdi
movq %rdi, -0x150(%rbp)
callq 0x4ac0
movb -0x143(%rbp), %dl
movb -0x142(%rbp), %cl
movb -0x141(%rbp), %al
movl -0x154(%rbp), %r8d
movq -0x150(%rbp), %r9
movzbl %dl, %edi
movzbl %cl, %esi
movzbl %al, %edx
leaq -0xc0(%rbp), %rcx
callq 0x41b0
movw %ax, -0x146(%rbp)
jmp 0x3df0
movq -0x138(%rbp), %rdi
movw -0x146(%rbp), %ax
movzwl %ax, %esi
callq 0x3390
movq %rax, -0x160(%rbp)
jmp 0x3e0f
movq -0x160(%rbp), %rdi
leaq 0x42d4(%rip), %rsi      # 0x80f1
callq 0x31b0
movq %rax, -0x168(%rbp)
jmp 0x3e2b
movq -0x168(%rbp), %rdi
leaq 0x1127(%rip), %rsi      # 0x4f60
callq 0x30a0
movq %rax, -0x170(%rbp)
jmp 0x3e47
movq -0x170(%rbp), %rdi
movq 0x815b(%rip), %rsi      # 0xbfb0
callq 0x3200
jmp 0x3e5c
leaq -0xd8(%rbp), %rdi
callq 0x4af0
leaq -0xc0(%rbp), %rdi
callq 0x3110
leaq -0xc1(%rbp), %rdi
callq 0x3240
jmp 0x3ec2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x3eb4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x4af0
leaq -0xc0(%rbp), %rdi
callq 0x3110
leaq -0xc1(%rbp), %rdi
callq 0x3240
jmp 0x3f29
jmp 0x3ec4
movq 0x8105(%rip), %rdi      # 0xbfd0
leaq 0x41c4(%rip), %rsi      # 0x8096
callq 0x31b0
movq %rax, -0x178(%rbp)
jmp 0x3ee0
movq -0x178(%rbp), %rdi
movzwl -0x6e(%rbp), %esi
callq 0x3390
movq %rax, -0x180(%rbp)
jmp 0x3ef9
movq -0x180(%rbp), %rdi
movq 0x80a9(%rip), %rsi      # 0xbfb0
callq 0x3200
jmp 0x3f0e
jmp 0x3f10
jmp 0x3f12
leaq -0x50(%rbp), %rdi
callq 0x3110
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3a57
leaq -0x50(%rbp), %rdi
callq 0x3110
jmp 0x3fbc
movzbl -0x15(%rbp), %eax
cmpl $0x0, %eax
je 0x3fb3
movq -0xf0(%rbp), %rsi
movzbl -0x15(%rbp), %eax
movl %eax, -0x190(%rbp)
movzbl -0x16(%rbp), %eax
movl %eax, -0x18c(%rbp)
leaq -0xe8(%rbp), %rdi
movq %rdi, -0x188(%rbp)
callq 0x4ac0
movl -0x190(%rbp), %edi
movl -0x18c(%rbp), %esi
movq -0x188(%rbp), %rdx
movl -0x14(%rbp), %ecx
callq 0x39a0
jmp 0x3f8b
leaq -0xe8(%rbp), %rdi
callq 0x4af0
jmp 0x3fb3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x4af0
jmp 0x3fbc
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x33d0
nopw %cs:(%rax,%rax)