LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rsc.c
// Function: detect_rsc_format
static void detect_rsc_format(deark *c, lctx *d)
{
	i64 n_be, n_le;
	i64 pos;

	// Check the version number. Assumes PC format is always 0.
	n_be = de_getu16be(0);
	if(n_be != 0) {
		d->fmt = RSCFMT_ATARI;
		return;
	}

	// Check the (old-style) file size field
	n_le = de_getu16le(34);
	n_be = de_getu16be(34);
	if(n_le != n_be) {
		if(n_be==c->infile->len) {
			d->fmt = RSCFMT_ATARI;
			return;
		}
		if(n_le==c->infile->len) {
			d->fmt = RSCFMT_PC;
			return;
		}
	}

	// Check some file offsets
	for(pos=2; pos<=18; pos+=2) {
		n_le = de_getu16le(pos);
		if(n_le==0 || n_le==0xffff) continue;
		n_be = de_getu16be(pos);
		if(n_le > c->infile->len) {
			d->fmt = RSCFMT_ATARI;
			return;
		}
		if(n_be > c->infile->len) {
			d->fmt = RSCFMT_PC;
			return;
		}
		// Offsets should be even, I think.
		if(n_le&0x1) {
			d->fmt = RSCFMT_ATARI;
			return;
		}
		if(n_be&0x1) {
			d->fmt = RSCFMT_PC;
			return;
		}
	}

	// TODO: Is it worth doing more checks?
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1651d0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x1230ec
movq -0x10(%rbp), %rax
movl $0x1, 0xc(%rax)
jmp 0x123242
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x22, %esi
callq 0x165280
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x22, %esi
callq 0x1651d0
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x18(%rbp), %rax
je 0x123168
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpq 0x18(%rcx), %rax
jne 0x123144
movq -0x10(%rbp), %rax
movl $0x1, 0xc(%rax)
jmp 0x123242
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpq 0x18(%rcx), %rax
jne 0x123166
movq -0x10(%rbp), %rax
movl $0x2, 0xc(%rax)
jmp 0x123242
jmp 0x123168
movq $0x2, -0x28(%rbp)
cmpq $0x12, -0x28(%rbp)
jg 0x123242
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x165280
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1231a1
cmpq $0xffff, -0x20(%rbp)    # imm = 0xFFFF
jne 0x1231a6
jmp 0x123231
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x1651d0
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpq 0x18(%rcx), %rax
jle 0x1231da
movq -0x10(%rbp), %rax
movl $0x1, 0xc(%rax)
jmp 0x123242
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpq 0x18(%rcx), %rax
jle 0x1231f9
movq -0x10(%rbp), %rax
movl $0x2, 0xc(%rax)
jmp 0x123242
movq -0x20(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x123214
movq -0x10(%rbp), %rax
movl $0x1, 0xc(%rax)
jmp 0x123242
movq -0x18(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x12322f
movq -0x10(%rbp), %rax
movl $0x2, 0xc(%rax)
jmp 0x123242
jmp 0x123231
movq -0x28(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x28(%rbp)
jmp 0x123170
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rsc.c
// Function: do_extension_array
static void do_extension_array(deark *c, lctx *d)
{
	i64 pos;

	pos = d->rssize;
	de_dbg(c, "extension array at %"I64_FMT, d->rssize);
	de_dbg_indent(c, 1);
	if(!is_valid_segment_pos(c, d, d->rssize, 8, "Extension Array")) goto done;

	d->reported_file_size = gem_getu32(d, pos);
	de_dbg(c, "reported file size: %"I64_FMT, d->reported_file_size);
	d->avail_file_size = de_min_int(d->reported_file_size, c->infile->len);

	d->cicon_offs = gem_getu32m1(d, pos+4);
	if(d->cicon_offs==0) goto done;
	de_dbg(c, "CICON offset: %"I64_FMT, d->cicon_offs);

done:
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rdx
leaq 0xa343d(%rip), %rsi     # 0x1c66fc
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rdx
movl $0x8, %ecx
leaq 0xa3423(%rip), %r8      # 0x1c6713
callq 0x123800
cmpl $0x0, %eax
jne 0x1232ff
jmp 0x12339b
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x123920
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rdx
leaq 0x8411b(%rip), %rsi     # 0x1a7445
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rsi
callq 0x15ccf0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x4, %rsi
callq 0x123960
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x70(%rax)
jne 0x123381
jmp 0x12339b
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rdx
leaq 0xa338f(%rip), %rsi     # 0x1c6723
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rsc.c
// Function: do_OBJECTs
static void do_OBJECTs(deark *c, lctx *d)
{
	i64 i;

	if(d->object_num<=0) return;
	de_dbg(c, "OBJECTs at %"I64_FMT, d->object_offs);
	if(!is_valid_segment_pos(c, d, d->object_offs, 24*d->object_num, "OBJECT table")) {
		return;
	}
	if(!d->decode_objects) return;

	de_dbg_indent(c, 1);
	for(i=0; i<d->object_num; i++) {
		if(d->object_offs + 24*(i+1) > d->avail_file_size) break;
		do_object(c, d, i, d->object_offs + 24*i);
	}
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jg 0x1233d0
jmp 0x1234af
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdx
leaq 0xa3388(%rip), %rsi     # 0x1c676b
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x10(%rbp), %rax
imulq $0x18, 0x28(%rax), %rcx
leaq 0xa3370(%rip), %r8      # 0x1c677a
callq 0x123800
cmpl $0x0, %eax
jne 0x123419
jmp 0x1234af
movq -0x10(%rbp), %rax
cmpb $0x0, 0x14(%rax)
jne 0x123428
jmp 0x1234af
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x28(%rcx), %rax
jge 0x1234a1
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x18(%rbp), %rcx
addq $0x1, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq -0x10(%rbp), %rcx
cmpq 0x80(%rcx), %rax
jle 0x123472
jmp 0x1234a1
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rcx
imulq $0x18, -0x18(%rbp), %rax
addq %rax, %rcx
callq 0x1239a0
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x12343e
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rsc.c
// Function: do_BITBLKs
static void do_BITBLKs(deark *c, lctx *d)
{
	i64 i;

	if(d->bitblk_num<=0) return;
	de_dbg(c, "BITBLKs at %"I64_FMT, d->bitblk_offs);
	if(!is_valid_segment_pos(c, d, d->bitblk_offs, 14*d->bitblk_num, "BITBLK table")) {
		return;
	}
	de_dbg_indent(c, 1);
	for(i=0; i<d->bitblk_num; i++) {
		if(d->bitblk_offs + 14*(i+1) > d->avail_file_size) break;
		do_bitblk(c, d, d->bitblk_offs + 14*i);
	}
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x50(%rax)
jg 0x1234e0
jmp 0x1235ac
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdx
leaq 0xa33af(%rip), %rsi     # 0x1c68a2
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdx
movq -0x10(%rbp), %rax
imulq $0xe, 0x50(%rax), %rcx
leaq 0xa3397(%rip), %r8      # 0x1c68b1
callq 0x123800
cmpl $0x0, %eax
jne 0x123529
jmp 0x1235ac
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x50(%rcx), %rax
jge 0x12359e
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x18(%rbp), %rcx
addq $0x1, %rcx
imulq $0xe, %rcx, %rcx
addq %rcx, %rax
movq -0x10(%rbp), %rcx
cmpq 0x80(%rcx), %rax
jle 0x123573
jmp 0x12359e
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdx
imulq $0xe, -0x18(%rbp), %rax
addq %rax, %rdx
callq 0x123c90
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x12353f
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rsc.c
// Function: do_ICONBLKs
static void do_ICONBLKs(deark *c, lctx *d)
{
	i64 i;

	if(d->iconblk_num<=0) return;
	de_dbg(c, "ICONBLKs at %"I64_FMT, d->iconblk_offs);
	if(!is_valid_segment_pos(c, d, d->iconblk_offs, 34*d->iconblk_num, "ICONBLK table")) {
		return;
	}
	de_dbg_indent(c, 1);
	for(i=0; i<d->iconblk_num; i++) {
		if(d->iconblk_offs + 34*(i+1) > d->avail_file_size) break;
		do_old_iconblk(c, d, d->iconblk_offs + 34*i);
	}
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x40(%rax)
jg 0x1235e0
jmp 0x1236ac
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdx
leaq 0xa3315(%rip), %rsi     # 0x1c6908
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdx
movq -0x10(%rbp), %rax
imulq $0x22, 0x40(%rax), %rcx
leaq 0xa32fe(%rip), %r8      # 0x1c6918
callq 0x123800
cmpl $0x0, %eax
jne 0x123629
jmp 0x1236ac
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x40(%rcx), %rax
jge 0x12369e
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x18(%rbp), %rcx
addq $0x1, %rcx
imulq $0x22, %rcx, %rcx
addq %rcx, %rax
movq -0x10(%rbp), %rcx
cmpq 0x80(%rcx), %rax
jle 0x123673
jmp 0x12369e
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdx
imulq $0x22, -0x18(%rbp), %rax
addq %rax, %rdx
callq 0x123f90
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x12363f
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rsc.c
// Function: do_cicon
static int do_cicon(deark *c, lctx *d)
{
	i64 bytes_consumed;
	int ret;
	i64 pos1;
	i64 pos;
	i64 i;
	int retval = 0;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);
	if(!is_valid_segment_pos(c, d, d->cicon_offs, 1, "CICON segment")) {
		goto done;
	}
	pos1 = d->cicon_offs;
	de_dbg(c, "CICON file segment at %"I64_FMT, pos1);
	de_dbg_indent(c, 1);
	pos = pos1;
	ret = do_cicon_ptr_table(c, d, pos, &bytes_consumed);
	if(!ret) goto done;
	pos += bytes_consumed;

	for(i=0; i<d->num_ciconblk; i++) {
		if(pos>=d->avail_file_size) goto done;
		ret = do_ciconblk_struct(c, d, i, pos, &bytes_consumed);
		if(!ret) goto done;
		pos += bytes_consumed;
	}
	retval = 1;

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x3c(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x15b580
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rdx
movl $0x1, %ecx
leaq 0xa3261(%rip), %r8      # 0x1c6961
callq 0x123800
cmpl $0x0, %eax
jne 0x12370f
jmp 0x1237e4
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0xa3245(%rip), %rsi     # 0x1c696f
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
leaq -0x18(%rbp), %rcx
callq 0x124460
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x123767
jmp 0x1237e4
movq -0x18(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x88(%rcx), %rax
jge 0x1237dd
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x80(%rcx), %rax
jl 0x12379f
jmp 0x1237e4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x30(%rbp), %rcx
leaq -0x18(%rbp), %r8
callq 0x124590
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x1237c3
jmp 0x1237e4
movq -0x18(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x12377b
movl $0x1, -0x3c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x40(%rbp), %esi
callq 0x15b5a0
movl -0x3c(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rsc.c
// Function: is_valid_segment_pos
static int is_valid_segment_pos(deark *c, lctx *d, i64 pos, i64 len, const char *name)
{
	int ok_start = 1;
	int ok_end = 1;

	if(pos<36 && len>0) ok_start = 0;
	if(pos>d->avail_file_size) ok_start = 0;
	if(!d->allow_unaligned_offsets && (pos%2)) ok_start = 0;
	if(pos+len > d->avail_file_size) ok_end = 0;

	if(ok_start && ok_end) return 1;
	if(ok_start && !ok_end && len>=2) {
		de_err(c, "Invalid %s location: %"I64_FMT"-%"I64_FMT, name, pos, pos+len-1);
	}
	else {
		de_err(c, "Invalid %s location: %"I64_FMT, name, pos);
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl $0x1, -0x34(%rbp)
movl $0x1, -0x38(%rbp)
cmpq $0x24, -0x20(%rbp)
jge 0x12383f
cmpq $0x0, -0x28(%rbp)
jle 0x12383f
movl $0x0, -0x34(%rbp)
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x80(%rcx), %rax
jle 0x123857
movl $0x0, -0x34(%rbp)
movq -0x18(%rbp), %rax
cmpb $0x0, 0x15(%rax)
jne 0x12387c
movq -0x20(%rbp), %rax
movl $0x2, %ecx
cqto
idivq %rcx
cmpq $0x0, %rdx
je 0x12387c
movl $0x0, -0x34(%rbp)
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x80(%rcx), %rax
jle 0x123898
movl $0x0, -0x38(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x1238ad
cmpl $0x0, -0x38(%rbp)
je 0x1238ad
movl $0x1, -0x4(%rbp)
jmp 0x123909
cmpl $0x0, -0x34(%rbp)
je 0x1238e8
cmpl $0x0, -0x38(%rbp)
jne 0x1238e8
cmpq $0x2, -0x28(%rbp)
jl 0x1238e8
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x20(%rbp), %r8
addq -0x28(%rbp), %r8
subq $0x1, %r8
leaq 0xa2e56(%rip), %rsi     # 0x1c6735
movb $0x0, %al
callq 0x15bfb0
jmp 0x123902
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rdx
movq -0x20(%rbp), %rcx
leaq 0xa2e57(%rip), %rsi     # 0x1c6752
movb $0x0, %al
callq 0x15bfb0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rsc.c
// Function: get_obj_type_name
static const char *get_obj_type_name(u8 t)
{
	const char *s = NULL;

	switch(t) {
	case 20: s="box"; break;
	case 21: s="formatted text"; break;
	case 22: s="formatted text in a box"; break;
	case OBJTYPE_IMAGE: s="image"; break;
	case 24: s="programmer-defined object"; break;
	case 25: s="invisible box"; break;
	case 26: s="push button w/string"; break;
	case 27: s="character in a box"; break;
	case 28: s="unformatted text"; break;
	case 29: s="editable formatted text"; break;
	case 30: s="editable formatted text in a box"; break;
	case OBJTYPE_ICON: s="icon"; break;
	case 32: s="menu title"; break;
	case OBJTYPE_CLRICON: s="clricon"; break;
	}
	return s?s:"?";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb %dil, %al
movb %al, -0x1(%rbp)
movq $0x0, -0x10(%rbp)
movzbl -0x1(%rbp), %eax
addl $-0x14, %eax
movl %eax, %ecx
movq %rcx, -0x18(%rbp)
subl $0xd, %eax
ja 0x123c6c
movq -0x18(%rbp), %rax
leaq 0xa293d(%rip), %rcx     # 0x1c64e0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xa2c8e(%rip), %rax     # 0x1c6841
movq %rax, -0x10(%rbp)
jmp 0x123c6c
leaq 0xa2c9c(%rip), %rax     # 0x1c685f
movq %rax, -0x10(%rbp)
jmp 0x123c6c
leaq 0xa2ca4(%rip), %rax     # 0x1c6877
movq %rax, -0x10(%rbp)
jmp 0x123c6c
leaq 0x8c881(%rip), %rax     # 0x1b0464
movq %rax, -0x10(%rbp)
jmp 0x123c6c
leaq 0xa2c02(%rip), %rax     # 0x1c67f5
movq %rax, -0x10(%rbp)
jmp 0x123c6c
leaq 0xa2c0f(%rip), %rax     # 0x1c680f
movq %rax, -0x10(%rbp)
jmp 0x123c6c
leaq 0xa2c10(%rip), %rax     # 0x1c681d
movq %rax, -0x10(%rbp)
jmp 0x123c6c
leaq 0xa2c18(%rip), %rax     # 0x1c6832
movq %rax, -0x10(%rbp)
jmp 0x123c6c
leaq 0xa2c1e(%rip), %rax     # 0x1c6845
movq %rax, -0x10(%rbp)
jmp 0x123c6c
leaq 0xa2c22(%rip), %rax     # 0x1c6856
movq %rax, -0x10(%rbp)
jmp 0x123c6c
leaq 0xa2c2d(%rip), %rax     # 0x1c686e
movq %rax, -0x10(%rbp)
jmp 0x123c6c
leaq 0x8c7fc(%rip), %rax     # 0x1b044a
movq %rax, -0x10(%rbp)
jmp 0x123c6c
leaq 0xa2c34(%rip), %rax     # 0x1c688f
movq %rax, -0x10(%rbp)
jmp 0x123c6c
leaq 0xa2c32(%rip), %rax     # 0x1c689a
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x123c7d
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x123c8a
leaq 0x93fa9(%rip), %rax     # 0x1b7c2d
movq %rax, -0x20(%rbp)
jmp 0x123c8a
movq -0x20(%rbp), %rax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rsc.c
// Function: do_bitblk
static int do_bitblk(deark *c, lctx *d, i64 pos)
{
	i64 bits_pos;
	i64 width_in_bytes;
	i64 width, height;
	i64 fgcol;

	de_dbg(c, "BITBLK at %"I64_FMT, pos);
	de_dbg_indent(c, 1);

	bits_pos = gem_getu32(d, pos);
	de_dbg(c, "bitmap pos: %"I64_FMT, bits_pos);
	width_in_bytes = gem_getu16(d, pos+4);
	width = width_in_bytes*8;
	de_dbg(c, "width in bytes: %d", (int)width_in_bytes);
	height = gem_getu16(d, pos+6);
	de_dbg_dimensions(c, width, height);
	fgcol = gem_getu16(d, pos+12);
	de_dbg(c, "foreground color: 0x%04x", (unsigned int)fgcol);
	// TODO: Can we do anything with the foreground color?

	do_decode_and_write_bilevel_image(c, d, bits_pos, width_in_bytes, width, height);

	de_dbg_indent(c, -1);
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0xa2c0b(%rip), %rsi     # 0x1c68be
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x123920
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0xa2be4(%rip), %rsi     # 0x1c68cc
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x4, %rsi
callq 0x123250
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
shlq $0x3, %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %edx
leaq 0xa2bbb(%rip), %rsi     # 0x1c68dc
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x6, %rsi
callq 0x123250
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x15bba0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0xc, %rsi
callq 0x123250
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rax
movl %eax, %edx
leaq 0xa2b7b(%rip), %rsi     # 0x1c68ef
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %r9
callq 0x123dc0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movl $0x1, %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rsc.c
// Function: do_decode_and_write_bilevel_image
static void do_decode_and_write_bilevel_image(deark *c, lctx *d, i64 bits_pos,
	i64 rowspan, i64 width, i64 height)
{
	de_bitmap *img = NULL;

	if(!is_valid_segment_pos(c, d, bits_pos, rowspan*height, "bitmap")) {
		goto done;
	}
	if(!de_good_image_dimensions(c, width, height)) {
		goto done;
	}

	img = de_bitmap_create(c, width, height, 1);
	do_decode_bilevel_image(c, d, img, bits_pos, rowspan);
	de_bitmap_write_to_file(img, NULL, DE_CREATEFLAG_IS_BWIMG);
done:
	de_bitmap_destroy(img);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
imulq -0x30(%rbp), %rcx
leaq 0x7f8a0(%rip), %r8      # 0x1a36a4
callq 0x123800
cmpl $0x0, %eax
jne 0x123e10
jmp 0x123e6d
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x16a850
cmpl $0x0, %eax
jne 0x123e28
jmp 0x123e6d
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movl $0x1, %ecx
callq 0x16b750
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
callq 0x123e80
movq -0x38(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x8, %edx
callq 0x16afd0
movq -0x38(%rbp), %rdi
callq 0x16af60
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rsc.c
// Function: do_decode_bilevel_image
static void do_decode_bilevel_image(deark *c, lctx *d, de_bitmap *img, i64 bits_pos,
	i64 rowspan)
{
	i64 i, j;
	i64 rowspan_in_16bit_chunks;
	UI k;
	UI n;

	rowspan_in_16bit_chunks = (rowspan+1)/2;

	for(j=0; j<img->height; j++) {
		for(i=0; i<rowspan_in_16bit_chunks; i++) {
			n = (UI)gem_getu16(d, bits_pos + j*rowspan + i*2);
			for(k=0; k<16; k++) {
				u8 clr;

				clr = (n & (1U<<(15-k))) ? 0 : 0xff;
				de_bitmap_setpixel_gray(img, i*16+(i64)k, j, clr);
			}
		}
	}
}

// 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)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, -0x40(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jge 0x123f89
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x40(%rbp), %rax
jge 0x123f76
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x38(%rbp), %rax
imulq -0x28(%rbp), %rax
addq %rax, %rsi
movq -0x30(%rbp), %rax
shlq %rax
addq %rax, %rsi
callq 0x123250
movl %eax, -0x48(%rbp)
movl $0x0, -0x44(%rbp)
cmpl $0x10, -0x44(%rbp)
jae 0x123f63
movl -0x48(%rbp), %edx
movl $0xf, %ecx
subl -0x44(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
andl %eax, %edx
movl $0xff, %eax
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movb %al, -0x49(%rbp)
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rsi
shlq $0x4, %rsi
movl -0x44(%rbp), %eax
addq %rax, %rsi
movq -0x38(%rbp), %rdx
movzbl -0x49(%rbp), %ecx
callq 0x16b1c0
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x123f0f
jmp 0x123f65
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x123ed4
jmp 0x123f78
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x123eba
addq $0x50, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rsc.c
// Function: do_old_iconblk
static int do_old_iconblk(deark *c, lctx *d, i64 pos)
{
	i64 mask_pos, fg_pos;
	int retval = 0;
	struct iconinfo *ii = NULL;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);
	ii = de_malloc(c, sizeof(struct iconinfo));

	de_dbg(c, "ICONBLK at %"I64_FMT, pos);
	de_dbg_indent(c, 1);
	if(!do_scan_iconblk(c, d, pos, ii)) goto done;

	mask_pos = gem_getu32(d, pos);
	fg_pos = gem_getu32(d, pos+4);
	de_dbg(c, "fg at %"I64_FMT, fg_pos);
	de_dbg(c, "mask at %"I64_FMT, mask_pos);

	ii->mono_rowspan = ((ii->width+15)/16)*2;
	do_bilevel_icon(c, d, ii, fg_pos, mask_pos, "1");

	retval = 1;
done:
	destroy_iconinfo(c, ii);
	de_dbg_indent_restore(c, saved_indent_level);
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x2c(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
callq 0x15b580
movq -0x8(%rbp), %rdi
movl $0x28, %esi
callq 0x15b780
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0xa2945(%rip), %rsi     # 0x1c6926
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x38(%rbp), %rcx
callq 0x1240e0
cmpl $0x0, %eax
jne 0x124015
jmp 0x1240b1
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x123920
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x4, %rsi
callq 0x123920
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0xa28eb(%rip), %rsi     # 0x1c6935
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0xa2167(%rip), %rsi     # 0x1c61c7
movb $0x0, %al
callq 0x15b0d0
movq -0x38(%rbp), %rax
movq (%rax), %rax
addq $0xf, %rax
movl $0x10, %ecx
cqto
idivq %rcx
movq %rax, %rcx
shlq %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %r8
leaq 0x9add7(%rip), %r9      # 0x1bee7c
callq 0x1241b0
movl $0x1, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x124360
movq -0x8(%rbp), %rdi
movl -0x3c(%rbp), %esi
callq 0x15b5a0
movl -0x2c(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rsc.c
// Function: do_scan_iconblk
static int do_scan_iconblk(deark *c, lctx *d, i64 pos1, struct iconinfo *ii)
{
	i64 pos;

	// TODO: Refactor this code to better share it with old- and new-style RSC.

	pos = pos1;
	ii->width = gem_getu16(d, pos+22);
	ii->height = gem_getu16(d, pos+24);
	de_dbg_dimensions(c, ii->width, ii->height);
	if(ii->width<1 || ii->width>MAX_RSC_ICON_WIDTH ||
		ii->height<1 || ii->height>MAX_RSC_ICON_HEIGHT)
	{
		de_dbg(c, "bad or unexpected icon dimensions");
		return 0;
	}
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rsi
addq $0x16, %rsi
callq 0x123250
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rsi
addq $0x18, %rsi
callq 0x123250
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rsi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdx
callq 0x15bba0
movq -0x28(%rbp), %rax
cmpq $0x1, (%rax)
jl 0x12417f
movq -0x28(%rbp), %rax
cmpq $0x400, (%rax)          # imm = 0x400
jg 0x12417f
movq -0x28(%rbp), %rax
cmpq $0x1, 0x8(%rax)
jl 0x12417f
movq -0x28(%rbp), %rax
cmpq $0x400, 0x8(%rax)       # imm = 0x400
jle 0x12419a
movq -0x10(%rbp), %rdi
leaq 0xa27b5(%rip), %rsi     # 0x1c693f
movb $0x0, %al
callq 0x15b0d0
movl $0x0, -0x4(%rbp)
jmp 0x1241a1
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rsc.c
// Function: do_bilevel_icon
static void do_bilevel_icon(deark *c, lctx *d, struct iconinfo *ii, i64 fg_pos,
	i64 mask_pos, const char *token)
{
	de_bitmap *img = NULL;
	de_bitmap *mask = NULL;
	de_finfo *fi = NULL;

	if(!is_valid_segment_pos(c, d, fg_pos, ii->height*ii->mono_rowspan, "bitmap")) {
		goto done;
	}
	if(!is_valid_segment_pos(c, d, mask_pos, ii->height*ii->mono_rowspan, "mask")) {
		goto done;
	}
	if(!de_good_image_dimensions(c, ii->width, ii->height)) {
		goto done;
	}

	img = de_bitmap_create(c, ii->width, ii->height, 2);
	mask = de_bitmap_create(c, ii->width, ii->height, 1);
	do_decode_bilevel_image(c, d, img, fg_pos, ii->mono_rowspan);
	do_decode_bilevel_image(c, d, mask, mask_pos, ii->mono_rowspan);
	de_bitmap_apply_mask(img, mask, DE_BITMAPFLAG_WHITEISTRNS);
	fi = de_finfo_create(c);
	set_icon_finfo(c, d, fi, ii, token);
	de_bitmap_write_to_file_finfo(img, fi, DE_CREATEFLAG_OPT_IMAGE);

done:
	de_bitmap_destroy(img);
	de_bitmap_destroy(mask);
	de_finfo_destroy(c, fi);
}

// 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)
movq %r9, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x18(%rbp), %rax
imulq 0x10(%rax), %rcx
leaq 0x7f498(%rip), %r8      # 0x1a36a4
callq 0x123800
cmpl $0x0, %eax
jne 0x12421b
jmp 0x124336
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x18(%rbp), %rax
imulq 0x10(%rax), %rcx
leaq 0xad904(%rip), %r8      # 0x1d1b43
callq 0x123800
cmpl $0x0, %eax
jne 0x12424e
jmp 0x124336
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
callq 0x16a850
cmpl $0x0, %eax
jne 0x124270
jmp 0x124336
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0x2, %ecx
callq 0x16b750
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0x1, %ecx
callq 0x16b750
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %r8
callq 0x123e80
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %r8
callq 0x123e80
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
movl $0x1, %edx
callq 0x16cf60
movq -0x8(%rbp), %rdi
callq 0x15d230
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x30(%rbp), %r8
callq 0x1243b0
movq -0x38(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl $0x2, %edx
callq 0x16afa0
movq -0x38(%rbp), %rdi
callq 0x16af60
movq -0x40(%rbp), %rdi
callq 0x16af60
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x15d260
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rsc.c
// Function: destroy_iconinfo
static void destroy_iconinfo(deark *c, struct iconinfo *ii)
{
	if(!ii) return;
	if(ii->icon_text) {
		ucstring_destroy(ii->icon_text);
	}
	de_free(c, ii);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x124379
jmp 0x12439e
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x124391
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x171750
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x15b820
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rsc.c
// Function: set_icon_finfo
static void set_icon_finfo(deark *c, lctx *d, de_finfo *fi, struct iconinfo *ii,
	const char *token)
{
	de_ucstring *s = NULL;

	s = ucstring_create(c);

	if(ucstring_isnonempty(ii->icon_text)) {
		ucstring_append_ucstring(s, ii->icon_text);
	}

	if(token) {
		if(ucstring_isnonempty(s)) {
			ucstring_append_char(s, '.');
		}
		ucstring_append_sz(s, token, DE_ENCODING_UTF8);
	}

	de_finfo_set_name_from_ucstring(c, fi, s, 0x0);
	ucstring_destroy(s);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x1717f0
cmpl $0x0, %eax
je 0x124404
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x171460
cmpq $0x0, -0x28(%rbp)
je 0x124439
movq -0x30(%rbp), %rdi
callq 0x1717f0
cmpl $0x0, %eax
je 0x124427
movq -0x30(%rbp), %rdi
movl $0x2e, %esi
callq 0x1714c0
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl $0x2, %edx
callq 0x1715e0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x30(%rbp), %rdx
xorl %ecx, %ecx
callq 0x15d2c0
movq -0x30(%rbp), %rdi
callq 0x171750
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rsc.c
// Function: do_cicon_ptr_table
static int do_cicon_ptr_table(deark *c, lctx *d, i64 pos1, i64 *bytes_consumed)
{
	i64 n;
	i64 count = 0;
	i64 pos;
	int retval = 0;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);
	pos = pos1;
	*bytes_consumed = 0;

	de_dbg(c, "CICONBLK pointer table at %"I64_FMT, pos1);
	de_dbg_indent(c, 1);

	while(1) {
		if(pos>=d->avail_file_size) {
			// error
			goto done;
		}

		// Values are expected to be 0. We just have to find the -1 that marks
		// the end of this scratch space.
		n = gem_getu32m1(d, pos);
		de_dbg3(c, "item[%d]: %"I64_FMT, (int)count, n);
		pos+=4;

		if(n<0) {
			break;
		}
		count++;
	}

	d->num_ciconblk = count;
	de_dbg(c, "count of CICONBLKs: %d", (int)d->num_ciconblk);
	*bytes_consumed = pos - pos1;
	retval = 1;

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq $0x0, -0x30(%rbp)
movl $0x0, -0x3c(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x15b580
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0xa24d3(%rip), %rsi     # 0x1c6989
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x38(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x80(%rcx), %rax
jl 0x1244e1
jmp 0x124575
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x123960
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movl %eax, %edx
movq -0x28(%rbp), %rcx
leaq 0xa24a0(%rip), %rsi     # 0x1c69a7
movb $0x0, %al
callq 0x15b400
movq -0x38(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x28(%rbp)
jge 0x124523
jmp 0x124531
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1244cb
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x88(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rax
movl %eax, %edx
leaq 0xa245d(%rip), %rsi     # 0x1c69b5
movb $0x0, %al
callq 0x15b0d0
movq -0x38(%rbp), %rcx
subq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x3c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x40(%rbp), %esi
callq 0x15b5a0
movl -0x3c(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rsc.c
// Function: construct_palettes
static void construct_palettes(deark *c, lctx *d)
{
	UI k;

	d->pal2[0] = DE_STOCKCOLOR_WHITE;
	d->pal2[1] = DE_STOCKCOLOR_BLACK;
	for(k=0; k<16; k++) {
		d->pal16[k] = DE_MAKE_OPAQUE(getpal16(k));
	}
	for(k=0; k<256; k++) {
		d->pal256[k] = DE_MAKE_OPAQUE(getpal256(k));
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x90(%rax) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rax
movl $0xff000000, 0x94(%rax) # imm = 0xFF000000
movl $0x0, -0x14(%rbp)
cmpl $0x10, -0x14(%rbp)
jae 0x124de2
movl -0x14(%rbp), %edi
callq 0x124e30
movl %eax, %edx
orl $0xff000000, %edx       # imm = 0xFF000000
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %edx, 0x98(%rax,%rcx,4)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x124db3
movl $0x0, -0x14(%rbp)
cmpl $0x100, -0x14(%rbp)     # imm = 0x100
jae 0x124e1b
movl -0x14(%rbp), %edi
callq 0x124e60
movl %eax, %edx
orl $0xff000000, %edx       # imm = 0xFF000000
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %edx, 0xd8(%rax,%rcx,4)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x124de9
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/rsc.c
// Function: getpal256
static de_color getpal256(unsigned int k)
{
	unsigned int x;
	u8 r, g, b;

	if(k<=15) {
		// first 16 entries
		return supplpal1[k];
	}
	else if(k<=229) {
		// next 214 entries
		x = k-15;
		r = (u8)((x/36)*0x33);
		g = ((x%36)/6)*0x33;
		b = (x%6)*0x33;
		return DE_MAKE_RGB(r,g,b);
	}
	else if(k<=255) {
		// last 26 entries
		return supplpal2[k-230];
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x8(%rbp)
cmpl $0xf, -0x8(%rbp)
ja 0x124e84
movl -0x8(%rbp), %eax
movl %eax, %ecx
leaq 0xa16e7(%rip), %rax     # 0x1c6560
movl (%rax,%rcx,4), %eax
movl %eax, -0x4(%rbp)
jmp 0x124f26
cmpl $0xe5, -0x8(%rbp)
ja 0x124ef7
movl -0x8(%rbp), %eax
subl $0xf, %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
movl $0x24, %ecx
xorl %edx, %edx
divl %ecx
imull $0x33, %eax, %eax
movb %al, -0xd(%rbp)
movl -0xc(%rbp), %eax
movl $0x24, %ecx
xorl %edx, %edx
divl %ecx
movl %edx, %eax
movl $0x6, %ecx
xorl %edx, %edx
divl %ecx
imull $0x33, %eax, %eax
movb %al, -0xe(%rbp)
movl -0xc(%rbp), %eax
movl $0x6, %ecx
xorl %edx, %edx
divl %ecx
imull $0x33, %edx, %eax
movb %al, -0xf(%rbp)
movzbl -0xd(%rbp), %eax
shll $0x10, %eax
orl $0xff000000, %eax       # imm = 0xFF000000
movzbl -0xe(%rbp), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movzbl -0xf(%rbp), %ecx
orl %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x124f26
cmpl $0xff, -0x8(%rbp)
ja 0x124f1b
movl -0x8(%rbp), %eax
subl $0xe6, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0xa168d(%rip), %rax     # 0x1c65a0
movl (%rax,%rcx,4), %eax
movl %eax, -0x4(%rbp)
jmp 0x124f26
jmp 0x124f1d
jmp 0x124f1f
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/shg.c
// Function: de_module_shg
void de_module_shg(deark *c, struct deark_module_info *mi)
{
	mi->id = "shg";
	mi->desc = "SHG (Segmented Hypergraphics), MRB (Multiple Resolution Bitmap)";
	mi->run_fn = de_run_shg;
	mi->identify_fn = de_identify_shg;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0x87dae(%rip), %rcx     # 0x1accf5
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0xa1bdb(%rip), %rcx     # 0x1c6b30
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x1c(%rip), %rcx        # 0x124f80
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0xdd(%rip), %rcx        # 0x125050
movq %rcx, 0x20(%rax)
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/shg.c
// Function: de_run_shg
static void de_run_shg(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;

	d = de_malloc(c, sizeof(lctx));

	d->shg_startpos = 0;
	d->signature = de_getu16le(d->shg_startpos);
	if(d->signature==0x506c) {
		de_declare_fmt(c, "SHG");
	}
	else if(d->signature==0x706c) {
		de_declare_fmt(c, "MRB");
	}
	else {
		de_warn(c, "This is probably not an SHG/MRB file.");
	}

	do_shg(c, d);

	de_free(c, d);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0x18, %esi
callq 0x15b780
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x165280
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
cmpq $0x506c, (%rax)         # imm = 0x506C
jne 0x124ff4
movq -0x8(%rbp), %rdi
leaq 0xa1b83(%rip), %rsi     # 0x1c6b70
callq 0x15e380
jmp 0x125027
movq -0x18(%rbp), %rax
cmpq $0x706c, (%rax)         # imm = 0x706C
jne 0x125013
movq -0x8(%rbp), %rdi
leaq 0x87dbe(%rip), %rsi     # 0x1acdca
callq 0x15e380
jmp 0x125025
movq -0x8(%rbp), %rdi
leaq 0xa1b56(%rip), %rsi     # 0x1c6b74
movb $0x0, %al
callq 0x15bc10
jmp 0x125027
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1250b0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x15b820
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/shg.c
// Function: de_identify_shg
static int de_identify_shg(deark *c)
{
	u8 buf[2];
	de_read(buf, 0, 2);
	if(buf[0]==0x6c && (buf[1]==0x50 || buf[1]==0x70)) {
		return 50;
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x12(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
movl $0x2, %ecx
callq 0x164d10
movzbl -0x12(%rbp), %eax
cmpl $0x6c, %eax
jne 0x12509a
movzbl -0x11(%rbp), %eax
cmpl $0x50, %eax
je 0x125091
movzbl -0x11(%rbp), %eax
cmpl $0x70, %eax
jne 0x12509a
movl $0x32, -0x4(%rbp)
jmp 0x1250a1
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/shg.c
// Function: do_shg
static void do_shg(deark *c, lctx *d)
{
	i64 k;

	d->num_pictures = de_getu16le(d->shg_startpos+2);
	de_dbg(c, "number of pictures in file: %d", (int)d->num_pictures);
	if(!de_good_image_count(c, d->num_pictures)) {
		goto done;
	}

	for(k=0; k<d->num_pictures; k++) {
		if(!do_picture(c, d, k)) {
			goto done;
		}
	}

done:
	;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0x2, %rsi
callq 0x165280
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl %eax, %edx
leaq 0xa1aa1(%rip), %rsi     # 0x1c6b9a
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x16a9a0
cmpl $0x0, %eax
jne 0x125118
jmp 0x125158
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jge 0x125156
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x125160
cmpl $0x0, %eax
jne 0x125146
jmp 0x125158
jmp 0x125148
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x125120
jmp 0x125158
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/shg.c
// Function: do_decompress_type_3
static void do_decompress_type_3(deark *c, lctx *d,
	struct de_dfilter_in_params *dcmpri, struct de_dfilter_out_params *dcmpro,
	struct de_dfilter_results *dres)
{
	struct de_dcmpr_two_layer_params tlp;

	de_dbg(c, "doing LZ77+RLE decompression");

	de_zeromem(&tlp, sizeof(struct de_dcmpr_two_layer_params));
	tlp.codec1_type1 = fmtutil_hlp_lz77_codectype1;
	tlp.codec1_private_params = NULL;
	tlp.codec2 = dfilter_shgrle_codec;
	tlp.dcmpri = dcmpri;
	tlp.dcmpro = dcmpro;
	tlp.dres = dres;
	de_dfilter_decompress_two_layer(c, &tlp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rdi
leaq 0xa0af7(%rip), %rsi     # 0x1c6d91
movb $0x0, %al
callq 0x15b0d0
leaq -0x78(%rbp), %rdi
xorl %esi, %esi
movl $0x50, %edx
callq 0x19140
leaq 0x52738(%rip), %rax     # 0x1789f0
movq %rax, -0x78(%rbp)
movq $0x0, -0x68(%rbp)
leaq 0x35(%rip), %rax        # 0x126300
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x178cf0
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/shg.c
// Function: dfilter_shgrle_codec
static void dfilter_shgrle_codec(struct de_dfilter_ctx *dfctx, void *codec_private_params)
{
	struct rlectx *rctx = NULL;

	rctx = de_malloc(dfctx->c, sizeof(struct rlectx));
	rctx->outf = dfctx->dcmpro->f;

	dfctx->codec_private = (void*)rctx;
	dfctx->codec_finish_fn = my_shgrle_codec_finish;
	dfctx->codec_destroy_fn = my_shgrle_codec_destroy;
	dfctx->codec_addbuf_fn = my_shgrle_codec_addbuf;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl $0x28, %esi
callq 0x15b780
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rax
leaq 0x2a(%rip), %rcx        # 0x126380
movq %rcx, 0x40(%rax)
movq -0x8(%rbp), %rax
leaq 0x5b(%rip), %rcx        # 0x1263c0
movq %rcx, 0x48(%rax)
movq -0x8(%rbp), %rax
leaq 0x7c(%rip), %rcx        # 0x1263f0
movq %rcx, 0x30(%rax)
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/shg.c
// Function: my_shgrle_codec_addbuf
static void  my_shgrle_codec_addbuf(struct de_dfilter_ctx *dfctx,
	const u8 *buf, i64 buf_len)
{
	i64 k;
	struct rlectx *rctx = (struct rlectx*)dfctx->codec_private;

	for(k=0; k<buf_len; k++) {
		if(rctx->uncompressed_run_bytes_left>0) {
			dbuf_writebyte(rctx->outf, buf[k]);
			rctx->uncompressed_run_bytes_left--;
			rctx->nbytes_consumed++;
			continue;
		}

		if(rctx->compressed_run_pending) {
			dbuf_write_run(rctx->outf, buf[k], rctx->compressed_run_count);
			rctx->compressed_run_pending = 0;
			rctx->nbytes_consumed += 2;
			continue;
		}

		if(buf[k] & 0x80) { // beginning of uncompressed run
			rctx->uncompressed_run_bytes_left = (i64)(buf[k] & 0x7f);
			rctx->nbytes_consumed++;
			continue;
		}

		rctx->compressed_run_count = (i64)buf[k];
		rctx->compressed_run_pending = 1;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x12652b
movq -0x28(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jle 0x12646e
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movzbl (%rax,%rcx), %esi
callq 0x168380
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x20(%rax)
jmp 0x12651a
movq -0x28(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x1264b7
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movb (%rax,%rcx), %al
movq -0x28(%rbp), %rcx
movq 0x10(%rcx), %rdx
movzbl %al, %esi
callq 0x168800
movq -0x28(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rcx
addq $0x2, %rcx
movq %rcx, 0x20(%rax)
jmp 0x12651a
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movzbl (%rax,%rcx), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x1264f9
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movzbl (%rax,%rcx), %eax
andl $0x7f, %eax
movslq %eax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x20(%rax)
jmp 0x12651a
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rax
movl $0x1, 0x8(%rax)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x126418
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/spectrum512.c
// Function: de_module_spectrum512u
void de_module_spectrum512u(deark *c, struct deark_module_info *mi)
{
	mi->id = "spectrum512u";
	mi->desc = "Spectrum 512 Uncompressed";
	mi->run_fn = de_run_spectrum512u;
	mi->identify_fn = de_identify_spectrum512u;
	mi->help_fn = de_help_spectrum512u;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0xa08f1(%rip), %rcx     # 0x1c6e78
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0xa08f0(%rip), %rcx     # 0x1c6e85
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x2c(%rip), %rcx        # 0x1265d0
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0xad(%rip), %rcx        # 0x126660
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
leaq 0x12e(%rip), %rcx       # 0x1266f0
movq %rcx, 0x28(%rax)
popq %rbp
retq
nopl (%rax,%rax)