// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/apple2-dsk.c
// Function: do_woz_INFO
static void do_woz_INFO(deark *c, struct de_iffctx *ictx,
	const struct de_iffchunkctx *chunkctx)
{
	u8 b;
	i64 n;
	i64 pos = chunkctx->dpos;
	struct wozmoofctx_struct *d = ictx->userdata;
	de_ucstring *s = NULL;

	if(chunkctx->dlen<37) return;
	b = dbuf_getbyte_p(ictx->f, &pos);
	de_dbg(c, "INFO chunk version: %d", (int)b);
	b = dbuf_getbyte_p(ictx->f, &pos);
	de_dbg(c, "disk type: %d (%s)", (int)b, get_woz_disk_type_name(b));
	b = dbuf_getbyte_p(ictx->f, &pos);
	de_dbg(c, "write protected: %d", (int)b);
	b = dbuf_getbyte_p(ictx->f, &pos);
	de_dbg(c, "synchronized: %d", (int)b);
	b = dbuf_getbyte_p(ictx->f, &pos);
	de_dbg(c, "cleaned: %d", (int)b);

	s = ucstring_create(c);
	dbuf_read_to_ucstring(ictx->f, pos, 32, s, 0, DE_ENCODING_UTF8);
	ucstring_strip_trailing_spaces(s);
	de_dbg(c, "creator: \"%s\"", ucstring_getpsz(s));
	pos += 32;

	if(d->wozver<'2') goto done;

	b = dbuf_getbyte_p(ictx->f, &pos);
	de_dbg(c, "disk sides: %d", (int)b);
	b = dbuf_getbyte_p(ictx->f, &pos);
	de_dbg(c, "boot sector format: %d", (int)b);
	b = dbuf_getbyte_p(ictx->f, &pos);
	de_dbg(c, "optimal bit timing: %d", (int)b);
	n = dbuf_getu16le_p(ictx->f, &pos);
	de_dbg(c, "compatible hardware: %d", (int)n);
	n = dbuf_getu16le_p(ictx->f, &pos);
	de_dbg(c, "required RAM: %dK", (int)n);
	n = dbuf_getu16le_p(ictx->f, &pos);
	de_dbg(c, "largest track: %d blocks", (int)n);

done:
	ucstring_destroy(s);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x25, 0x48(%rax)
jge 0x3c224
jmp 0x3c49b
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165170
movb %al, -0x19(%rbp)
movq -0x8(%rbp), %rdi
movzbl -0x19(%rbp), %edx
leaq 0x16644d(%rip), %rsi    # 0x1a2694
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165170
movb %al, -0x19(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movzbl -0x19(%rbp), %eax
movl %eax, -0x4c(%rbp)
movzbl -0x19(%rbp), %edi
callq 0x3c4b0
movq -0x58(%rbp), %rdi
movl -0x4c(%rbp), %edx
movq %rax, %rcx
leaq 0x166420(%rip), %rsi    # 0x1a26ab
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165170
movb %al, -0x19(%rbp)
movq -0x8(%rbp), %rdi
movzbl -0x19(%rbp), %edx
leaq 0x166409(%rip), %rsi    # 0x1a26be
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165170
movb %al, -0x19(%rbp)
movq -0x8(%rbp), %rdi
movzbl -0x19(%rbp), %edx
leaq 0x1663f3(%rip), %rsi    # 0x1a26d2
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165170
movb %al, -0x19(%rbp)
movq -0x8(%rbp), %rdi
movzbl -0x19(%rbp), %edx
leaq 0x166488(%rip), %rsi    # 0x1a2791
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rsi
movq -0x40(%rbp), %rcx
movl $0x20, %edx
xorl %r8d, %r8d
movl $0x2, %r9d
callq 0x1669f0
movq -0x40(%rbp), %rdi
callq 0x171360
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
callq 0x172500
movq -0x48(%rbp), %rdi
movq %rax, %rdx
leaq 0x166392(%rip), %rsi    # 0x1a26fa
movb $0x0, %al
callq 0x15b0d0
movq -0x30(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x32, %eax
jge 0x3c38d
jmp 0x3c492
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165170
movb %al, -0x19(%rbp)
movq -0x8(%rbp), %rdi
movzbl -0x19(%rbp), %edx
leaq 0x1663ed(%rip), %rsi    # 0x1a279d
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165170
movb %al, -0x19(%rbp)
movq -0x8(%rbp), %rdi
movzbl -0x19(%rbp), %edx
leaq 0x1663d2(%rip), %rsi    # 0x1a27ac
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165170
movb %al, -0x19(%rbp)
movq -0x8(%rbp), %rdi
movzbl -0x19(%rbp), %edx
leaq 0x1663bf(%rip), %rsi    # 0x1a27c3
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %edx
leaq 0x1663a9(%rip), %rsi    # 0x1a27da
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %edx
leaq 0x166394(%rip), %rsi    # 0x1a27f2
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %edx
leaq 0x16627d(%rip), %rsi    # 0x1a2708
movb $0x0, %al
callq 0x15b0d0
movq -0x40(%rbp), %rdi
callq 0x171750
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)