// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/amiga-dsk.c
// Function: read_file_segment_from_extension_block
static int read_file_segment_from_extension_block(deark *c, lctx *d, struct member_data *md,
	i64 blknum, i64 *pnextblock)
{
	u64 pos1;
	int blocktype;
	int retval = 0;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);

	pos1 = blocknum_to_offset(d, blknum);
	de_dbg(c, "file ext. block #%"I64_FMT, blknum);
	de_dbg_indent(c, 1);

	if(!claim_block(c, d, blknum)) {
		goto done;
	}

	blocktype = (int)de_geti32be(pos1);
	de_dbg(c, "block type: %d", blocktype);
	if(blocktype!=ADF_T_LIST) {
		de_err(c, "%s: Bad extension block type in (%d, expected %d)",
			ucstring_getpsz_d(md->fn), blocktype, (int)ADF_T_LIST);
		goto done;
	}

	md->tmpbpt.high_seq = de_getu32be(pos1+8);
	de_dbg(c, "high_seq: %u", (UI)md->tmpbpt.high_seq);
	read_blocks_table(c, d, pos1+24, &md->tmpbpt);

	if(!read_file_segment_from_blocks_tbl(c, d, md)) {
		goto done;
	}

	*pnextblock = de_getu32be(pos1+d->bsize-8);
	de_dbg(c, "next ext. block: %"I64_FMT, (i64)(*pnextblock));

	retval = 1;

done:
	de_dbg_indent_restore(c, saved_indent_level);
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl $0x0, -0x38(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
callq 0x15b580
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x33b10
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x16c1da(%rip), %rsi    # 0x1a0e2a
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x33b30
cmpl $0x0, %eax
jne 0x34c80
jmp 0x34d9f
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rsi
callq 0x1655d0
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %edx
leaq 0x16bef7(%rip), %rsi    # 0x1a0b99
movb $0x0, %al
callq 0x15b0d0
cmpl $0x10, -0x34(%rbp)
je 0x34ce7
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x172650
movq -0x48(%rbp), %rdi
movq %rax, %rdx
movl -0x34(%rbp), %ecx
leaq 0x16c16a(%rip), %rsi    # 0x1a0e3f
movl $0x10, %r8d
movb $0x0, %al
callq 0x15bfb0
jmp 0x34d9f
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rsi
addq $0x8, %rsi
callq 0x165470
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rax
movl %eax, %edx
leaq 0x16c075(%rip), %rsi    # 0x1a0d91
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
addq $0x18, %rdx
movq -0x18(%rbp), %rcx
addq $0x70, %rcx
callq 0x34880
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x34ac0
cmpl $0x0, %eax
jne 0x34d58
jmp 0x34d9f
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rsi
movq -0x10(%rbp), %rax
addq 0x8(%rax), %rsi
subq $0x8, %rsi
callq 0x165470
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rdx
leaq 0x16c0e0(%rip), %rsi    # 0x1a0e71
movb $0x0, %al
callq 0x15b0d0
movl $0x1, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movl -0x3c(%rbp), %esi
callq 0x15b5a0
movl -0x38(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)