// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/mbk.c
// Function: render_stos_pictbank_std
static void render_stos_pictbank_std(deark *c, struct pictbank_params *pb)
{
	i64 planesize;
	i64 lump;
	u8 xbuf[8];

	if((size_t)pb->num_planes > sizeof(xbuf)) goto done;
	if(pb->bits_per_pixel != pb->num_planes) goto done;
	de_zeromem(xbuf, sizeof(xbuf));
	planesize = pb->width_in_bytes * pb->pseudoheight;

	for(lump=0; lump<pb->height_in_lumps; lump++) {
		i64 col_idx;
		i64 lump_start_srcpos_in_plane;
		i64 lump_start_ypos;

		lump_start_srcpos_in_plane = pb->width_in_bytes * pb->lines_per_lump * lump;
		lump_start_ypos = pb->lines_per_lump * lump;

		for(col_idx=0; col_idx<pb->width_in_bytes; col_idx++) {
			i64 col_start_srcpos_in_plane;
			i64 ypos_in_lump;

			col_start_srcpos_in_plane = lump_start_srcpos_in_plane +
				pb->lines_per_lump*col_idx;

			for(ypos_in_lump=0; ypos_in_lump<pb->lines_per_lump; ypos_in_lump++) {
				UI i;
				UI pn;
				i64 xpos, ypos;

				ypos = lump_start_ypos + ypos_in_lump;

				for(pn=0; pn<pb->num_planes; pn++) {
					xbuf[pn] = dbuf_getbyte(pb->unc_pixels, planesize*pn +
						col_start_srcpos_in_plane + ypos_in_lump);
				}

				for(i=0; i<8; i++) {
					UI palent;

					palent = 0;
					for(pn=0; pn<pb->bits_per_pixel; pn++) {
						if(xbuf[pn] & (1<<(7-i))) {
							palent |= (1<<pn);
						}
					}

					xpos = col_idx*8 + i;
					de_bitmap_setpixel_rgb(pb->img, xpos, ypos, pb->pal[palent]);
				}
			}
		}
	}

	pb->ok = 1;

done:
	;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
cmpq $0x8, %rax
jbe 0xddab2
jmp 0xddcbb
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4(%rcx), %eax
je 0xddac7
jmp 0xddcbb
leaq -0x28(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x19140
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
imulq 0x28(%rcx), %rax
movq %rax, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jge 0xddcb4
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
imulq 0x20(%rcx), %rax
imulq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
imulq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jge 0xddca1
movq -0x38(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x20(%rcx), %rcx
imulq -0x30(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jge 0xddc8e
movq -0x40(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x68(%rbp)
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jae 0xddbd0
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x18(%rbp), %rsi
movl -0x58(%rbp), %eax
imulq %rax, %rsi
addq -0x48(%rbp), %rsi
addq -0x50(%rbp), %rsi
callq 0x165060
movb %al, %cl
movl -0x58(%rbp), %eax
movb %cl, -0x28(%rbp,%rax)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0xddb90
movl $0x0, -0x54(%rbp)
cmpl $0x8, -0x54(%rbp)
jae 0xddc7b
movl $0x0, -0x6c(%rbp)
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jae 0xddc38
movl -0x58(%rbp), %eax
movzbl -0x28(%rbp,%rax), %eax
movl $0x7, %ecx
subl -0x54(%rbp), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0xddc2b
movl -0x58(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
orl -0x6c(%rbp), %eax
movl %eax, -0x6c(%rbp)
jmp 0xddc2d
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0xddbef
movq -0x30(%rbp), %rax
shlq $0x3, %rax
movl -0x54(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x60(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x6c(%rbp), %ecx
movl (%rax,%rcx,4), %ecx
callq 0x16b310
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0xddbd7
jmp 0xddc7d
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0xddb6b
jmp 0xddc90
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xddb39
jmp 0xddca3
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0xddaf4
movq -0x10(%rbp), %rax
movb $0x1, (%rax)
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)