// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bmp.c
// Function: de_run_ddb
static void de_run_ddb(deark *c, de_module_params *mparams)
{
	int has_filetype = 1;
	struct ddbctx_struct *d = NULL;
	i64 pos = 0;

	d = de_malloc(c, sizeof(struct ddbctx_struct));
	d->createflags = 0;

	if(de_havemodcode(c, mparams, 'N')) {
		has_filetype = 0;
	}
	if(de_havemodcode(c, mparams, 'X')) {
		d->createflags |= DE_CREATEFLAG_IS_AUX;
	}
	if(!c->padpix) {
		d->cdr_adjdim_flag = (u8)de_havemodcode(c, mparams, 'C');
	}
	if(mparams) {
		if(mparams->in_params.fi) {
			d->fi = mparams->in_params.fi;
		}
		// If not NULL, obj1 points to the  palette to use (must be de_color[256]).
		if(mparams->in_params.obj1) {
			d->have_custom_pal = 1;
			de_memcpy(d->pal, mparams->in_params.obj1, 256*sizeof(de_color));
		}
	}

	if(has_filetype) {
		UI file_type;
		file_type = (UI)de_getu16le_p(&pos);
		de_dbg(c, "file type: 0x%04x", file_type);
	}

	do_ddb_bitmap(c, d, pos);

	de_free(c, d);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq $0x0, 0x38(%rsp)
movl $0x420, %esi            # imm = 0x420
callq 0xe8b2b
movq %rax, %r12
movl $0x0, 0x8(%rax)
movq %rbx, %rdi
movq %r15, %rsi
movl $0x4e, %edx
callq 0xea4d9
movl %eax, %ebp
movq %rbx, %rdi
movq %r15, %rsi
movl $0x58, %edx
callq 0xea4d9
testl %eax, %eax
je 0x34ec2
orb $0x1, 0x8(%r12)
cmpb $0x0, 0xd6(%rbx)
jne 0x34ee0
movq %rbx, %rdi
movq %r15, %rsi
movl $0x43, %edx
callq 0xea4d9
movb %al, 0xc(%r12)
testq %r15, %r15
je 0x34f11
movq 0x28(%r15), %rax
testq %rax, %rax
je 0x34ef3
movq %rax, 0x10(%r12)
movq 0x38(%r15), %rsi
testq %rsi, %rsi
je 0x34f11
movb $0x1, 0x18(%r12)
leaq 0x1c(%r12), %rdi
movl $0x400, %edx            # imm = 0x400
callq 0x181e0
testl %ebp, %ebp
je 0x34f19
xorl %eax, %eax
jmp 0x34f40
movq 0x18(%rbx), %rdi
leaq 0x38(%rsp), %r15
movq %r15, %rsi
callq 0xeebeb
leaq 0xe030a(%rip), %rsi     # 0x11523b
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movq (%r15), %rax
leaq 0x28(%rsp), %rbp
movq %rax, (%rbp)
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xeebeb
leaq 0xe2f4c(%rip), %rsi     # 0x117ea8
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xeebeb
movq %rax, %r14
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xeebeb
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, 0x10(%rsp)
movq %rax, %rdx
callq 0xe8f88
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xeebeb
movq %rax, (%r12)
leaq 0x1013fc(%rip), %rsi    # 0x1363a9
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xeeb4b
movl %eax, %r15d
movq %r12, 0x18(%rsp)
movzbl %al, %r12d
leaq 0x1064d7(%rip), %rsi    # 0x13b4af
movq %rbx, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xeeb4b
movzbl %al, %r13d
leaq 0xe2eb7(%rip), %rsi     # 0x117eb3
movq %rbx, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0xe8617
movq (%rbp), %rdx
addq $0x4, %rdx
movq %rdx, (%rbp)
cmpb $0x1, %r13b
sete %al
cmpb $0x1, %r12b
sete %cl
movl %ecx, %ebp
andb %al, %bpl
cmpb $0x4, %r12b
sete %sil
andb %al, %sil
movl %ebp, %eax
orb %sil, %al
cmpb $0x8, %r13b
sete %dil
andb %cl, %dil
cmpb $0x20, %r13b
sete %r8b
andb %cl, %r8b
movl %r8d, %ecx
orb %dil, %cl
orb %al, %cl
je 0x35149
movb %r8b, 0xf(%rsp)
movb %dil, 0x30(%rsp)
movb %sil, 0x20(%rsp)
leaq 0x10cb45(%rip), %rsi    # 0x141bb7
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movl %r13d, %eax
mulb %r15b
movl %eax, %r12d
movq 0x18(%rsp), %rax
cmpb $0x0, 0xc(%rax)
setne %al
cmpb $0x1, %r12b
sete %cl
movq 0x10(%rsp), %r15
cmpq %r15, %r14
sete %dl
andb %al, %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x350db
cmpq $0x80, %r14
je 0x350be
movq %r14, %r15
cmpq $0x5a, %r14
jne 0x350db
decq %r14
leaq 0xe2e40(%rip), %rsi     # 0x117f08
movq %rbx, %rdi
movq %r14, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0xe8617
movq %r14, %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xf1db1
testl %eax, %eax
je 0x35164
xorl %ecx, %ecx
cmpb $0x1, %r12b
setne %cl
movq 0x18(%rsp), %r12
movq (%r12), %rax
shlq $0x3, %rax
cqto
idivq %r13
leal 0x1(,%rcx,2), %r8d
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
movq %r15, %rcx
callq 0xf26a5
movq %rax, %r15
testb %bpl, %bpl
je 0x3516d
movq 0x18(%rbx), %rdi
movq 0x28(%rsp), %rsi
movq (%r12), %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0xf2a40
movq %r15, %rbp
jmp 0x351d4
leaq 0xe2d73(%rip), %rsi     # 0x117ec3
xorl %ebp, %ebp
movq %rbx, %rdi
movl %r13d, %edx
movl %r12d, %ecx
xorl %eax, %eax
callq 0xe9295
jmp 0x35166
xorl %ebp, %ebp
movq 0x18(%rsp), %r12
jmp 0x351e9
movq %r15, 0x10(%rsp)
cmpb $0x0, 0x20(%rsp)
je 0x3520e
movq %r12, %r14
movq 0x28(%rsp), %r12
movq (%r14), %r13
shlq $0x2, %r13
leaq 0x40(%rsp), %rbp
movl $0x10, %r8d
movl $0x32, %edi
xorl %esi, %esi
xorl %edx, %edx
movq %rbp, %rcx
xorl %r9d, %r9d
callq 0xec55a
movq 0x18(%rbx), %rdi
movq (%r14), %r8
movl $0x4, %edx
movq %r12, %rsi
movq %r14, %r12
movq %r13, %rcx
movq %rbp, %r9
pushq $0x2
movq 0x18(%rsp), %rbp
pushq %rbp
callq 0xf30b3
addq $0x10, %rsp
movq 0x10(%r12), %rsi
movl 0x8(%r12), %edx
orl $0x2, %edx
movq %rbp, %rdi
callq 0xf22d0
movq %rbp, %rdi
callq 0xf228d
movq %rbx, %rdi
movq %r12, %rsi
callq 0xe8be2
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x0, 0x30(%rsp)
je 0x3536d
movq 0x28(%rsp), %r15
leaq 0x1c(%r12), %rcx
movl $0x8, %r8d
movl $0x32, %edi
movl $0x1, %esi
xorl %edx, %edx
xorl %r9d, %r9d
callq 0xec55a
movq %r12, %rcx
addq $0x3fc, %rcx            # imm = 0x3FC
movl $0x8, %edx
movl $0x8, %r8d
movl $0x32, %edi
movl $0x1, %esi
xorl %r9d, %r9d
callq 0xec55a
cmpb $0x0, 0x18(%r12)
movq 0x10(%rsp), %rbp
jne 0x352b1
movdqa 0xe2587(%rip), %xmm0    # 0x117800
movl $0x17, %eax
movdqa 0xe258a(%rip), %xmm1    # 0x117810
movdqa 0xe2592(%rip), %xmm2    # 0x117820
movdqa %xmm0, %xmm3
pslld $0x8, %xmm3
paddd %xmm1, %xmm3
movdqu %xmm3, (%r12,%rax,4)
paddd %xmm2, %xmm0
addq $0x4, %rax
cmpq $0xff, %rax
jne 0x3528e
movq 0x10(%rbp), %rcx
testq %rcx, %rcx
jle 0x351d4
movq %r15, 0x30(%rsp)
movq %r12, %r14
movq %rbx, 0x20(%rsp)
movq 0x8(%rbp), %rax
xorl %r12d, %r12d
xorl %ebx, %ebx
movq 0x30(%rsp), %r15
testq %rax, %rax
jle 0x3533f
xorl %r13d, %r13d
movl %ebx, %ebp
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rdi
movq (%r14), %rsi
imulq %r12, %rsi
addq %r15, %rsi
addq %r13, %rsi
callq 0xeead3
leal -0x8(%rax), %ecx
cmpb $-0x10, %cl
movl $0x1, %ecx
cmovbl %ecx, %ebx
cmpb $0x0, 0x18(%r14)
cmovnel %ebp, %ebx
movq 0x10(%rsp), %rbp
movzbl %al, %eax
movl 0x1c(%r14,%rax,4), %ecx
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0xf24ba
incq %r13
movq 0x8(%rbp), %rax
cmpq %rax, %r13
jl 0x352e1
movq 0x10(%rbp), %rcx
incq %r12
cmpq %rcx, %r12
jl 0x352d9
testl %ebx, %ebx
movq 0x20(%rsp), %rbx
movq %r14, %r12
je 0x351d4
leaq 0xe2bc8(%rip), %rsi     # 0x117f26
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8faa
jmp 0x351d4
cmpb $0x0, 0xf(%rsp)
movq 0x10(%rsp), %rbp
je 0x351d4
movq 0x28(%rsp), %rsi
movq 0x18(%rbx), %rdi
movq (%r12), %rdx
movl $0x4, %ecx
movq %rbp, %r8
movl $0x1, %r9d
callq 0xf3279
jmp 0x351d4