// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/misc3.c
// Function: do_arcv_v2
static void do_arcv_v2(deark *c, de_arch_lctx *d)
{
	i64 pos = 0;
	i64 arcv_hdr_len;
	i64 blck_hdr_len;
	i64 blck_dlen;
	u32 id;
	struct de_arch_member_data *md = NULL;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);

	arcv_hdr_len = de_getu16le(6);
	de_dbg(c, "arcv hdr len: %"I64_FMT, arcv_hdr_len);

	pos = arcv_hdr_len;
	while(1) {
		i64 nbytes_consumed = 0;

		if(pos >= c->infile->len) {
			goto done;
		}
		de_dbg(c, "member at %"I64_FMT, pos);

		if(md) {
			de_arch_destroy_md(c, md);
			md = NULL;
		}
		md = de_arch_create_md(c, d);
		md->member_hdr_pos = pos;

		de_dbg_indent(c, 1);
		id = (u32)de_getu32be_p(&pos);
		if(id!=CODE_BLCK) {
			de_dbg(c, "can't find item at %"I64_FMT, md->member_hdr_pos);
			goto done;
		}
		pos += 2; // format version?
		blck_hdr_len = de_getu16le_p(&pos);
		de_dbg(c, "block hdr len: %"I64_FMT, blck_hdr_len);
		pos += 4; // ?

		blck_dlen = de_getu32le_p(&pos);
		de_dbg(c, "block dlen: %"I64_FMT, blck_dlen);

		pos = md->member_hdr_pos+16;

		do_arcv_common_fields(c, d, md, pos, &nbytes_consumed);
		pos += nbytes_consumed;

		md->cmpr_pos = pos;
		de_dbg(c, "file data at %"I64_FMT", len=%"I64_FMT, md->cmpr_pos, md->cmpr_len);

		pos = md->member_hdr_pos + blck_hdr_len + blck_dlen;
		de_dbg_indent(c, -1);
	}

done:
	de_dbg_indent_restore(c, saved_indent_level);
	if(md) {
		de_arch_destroy_md(c, md);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x44(%rbp), %rsi
callq 0x15b580
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x6, %esi
callq 0x165280
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x10e4bc(%rip), %rsi    # 0x1b1b9e
movb $0x0, %al
callq 0x15b0d0
movq -0x20(%rbp), %rax
movq %rax, -0x18(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpq 0x18(%rcx), %rax
jl 0xa3710
jmp 0xa38a1
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x123c73(%rip), %rsi    # 0x1c7392
movb $0x0, %al
callq 0x15b0d0
cmpq $0x0, -0x40(%rbp)
je 0xa3742
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x17c1a0
movq $0x0, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x17c120
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x1654b0
movl %eax, -0x34(%rbp)
cmpl $0x424c434b, -0x34(%rbp) # imm = 0x424C434B
je 0xa37a9
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rdx
leaq 0x10e450(%rip), %rsi    # 0x1b1bed
movb $0x0, %al
callq 0x15b0d0
jmp 0xa38a1
movq -0x18(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x10e42b(%rip), %rsi    # 0x1b1c04
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x165580
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x10e407(%rip), %rsi    # 0x1b1c17
movb $0x0, %al
callq 0x15b0d0
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
addq $0x10, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x18(%rbp), %rcx
leaq -0x50(%rbp), %r8
callq 0xa38d0
movq -0x50(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x40(%rax), %rdx
movq -0x40(%rbp), %rax
movq 0x30(%rax), %rcx
leaq 0x11faf0(%rip), %rsi    # 0x1c3363
movb $0x0, %al
callq 0x15b0d0
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
addq -0x28(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
jmp 0xa36f1
movq -0x8(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x15b5a0
cmpq $0x0, -0x40(%rbp)
je 0xa38c1
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x17c1a0
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)