// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rar.c
// Function: do_rar_old
static void do_rar_old(deark *c, de_arch_lctx *d)
{
	i64 pos = d->data_startpos;
	i64 hdrpos;
	i64 hdrlen;
	struct de_arch_member_data *md = NULL;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);
	de_declare_fmt(c, "RAR (<v1.50)");
	hdrpos = pos;
	de_dbg(c, "archive header at %"I64_FMT, hdrpos);
	de_dbg_indent(c, 1);
	pos += 4; // header ID
	hdrlen = de_getu16le_p(&pos);
	de_dbg(c, "hdr len: %"I64_FMT, hdrlen);
	d->archive_flags = (UI)de_getbyte_p(&pos);
	de_dbg(c, "flags: 0x%02x", d->archive_flags);

	if(d->archive_flags & 0x02) {
		i64 cmtlen;

		cmtlen = de_getu16le_p(&pos);
		de_dbg(c, "archive comment at %"I64_FMT", len=%"I64_FMT", compressed=%d",
			pos, cmtlen, (int)((d->archive_flags & 0x10)!=0));
		if((d->archive_flags & 0x10)==0) {
			// The old format supports a non-compressed archive comment, though for
			// v1.4.0+ it is always(?) compressed.
			rar_handle_noncmpr_comment(c, d, pos, cmtlen, d->input_encoding, 0);
		}
		pos += cmtlen;
	}

	if(d->archive_flags & 0x20) {
		i64 ext1len;

		ext1len = de_getu16le_p(&pos);
		de_dbg(c, "EXT1 field at %"I64_FMT", len=%"I64_FMT, pos, ext1len);
		pos += ext1len;
	}

	de_dbg_indent_restore(c, saved_indent_level);

	pos = hdrpos + hdrlen;
	while(1) {
		if(pos >= c->infile->len) break;
		if(md) {
			de_arch_destroy_md(c, md);
			md = NULL;
		}
		md = de_arch_create_md(c, d);
		md->member_hdr_pos = pos;
		do_rar_old_member(c, d, md);

		if(d->fatalerrflag) goto done;
		if(md->member_total_size <= 0) goto done;
		pos += md->member_total_size;
	}

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x18(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x34(%rbp), %rsi
callq 0x15b580
movq -0x8(%rbp), %rdi
leaq 0x804bd(%rip), %rsi     # 0x1d0d49
callq 0x15e380
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x5e1ba(%rip), %rsi     # 0x1aea62
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x18(%rbp), %rax
addq $0x4, %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 0x6131d(%rip), %rsi     # 0x1b1c0a
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x165170
movzbl %al, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x60(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x60(%rax), %edx
leaq 0x6b1f8(%rip), %rsi     # 0x1bbb19
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movl 0x60(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x1509bb
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movl 0x60(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %r8d
leaq 0x803dd(%rip), %rsi     # 0x1d0d56
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movl 0x60(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
jne 0x1509af
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movl 0x18(%rax), %r8d
xorl %r9d, %r9d
callq 0x150d10
movq -0x40(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl 0x60(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x150a05
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x48(%rbp), %rcx
leaq 0x80393(%rip), %rsi     # 0x1d0d85
movb $0x0, %al
callq 0x15b0d0
movq -0x48(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0x15b5a0
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpq 0x18(%rcx), %rax
jl 0x150a31
jmp 0x150aa9
cmpq $0x0, -0x30(%rbp)
je 0x150a4d
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x17c1a0
movq $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x17c120
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x150e30
movq -0x10(%rbp), %rax
cmpl $0x0, 0x38(%rax)
je 0x150a87
jmp 0x150aab
movq -0x30(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jg 0x150a94
jmp 0x150aab
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x150a1d
jmp 0x150aab
cmpq $0x0, -0x30(%rbp)
je 0x150abf
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x17c1a0
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0x15b5a0
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)