// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/misc2.c
// Function: de_run_farbfeld
static void de_run_farbfeld(deark *c, de_module_params *mparams)
{
	de_bitmap *imghi = NULL; // high 8 bits of each sample
	de_bitmap *imglo = NULL; // low 8 bits of each sample
	i64 width, height;
	i64 i, j, k;
	i64 ppos;
	u8 sh[4];
	u8 sl[4];

	width = de_getu32be(8);
	height = de_getu32be(12);
	de_dbg_dimensions(c, width, height);
	if(!de_good_image_dimensions(c, width, height)) return;

	imghi = de_bitmap_create(c, width, height, 4);
	imglo = de_bitmap_create(c, width, height, 4);

	for(j=0; j<height; j++) {
		for(i=0; i<width; i++) {
			ppos = 16 + 8*(width*j + i);
			for(k=0; k<4; k++) {
				sh[k] = de_getbyte(ppos+2*k);
				sl[k] = de_getbyte(ppos+2*k+1);
			}
			de_bitmap_setpixel_rgba(imghi, i, j,
				DE_MAKE_RGBA(sh[0],sh[1],sh[2],sh[3]));
			de_bitmap_setpixel_rgba(imglo, i, j,
				DE_MAKE_RGBA(sl[0],sl[1],sl[2],sl[3]));
		}
	}
	de_bitmap16_write_to_file_finfo(imghi, imglo, NULL, DE_CREATEFLAG_OPT_IMAGE);
	de_bitmap_destroy(imghi);
	de_bitmap_destroy(imglo);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x8, %esi
callq 0x165470
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0xc, %esi
callq 0x165470
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x15bba0
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x16a850
cmpl $0x0, %eax
jne 0x97278
jmp 0x97408
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movl $0x4, %ecx
callq 0x16b750
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movl $0x4, %ecx
callq 0x16b750
movq %rax, -0x20(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x30(%rbp), %rax
jge 0x973e0
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x28(%rbp), %rax
jge 0x973cd
movq -0x28(%rbp), %rax
imulq -0x40(%rbp), %rax
addq -0x38(%rbp), %rax
shlq $0x3, %rax
addq $0x10, %rax
movq %rax, -0x50(%rbp)
movq $0x0, -0x48(%rbp)
cmpq $0x4, -0x48(%rbp)
jge 0x9735c
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rax
shlq %rax
addq %rax, %rsi
callq 0x165060
movb %al, %cl
movq -0x48(%rbp), %rax
movb %cl, -0x54(%rbp,%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rax
shlq %rax
addq %rax, %rsi
addq $0x1, %rsi
callq 0x165060
movb %al, %cl
movq -0x48(%rbp), %rax
movb %cl, -0x58(%rbp,%rax)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x972f9
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movzbl -0x51(%rbp), %ecx
shll $0x18, %ecx
movzbl -0x54(%rbp), %eax
shll $0x10, %eax
orl %eax, %ecx
movzbl -0x53(%rbp), %eax
shll $0x8, %eax
orl %eax, %ecx
movzbl -0x52(%rbp), %eax
orl %eax, %ecx
callq 0x16b350
movq -0x20(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movzbl -0x55(%rbp), %ecx
shll $0x18, %ecx
movzbl -0x58(%rbp), %eax
shll $0x10, %eax
orl %eax, %ecx
movzbl -0x57(%rbp), %eax
shll $0x8, %eax
orl %eax, %ecx
movzbl -0x56(%rbp), %eax
orl %eax, %ecx
callq 0x16b350
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x972ca
jmp 0x973cf
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x972b4
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
movl $0x2, %ecx
callq 0x16aac0
movq -0x18(%rbp), %rdi
callq 0x16af60
movq -0x20(%rbp), %rdi
callq 0x16af60
addq $0x60, %rsp
popq %rbp
retq
nop