LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/cfb.c
// Function: do_cfb_olepropertyset
static void do_cfb_olepropertyset(deark *c, lctx *d, struct dir_entry_info *dei,
	int is_summaryinfo, int is_root)
{
	dbuf *f = NULL;
	int saved_indent_level;

	if(dei->stream_size>1000000) goto done;
	f = dbuf_create_membuf(c, dei->stream_size, 1);
	copy_any_stream_to_dbuf(c, d, dei, 0, dei->stream_size, f);

	de_dbg_indent_save(c, &saved_indent_level);
	if(is_summaryinfo) {
		de_dbg(c, "SummaryInformation (%s)", is_root?"root":"non-root");
	}
	else {
		de_dbg(c, "property set stream");
	}

	de_dbg_indent(c, 1);
	de_run_module_by_id_on_slice(c, "olepropset", NULL, f, 0, f->len);
	de_dbg_indent(c, -1);

done:
	dbuf_close(f);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x18(%rbp), %rax
cmpq $0xf4240, 0x10(%rax)    # imm = 0xF4240
jle 0x54646
jmp 0x54712
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
movl $0x1, %edx
callq 0x168020
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %r8
movq -0x28(%rbp), %r9
xorl %eax, %eax
movl %eax, %ecx
callq 0x543d0
movq -0x8(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x15b580
cmpl $0x0, -0x1c(%rbp)
je 0x546c0
movq -0x8(%rbp), %rdi
movl -0x20(%rbp), %ecx
leaq 0x151506(%rip), %rdx    # 0x1a5ba8
leaq 0x151503(%rip), %rax    # 0x1a5bac
cmpl $0x0, %ecx
cmovneq %rax, %rdx
leaq 0x1514d9(%rip), %rsi    # 0x1a5b90
movb $0x0, %al
callq 0x15b0d0
jmp 0x546d2
movq -0x8(%rbp), %rdi
leaq 0x1514e6(%rip), %rsi    # 0x1a5bb1
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rcx
movq -0x28(%rbp), %rax
movq 0x18(%rax), %r9
leaq 0x1514ce(%rip), %rsi    # 0x1a5bc5
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rdx
callq 0x15c9f0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x28(%rbp), %rdi
callq 0x1676a0
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/cfb.c
// Function: do_OfficeArtStream
static void do_OfficeArtStream(deark *c, lctx *d, struct dir_entry_info *dei)
{
	dbuf *tmpstream = NULL;

	de_dbg(c, "OfficeArt stream, len=%"I64_FMT, dei->stream_size);
	de_dbg_indent(c, 1);
	tmpstream = dbuf_create_membuf(c, dei->stream_size, 0x1);
	copy_any_stream_to_dbuf(c, d, dei, 0, dei->stream_size, tmpstream);
	if(tmpstream->len < dei->stream_size) {
		de_warn(c, "OfficeArt stream might have been truncated");
	}

	de_run_module_by_id_on_slice2(c, "officeart", NULL, tmpstream, 0, tmpstream->len);
	de_dbg_indent(c, -1);
	dbuf_close(tmpstream);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdx
leaq 0x1510c1(%rip), %rsi    # 0x1a5c90
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
movl $0x1, %edx
callq 0x168020
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %r8
movq -0x20(%rbp), %r9
xorl %eax, %eax
movl %eax, %ecx
callq 0x543d0
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x18(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jge 0x54c43
movq -0x8(%rbp), %rdi
leaq 0x15106e(%rip), %rsi    # 0x1a5caa
movb $0x0, %al
callq 0x15bc10
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq -0x20(%rbp), %rax
movq 0x18(%rax), %r9
leaq 0x15107b(%rip), %rsi    # 0x1a5cd5
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rdx
callq 0x15cab0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x20(%rbp), %rdi
callq 0x1676a0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/cfb.c
// Function: do_StreamNamedThumbnail
static void do_StreamNamedThumbnail(deark *c, lctx *d, struct dir_entry_info *dei)
{
	dbuf *f = NULL;
	i64 size1;

	if(dei->stream_size<32 || dei->stream_size>DE_MAX_SANE_OBJECT_SIZE) {
		goto done;
	}
	f = dbuf_create_membuf(c, 0, 0);

	// Start by reading just a little, to figure out the data type
	copy_any_stream_to_dbuf(c, d, dei, 0, 16, f);
	size1 = dbuf_getu32le(f, 0);
	if(size1+4 != dei->stream_size) goto done;
	if(dbuf_memcmp(f, 4, "UI\x00\x00", 4)) goto done;

	copy_any_stream_to_dbuf(c, d, dei, 16, dei->stream_size-16, f);
	do_Corel_UIformat(c, d, dei, f, 4, size1-4, 1);

done:
	dbuf_close(f);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x20, 0x10(%rax)
jl 0x54cc5
movq -0x18(%rbp), %rax
cmpq $0x5f5e100, 0x10(%rax)  # imm = 0x5F5E100
jle 0x54cca
jmp 0x54d90
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x168020
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %r9
xorl %eax, %eax
movl %eax, %ecx
movl $0x10, %r8d
callq 0x543d0
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x165540
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
addq $0x4, %rax
movq -0x18(%rbp), %rcx
cmpq 0x10(%rcx), %rax
je 0x54d21
jmp 0x54d90
movq -0x20(%rbp), %rdi
movl $0x4, %ecx
leaq 0x150775(%rip), %rdx    # 0x1a54a6
movq %rcx, %rsi
callq 0x166ab0
cmpl $0x0, %eax
je 0x54d40
jmp 0x54d90
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %r8
subq $0x10, %r8
movq -0x20(%rbp), %r9
movl $0x10, %ecx
callq 0x543d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r9
subq $0x4, %r9
movl $0x4, %r8d
movl $0x1, (%rsp)
callq 0x55280
movq -0x20(%rbp), %rdi
callq 0x1676a0
addq $0x30, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/cfb.c
// Function: do_StreamNamedImages
static void do_StreamNamedImages(deark *c, lctx *d, struct dir_entry_info *dei)
{
	dbuf *f = NULL;

	if(dei->stream_size<32 || dei->stream_size>DE_MAX_SANE_OBJECT_SIZE) {
		goto done;
	}
	f = dbuf_create_membuf(c, 0, 0);

	// Start by reading just a little, to figure out the data type
	copy_any_stream_to_dbuf(c, d, dei, 0, 16, f);
	if(dbuf_memcmp(f, 4, "\x01\x00\x00\x00\xff\xd8\xff", 7) &&
		dbuf_memcmp(f, 4, "\x00\x00\x00\x00\x55\x49\x00\x00", 8))
	{
		// Not an "Images" stream we recognize.
		// TODO: Can we detect this if the first image is in "simple"
		// format?
		goto done;
	}

	// This is an object found in Corel Print House (.CPH) and similar files.
	copy_any_stream_to_dbuf(c, d, dei, 16, dei->stream_size-16, f);
	do_CorelImages_internal(c, d, dei, f);

done:
	dbuf_close(f);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x20, 0x10(%rax)
jl 0x54dd5
movq -0x18(%rbp), %rax
cmpq $0x5f5e100, 0x10(%rax)  # imm = 0x5F5E100
jle 0x54dda
jmp 0x54e87
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x168020
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %r9
xorl %eax, %eax
movl %eax, %ecx
movl $0x10, %r8d
callq 0x543d0
movq -0x20(%rbp), %rdi
movl $0x4, %esi
leaq 0x151113(%rip), %rdx    # 0x1a5f2f
movl $0x7, %ecx
callq 0x166ab0
cmpl $0x0, %eax
je 0x54e4c
movq -0x20(%rbp), %rdi
movl $0x4, %esi
leaq 0x150670(%rip), %rdx    # 0x1a54ab
movl $0x8, %ecx
callq 0x166ab0
cmpl $0x0, %eax
je 0x54e4c
jmp 0x54e87
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %r8
subq $0x10, %r8
movq -0x20(%rbp), %r9
movl $0x10, %ecx
callq 0x543d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x55790
movq -0x20(%rbp), %rdi
callq 0x1676a0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/cfb.c
// Function: lookup_thumbsdb_catalog_entry
static i64 lookup_thumbsdb_catalog_entry(deark *c, lctx *d, struct dir_entry_info *dei)
{
	i64 i;
	i64 id;

	if(d->thumbsdb_catalog_num_entries<1 || !d->thumbsdb_catalog) return -1;
	if(!dei->fname_srd || !dei->fname_srd->str) return -1;

	id = stream_name_to_catalog_id(c, d, dei);
	if(id<0) return -1;

	for(i=0; i<d->thumbsdb_catalog_num_entries; i++) {
		if(d->thumbsdb_catalog[i].id == id)
			return i;
	}
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x1, 0xa8(%rax)
jl 0x54ed0
movq -0x18(%rbp), %rax
cmpq $0x0, 0xb0(%rax)
jne 0x54edd
movq $-0x1, -0x8(%rbp)
jmp 0x54f80
movq -0x20(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x54ef7
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
cmpq $0x0, 0x18(%rax)
jne 0x54f01
movq $-0x1, -0x8(%rbp)
jmp 0x54f80
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x55120
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jge 0x54f27
movq $-0x1, -0x8(%rbp)
jmp 0x54f80
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0xa8(%rcx), %rax
jge 0x54f78
movq -0x18(%rbp), %rax
movq 0xb0(%rax), %rax
movq -0x28(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
cmpq -0x30(%rbp), %rax
jne 0x54f68
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x54f80
jmp 0x54f6a
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x54f2f
movq $-0x1, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/cfb.c
// Function: stream_name_to_catalog_id
static i64 stream_name_to_catalog_id(deark *c, lctx *d, struct dir_entry_info *dei)
{
	char buf[16];
	size_t nlen;
	size_t i;

	nlen = dei->fname_srd->sz_utf8_strlen;
	if(nlen>sizeof(buf)-1) return -1;

	for(i=0; i<nlen; i++) {
		// Name should contain only digits
		if(dei->fname_srd->sz_utf8[i]<'0' || dei->fname_srd->sz_utf8[i]>'9') return -1;

		// The stream name is the *reversed* string form of the ID number.
		// (I assume this is to try to keep the directory tree structure balanced.)
		buf[nlen-1-i] = dei->fname_srd->sz_utf8[i];
	}
	buf[nlen] = '\0';

	return de_atoi64(buf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x28(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0xf, -0x38(%rbp)
jbe 0x55158
movq $-0x1, -0x8(%rbp)
jmp 0x551ed
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x551d7
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x20(%rax), %rax
movq -0x40(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x30, %eax
jl 0x5519c
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x20(%rax), %rax
movq -0x40(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x39, %eax
jle 0x551a6
movq $-0x1, -0x8(%rbp)
jmp 0x551ed
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x20(%rax), %rax
movq -0x40(%rbp), %rcx
movb (%rax,%rcx), %cl
movq -0x38(%rbp), %rax
subq $0x1, %rax
subq -0x40(%rbp), %rax
movb %cl, -0x30(%rbp,%rax)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x55160
movq -0x38(%rbp), %rax
movb $0x0, -0x30(%rbp,%rax)
leaq -0x30(%rbp), %rdi
callq 0x15ccc0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/cfb.c
// Function: thumbsdb_msrgba_write_dqt
static void thumbsdb_msrgba_write_dqt(deark *c, dbuf *outf)
{
	size_t i;
	u8 tbl[64];

	fmtutil_get_std_jpeg_qtable(0, tbl);

	for(i=0; i<64; i++) {
		tbl[i] = (u8)(((UI)tbl[i]+1)/2);
	}

	dbuf_write(outf, (const u8*)"\xff\xdb\x00\x43\x00", 5);
	dbuf_write(outf, tbl, 64);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x60(%rbp), %rsi
xorl %edi, %edi
callq 0x176500
movq $0x0, -0x18(%rbp)
cmpq $0x40, -0x18(%rbp)
jae 0x55250
movq -0x18(%rbp), %rax
movzbl -0x60(%rbp,%rax), %eax
addl $0x1, %eax
shrl %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, -0x60(%rbp,%rax)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x55223
movq -0x10(%rbp), %rdi
leaq 0x150245(%rip), %rsi    # 0x1a54a0
movl $0x5, %edx
callq 0x166170
movq -0x10(%rbp), %rdi
leaq -0x60(%rbp), %rsi
movl $0x40, %edx
callq 0x166170
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/cfb.c
// Function: do_Corel_simple_image
static void do_Corel_simple_image(deark *c, lctx *d, struct dir_entry_info *dei,
	dbuf *f, i64 pos1)
{
	i64 pos = pos1;
	i64 w, h;
	i64 i, j;
	u8 b;
	de_bitmap *img = NULL;

	w = dbuf_getu32le_p(f, &pos);
	h = dbuf_getu32le_p(f, &pos);
	de_dbg_dimensions(c, w, h);
	if(!de_good_image_dimensions(c, w, h)) goto done;

	img = de_bitmap_create(c, w, h, 1);

	// TODO: I don't know whether this is the right way to interpret this
	// image type.
	for(j=0; j<img->height; j++) {
		for(i=0; i<img->width; i++) {
			b = dbuf_getbyte(f, pos + j*w + i);
			de_bitmap_setpixel_gray(img, i, j, b);
		}
	}

	de_bitmap_write_to_file(img, NULL, DE_CREATEFLAG_FLIP_IMAGE);

done:
	de_bitmap_destroy(img);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %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
movq %rax, -0x30(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x20(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165580
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165580
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x15bba0
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x16a850
cmpl $0x0, %eax
jne 0x55a3a
jmp 0x55ae5
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movl $0x1, %ecx
callq 0x16b750
movq %rax, -0x60(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq -0x60(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jge 0x55ad3
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0x60(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jge 0x55ac3
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x50(%rbp), %rax
imulq -0x38(%rbp), %rax
addq %rax, %rsi
addq -0x48(%rbp), %rsi
callq 0x165060
movb %al, -0x51(%rbp)
movq -0x60(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x50(%rbp), %rdx
movzbl -0x51(%rbp), %ecx
callq 0x16b1c0
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x55a72
jmp 0x55ac5
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x55a5c
movq -0x60(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x4, %edx
callq 0x16afd0
movq -0x60(%rbp), %rdi
callq 0x16af60
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/cpio.c
// Function: de_module_cpio
void de_module_cpio(deark *c, struct deark_module_info *mi)
{
	mi->id = "cpio";
	mi->desc = "cpio archive";
	mi->run_fn = de_run_cpio;
	mi->identify_fn = de_identify_cpio;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0x150435(%rip), %rcx    # 0x1a5f4c
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0x15042c(%rip), %rcx    # 0x1a5f51
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x1c(%rip), %rcx        # 0x55b50
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0x14d(%rip), %rcx       # 0x55c90
movq %rcx, 0x20(%rax)
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/cpio.c
// Function: de_run_cpio
static void de_run_cpio(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	const char *subfmt_name;
	i64 bytes_consumed;
	i64 pos;
	int ret;

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

	d->input_encoding = de_get_input_encoding(c, NULL, DE_ENCODING_UTF8);

	pos = 0;

	if(identify_cpio_internal(c, pos, &d->first_subfmt)==0) {
		de_err(c, "Not a cpio file, or unknown cpio format");
		goto done;
	}

	subfmt_name = get_subfmt_name(d->first_subfmt);
	de_declare_fmtf(c, "cpio %s", subfmt_name);

	d->crco_cksum = de_crcobj_create(c, DE_CRCOBJ_SUM_BYTES);

	while(1) {
		if(d->trailer_found) break;
		if(pos >= c->infile->len) break;
		bytes_consumed = 0;
		ret = read_member(c, d, pos, &bytes_consumed);
		if(!ret) break;
		if(bytes_consumed<1) break;
		pos += bytes_consumed;
	}

done:
	if(d) {
		de_crcobj_destroy(d->crco_cksum);
		de_free(c, d);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %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 -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0x15e4a0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8(%rax)
movq $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x55cc0
cmpl $0x0, %eax
jne 0x55bca
movq -0x8(%rbp), %rdi
leaq 0x1503a0(%rip), %rsi    # 0x1a5f5e
movb $0x0, %al
callq 0x15bfb0
jmp 0x55c69
movq -0x18(%rbp), %rax
movl (%rax), %edi
callq 0x55df0
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x15039e(%rip), %rsi    # 0x1a5f86
movb $0x0, %al
callq 0x15e3d0
movq -0x8(%rbp), %rdi
movl $0x30, %esi
callq 0x15eac0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0x55c14
jmp 0x55c67
movq -0x30(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpq 0x18(%rcx), %rax
jl 0x55c28
jmp 0x55c67
movq $0x0, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x30(%rbp), %rdx
leaq -0x28(%rbp), %rcx
callq 0x55e90
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0x55c50
jmp 0x55c67
cmpq $0x1, -0x28(%rbp)
jge 0x55c59
jmp 0x55c67
movq -0x28(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x55c08
jmp 0x55c69
cmpq $0x0, -0x18(%rbp)
je 0x55c8a
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x15f2e0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x15b820
addq $0x40, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/cpio.c
// Function: identify_cpio_internal
static int identify_cpio_internal(deark *c, i64 pos, int *subfmt)
{
	u8 b[6];

	*subfmt = 0;
	de_read(b, pos, sizeof(b));

	if(!de_memcmp(b, "070707", 6)) {
		*subfmt = SUBFMT_ASCII_PORTABLE;
		return 100;
	}
	if(!de_memcmp(b, "070701", 6)) {
		*subfmt = SUBFMT_ASCII_NEW;
		return 100;
	}
	if(!de_memcmp(b, "070702", 6)) {
		*subfmt = SUBFMT_ASCII_NEWCRC;
		return 100;
	}
	if(b[0]==0xc7 && b[1]==0x71) {
		*subfmt = SUBFMT_BINARY_LE;
		return 70;
	}
	if(b[0]==0x71 && b[1]==0xc7) {
		*subfmt = SUBFMT_BINARY_BE;
		return 70;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x26(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl $0x6, %ecx
callq 0x164d10
leaq -0x26(%rbp), %rdi
leaq 0x15028b(%rip), %rsi    # 0x1a5f8e
movl $0x6, %edx
callq 0x19170
cmpl $0x0, %eax
jne 0x55d28
movq -0x20(%rbp), %rax
movl $0x3, (%rax)
movl $0x64, -0x4(%rbp)
jmp 0x55dda
leaq -0x26(%rbp), %rdi
leaq 0x150262(%rip), %rsi    # 0x1a5f95
movl $0x6, %edx
callq 0x19170
cmpl $0x0, %eax
jne 0x55d58
movq -0x20(%rbp), %rax
movl $0x4, (%rax)
movl $0x64, -0x4(%rbp)
jmp 0x55dda
leaq -0x26(%rbp), %rdi
leaq 0x150239(%rip), %rsi    # 0x1a5f9c
movl $0x6, %edx
callq 0x19170
cmpl $0x0, %eax
jne 0x55d85
movq -0x20(%rbp), %rax
movl $0x5, (%rax)
movl $0x64, -0x4(%rbp)
jmp 0x55dda
movzbl -0x26(%rbp), %eax
cmpl $0xc7, %eax
jne 0x55dac
movzbl -0x25(%rbp), %eax
cmpl $0x71, %eax
jne 0x55dac
movq -0x20(%rbp), %rax
movl $0x1, (%rax)
movl $0x46, -0x4(%rbp)
jmp 0x55dda
movzbl -0x26(%rbp), %eax
cmpl $0x71, %eax
jne 0x55dd3
movzbl -0x25(%rbp), %eax
cmpl $0xc7, %eax
jne 0x55dd3
movq -0x20(%rbp), %rax
movl $0x2, (%rax)
movl $0x46, -0x4(%rbp)
jmp 0x55dda
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/cpio.c
// Function: get_subfmt_name
static const char *get_subfmt_name(int n)
{
	const char *name = NULL;

	switch(n) {
	case SUBFMT_BINARY_LE: name = "Binary little-endian"; break;
	case SUBFMT_BINARY_BE: name = "Binary big-endian"; break;
	case SUBFMT_ASCII_PORTABLE: name = "ASCII Portable"; break;
	case SUBFMT_ASCII_NEW: name = "ASCII New"; break;
	case SUBFMT_ASCII_NEWCRC: name = "ASCII New-CRC"; break;
	}
	return name?name:"?";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x4(%rbp)
movq $0x0, -0x10(%rbp)
movl -0x4(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x18(%rbp)
subl $0x4, %eax
ja 0x55e62
movq -0x18(%rbp), %rax
leaq 0x15011e(%rip), %rcx    # 0x1a5f38
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x150179(%rip), %rax    # 0x1a5fa3
movq %rax, -0x10(%rbp)
jmp 0x55e62
leaq 0x150181(%rip), %rax    # 0x1a5fb8
movq %rax, -0x10(%rbp)
jmp 0x55e62
leaq 0x150186(%rip), %rax    # 0x1a5fca
movq %rax, -0x10(%rbp)
jmp 0x55e62
leaq 0x150188(%rip), %rax    # 0x1a5fd9
movq %rax, -0x10(%rbp)
jmp 0x55e62
leaq 0x150185(%rip), %rax    # 0x1a5fe3
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x55e73
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x55e80
leaq 0x161db3(%rip), %rax    # 0x1b7c2d
movq %rax, -0x20(%rbp)
jmp 0x55e80
movq -0x20(%rbp), %rax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/cpio.c
// Function: read_member_name
static void read_member_name(deark *c, lctx *d, struct member_data *md)
{
	i64 namesize_adjusted;

	// Filenames end with a NUL byte, which is included in the namesize field.
	namesize_adjusted = md->namesize - 1;
	if(namesize_adjusted<0) namesize_adjusted=0;
	if(namesize_adjusted>DE_DBG_MAX_STRLEN) namesize_adjusted=DE_DBG_MAX_STRLEN;

	md->filename_srd = dbuf_read_string(c->infile, md->startpos + md->fixed_header_size,
		namesize_adjusted, namesize_adjusted, 0, d->input_encoding);

	de_dbg(c, "name: \"%s\"", ucstring_getpsz(md->filename_srd->str));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
subq $0x1, %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jge 0x56ca3
movq $0x0, -0x20(%rbp)
cmpq $0x1f4, -0x20(%rbp)     # imm = 0x1F4
jle 0x56cb5
movq $0x1f4, -0x20(%rbp)     # imm = 0x1F4
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x18(%rbp), %rax
addq 0x10(%rax), %rsi
movq -0x20(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movl 0x8(%rax), %r9d
xorl %r8d, %r8d
callq 0x1664c0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x172500
movq -0x28(%rbp), %rdi
movq %rax, %rdx
leaq 0x1574b9(%rip), %rsi    # 0x1ae1d0
movb $0x0, %al
callq 0x15b0d0
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/d64.c
// Function: de_module_d64
void de_module_d64(deark *c, struct deark_module_info *mi)
{
	mi->id = "d64";
	mi->desc = "D64 (C64 disk image)";
	mi->run_fn = de_run_d64;
	mi->identify_fn = de_identify_d64;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0x14f40e(%rip), %rcx    # 0x1a6155
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0x14f404(%rip), %rcx    # 0x1a6159
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x1c(%rip), %rcx        # 0x56d80
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0x6d(%rip), %rcx        # 0x56de0
movq %rcx, 0x20(%rax)
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/d64.c
// Function: de_run_d64
static void de_run_d64(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;

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

	do_directory(c, d, 18, 1);

	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 $0x4, %esi
callq 0x15b780
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x12, %edx
movl $0x1, %ecx
callq 0x56e80
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x15b820
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/d64.c
// Function: de_identify_d64
static int de_identify_d64(deark *c)
{
	if(!de_input_file_has_ext(c, "d64")) return 0;
	if(!dbuf_memcmp(c->infile, 357*256, "\x12\x01\x41\x00", 4)) {
		return 100;
	}
	if(c->infile->len==683*256) return 30;
	if(c->infile->len==683*256+683) return 30;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x14f35e(%rip), %rsi    # 0x1a6155
callq 0x15d180
cmpl $0x0, %eax
jne 0x56e0a
movl $0x0, -0x4(%rbp)
jmp 0x56e73
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x16500, %esi          # imm = 0x16500
leaq 0x14f332(%rip), %rdx    # 0x1a6150
movl $0x4, %ecx
callq 0x166ab0
cmpl $0x0, %eax
jne 0x56e36
movl $0x64, -0x4(%rbp)
jmp 0x56e73
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
cmpq $0x2ab00, 0x18(%rax)    # imm = 0x2AB00
jne 0x56e51
movl $0x1e, -0x4(%rbp)
jmp 0x56e73
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
cmpq $0x2adab, 0x18(%rax)    # imm = 0x2ADAB
jne 0x56e6c
movl $0x1e, -0x4(%rbp)
jmp 0x56e73
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/d64.c
// Function: do_directory
static void do_directory(deark *c, lctx *d, i64 track, i64 sector)
{
	i64 pos;
	i64 sectorcount;
	i64 nexttrack, nextsector;
	i64 curtrack, cursector;

	pos = sector_offset(track, sector);
	de_dbg(c, "directory at t=%d,s=%d pos=%d", (int)track, (int)sector,
		(int)pos);

	curtrack = track;
	cursector = sector;
	sectorcount = 0;
	while(1) {
		do_directory_sector(c, d, curtrack, cursector, &nexttrack, &nextsector);
		if(nexttrack==0) break;
		sectorcount++;
		if(sectorcount>1000) break;
		curtrack = nexttrack;
		cursector = nextsector;
	}
}

// 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 -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x56f40
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl %eax, %edx
movq -0x20(%rbp), %rax
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %eax, %r8d
leaq 0x14f2a7(%rip), %rsi    # 0x1a616e
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x50(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x50(%rbp), %rcx
leaq -0x38(%rbp), %r8
leaq -0x40(%rbp), %r9
callq 0x56fe0
cmpq $0x0, -0x38(%rbp)
jne 0x56f0c
jmp 0x56f36
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
cmpq $0x3e8, -0x30(%rbp)     # imm = 0x3E8
jle 0x56f24
jmp 0x56f36
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x56ee6
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/d64.c
// Function: sector_offset
static i64 sector_offset(i64 track, i64 sector)
{
	i64 global_sector_index;
	i64 t;

	global_sector_index = 0;
	for(t=1; t<track; t++) {
		if(t<=17) global_sector_index+=21;
		else if(t<=24) global_sector_index+=19;
		else if(t<=30) global_sector_index+=18;
		else global_sector_index+=17;
	}
	global_sector_index += sector;

	return 256*(global_sector_index);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x1, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x8(%rbp), %rax
jge 0x56fc5
cmpq $0x11, -0x20(%rbp)
jg 0x56f7b
movq -0x18(%rbp), %rax
addq $0x15, %rax
movq %rax, -0x18(%rbp)
jmp 0x56fb5
cmpq $0x18, -0x20(%rbp)
jg 0x56f90
movq -0x18(%rbp), %rax
addq $0x13, %rax
movq %rax, -0x18(%rbp)
jmp 0x56fb3
cmpq $0x1e, -0x20(%rbp)
jg 0x56fa5
movq -0x18(%rbp), %rax
addq $0x12, %rax
movq %rax, -0x18(%rbp)
jmp 0x56fb1
movq -0x18(%rbp), %rax
addq $0x11, %rax
movq %rax, -0x18(%rbp)
jmp 0x56fb3
jmp 0x56fb5
jmp 0x56fb7
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x56f5c
movq -0x10(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
shlq $0x8, %rax
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/d64.c
// Function: do_directory_sector
static void do_directory_sector(deark *c, lctx *d, i64 track, i64 sector,
	i64 *nexttrack, i64 *nextsector)
{
	i64 pos;
	i64 i;

	pos = sector_offset(track, sector);
	de_dbg(c, "directory sector at t=%d,s=%d pos=%d", (int)track, (int)sector,
		(int)pos);
	de_dbg_indent(c, 1);

	*nexttrack = (i64)de_getbyte(pos);
	*nextsector = (i64)de_getbyte(pos+1);
	de_dbg(c, "next dir sector: t=%d,s=%d", (int)*nexttrack, (int)*nextsector);

	for(i=0; i<8; i++) {
		do_dir_entry(c, d, pos+i*32);
	}

	de_dbg_indent(c, -1);
}

// 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 -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x56f40
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl %eax, %edx
movq -0x20(%rbp), %rax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %eax, %r8d
leaq 0x14f15d(%rip), %rsi    # 0x1a618c
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x165060
movzbl %al, %eax
movl %eax, %ecx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
addq $0x1, %rsi
callq 0x165060
movzbl %al, %eax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rax
movl %eax, %edx
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl %eax, %ecx
leaq 0x14f112(%rip), %rsi    # 0x1a61b1
movb $0x0, %al
callq 0x15b0d0
movq $0x0, -0x40(%rbp)
cmpq $0x8, -0x40(%rbp)
jge 0x570df
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x40(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdx
callq 0x57100
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x570ae
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/drhalo.c
// Function: de_module_drhalocut
void de_module_drhalocut(deark *c, struct deark_module_info *mi)
{
	mi->id = "drhalocut";
	mi->desc = "Dr. Halo .CUT image";
	mi->run_fn = de_run_drhalocut;
	mi->identify_fn = de_identify_drhalocut;
	mi->help_fn = de_help_drhalocut;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0x14ec01(%rip), %rcx    # 0x1a62e8
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0x14ebfd(%rip), %rcx    # 0x1a62f2
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x2c(%rip), %rcx        # 0x57730
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0x15d(%rip), %rcx       # 0x57870
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
leaq 0x21e(%rip), %rcx       # 0x57940
movq %rcx, 0x28(%rax)
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/drhalo.c
// Function: de_run_drhalocut
static void de_run_drhalocut(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	i64 pos;
	dbuf *unc_pixels = NULL;
	const char *palfn;
	const char *tmps;

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

	palfn = de_get_ext_option(c, "file2");
	if(palfn) {
		if(!do_read_pal_file(c, d, palfn)) goto done;
	}

	tmps = de_get_ext_option(c, "drhalocut:pal");
	if(tmps) {
		if(!de_strcmp(tmps, "pc16"))
			d->opt_pal_pc16 = 1;
	}

	pos = 0;
	if(!do_read_header(c, d)) goto done;
	pos += 6;

	unc_pixels = dbuf_create_membuf(c, d->w*d->h, 0x1);
	if(!do_decompress(c, d, pos, unc_pixels)) goto done;

	write_cut_image(c, d, unc_pixels);

done:
	dbuf_close(unc_pixels);
	de_free(c, d);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl $0x478, %esi            # imm = 0x478
callq 0x15b780
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x144e0b(%rip), %rsi    # 0x19c578
callq 0x15cb30
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x5779a
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x58030
cmpl $0x0, %eax
jne 0x57798
jmp 0x5784b
jmp 0x5779a
movq -0x8(%rbp), %rdi
leaq 0x14eb7f(%rip), %rsi    # 0x1a6324
callq 0x15cb30
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x577d4
movq -0x38(%rbp), %rdi
leaq 0x14eb72(%rip), %rsi    # 0x1a6332
callq 0x191a0
cmpl $0x0, %eax
jne 0x577d2
movq -0x18(%rbp), %rax
movb $0x1, 0x11(%rax)
jmp 0x577d4
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x58490
cmpl $0x0, %eax
jne 0x577f0
jmp 0x5784b
movq -0x20(%rbp), %rax
addq $0x6, %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
imulq 0x8(%rax), %rsi
movl $0x1, %edx
callq 0x168020
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x58530
cmpl $0x0, %eax
jne 0x5783a
jmp 0x5784b
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x58620
movq -0x28(%rbp), %rdi
callq 0x1676a0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x15b820
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/drhalo.c
// Function: de_identify_drhalocut
static int de_identify_drhalocut(deark *c)
{
	i64 n;

	if(!de_input_file_has_ext(c, "cut")) return 0;
	n = de_getu16le(4);
	if(n!=0) return 0;
	n = de_getu16le(0);
	if(n<1 || n>4096) return 0;
	n = de_getu16le(2);
	if(n<1 || n>4096) return 0;
	return 10;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x14ea67(%rip), %rsi    # 0x1a62ee
callq 0x15d180
cmpl $0x0, %eax
jne 0x5789d
movl $0x0, -0x4(%rbp)
jmp 0x57929
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x4, %esi
callq 0x165280
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x578c3
movl $0x0, -0x4(%rbp)
jmp 0x57929
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x165280
movq %rax, -0x18(%rbp)
cmpq $0x1, -0x18(%rbp)
jl 0x578e9
cmpq $0x1000, -0x18(%rbp)    # imm = 0x1000
jle 0x578f2
movl $0x0, -0x4(%rbp)
jmp 0x57929
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x2, %esi
callq 0x165280
movq %rax, -0x18(%rbp)
cmpq $0x1, -0x18(%rbp)
jl 0x57919
cmpq $0x1000, -0x18(%rbp)    # imm = 0x1000
jle 0x57922
movl $0x0, -0x4(%rbp)
jmp 0x57929
movl $0xa, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/drhalo.c
// Function: de_module_drhalopic
void de_module_drhalopic(deark *c, struct deark_module_info *mi)
{
	mi->id = "drhalopic";
	mi->desc = "Dr. Halo .PIC image";
	mi->run_fn = de_run_drhalopic;
	mi->identify_fn = de_identify_drhalopic;
	mi->help_fn = de_help_drhalopic;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0x14e97f(%rip), %rcx    # 0x1a6306
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0x14e97b(%rip), %rcx    # 0x1a6310
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x2c(%rip), %rcx        # 0x579d0
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0x5dd(%rip), %rcx       # 0x57f90
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
leaq 0x64e(%rip), %rcx       # 0x58010
movq %rcx, 0x28(%rax)
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/drhalo.c
// Function: de_identify_drhalopic
static int de_identify_drhalopic(deark *c)
{
	if((UI)de_getu16be(0)!=0x4148) return 0;
	if(de_getbyte(6)!=0x02) return 0;
	if(de_input_file_has_ext(c, "pic")) return 70;
	return 30;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1651d0
cmpl $0x4148, %eax           # imm = 0x4148
je 0x57fbd
movl $0x0, -0x4(%rbp)
jmp 0x58005
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x6, %esi
callq 0x165060
movzbl %al, %eax
cmpl $0x2, %eax
je 0x57fe0
movl $0x0, -0x4(%rbp)
jmp 0x58005
movq -0x10(%rbp), %rdi
leaq 0x169ab2(%rip), %rsi    # 0x1c1a9d
callq 0x15d180
cmpl $0x0, %eax
je 0x57ffe
movl $0x46, -0x4(%rbp)
jmp 0x58005
movl $0x1e, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/drhalo.c
// Function: do_read_header
static int do_read_header(deark *c, lctx *d)
{
	d->w = de_getu16le(0);
	d->h = de_getu16le(2);
	de_dbg_dimensions(c, d->w, d->h);
	if(!de_good_image_dimensions(c, d->w, d->h)) return 0;
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x165280
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x2, %esi
callq 0x165280
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
callq 0x15bba0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
callq 0x16a850
cmpl $0x0, %eax
jne 0x58516
movl $0x0, -0x4(%rbp)
jmp 0x5851d
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/drhalo.c
// Function: do_decompress
static int do_decompress(deark *c, lctx *d, i64 pos1, dbuf *unc_pixels)
{
	i64 j;
	i64 pos = pos1;

	for(j=0; j<d->h; j++) {
		i64 linebytecount;

		// Make sure we're at the right place in the uncompressed pixels.
		dbuf_truncate(unc_pixels, j*d->w);

		if(pos > c->infile->len-2) break;
		linebytecount = de_getu16le_p(&pos);
		do_decompress_scanline(c, d, j, pos, linebytecount, unc_pixels);
		pos += linebytecount;
	}

	de_dbg(c, "decompressed %"I64_FMT" bytes to %"I64_FMT" bytes",
		(pos-pos1), unc_pixels->len);

	return 1;
}

// 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 -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jge 0x585e5
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x10(%rbp), %rax
imulq (%rax), %rsi
callq 0x168900
movq -0x30(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq 0x18(%rcx), %rcx
subq $0x2, %rcx
cmpq %rcx, %rax
jle 0x58596
jmp 0x585e5
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %r8
movq -0x20(%rbp), %r9
callq 0x586d0
movq -0x38(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x58558
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
subq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rcx
leaq 0x14dde3(%rip), %rsi    # 0x1a63e3
movb $0x0, %al
callq 0x15b0d0
movl $0x1, %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/drhalo.c
// Function: write_cut_image
static void write_cut_image(deark *c, lctx *d, dbuf *unc_pixels)
{
	if(d->have_palfile) {
		do_write_image_pal(c, d, unc_pixels);
		return;
	}

	analyze_image(c, d, unc_pixels);

	if(d->opt_pal_pc16 && d->max_color_val<16) {
		de_copy_std_palette(DE_PALID_PC16, 0, 0, d->pal, 16, 0);
		do_write_image_pal(c, d, unc_pixels);
		return;
	}

	do_write_image_gray(c, d, unc_pixels);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, 0x10(%rax)
je 0x58651
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x58800
jmp 0x586c2
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x58890
movq -0x10(%rbp), %rax
movzbl 0x11(%rax), %eax
cmpl $0x0, %eax
je 0x586b1
movq -0x10(%rbp), %rax
movzbl 0x12(%rax), %eax
cmpl $0x10, %eax
jge 0x586b1
movq -0x10(%rbp), %rcx
addq $0x18, %rcx
movl $0x14, %edi
xorl %r9d, %r9d
xorl %eax, %eax
movl %eax, %edx
movl $0x10, %r8d
movl %r9d, %esi
callq 0x161320
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x58800
jmp 0x586c2
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x589b0
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/drhalo.c
// Function: do_decompress_scanline
static int do_decompress_scanline(deark *c, lctx *d, i64 line_idx,
	i64 pos1, i64 len, dbuf *unc_pixels)
{
	u8 b, b2;
	i64 count;
	i64 pos = pos1;
	i64 opos1 = unc_pixels->len;

	while(1) {
		if((pos-pos1) >= len) break;

		b = de_getbyte_p(&pos);

		if(b==0 || b==0x80) { // end of row
			break;
		}
		else if(b & 0x80) { // RLE block
			count = (i64)(b - 0x80);
			b2 = de_getbyte_p(&pos);
			dbuf_write_run(unc_pixels, b2, count);
		}
		else { // uncompressed block
			count = (i64)b;
			dbuf_copy(c->infile, pos, count, unc_pixels);
			pos += count;
		}
	}

	de_dbg3(c, "scanline[%d]: decompressed %"I64_FMT
		" bytes (expected %"I64_FMT") to %"I64_FMT" bytes",
		(int)line_idx, pos-pos1,
		len, (unc_pixels->len - opos1));
	return 1;
}

// 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 -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rax
subq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jl 0x58717
jmp 0x587bb
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x48(%rbp), %rsi
callq 0x165170
movb %al, -0x31(%rbp)
movzbl -0x31(%rbp), %eax
cmpl $0x0, %eax
je 0x5873f
movzbl -0x31(%rbp), %eax
cmpl $0x80, %eax
jne 0x58741
jmp 0x587bb
movzbl -0x31(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x58787
movzbl -0x31(%rbp), %eax
subl $0x80, %eax
cltq
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x48(%rbp), %rsi
callq 0x165170
movb %al, -0x32(%rbp)
movq -0x30(%rbp), %rdi
movb -0x32(%rbp), %al
movq -0x40(%rbp), %rdx
movzbl %al, %esi
callq 0x168800
jmp 0x587b4
movzbl -0x31(%rbp), %eax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0x166070
movq -0x40(%rbp), %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x587b6
jmp 0x58704
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl %eax, %edx
movq -0x48(%rbp), %rcx
subq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
movq -0x30(%rbp), %rax
movq 0x18(%rax), %r9
subq -0x50(%rbp), %r9
leaq 0x14dc23(%rip), %rsi    # 0x1a6407
movb $0x0, %al
callq 0x15b400
movl $0x1, %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/drhalo.c
// Function: do_write_image_pal
static void do_write_image_pal(deark *c, lctx *d, dbuf *unc_pixels)
{
	de_bitmap *img = NULL;

	img = de_bitmap_create(c, d->w, d->h, 3);
	de_convert_image_paletted(unc_pixels, 0, 8, d->w, d->pal, img, 0);
	de_bitmap_write_to_file(img, NULL, DE_CREATEFLAG_OPT_IMAGE);
	de_bitmap_destroy(img);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0x3, %ecx
callq 0x16b750
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %r8
addq $0x18, %r8
movq -0x20(%rbp), %r9
xorl %eax, %eax
movl %eax, %esi
movl $0x8, %edx
xorl %eax, %eax
movl $0x0, (%rsp)
callq 0x16c520
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0x16afd0
movq -0x20(%rbp), %rdi
callq 0x16af60
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/drhalo.c
// Function: analyze_image
static void analyze_image(deark *c, lctx *d, dbuf *unc_pixels)
{
	i64 k;
	u8 b;
	u8 *v_used = NULL;

	v_used = de_malloc(c, 256);
	d->max_color_val = 0;
	d->color_count = 0;
	for(k=0; k<unc_pixels->len; k++) {
		b = dbuf_getbyte(unc_pixels, k);
		if(b > d->max_color_val)
			d->max_color_val = b;
		if(v_used[(UI)b]==0) {
			v_used[(UI)b] = 1;
			d->color_count++;
		}
	}
	de_dbg(c, "detected max val: %u", (UI)d->max_color_val);
	if(d->max_color_val<1) d->max_color_val=1;
	de_dbg(c, "detected color count: %u", d->color_count);
	de_free(c, v_used);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x15b780
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movb $0x0, 0x12(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x14(%rax)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jge 0x5894f
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x165060
movb %al, -0x21(%rbp)
movzbl -0x21(%rbp), %eax
movq -0x10(%rbp), %rcx
movzbl 0x12(%rcx), %ecx
cmpl %ecx, %eax
jle 0x58911
movb -0x21(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x12(%rax)
movq -0x30(%rbp), %rax
movzbl -0x21(%rbp), %ecx
movl %ecx, %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x5893f
movq -0x30(%rbp), %rax
movzbl -0x21(%rbp), %ecx
movl %ecx, %ecx
movb $0x1, (%rax,%rcx)
movq -0x10(%rbp), %rax
movl 0x14(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x14(%rax)
jmp 0x58941
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x588d9
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movzbl 0x12(%rax), %edx
leaq 0x14dae6(%rip), %rsi    # 0x1a6448
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movzbl 0x12(%rax), %eax
cmpl $0x1, %eax
jge 0x5897e
movq -0x10(%rbp), %rax
movb $0x1, 0x12(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x14(%rax), %edx
leaq 0x14dacd(%rip), %rsi    # 0x1a645d
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x15b820
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/drhalo.c
// Function: do_write_image_gray
static void do_write_image_gray(deark *c, lctx *d, dbuf *unc_pixels)
{
	de_bitmap *img = NULL;

	de_make_grayscale_palette(d->pal, (i64)d->max_color_val+1, 0);
	img = de_bitmap_create(c, d->w, d->h, 1);
	de_convert_image_paletted(unc_pixels, 0, 8, d->w, d->pal, img, 0);
	de_bitmap_write_to_file(img, NULL, DE_CREATEFLAG_OPT_IMAGE);
	de_bitmap_destroy(img);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rax
movzbl 0x12(%rax), %eax
movl %eax, %esi
addq $0x1, %rsi
xorl %edx, %edx
callq 0x16d580
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0x1, %ecx
callq 0x16b750
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %r8
addq $0x18, %r8
movq -0x20(%rbp), %r9
xorl %eax, %eax
movl %eax, %esi
movl $0x8, %edx
xorl %eax, %eax
movl $0x0, (%rsp)
callq 0x16c520
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0x16afd0
movq -0x20(%rbp), %rdi
callq 0x16af60
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)