// File: /workspace/github_c_makefile_star2_O2/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 $0x78, %rsp
movq %rsi, %r15
movq %rdi, %r14
andq $0x0, 0x28(%rsp)
movl $0x420, %esi            # imm = 0x420
callq 0xdecaf
movq %rax, %r12
andl $0x0, 0x8(%rax)
pushq $0x4e
popq %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0xdfcf4
movl %eax, %ebp
pushq $0x58
popq %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0xdfcf4
testl %eax, %eax
je 0x33c78
orb $0x1, 0x8(%r12)
cmpb $0x0, 0xd6(%r14)
jne 0x33c95
pushq $0x43
popq %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0xdfcf4
movb %al, 0xc(%r12)
testq %r15, %r15
je 0x33cc6
movq 0x28(%r15), %rax
testq %rax, %rax
je 0x33ca8
movq %rax, 0x10(%r12)
movq 0x38(%r15), %rsi
testq %rsi, %rsi
je 0x33cc6
movb $0x1, 0x18(%r12)
leaq 0x1c(%r12), %rdi
movl $0x400, %edx            # imm = 0x400
callq 0x181e0
testl %ebp, %ebp
je 0x33cce
xorl %eax, %eax
jmp 0x33cf5
movq 0x18(%r14), %rdi
leaq 0x28(%rsp), %r15
movq %r15, %rsi
callq 0xe3fc4
leaq 0xd44c9(%rip), %rsi     # 0x1081af
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq (%r15), %rax
leaq 0x10(%rsp), %rbp
movq %rax, (%rbp)
movq 0x18(%r14), %rdi
movq %rbp, %rsi
callq 0xe3fc4
leaq 0xd70a7(%rip), %rsi     # 0x10adb8
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq 0x18(%r14), %rdi
movq %rbp, %rsi
callq 0xe3fc4
movq %rax, %rbx
movq 0x18(%r14), %rdi
movq %rbp, %rsi
callq 0xe3fc4
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, 0x8(%rsp)
movq %rax, %rdx
callq 0xdf038
movq 0x18(%r14), %rdi
movq %rbp, %rsi
callq 0xe3fc4
movq %rax, (%r12)
leaq 0xf5347(%rip), %rsi     # 0x1290a9
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq 0x18(%r14), %rdi
movq %rbp, %rsi
callq 0xe3f2a
movl %eax, %r15d
movq %r12, 0x20(%rsp)
movzbl %al, %r12d
leaq 0xfa432(%rip), %rsi     # 0x12e1bf
movq %r14, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xde896
movq 0x18(%r14), %rdi
movq %rbp, %rsi
callq 0xe3f2a
movzbl %al, %r13d
leaq 0xd7012(%rip), %rsi     # 0x10adc3
movq %r14, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0xde896
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 0x33efa
movb %r8b, 0x5(%rsp)
movb %dil, 0x6(%rsp)
movb %sil, 0x7(%rsp)
leaq 0x100940(%rip), %rsi    # 0x134767
movq %r14, %rdi
xorl %eax, %eax
callq 0xde896
movl %r13d, %eax
mulb %r15b
movq 0x20(%rsp), %r12
cmpb $0x0, 0xc(%r12)
setne %dil
cmpb $0x1, %al
sete %cl
movq 0x8(%rsp), %r15
cmpq %r15, %rbx
sete %dl
andb %dil, %dl
andb %cl, %dl
cmpb $0x1, %dl
movb %al, 0x18(%rsp)
jne 0x33e93
cmpq $0x80, %rbx
je 0x33e76
movq %rbx, %r15
cmpq $0x5a, %rbx
jne 0x33e93
decq %rbx
leaq 0xd6f98(%rip), %rsi     # 0x10ae18
movq %r14, %rdi
movq %rbx, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0xde896
movq %rbx, %r15
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0xe6be1
testl %eax, %eax
je 0x33f1e
xorl %ecx, %ecx
cmpb $0x1, 0x18(%rsp)
setne %cl
movq (%r12), %rax
shlq $0x3, %rax
cqto
idivq %r13
leal 0x1(,%rcx,2), %r8d
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
movq %r15, %rcx
callq 0xe746f
movq %rax, %r15
testb %bpl, %bpl
je 0x33f26
movq 0x18(%r14), %rdi
movq 0x10(%rsp), %rsi
movq (%r12), %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0xe77b7
jmp 0x34093
leaq 0xd6ed2(%rip), %rsi     # 0x10add3
xorl %r15d, %r15d
movq %r14, %rdi
movl %r13d, %edx
movl %r12d, %ecx
xorl %eax, %eax
callq 0xdf2a5
movq 0x20(%rsp), %r12
jmp 0x340a8
xorl %r15d, %r15d
jmp 0x340a8
cmpb $0x0, 0x7(%rsp)
je 0x33f7d
movq %r12, %rbx
movq 0x10(%rsp), %r12
movq (%rbx), %r13
shlq $0x2, %r13
pushq $0x32
popq %rdi
leaq 0x30(%rsp), %rbp
pushq $0x10
popq %r8
xorl %esi, %esi
xorl %edx, %edx
movq %rbp, %rcx
xorl %r9d, %r9d
callq 0xe1b11
movq 0x18(%r14), %rdi
movq (%rbx), %r8
pushq $0x4
popq %rdx
movq %r12, %rsi
movq %rbx, %r12
movq %r13, %rcx
movq %rbp, %r9
pushq $0x2
pushq %r15
callq 0xe7de1
popq %rax
popq %rcx
jmp 0x34093
cmpb $0x0, 0x6(%rsp)
je 0x34051
movq %r14, 0x8(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0x1c(%r12), %rcx
xorl %ebp, %ebp
pushq $0x32
popq %r14
pushq $0x1
popq %rbx
pushq $0x8
popq %r13
movl %r14d, %edi
movl %ebx, %esi
xorl %edx, %edx
movq %r13, %r8
xorl %r9d, %r9d
callq 0xe1b11
movq %r12, %rcx
addq $0x3fc, %rcx            # imm = 0x3FC
movl %r14d, %edi
movl %ebx, %esi
movq %r13, %rdx
movq %r13, %r8
xorl %r9d, %r9d
callq 0xe1b11
movq %r12, %rbx
cmpb $0x0, 0x18(%r12)
je 0x340ca
xorl %r12d, %r12d
cmpq 0x10(%r15), %r12
jge 0x34076
xorl %r13d, %r13d
cmpq 0x8(%r15), %r13
jge 0x3404c
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rdi
movq (%rbx), %rsi
imulq %r12, %rsi
movq 0x18(%rsp), %rax
addq %r13, %rax
addq %rax, %rsi
callq 0xe3eb4
leal -0x8(%rax), %ecx
cmpb $-0x10, %cl
movl %ebp, %ecx
pushq $0x1
popq %rdx
cmovbl %edx, %ecx
cmpb $0x0, 0x18(%rbx)
cmovel %ecx, %ebp
movzbl %al, %eax
movl 0x1c(%rbx,%rax,4), %ecx
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0xe7287
incq %r13
jmp 0x33ff7
incq %r12
jmp 0x33fea
cmpb $0x0, 0x5(%rsp)
je 0x34093
movq 0x10(%rsp), %rsi
movq 0x18(%r14), %rdi
movq (%r12), %rdx
pushq $0x4
popq %rcx
pushq $0x1
popq %r9
movq %r15, %r8
callq 0xe7f67
jmp 0x34093
testl %ebp, %ebp
movq 0x8(%rsp), %r14
movq %rbx, %r12
je 0x34093
leaq 0xd6dad(%rip), %rsi     # 0x10ae36
movq %r14, %rdi
xorl %eax, %eax
callq 0xdf05a
movq 0x10(%r12), %rsi
movl 0x8(%r12), %edx
orl $0x2, %edx
movq %r15, %rdi
callq 0xe70ab
movq %r15, %rdi
callq 0xe7084
movq %r14, %rdi
movq %r12, %rsi
callq 0xded32
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x17
popq %rax
movl $0xfffe10fe, %ecx       # imm = 0xFFFE10FE
cmpq $0xff, %rax
je 0x33fe7
movl %ecx, (%rbx,%rax,4)
incq %rax
addl $0x100, %ecx            # imm = 0x100
jmp 0x340d2