// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rar.c
// Function: do_rar_old_member
static void do_rar_old_member(deark *c, de_arch_lctx *d, struct de_arch_member_data *md)
{
	i64 n;
	u8 b;
	i64 pos = md->member_hdr_pos;
	i64 hdrlen;
	i64 fnlen;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);
	de_dbg(c, "member file at %"I64_FMT, md->member_hdr_pos);
	de_dbg_indent(c, 1);

	de_arch_read_field_cmpr_len_p(md, &pos);
	de_arch_read_field_orig_len_p(md, &pos);

	// Note: This is a checksum of the decompressed bytes. Algorithm:
	//  Initialize ck = 0x0000
	//  For each byte b:
	//    * ck = ck + b
	//    * Rotate ck left 1 bit,
	//      i.e. ck = (ck & 0x7fff)<<1 | (ck & 0x8000)>>15)
	n = de_getu16le_p(&pos);
	de_dbg(c, "checksum: 0x%04x", (UI)n);

	hdrlen = de_getu16le_p(&pos);
	de_dbg(c, "hdr len: %u", (int)hdrlen);

	if(hdrlen < 12) {
		d->fatalerrflag = 1;
		goto done;
	}

	md->member_total_size = hdrlen + md->cmpr_len;

	de_arch_read_field_dttm_p(d, &md->fi->timestamp[DE_TIMESTAMPIDX_MODIFY], "mod",
		DE_ARCH_TSTYPE_DOS_TD, &pos);
	de_arch_read_field_dos_attr_p(md, &pos);

	md->file_flags = (UI)de_getbyte_p(&pos); // status flags
	de_dbg(c, "flags: 0x%02x", md->file_flags);

	b = de_getbyte_p(&pos);
	de_dbg(c, "min ver needed to unpack: %u", (UI)b);

	fnlen = (i64)de_getbyte_p(&pos);

	md->cmpr_meth = (UI)de_getbyte_p(&pos);
	de_dbg(c, "cmpr. method: %u (%s)", md->cmpr_meth, get_generic_rar_cmpr_name(md->cmpr_meth));

	// Spec says the filename occurs *after* the comment, but (for v1.40.2)
	// it just isn't true.
	dbuf_read_to_ucstring(c->infile, pos, fnlen, md->filename, 0,
		d->input_encoding);
	de_dbg(c, "filename: \"%s\"", ucstring_getpsz_d(md->filename));
	pos += fnlen;

	if(md->file_flags & 0x08) {
		i64 cmtlen;

		cmtlen = de_getu16le_p(&pos);
		de_dbg(c, "file comment at %"I64_FMT", len=%"I64_FMT, pos, cmtlen);
		rar_handle_noncmpr_comment(c, d, pos, cmtlen, d->input_encoding, 1);
		pos += cmtlen;
	}

	md->cmpr_pos = md->member_hdr_pos + hdrlen;
	de_dbg(c, "cmpr. data at %"I64_FMT", len=%"I64_FMT, md->cmpr_pos, md->cmpr_len);

done:
	de_dbg_indent_restore(c, saved_indent_level);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x44(%rbp), %rsi
callq 0x15b580
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdx
leaq 0x60b75(%rip), %rsi     # 0x1b19e5
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x18(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x17c400
movq -0x18(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x17c350
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movl %eax, %edx
leaq 0x5d31f(%rip), %rsi     # 0x1ae1e4
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movl %eax, %edx
leaq 0x7fec4(%rip), %rsi     # 0x1d0db6
movb $0x0, %al
callq 0x15b0d0
cmpq $0xc, -0x38(%rbp)
jge 0x150f10
movq -0x10(%rbp), %rax
movl $0x1, 0x38(%rax)
jmp 0x151130
movq -0x38(%rbp), %rcx
movq -0x18(%rbp), %rax
addq 0x30(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rsi
addq $0x18, %rsi
leaq 0x52fb8(%rip), %rdx     # 0x1a3ef3
movl $0x4, %ecx
leaq -0x30(%rbp), %r8
callq 0x17c580
movq -0x18(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x17c540
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165170
movzbl %al, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x94(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x94(%rax), %edx
leaq 0x6ab90(%rip), %rsi     # 0x1bbb19
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165170
movb %al, -0x21(%rbp)
movq -0x8(%rbp), %rdi
movzbl -0x21(%rbp), %edx
leaq 0x7fe0f(%rip), %rsi     # 0x1d0dc2
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165170
movzbl %al, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x90(%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x18(%rbp), %rax
movl 0x90(%rax), %eax
movl %eax, -0x5c(%rbp)
movq -0x18(%rbp), %rax
movl 0x90(%rax), %edi
callq 0x151150
movq -0x68(%rbp), %rdi
movl -0x5c(%rbp), %edx
movq %rax, %rcx
leaq 0x7fdba(%rip), %rsi     # 0x1d0ddf
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rcx
movq -0x10(%rbp), %rax
movl 0x18(%rax), %r9d
xorl %r8d, %r8d
callq 0x1669f0
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0x172650
movq -0x58(%rbp), %rdi
movq %rax, %rdx
leaq 0x7650c(%rip), %rsi     # 0x1c7583
movb $0x0, %al
callq 0x15b0d0
movq -0x40(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movl 0x94(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x1510fa
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
movq -0x50(%rbp), %rcx
leaq 0x7fd31(%rip), %rsi     # 0x1d0df5
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x50(%rbp), %rcx
movq -0x10(%rbp), %rax
movl 0x18(%rax), %r8d
movl $0x1, %r9d
callq 0x150d10
movq -0x50(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rcx
addq -0x38(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdx
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rcx
leaq 0x7fce9(%rip), %rsi     # 0x1d0e12
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x15b5a0
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)