// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/apple2-dsk.c
// Function: do_read_VTOC
static void do_read_VTOC(deark *c, lctx *d, UI tr, UI se)
{
	i64 pos1 = trksec_to_offset(d, tr, se);
	i64 pos = pos1;
	int n;

	de_dbg(c, "VTOC at %u,%u (%"I64_FMT")", tr, se, pos1);
	de_dbg_indent(c, 1);
	pos++;
	d->catalog_tr = (UI)de_getbyte_p(&pos);
	d->catalog_se = (UI)de_getbyte_p(&pos);
	de_dbg(c, "catalog trk,sec: %u,%u", d->catalog_tr, d->catalog_se);
	n = (int)de_getbyte_p(&pos);
	de_dbg(c, "created by DOS ver: %d", n);
	pos += 2; // unused
	n = (int)de_getbyte_p(&pos);
	de_dbg(c, "volume num: %d", n);
	// 7-38  unused
	pos = pos1 + 39;
	n = (int)de_getbyte_p(&pos);
	de_dbg(c, "items per sector list sector: %d", n);
	// 40-47 unused
	pos = pos1 + 48;
	pos++; // last track with allocated sectors
	pos++; // direction of allocation
	pos += 2; // unused
	n = (int)de_getbyte_p(&pos);
	de_dbg(c, "num tracks: %d", n);
	n = (int)de_getbyte_p(&pos);
	de_dbg(c, "sectors/track: %d", n);
	n = (int)de_getu16le_p(&pos);
	de_dbg(c, "bytes/sector: %d", n);
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0x3abd0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
movq -0x20(%rbp), %r8
leaq 0x167a38(%rip), %rsi    # 0x1a237e
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x165170
movzbl %al, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x165170
movzbl %al, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x18(%rax), %edx
movq -0x10(%rbp), %rax
movl 0x1c(%rax), %ecx
leaq 0x1679dc(%rip), %rsi    # 0x1a2392
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %edx
leaq 0x1679c7(%rip), %rsi    # 0x1a23a9
movb $0x0, %al
callq 0x15b0d0
movq -0x28(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %edx
leaq 0x1679a6(%rip), %rsi    # 0x1a23c0
movb $0x0, %al
callq 0x15b0d0
movq -0x20(%rbp), %rax
addq $0x27, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %edx
leaq 0x16797d(%rip), %rsi    # 0x1a23cf
movb $0x0, %al
callq 0x15b0d0
movq -0x20(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %edx
leaq 0x167942(%rip), %rsi    # 0x1a23f0
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %edx
leaq 0x164287(%rip), %rsi    # 0x19ed61
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x1652c0
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %edx
leaq 0x1678fc(%rip), %rsi    # 0x1a23ff
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x30, %rsp
popq %rbp
retq
nop