LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/riff.c
// Function: do_DISP
static void do_DISP(deark *c, lctx *d, struct de_iffctx *ictx, i64 pos, i64 len)
{
	unsigned int ty;
	i64 dpos, dlen;

	if(!ictx->is_le) return;
	if(len<4) return;
	ty = (unsigned int)de_getu32le(pos);
	de_dbg(c, "data type: %u (%s)", ty,
		fmtutil_get_windows_cb_data_type_name(ty));

	dpos = pos+4;
	dlen = len-4;
	switch(ty) {
	case 1:
	case 7:
		do_DISP_TEXT(c, d, ictx, dpos, dlen);
		break;
	case 8:
	case 17:
		do_DISP_DIB(c, d, ictx, dpos, dlen);
		break;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpq $0x4, %rcx
jl 0xc3012
movq %rsi, %r15
cmpl $0x0, 0x58(%rsi)
je 0xc3012
movq %rcx, %r13
movq %rdx, %rbx
movq %rdi, %r14
movq 0x18(%rdi), %rdi
movq %rdx, %rsi
callq 0xef37e
movq %rax, %rbp
movl %ebp, %edi
callq 0xf93cf
leaq 0x4f79f(%rip), %rsi     # 0x11271d
movq %r14, %rdi
movl %ebp, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe9226
addq $0x4, %rbx
leaq -0x4(%r13), %r12
cmpl $0x7, %ebp
jg 0xc3002
cmpl $0x1, %ebp
je 0xc2fa4
cmpl $0x7, %ebp
jne 0xc3012
movq 0x18(%r15), %rdi
movq %rsp, %r13
xorl %esi, %esi
movq %rbx, %rdx
movq %r12, %rcx
movq %r13, %r8
callq 0xf0057
movq (%r13), %r13
subq %rbx, %r13
testl %eax, %eax
cmoveq %r12, %r13
leaq 0x5663f(%rip), %rsi     # 0x11960e
movq %r14, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0xe9226
testq %r13, %r13
jle 0xc3012
movq 0x18(%r15), %rdi
leaq 0x770f2(%rip), %rcx     # 0x13a0de
movq %rbx, %rsi
movq %r13, %rdx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0xf0321
jmp 0xc3012
cmpl $0x8, %ebp
je 0xc300c
cmpl $0x11, %ebp
jne 0xc3012
cmpq $0x10, %r13
jge 0xc3021
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x70, %esi
movq %r14, %rdi
callq 0xe969b
movq %rax, %r13
leaq 0x80524(%rip), %rax     # 0x14355c
movq %rax, (%r13)
movl $0x80, 0x8(%r13)
movq 0x18(%r15), %rcx
leaq 0x601e0(%rip), %rsi     # 0x12322f
movq %r14, %rdi
movq %r13, %rdx
movq %rbx, %r8
movq %r12, %r9
callq 0xea5fa
movq %r14, %rdi
movq %r13, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe9752
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/riff.c
// Function: extract_ani_frame
static void extract_ani_frame(deark *c, lctx *d, struct de_iffctx *ictx, i64 pos, i64 len)
{
	u8 buf[4];
	const char *ext;

	de_dbg(c, "frame at %d, len=%d", (int)pos, (int)len);

	de_read(buf, pos, 4);

	// Try to identify the format of this frame.
	if(!de_memcmp(buf, "\x00\x00\x01\x00", 4)) {
		ext = "ico";
	}
	else if(!de_memcmp(buf, "\x00\x00\x02\x00", 4)) {
		ext = "cur";
	}
	else {
		ext = "bin";
	}

	dbuf_create_file_from_slice(ictx->f, pos, len, ext, NULL, 0);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
leaq 0x77053(%rip), %rsi     # 0x13a0e7
xorl %eax, %eax
callq 0xe9226
movq 0x18(%r12), %rdi
leaq 0x4(%rsp), %r12
movl $0x4, %ecx
movq %r12, %rsi
movq %r14, %rdx
callq 0xeeee8
cmpl $0x10000, (%r12)        # imm = 0x10000
je 0xc30db
cmpl $0x20000, 0x4(%rsp)     # imm = 0x20000
leaq 0x5a1b5(%rip), %rax     # 0x11d283
leaq 0x7235c(%rip), %rcx     # 0x135431
cmoveq %rax, %rcx
jmp 0xc30e2
leaq 0x5df67(%rip), %rcx     # 0x121049
movq 0x18(%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xf0321
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/riff.c
// Function: do_palette
static void do_palette(deark *c, lctx *d, struct de_iffctx *ictx, i64 pos, i64 len)
{
	i64 ver;
	i64 n;
	i64 i;
	u8 r,g,b,flags;
	u32 clr;
	char tmps[32];

	if(!ictx->is_le) return;
	ver = de_getu16le(pos);
	de_dbg(c, "version: 0x%04x", (unsigned int)ver);
	pos += 2;
	n = de_getu16le(pos);
	de_dbg(c, "number of entries: %d", (int)n);
	pos += 2;
	if(n>(len-4)/4) n=(len-4)/4;
	if(n>1024) n=1024;
	if(n<1) return;

	de_dbg(c, "palette entries at %d", (int)pos);
	de_dbg_indent(c, 1);
	for(i=0; i<n; i++) {
		r = de_getbyte(pos);
		g = de_getbyte(pos+1);
		b = de_getbyte(pos+2);
		flags = de_getbyte(pos+3);
		pos += 4;
		clr = DE_MAKE_RGB(r, g, b);
		de_snprintf(tmps, sizeof(tmps), " flags=0x%02x", (unsigned int)flags);
		de_dbg_pal_entry2(c, i, clr, NULL, NULL, tmps);
	}
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, 0x8(%rsp)
cmpl $0x0, 0x58(%rsi)
je 0xc3280
movq %rcx, %r15
movq %rdx, %r14
movq 0x8(%rsp), %rbx
movq 0x18(%rbx), %rdi
movq %rdx, %rsi
callq 0xef1ca
leaq 0x71f2f(%rip), %rsi     # 0x13506d
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
leaq 0x2(%r14), %rsi
movq 0x18(%rbx), %rdi
callq 0xef1ca
movq %rax, %r12
leaq 0x5386d(%rip), %rsi     # 0x1169ce
movq %rbx, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe9226
leaq -0x4(%r15), %rax
decq %r15
testq %rax, %rax
cmovnsq %rax, %r15
sarq $0x2, %r15
cmpq %r15, %r12
cmovlq %r12, %r15
movl $0x400, %r12d           # imm = 0x400
cmpq %r12, %r15
cmovlq %r15, %r12
testq %r15, %r15
jle 0xc3280
addq $0x4, %r14
leaq 0x76f53(%rip), %rsi     # 0x13a0fb
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
xorl %r13d, %r13d
movq 0x8(%rsp), %r15
movq 0x18(%r15), %rdi
movq %r14, %rsi
callq 0xef0d5
movb %al, 0x7(%rsp)
movq 0x18(%r15), %rdi
leaq 0x1(%r14), %rsi
callq 0xef0d5
movl %eax, %ebp
movq 0x18(%r15), %rdi
leaq 0x2(%r14), %rsi
callq 0xef0d5
movq %r12, %rbx
movl %eax, %r12d
movq 0x18(%r15), %rdi
leaq 0x3(%r14), %rsi
callq 0xef0d5
movzbl 0x7(%rsp), %ecx
shll $0x10, %ecx
movzbl %bpl, %edx
shll $0x8, %edx
orl %ecx, %edx
movzbl %r12b, %ebp
movq %rbx, %r12
orl %edx, %ebp
orl $0xff000000, %ebp       # imm = 0xFF000000
movzbl %al, %ecx
movl $0x20, %esi
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
leaq 0x5ac18(%rip), %rdx     # 0x11de5d
xorl %eax, %eax
callq 0xe8d67
movq %r15, %rdi
movq %r13, %rsi
movl %ebp, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %rbx, %r9
callq 0xe9c1e
incq %r13
addq $0x4, %r14
cmpq %r13, %r12
jne 0xc31cf
movq 0x8(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/riff.c
// Function: do_RDIB_data
static void do_RDIB_data(deark *c, lctx *d, struct de_iffctx *ictx, i64 pos, i64 len)
{
	de_finfo *fi = NULL;

	if(!ictx->chunkctx->parent) goto done;
	if(ictx->chunkctx->parent->user_flags & 0x1) goto done; // Extraction suppressed, or already done
	ictx->chunkctx->parent->user_flags |= 0x1;

	fi = de_finfo_create(c);
	if(ucstring_isnonempty(d->INAM_data)) {
		// In CorelMOVE format, at least, the INAM chunk seems to have a usable
		// name for the RDIB bitmap.
		de_finfo_set_name_from_ucstring(c, fi, d->INAM_data, 0);
		ucstring_empty(d->INAM_data);
	}
	do_extract_raw(c, d, ictx, pos, len, "bmp", fi, 0);
done:
	de_finfo_destroy(c, fi);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x128(%rdx), %rax
movq 0x50(%rax), %rax
testq %rax, %rax
je 0xc3317
movq %rcx, %r15
movl 0x60(%rax), %ecx
testb $0x1, %cl
jne 0xc3317
movq %r8, %r14
movq %rdx, %r13
movq %rsi, %rbp
orl $0x1, %ecx
movl %ecx, 0x60(%rax)
movq %rbx, %rdi
callq 0xea9a9
movq %rax, %r12
movq 0x18(%rbp), %rdi
callq 0xf6c00
testl %eax, %eax
je 0xc32f9
movq 0x18(%rbp), %rdx
movq %rbx, %rdi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0xea9e4
movq 0x18(%rbp), %rdi
callq 0xf6883
movq 0x18(%r13), %rdi
leaq 0x5dd4e(%rip), %rcx     # 0x121052
movq %r15, %rsi
movq %r14, %rdx
movq %r12, %r8
xorl %r9d, %r9d
callq 0xf0321
jmp 0xc331a
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r12, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xea9b3
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/riff.c
// Function: do_avi_avih
static void do_avi_avih(deark *c, lctx *d, struct de_iffctx *ictx, i64 pos, i64 len)
{
	i64 n, n2;

	if(len<40) return;
	n = de_getu32le(pos);
	de_dbg(c, "microseconds/frame: %u", (unsigned int)n);
	n = de_getu32le(pos+12);
	de_dbg(c, "flags: 0x%08x", (unsigned int)n);
	n = de_getu32le(pos+16);
	de_dbg(c, "number of frames: %u", (unsigned int)n);
	n = de_getu32le(pos+24);
	de_dbg(c, "number of streams: %u", (unsigned int)n);
	n = de_getu32le(pos+32);
	n2 = de_getu32le(pos+36);
	de_dbg_dimensions(c, n, n2);
	// TODO: There are more fields in this chunk.
}

// Assembly:
cmpq $0x28, %rdx
jge 0xc336b
retq
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
callq 0xef37e
leaq 0x76e32(%rip), %rsi     # 0x13a1b8
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
leaq 0xc(%r14), %rsi
callq 0xef37e
leaq 0x63258(%rip), %rsi     # 0x1265fe
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
leaq 0x10(%r14), %rsi
callq 0xef37e
leaq 0x76e09(%rip), %rsi     # 0x13a1cf
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
leaq 0x18(%r14), %rsi
callq 0xef37e
leaq 0x76dfe(%rip), %rsi     # 0x13a1e4
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
leaq 0x20(%r14), %rsi
callq 0xef37e
movq %rax, %r15
movq 0x18(%rbx), %rdi
addq $0x24, %r14
movq %r14, %rsi
callq 0xef37e
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0xe9b05
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/riff.c
// Function: do_avi_strh
static void do_avi_strh(deark *c, lctx *d, struct de_iffctx *ictx, i64 pos, i64 len)
{
	struct de_fourcc type4cc;
	struct de_fourcc codec4cc;

	if(len<8) return;

	dbuf_read_fourcc(ictx->f, pos, &type4cc, 4, 0x0);
	de_dbg(c, "stream type: '%s'", type4cc.id_dbgstr);
	// Hack. TODO: Need a better way to track state.
	d->curr_avi_stream_type = type4cc.id;

	dbuf_read_fourcc(ictx->f, pos+4, &codec4cc, 4, 0x0);
	de_dbg(c, "codec: '%s'", codec4cc.id_dbgstr);

	// TODO: There are more fields here.
}

// Assembly:
cmpq $0x8, %r8
jl 0xc34c1
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x60, %rsp
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
movq 0x18(%rdx), %rdi
leaq 0x30(%rsp), %rdx
movq %rcx, %rsi
movl $0x4, %ecx
xorl %r8d, %r8d
callq 0xf1d74
leaq 0x40(%rsp), %r13
leaq 0x76d8d(%rip), %rsi     # 0x13a1fa
movq %rbx, %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0xe9226
movl -0xc(%r13), %eax
movl %eax, 0x8(%r12)
movq 0x18(%r15), %rdi
addq $0x4, %r14
movq %rsp, %rdx
movq %r14, %rsi
movl $0x4, %ecx
xorl %r8d, %r8d
callq 0xf1d74
leaq 0x10(%rsp), %rdx
leaq 0x76d62(%rip), %rsi     # 0x13a20c
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/riff.c
// Function: do_avi_strf
static void do_avi_strf(deark *c, lctx *d, struct de_iffctx *ictx, i64 pos, i64 len)
{
	if(d->curr_avi_stream_type==CODE_vids) {
		struct de_bmpinfo bi;
		// For video streams, this is a BITMAPINFO.
		fmtutil_get_bmpinfo(c, ictx->f, &bi, pos, len,
			DE_BMPINFO_CMPR_IS_4CC | DE_BMPINFO_NOERR);
		// This chunk contains just a bitmap header, so we can't extract a bitmap.
	}
	else if(d->curr_avi_stream_type==CODE_auds) {
		// For audio streams, this is a WAVEFORMATEX.
		decode_WAVEFORMATEX(c, d, ictx, pos, len);
	}
}

// Assembly:
movl 0x8(%rsi), %eax
cmpl $0x61756473, %eax       # imm = 0x61756473
je 0xc34f6
cmpl $0x76696473, %eax       # imm = 0x76696473
jne 0xc34f5
subq $0xa8, %rsp
movq 0x18(%rdx), %rsi
leaq 0x8(%rsp), %rdx
movl $0x18, %r9d
callq 0xf7881
addq $0xa8, %rsp
retq
movq %rdx, %rsi
movq %rcx, %rdx
movq %r8, %rcx
jmp 0xc3501
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/riff.c
// Function: decode_WAVEFORMATEX
static void decode_WAVEFORMATEX(deark *c, lctx *d, struct de_iffctx *ictx, i64 pos1, i64 len)
{
	unsigned int formattag;
	i64 n;
	i64 pos = pos1;

	if(!ictx->is_le) goto done;
	if(len<14) goto done;

	formattag = (unsigned int)dbuf_getu16le_p(ictx->f, &pos);
	de_dbg(c, "FormatTag: 0x%04x (%s)", formattag, get_wav_fmt_name(formattag));
	n = dbuf_getu16le_p(ictx->f, &pos);
	de_dbg(c, "Channels: %u", (unsigned int)n);
	n = dbuf_getu32le_p(ictx->f, &pos);
	de_dbg(c, "SamplesPerSec: %u", (unsigned int)n);
	n = dbuf_getu32le_p(ictx->f, &pos);
	de_dbg(c, "AvgBytesPerSec: %u", (unsigned int)n);
	n = dbuf_getu16le_p(ictx->f, &pos);
	de_dbg(c, "BlockAlign: %u", (unsigned int)n);
	if(len<16) goto done;
	n = dbuf_getu16le_p(ictx->f, &pos);
	de_dbg(c, "BitsPerSample: %u", (unsigned int)n);
	if(len<18) goto done;
	n = dbuf_getu16le_p(ictx->f, &pos);
	de_dbg(c, "cbSize: %u", (unsigned int)n);

done:
	;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, (%rsp)
cmpq $0xe, %rcx
jl 0xc3664
movq %rsi, %r14
cmpl $0x0, 0x58(%rsi)
je 0xc3664
movq %rcx, %r15
movq %rdi, %rbx
movq 0x18(%r14), %rdi
movq %rsp, %rsi
callq 0xef1ed
leaq 0x6892c(%rip), %rcx     # 0x12be69
cmpl $0x4f, %eax
jle 0xc355c
cmpl $0x50, %eax
je 0xc356f
cmpl $0x55, %eax
je 0xc3578
cmpl $0xfffe, %eax           # imm = 0xFFFE
jne 0xc3588
leaq 0x76c3d(%rip), %rcx     # 0x13a197
jmp 0xc3588
cmpl $0x1, %eax
je 0xc3581
cmpl $0x2, %eax
jne 0xc3588
leaq 0x76c19(%rip), %rcx     # 0x13a186
jmp 0xc3588
leaq 0x69475(%rip), %rcx     # 0x12c9eb
jmp 0xc3588
leaq 0x76c0d(%rip), %rcx     # 0x13a18c
jmp 0xc3588
leaq 0x76c00(%rip), %rcx     # 0x13a188
leaq 0x76b82(%rip), %rsi     # 0x13a111
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%r14), %rdi
movq %rsp, %r12
movq %r12, %rsi
callq 0xef1ed
leaq 0x76b77(%rip), %rsi     # 0x13a128
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xef3a0
leaq 0x76b65(%rip), %rsi     # 0x13a135
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xef3a0
leaq 0x76b58(%rip), %rsi     # 0x13a147
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xef1ed
leaq 0x76b4c(%rip), %rsi     # 0x13a15a
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
cmpq $0x10, %r15
jl 0xc3664
movq 0x18(%r14), %rdi
movq %rsp, %rsi
callq 0xef1ed
leaq 0x76b36(%rip), %rsi     # 0x13a169
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
cmpq $0x12, %r15
jl 0xc3664
movq 0x18(%r14), %rdi
movq %rsp, %rsi
callq 0xef1ed
leaq 0x76b23(%rip), %rsi     # 0x13a17b
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/riff.c
// Function: my_handle_nonchunk_riff_data_fn
static int my_handle_nonchunk_riff_data_fn(struct de_iffctx *ictx,
	i64 pos, i64 *plen)
{
	deark *c = ictx->c;
	lctx *d = (lctx*)ictx->userdata;

	if(d->cmx_parse_hack) {
		return do_cmx_parse_hack(c, d, ictx, pos, plen);
	}
	else if(d->cmv_parse_hack) {
		return do_cmv_parse_hack(c, d, ictx, pos, plen);
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r13
movq (%rdi), %r15
movq 0x10(%rdi), %rax
cmpb $0x0, 0xc(%rax)
je 0xc36f6
movq 0x18(%r13), %rdi
movq %r14, %rsi
callq 0xef1ca
cmpq $0x101, %rax            # imm = 0x101
setge %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
jne 0xc36f2
movq %rax, %rdi
callq 0xea7d5
movq %rax, %r12
leaq (%rax,%r14), %rdx
movq 0x18(%r13), %rdi
leaq 0x4(%rsp), %rsi
movl $0x4, %ecx
callq 0xeeee8
xorl %eax, %eax
movb 0x4(%rsp,%rax), %cl
addb $-0x7f, %cl
cmpb $-0x5f, %cl
jb 0xc36ed
leaq 0x1(%rax), %rdx
cmpq $0x3, %rax
movq %rdx, %rax
jne 0xc36d4
cmpb $-0x5f, %cl
jae 0xc3738
xorl %ebp, %ebp
jmp 0xc3757
xorl %ebp, %ebp
cmpb $0x0, 0xd(%rax)
je 0xc3757
cmpl $0x0, 0x64(%r13)
jne 0xc3757
movq 0x18(%r13), %rdi
movq %r14, %rsi
callq 0xef32a
testq %rax, %rax
jne 0xc3757
movq 0x18(%r13), %rdi
leaq 0x4(%r14), %rsi
callq 0xef32a
cmpq $0x52494646, %rax       # imm = 0x52494646
jne 0xc3757
movl $0x4, %r12d
movl $0x4, %edx
jmp 0xc373b
movl %r12d, %edx
leaq 0x76b5a(%rip), %rsi     # 0x13a29c
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0xe9226
movq %r12, (%rbx)
movl $0x1, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/rosprite.c
// Function: de_module_rosprite
void de_module_rosprite(deark *c, struct deark_module_info *mi)
{
	mi->id = "rosprite";
	mi->desc = "RISC OS Sprite, a.k.a. Acorn Sprite";
	mi->run_fn = de_run_rosprite;
	mi->identify_fn = de_identify_rosprite;
}

// Assembly:
leaq 0x76b71(%rip), %rax     # 0x13a2e0
movq %rax, (%rsi)
leaq 0x76b70(%rip), %rax     # 0x13a2e9
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xc3794
movq %rax, 0x18(%rsi)
leaq 0xd2d(%rip), %rax       # 0xc44bc
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/rosprite.c
// Function: de_identify_rosprite
static int de_identify_rosprite(deark *c)
{
	i64 num_images, first_sprite_offset, implied_file_size;
	i64 offset2;

	num_images = de_getu32le(0);
	if(num_images<1 || num_images>1000) return 0;

	first_sprite_offset = de_getu32le(4) - 4;
	// I've only ever seen this be 12 or (rarely) 28, though it's legal
	// for it to have other values
	if(first_sprite_offset!=12 && first_sprite_offset!=28) return 0;
	if(first_sprite_offset+48 > c->infile->len) return 0;

	implied_file_size = de_getu32le(8) - 4;
	if(implied_file_size > c->infile->len) return 0;

	if(num_images!=1) {
		// TODO?: A multi-sprite file with extra junk at EOF will not be detected.
		// To better detect multi-sprite files, we'd probably have to walk through
		// the file.
		if(implied_file_size != c->infile->len) return 0;
		return 55;
	}

	offset2 = de_getu32le(first_sprite_offset);
	if(offset2==implied_file_size && implied_file_size==c->infile->len) {
		// Found some bad files where this pointer is absolute when it should be
		// relative.
		return 15;
	}
	offset2 += first_sprite_offset;
	if(offset2 != implied_file_size) return 0;
	if(implied_file_size == c->infile->len) return 80;
	return 30;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
xorl %r14d, %r14d
xorl %esi, %esi
callq 0xef37e
movq %rax, %r13
addq $-0x3e9, %rax           # imm = 0xFC17
cmpq $-0x3e8, %rax           # imm = 0xFC18
jb 0xc4593
movq 0x18(%rbx), %rdi
movl $0x4, %esi
callq 0xef37e
leaq -0x4(%rax), %r15
movq %r15, %rcx
andq $-0x11, %rcx
cmpq $0xc, %rcx
jne 0xc4593
addq $0x2c, %rax
movq 0x18(%rbx), %rdi
cmpq 0x18(%rdi), %rax
jg 0xc4593
movl $0x8, %esi
callq 0xef37e
movq %rax, %r12
addq $-0x4, %r12
movq 0x18(%rbx), %rdi
movq 0x18(%rdi), %rax
cmpq %rax, %r12
jg 0xc4593
cmpq $0x1, %r13
jne 0xc4584
movq %r15, %rsi
callq 0xef37e
cmpq %r12, %rax
jne 0xc455d
movq 0x18(%rbx), %rcx
movl $0xf, %r14d
cmpq 0x18(%rcx), %r12
je 0xc4593
addq %r15, %rax
movl $0x0, %r14d
cmpq %r12, %rax
jne 0xc4593
movq 0x18(%rbx), %rax
cmpq 0x18(%rax), %r12
movl $0x50, %eax
movl $0x1e, %r14d
cmovel %eax, %r14d
jmp 0xc4593
xorl %ecx, %ecx
cmpq %rax, %r12
movl $0x37, %r14d
cmovnel %ecx, %r14d
movl %r14d, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/rosprite.c
// Function: getpal256
static de_color getpal256(int k)
{
	u8 r, g, b;
	if(k<0 || k>255) return 0;
	r = k%8 + ((k%32)/16)*8;
	g = k%4 + ((k%128)/32)*4;
	b = (u8)(k%4 + ((k%16)/8)*4 + (k/128)*8);
	r = (r<<4)|r;
	g = (g<<4)|g;
	b = (b<<4)|b;
	return DE_MAKE_RGB(r,g,b);
}

// Assembly:
xorl %eax, %eax
cmpl $0xff, %edi
ja 0xc45f2
movl %edi, %eax
andl $0x7, %eax
movl %edi, %ecx
shrl %ecx
movl %ecx, %edx
andl $0x8, %edx
orl %eax, %edx
movl %edi, %eax
andl $0x3, %eax
movl %edi, %esi
shrl $0x3, %esi
andl $0xc, %esi
orl %eax, %esi
andl $0x4, %ecx
shrl $0x4, %edi
andl $0x8, %edi
orl %ecx, %edi
orl %eax, %edi
movl %edi, %eax
shll $0x4, %eax
orl %edi, %eax
imull $0x110000, %edx, %ecx   # imm = 0x110000
imull $0x1100, %esi, %edx     # imm = 0x1100
orl %ecx, %edx
addl %edx, %eax
addl $0xff000000, %eax       # imm = 0xFF000000
retq
nop
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/rpm.c
// Function: de_module_rpm
void de_module_rpm(deark *c, struct deark_module_info *mi)
{
	mi->id = "rpm";
	mi->desc = "RPM Package Manager";
	mi->run_fn = de_run_rpm;
	mi->identify_fn = de_identify_rpm;
}

// Assembly:
leaq 0x76115(%rip), %rax     # 0x13a710
movq %rax, (%rsi)
leaq 0x7610f(%rip), %rax     # 0x13a714
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xc4620
movq %rax, 0x18(%rsi)
leaq 0x2ed(%rip), %rax       # 0xc4908
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/rsc.c
// Function: de_module_rsc
void de_module_rsc(deark *c, struct deark_module_info *mi)
{
	mi->id = "rsc";
	mi->desc = "GEM resource file";
	mi->run_fn = de_run_rsc;
	mi->identify_fn = de_identify_rsc;
	mi->help_fn = de_help_rsc;
}

// Assembly:
leaq 0x75b6b(%rip), %rax     # 0x13a8c2
movq %rax, (%rsi)
leaq 0x75b65(%rip), %rax     # 0x13a8c6
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0xc4d87
movq %rax, 0x18(%rsi)
leaq 0x11b3(%rip), %rax      # 0xc5f2a
movq %rax, 0x20(%rsi)
leaq 0x11e1(%rip), %rax      # 0xc5f63
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/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 %rbx
movq %rdx, %rax
cmpq $0x24, %rdx
setge %dl
testq %rcx, %rcx
setle %r9b
orb %dl, %r9b
movq 0x80(%rsi), %rdx
cmpq %rax, %rdx
setge %r10b
andb %r9b, %r10b
cmpb $0x0, 0x15(%rsi)
setne %r9b
testb $0x1, %al
sete %sil
orb %r9b, %sil
andb %r10b, %sil
leaq (%rcx,%rax), %r9
cmpq %rdx, %r9
jg 0xc5fbe
movl $0x1, %ebx
testb %sil, %sil
jne 0xc6003
cmpq %rdx, %r9
jle 0xc5fed
cmpq $0x2, %rcx
jl 0xc5fed
xorb $0x1, %sil
jne 0xc5fed
decq %r9
leaq 0x74a16(%rip), %rsi     # 0x13a9ef
xorl %ebx, %ebx
movq %r8, %rdx
movq %rax, %rcx
movq %r9, %r8
xorl %eax, %eax
callq 0xe9df7
jmp 0xc6003
leaq 0x74a18(%rip), %rsi     # 0x13aa0c
xorl %ebx, %ebx
movq %r8, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe9df7
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
movq %rdi, 0x20(%rsp)
cmpq $0x0, 0x10(%rsi)
jle 0xc60ee
movq %rsi, %r15
movq 0x8(%rsp), %rcx
leaq 0x1(%rcx), %rax
shrq $0x3f, %rax
addq %rcx, %rax
incq %rax
sarq %rax
cmpq $0x2, %rax
movl $0x1, %ecx
cmovgeq %rax, %rcx
movq %rcx, 0x18(%rsp)
xorl %r13d, %r13d
cmpq $0x0, 0x8(%rsp)
jle 0xc60e1
movq %r13, %rax
imulq 0x8(%rsp), %rax
addq 0x10(%rsp), %rax
movq %rax, 0x28(%rsp)
xorl %r14d, %r14d
xorl %r12d, %r12d
movq 0x28(%rsp), %rax
leaq (%rax,%r12,2), %rsi
movq 0x20(%rsp), %rcx
movq (%rcx), %rax
movq 0x18(%rax), %rdi
movl 0x10(%rcx), %edx
callq 0xef570
movq %rax, %rbp
movl $0x10, %ebx
movq %r14, 0x30(%rsp)
decq %rbx
btl %ebx, %ebp
movl $0x0, %eax
adcb $-0x1, %al
movzbl %al, %ecx
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0xf2a4a
incq %r14
testq %rbx, %rbx
jne 0xc60a8
incq %r12
movq 0x30(%rsp), %r14
addq $0x10, %r14
cmpq 0x18(%rsp), %r12
jne 0xc607e
incq %r13
cmpq 0x10(%r15), %r13
jl 0xc605d
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x16(%rdx), %rsi
movq (%r12), %rax
movq 0x18(%rax), %rdi
movl 0x10(%r12), %edx
callq 0xef570
movq %rax, (%r14)
addq $0x18, %r15
movq (%r12), %rax
movq 0x18(%rax), %rdi
movl 0x10(%r12), %edx
movq %r15, %rsi
callq 0xef570
movq %rax, 0x8(%r14)
movq (%r14), %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0xe9b05
movq $-0x401, %rax           # imm = 0xFBFF
movq (%r14), %rcx
addq %rax, %rcx
cmpq $-0x400, %rcx           # imm = 0xFC00
jb 0xc617c
movq 0x8(%r14), %rcx
addq %rax, %rcx
movl $0x1, %ebp
cmpq %rax, %rcx
ja 0xc618f
leaq 0x74a76(%rip), %rsi     # 0x13abf9
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r15
movq %rcx, %rbp
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %rbx
movq 0x10(%rdx), %rcx
imulq 0x8(%rdx), %rcx
leaq 0x516b8(%rip), %r8      # 0x11787c
movq %rbp, %rdx
callq 0xc5f71
testl %eax, %eax
je 0xc62aa
movq 0x10(%r14), %rcx
imulq 0x8(%r14), %rcx
leaq 0x7f9af(%rip), %r8      # 0x145b93
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0xc5f71
testl %eax, %eax
je 0xc62aa
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
callq 0xf241d
testl %eax, %eax
je 0xc62aa
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
movl $0x2, %ecx
callq 0xf2cab
movq %rax, %r12
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
movl $0x1, %ecx
callq 0xf2cab
movq %r15, (%rsp)
movq %rax, %r15
movq 0x10(%r14), %rcx
movq %r13, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0xc6007
movq 0x10(%r14), %rcx
movq %r13, %rdi
movq %r15, %rsi
movq (%rsp), %rdx
callq 0xc6007
movq %r12, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0xf3e1c
movq %rbx, %rdi
callq 0xea9a9
movq %rax, %r13
leaq 0x6cdb3(%rip), %rcx     # 0x13303d
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0xc630c
movq %r12, %rdi
movq %r13, %rsi
movl $0x2, %edx
callq 0xf2917
jmp 0xc62b3
xorl %r12d, %r12d
xorl %r15d, %r15d
xorl %r13d, %r13d
movq %r12, %rdi
callq 0xf28d4
movq %r15, %rdi
callq 0xf28d4
movq %rbx, %rdi
movq %r13, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xea9b3
// File: /workspace/github_c_makefile_star2_O1/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:
testq %rsi, %rsi
je 0xc630b
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x20(%rsi), %rdi
testq %rdi, %rdi
je 0xc62f9
callq 0xf6bb0
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe9752
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %rbx
movq %rdi, %r15
callq 0xf6870
movq %rax, %r14
movq 0x20(%r13), %rdi
callq 0xf6c00
testl %eax, %eax
je 0xc6342
movq 0x20(%r13), %rsi
movq %r14, %rdi
callq 0xf6969
testq %r12, %r12
je 0xc6370
movq %r14, %rdi
callq 0xf6c00
testl %eax, %eax
je 0xc6360
movq %r14, %rdi
movl $0x2e, %esi
callq 0xf69a2
movq %r14, %rdi
movq %r12, %rsi
movl $0x2, %edx
callq 0xf6a40
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0xea9e4
movq %r14, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xf6bb0
// File: /workspace/github_c_makefile_star2_O1/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:
leaq 0x5aa35(%rip), %rax     # 0x121040
movq %rax, (%rsi)
leaq 0x74913(%rip), %rax     # 0x13af28
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xc6630
movq %rax, 0x18(%rsi)
leaq 0xae4(%rip), %rax       # 0xc710f
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/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 %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
movl $0x28, %esi
callq 0xe969b
movq 0x10(%rbx), %rcx
movq (%rcx), %rcx
movq %rcx, (%rax)
movq %rax, 0x28(%rbx)
leaq 0x1c(%rip), %rax        # 0xc7383
movq %rax, 0x40(%rbx)
leaq 0x26(%rip), %rax        # 0xc7398
movq %rax, 0x48(%rbx)
leaq 0x2a(%rip), %rax        # 0xc73a7
movq %rax, 0x30(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/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:
testq %rdx, %rdx
jle 0xc743d
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq 0x28(%rdi), %r15
xorl %r12d, %r12d
cmpq $0x0, 0x18(%r15)
jle 0xc73e3
movq (%r15), %rdi
movzbl (%r14,%r12), %esi
callq 0xf11be
decq 0x18(%r15)
incq 0x20(%r15)
jmp 0xc741f
cmpl $0x0, 0x8(%r15)
je 0xc740a
movzbl (%r14,%r12), %esi
movq (%r15), %rdi
movq 0x10(%r15), %rdx
callq 0xf14bd
movl $0x0, 0x8(%r15)
addq $0x2, 0x20(%r15)
jmp 0xc741f
movzbl (%r14,%r12), %eax
testb %al, %al
js 0xc7429
movq %rax, 0x10(%r15)
movl $0x1, 0x8(%r15)
incq %r12
cmpq %r12, %rbx
jne 0xc73c5
jmp 0xc7432
andl $0x7f, %eax
movq %rax, 0x18(%r15)
jmp 0xc73dd
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O1/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:
leaq 0x73e39(%rip), %rax     # 0x13b280
movq %rax, (%rsi)
leaq 0x73e3c(%rip), %rax     # 0x13b28d
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0xc7477
movq %rax, 0x18(%rsi)
leaq 0x6c(%rip), %rax        # 0xc74d3
movq %rax, 0x20(%rsi)
leaq 0xb8(%rip), %rax        # 0xc752a
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/spectrum512.c
// Function: de_module_spectrum512c
void de_module_spectrum512c(deark *c, struct deark_module_info *mi)
{
	mi->id = "spectrum512c";
	mi->desc = "Spectrum 512 Compressed";
	mi->run_fn = de_run_spectrum512c;
	mi->identify_fn = de_identify_spectrum512c;
	mi->help_fn = de_help_spectrum512cs;
}

// Assembly:
leaq 0x73d71(%rip), %rax     # 0x13b2a7
movq %rax, (%rsi)
leaq 0x73d74(%rip), %rax     # 0x13b2b4
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0xc7566
movq %rax, 0x18(%rsi)
leaq 0x17(%rip), %rax        # 0xc756d
movq %rax, 0x20(%rsi)
leaq 0x72(%rip), %rax        # 0xc75d3
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/spectrum512.c
// Function: de_identify_spectrum512c
static int de_identify_spectrum512c(deark *c)
{
	if(dbuf_memcmp(c->infile, 0, "\x53\x50\x00\x00", 4))
		return 0;

	if(de_input_file_has_ext(c, "spc")) {
		return 100;
	}

	if(de_input_file_has_ext(c, "sps")) {
		return 0;
	}

	return 10;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
leaq 0x73e6d(%rip), %rdx     # 0x13b3ec
xorl %r14d, %r14d
movl $0x4, %ecx
xorl %esi, %esi
callq 0xf025e
testl %eax, %eax
jne 0xc75c8
leaq 0x73e1b(%rip), %rsi     # 0x13b3b4
movq %rbx, %rdi
callq 0xea936
movl $0x64, %r14d
testl %eax, %eax
jne 0xc75c8
leaq 0x73e06(%rip), %rsi     # 0x13b3b8
movq %rbx, %rdi
callq 0xea936
xorl %ecx, %ecx
testl %eax, %eax
movl $0xa, %r14d
cmovnel %ecx, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/spectrum512.c
// Function: de_module_spectrum512s
void de_module_spectrum512s(deark *c, struct deark_module_info *mi)
{
	mi->id = "spectrum512s";
	mi->desc = "Spectrum 512 Smooshed";
	mi->run_fn = de_run_spectrum512s;
	mi->identify_fn = de_identify_spectrum512s;
	mi->help_fn = de_help_spectrum512cs;
}

// Assembly:
leaq 0x73cd7(%rip), %rax     # 0x13b2cc
movq %rax, (%rsi)
leaq 0x73cda(%rip), %rax     # 0x13b2d9
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0xc7625
movq %rax, 0x18(%rsi)
leaq 0x1a(%rip), %rax        # 0xc762f
movq %rax, 0x20(%rsi)
leaq -0x4d(%rip), %rax       # 0xc75d3
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/spectrum512.c
// Function: do_spu_internal
static void do_spu_internal(deark *c, dbuf *inf, int is_enhanced)
{
	struct atari_img_decode_data *adata = NULL;
	de_finfo *fi = NULL;
	static const i64 num_colors = 199*48;

	adata = de_malloc(c, sizeof(struct atari_img_decode_data));
	adata->is_spectrum512 = 1;
	adata->pal = de_mallocarray(c, num_colors, sizeof(u32));
	adata->bpp = 4;
	adata->w = 320;
	adata->h = 199;
	adata->ncolors = num_colors;

	fmtutil_read_atari_palette(c, inf, 32000, adata->pal, num_colors, num_colors,
		is_enhanced?DE_FLAG_ATARI_15BIT_PAL:0);

	adata->unc_pixels = dbuf_open_input_subfile(inf, 160, inf->len-160);
	adata->img = de_bitmap_create(c, adata->w, adata->h, 3);
	fi = de_finfo_create(c);
	fmtutil_atari_set_standard_density(c, adata, fi);
	fmtutil_atari_decode_image(c, adata);
	de_bitmap_write_to_file_finfo(adata->img, fi, 0);

	if(adata) {
		de_bitmap_destroy(adata->img);
		de_free(c, adata->pal);
		dbuf_close(adata->unc_pixels);
		de_free(c, adata);
	}
	de_finfo_destroy(c, fi);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
xorl %ebp, %ebp
testl %edx, %edx
setne %bpl
movl $0x40, %esi
callq 0xe969b
movq %rax, %r14
movl $0x1, 0x2c(%rax)
movl $0x2550, %esi           # imm = 0x2550
movl $0x4, %edx
movq %rbx, %rdi
callq 0xea259
movq %rax, 0x30(%r14)
movq $0x4, (%r14)
movq $0x140, 0x10(%r14)      # imm = 0x140
movq $0xc7, 0x18(%r14)
movq $0x2550, 0x8(%r14)      # imm = 0x2550
addl %ebp, %ebp
movl %ebp, (%rsp)
movl $0x7d00, %edx           # imm = 0x7D00
movl $0x2550, %r8d           # imm = 0x2550
movl $0x2550, %r9d           # imm = 0x2550
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rcx
callq 0xf8c62
movq $-0xa0, %rdx
addq 0x18(%r15), %rdx
movl $0xa0, %esi
movq %r15, %rdi
callq 0xf1988
movq %rax, 0x20(%r14)
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
movq %rbx, %rdi
movl $0x3, %ecx
callq 0xf2cab
movq %rax, 0x38(%r14)
movq %rbx, %rdi
callq 0xea9a9
movq %rax, %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0xf9323
movq %rbx, %rdi
movq %r14, %rsi
callq 0xf900c
movq 0x38(%r14), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0xf2917
movq 0x38(%r14), %rdi
callq 0xf28d4
movq 0x30(%r14), %rsi
movq %rbx, %rdi
callq 0xe9752
movq 0x20(%r14), %rdi
callq 0xf0b13
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe9752
movq %rbx, %rdi
movq %r15, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xea9b3
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/sunras.c
// Function: de_module_sunras
void de_module_sunras(deark *c, struct deark_module_info *mi)
{
	mi->id = "sunras";
	mi->desc = "Sun Raster";
	mi->run_fn = de_run_sunras;
	mi->identify_fn = de_identify_sunras;
	mi->help_fn = de_help_sunras;
}

// Assembly:
leaq 0x7354d(%rip), %rax     # 0x13b418
movq %rax, (%rsi)
leaq 0x7354a(%rip), %rax     # 0x13b41f
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0xc7efb
movq %rax, 0x18(%rsi)
leaq 0x860(%rip), %rax       # 0xc874b
movq %rax, 0x20(%rsi)
leaq 0x87b(%rip), %rax       # 0xc8771
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/t64.c
// Function: de_module_t64
void de_module_t64(deark *c, struct deark_module_info *mi)
{
	mi->id = "t64";
	mi->desc = "T64 (C64 tape format)";
	mi->run_fn = de_run_t64;
	mi->identify_fn = de_identify_t64;
}

// Assembly:
leaq 0x4cc85(%rip), %rax     # 0x11540c
movq %rax, (%rsi)
leaq 0x72eb5(%rip), %rax     # 0x13b646
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xc87ac
movq %rax, 0x18(%rsi)
leaq 0x32c(%rip), %rax       # 0xc8ad3
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/tar.c
// Function: de_module_tar
void de_module_tar(deark *c, struct deark_module_info *mi)
{
	mi->id = "tar";
	mi->desc = "tar archive";
	mi->run_fn = de_run_tar;
	mi->identify_fn = de_identify_tar;
}

// Assembly:
leaq 0x80066(%rip), %rax     # 0x148b69
movq %rax, (%rsi)
leaq 0x72c93(%rip), %rax     # 0x13b7a0
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xc8b28
movq %rax, 0x18(%rsi)
leaq 0xc67(%rip), %rax       # 0xc978a
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/tar.c
// Function: de_identify_tar
static int de_identify_tar(deark *c)
{
	int has_ext;
	u8 buf[8];
	i64 k;
	i64 digit_count;

	has_ext = de_input_file_has_ext(c, "tar");;
	if(!dbuf_memcmp(c->infile, 257, "ustar", 5)) {
		return has_ext ? 100 : 90;
	}

	if(has_ext) {
		if(!dbuf_memcmp(c->infile, 508, "tar\0", 4)) {
			return 90;
		}
	}

	// Try to detect tar formats that don't have the "ustar" identifier.
	if(!has_ext) return 0;

	// The 'checksum' field has a fairly distinctive format.
	// "This field should be stored as six octal digits followed by a null and
	// a space character."

	de_read(buf, 148, 8);
	digit_count = 0;
	for(k=0; k<6; k++) {
		if(buf[k]>='0' && buf[k]<='7') {
			digit_count++;
		}
		else if(buf[k]!=' ') {
			return 0;
		}
	}
	if(digit_count<1) return 0;
	if(buf[6]==0x00 && buf[7]==' ') return 60;
	if(buf[6]==' ' && buf[7]==0x00) return 15;
	return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x7f3d2(%rip), %rsi     # 0x148b69
callq 0xea936
movl %eax, %ebp
movq 0x18(%rbx), %rdi
leaq 0x7230a(%rip), %rdx     # 0x13bab3
movl $0x101, %esi            # imm = 0x101
movl $0x5, %ecx
callq 0xf025e
testl %eax, %eax
je 0xc9860
testl %ebp, %ebp
je 0xc985c
movq 0x18(%rbx), %rdi
leaq 0x71fb9(%rip), %rdx     # 0x13b78c
movl $0x1fc, %esi            # imm = 0x1FC
movl $0x4, %ecx
callq 0xf025e
movl %eax, %ecx
xorl %edx, %edx
movl $0x5a, %eax
testl %ecx, %ecx
cmovnel %edx, %eax
je 0xc986f
movq 0x18(%rbx), %rdi
movq %rsp, %rsi
movl $0x94, %edx
movl $0x8, %ecx
callq 0xeeee8
xorl %eax, %eax
xorl %ecx, %ecx
movb (%rsp,%rcx), %dl
movl %edx, %esi
andb $-0x8, %sil
cmpb $0x30, %sil
jne 0xc9820
incq %rax
jmp 0xc9825
cmpb $0x20, %dl
jne 0xc985c
incq %rcx
cmpq $0x6, %rcx
jne 0xc980c
testq %rax, %rax
jle 0xc985c
movb 0x6(%rsp), %cl
movb 0x7(%rsp), %dl
movl %edx, %esi
xorb $0x20, %sil
movl $0x3c, %eax
orb %cl, %sil
je 0xc986f
xorb $0x20, %cl
xorl %esi, %esi
orb %dl, %cl
movl $0xf, %eax
cmovnel %esi, %eax
jmp 0xc986f
xorl %eax, %eax
jmp 0xc986f
testl %ebp, %ebp
movl $0x5a, %ecx
movl $0x64, %eax
cmovel %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/tar.c
// Function: destroy_pmd
static void destroy_pmd(deark *c, struct phys_member_data *pmd)
{
	if(!pmd) return;
	ucstring_destroy(pmd->name);
	de_destroy_stringreaderdata(c, pmd->linkname);
	ucstring_destroy(pmd->prefix);
	de_free(c, pmd);
}

// Assembly:
testq %rsi, %rsi
je 0xc98d1
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x30(%rsi), %rdi
callq 0xf6bb0
movq 0x38(%rbx), %rsi
movq %r14, %rdi
callq 0xf00aa
movq 0x40(%rbx), %rdi
callq 0xf6bb0
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe9752
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/tar.c
// Function: read_ascii_octal_number
static int read_ascii_octal_number(dbuf *f, i64 pos, i64 fieldsize,
	i64 *value)
{
	u8 b1;
	b1 = dbuf_getbyte(f, pos);

	if(b1<0x80) {
		// The usual ASCII-octal format
		return dbuf_read_ascii_number(f, pos, fieldsize, 8, value);
	}

	// "base-256" or some other special format
	if(b1==0x80) { // positive base-256 number
		*value = dbuf_getint_ext(f, pos+1, (unsigned int)(fieldsize-1), 0, 0);
		return 1;
	}
	else if(b1==0xff) { // negative base-256 number
		*value = dbuf_getint_ext(f, pos+1, (unsigned int)(fieldsize-1), 0, 1);
		return 1;
	}

	*value = 0;
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
callq 0xef0d5
testb %al, %al
js 0xc9f82
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movl $0x8, %ecx
movq %rbx, %r8
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xefa0a
cmpb $-0x1, %al
je 0xc9fb3
movzbl %al, %eax
cmpl $0x80, %eax
jne 0xc9fd9
incq %r15
decl %r14d
movq %r12, %rdi
movq %r15, %rsi
movl %r14d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0xef6f2
movq %rax, (%rbx)
movl $0x1, %ebp
jmp 0xc9fe2
incq %r15
decl %r14d
movl $0x1, %ebp
movq %r12, %rdi
movq %r15, %rsi
movl %r14d, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0xef6f2
movq %rax, (%rbx)
jmp 0xc9fe2
movq $0x0, (%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/tar.c
// Function: do_exthdr_timestamp
static void do_exthdr_timestamp(deark *c, lctx *d, struct phys_member_data *pmd,
	struct exthdr_item *ehi, struct extattr_data *ea, int tsidx, const char *name)
{
	double val_dbl;
	double val_frac;
	i64 val_int;
	char timestamp_buf[64];

	if(ehi->val_len<1) return;

	// TODO: There is probably more roundoff error here than there needs to be.
	val_dbl = de_strtod(ehi->value->sz, NULL);
	if(val_dbl > 0.0) {
		val_int = (i64)val_dbl;
		val_frac = val_dbl - (double)val_int;
	}
	else {
		val_int = (i64)val_dbl;
		val_frac = 0.0;
	}

	de_unix_time_to_timestamp(val_int, &ea->alt_timestamps[tsidx], 0x1);
	if(val_frac > 0.0) {
		de_timestamp_set_subsec(&ea->alt_timestamps[tsidx], val_frac);
	}

	de_dbg_timestamp_to_string(c, &ea->alt_timestamps[tsidx],
		timestamp_buf, sizeof(timestamp_buf), 0);
	de_dbg(c, "%s: %s", name, timestamp_buf);
}

// Assembly:
cmpq $0x0, 0x38(%rsi)
jle 0xca0ad
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq %r8, %rbx
movl %ecx, %ebp
movq %rdx, %r15
movq %rdi, %r14
movq 0x48(%rsi), %rax
movq 0x8(%rax), %rdi
xorl %esi, %esi
callq 0x18090
cvttsd2si %xmm0, %rdi
cvtsi2sd %rdi, %xmm2
xorpd %xmm1, %xmm1
cmpltsd %xmm0, %xmm1
subsd %xmm2, %xmm0
andpd %xmm1, %xmm0
movapd %xmm0, (%rsp)
movl %ebp, %eax
shlq $0x4, %rax
addq %rax, %r15
addq $0x20, %r15
movq %r15, %rsi
movl $0x1, %edx
callq 0xeace2
movapd (%rsp), %xmm0
ucomisd 0x689b3(%rip), %xmm0    # 0x132a18
jbe 0xca06f
movq %r15, %rdi
callq 0xead3a
leaq 0x10(%rsp), %r12
movl $0x40, %ecx
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
xorl %r8d, %r8d
callq 0xeb687
leaq 0x7ed59(%rip), %rsi     # 0x148dea
movq %r14, %rdi
movq %rbx, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0xe9226
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/tga.c
// Function: de_module_tga
void de_module_tga(deark *c, struct deark_module_info *mi)
{
	mi->id = "tga";
	mi->desc = "Truevision TGA, a.k.a. TARGA";
	mi->run_fn = de_run_tga;
	mi->identify_fn = de_identify_tga;
	mi->help_fn = de_help_tga;
}

// Assembly:
leaq 0x71aa5(%rip), %rax     # 0x13bb5c
movq %rax, (%rsi)
leaq 0x71a9f(%rip), %rax     # 0x13bb60
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0xca0e7
movq %rax, 0x18(%rsi)
leaq 0x12dc(%rip), %rax      # 0xcb3b3
movq %rax, 0x20(%rsi)
leaq 0x142b(%rip), %rax      # 0xcb50d
movq %rax, 0x28(%rsi)
retq