// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/mmm.c
// Function: mmm_default_pal256
static void mmm_default_pal256(deark *c, struct mmm_ctx *d)
{
	UI i, j, k;
	static const u8 v[6] = {0, 48, 100, 152, 204, 252};

	de_warn(c, "Using a default palette. Colors might be wrong.");

	// Note: This sets pal[40] incorrectly, but it will be fixed later.
	for(i=0; i<6; i++) {
		for(j=0; j<6; j++) {
			for(k=0; k<6; k++) {
				d->pal[40 + i*36 + j*6 + k] = DE_MAKE_RGB(v[i], v[j], v[k]);
			}
		}
	}

	for(i=0; i<=10; i++) {
		d->pal[i] = DE_MAKE_GRAY(i*24);
	}

	for(i=0; i<10; i++) {
		UI t;

		t = 16+24*i;
		if(t>=128) t += 4;
		d->pal[11+i] = DE_MAKE_RGB(0, 0, t);
		d->pal[21+i] = DE_MAKE_RGB(0, t, 0);
		d->pal[31+i] = DE_MAKE_RGB(t, 0, 0);
	}

	d->have_pal = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
leaq 0xdcb0f(%rip), %rsi     # 0x1bc32a
movb $0x0, %al
callq 0x15bc10
movl $0x0, -0x14(%rbp)
cmpl $0x6, -0x14(%rbp)
jae 0xdf8d6
movl $0x0, -0x18(%rbp)
cmpl $0x6, -0x18(%rbp)
jae 0xdf8c6
movl $0x0, -0x1c(%rbp)
cmpl $0x6, -0x1c(%rbp)
jae 0xdf8b6
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0xdcd04(%rip), %rax     # 0x1bc561
movzbl (%rax,%rcx), %edx
shll $0x10, %edx
orl $0xff000000, %edx       # imm = 0xFF000000
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0xdcceb(%rip), %rax     # 0x1bc561
movzbl (%rax,%rcx), %eax
shll $0x8, %eax
orl %eax, %edx
movl -0x1c(%rbp), %eax
movl %eax, %ecx
leaq 0xdccd6(%rip), %rax     # 0x1bc561
movzbl (%rax,%rcx), %eax
orl %eax, %edx
movq -0x10(%rbp), %rax
imull $0x24, -0x14(%rbp), %ecx
addl $0x28, %ecx
imull $0x6, -0x18(%rbp), %esi
addl %esi, %ecx
addl -0x1c(%rbp), %ecx
movl %ecx, %ecx
movl %edx, 0x38(%rax,%rcx,4)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xdf84b
jmp 0xdf8b8
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xdf83a
jmp 0xdf8c8
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xdf829
movl $0x0, -0x14(%rbp)
cmpl $0xa, -0x14(%rbp)
ja 0xdf915
imull $0x18, -0x14(%rbp), %edx
shll $0x10, %edx
orl $0xff000000, %edx       # imm = 0xFF000000
imull $0x18, -0x14(%rbp), %eax
shll $0x8, %eax
orl %eax, %edx
imull $0x18, -0x14(%rbp), %eax
orl %eax, %edx
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %edx, 0x38(%rax,%rcx,4)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xdf8dd
movl $0x0, -0x14(%rbp)
cmpl $0xa, -0x14(%rbp)
jae 0xdf9aa
imull $0x18, -0x14(%rbp), %eax
addl $0x10, %eax
movl %eax, -0x20(%rbp)
cmpl $0x80, -0x20(%rbp)
jb 0xdf942
movl -0x20(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %edx
orl $0xff000000, %edx       # imm = 0xFF000000
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0xb, %ecx
movl %ecx, %ecx
movl %edx, 0x38(%rax,%rcx,4)
movl -0x20(%rbp), %edx
shll $0x8, %edx
orl $0xff000000, %edx       # imm = 0xFF000000
orl $0x0, %edx
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x15, %ecx
movl %ecx, %ecx
movl %edx, 0x38(%rax,%rcx,4)
movl -0x20(%rbp), %edx
shll $0x10, %edx
orl $0xff000000, %edx       # imm = 0xFF000000
orl $0x0, %edx
orl $0x0, %edx
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1f, %ecx
movl %ecx, %ecx
movl %edx, 0x38(%rax,%rcx,4)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xdf91c
movq -0x10(%rbp), %rax
movb $0x1, 0x20(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)