// File: /workspace/github_c_makefile_star2_O1/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, %rbx
movq $0x0, 0x28(%rsp)
movl $0x420, %esi            # imm = 0x420
callq 0xe969b
movq %rax, %r12
movl $0x0, 0x8(%rax)
movq %rbx, %rdi
movq %r15, %rsi
movl $0x4e, %edx
callq 0xea97e
movl %eax, %ebp
movq %rbx, %rdi
movq %r15, %rsi
movl $0x58, %edx
callq 0xea97e
testl %eax, %eax
je 0x35050
orb $0x1, 0x8(%r12)
cmpb $0x0, 0xd6(%rbx)
jne 0x3506e
movq %rbx, %rdi
movq %r15, %rsi
movl $0x43, %edx
callq 0xea97e
movb %al, 0xc(%r12)
testq %r15, %r15
je 0x3509f
movq 0x28(%r15), %rax
testq %rax, %rax
je 0x35081
movq %rax, 0x10(%r12)
movq 0x38(%r15), %rsi
testq %rsi, %rsi
je 0x3509f
movb $0x1, 0x18(%r12)
leaq 0x1c(%r12), %rdi
movl $0x400, %edx            # imm = 0x400
callq 0x181e0
testl %ebp, %ebp
jne 0x350c4
movq 0x18(%rbx), %rdi
leaq 0x28(%rsp), %rsi
callq 0xef1ed
leaq 0xe00d3(%rip), %rsi     # 0x11518b
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x28(%rsp), %rax
leaq 0x18(%rsp), %rbp
movq %rax, (%rbp)
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xef1ed
leaq 0xe2c8b(%rip), %rsi     # 0x117d70
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xef1ed
movq %rax, %r14
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xef1ed
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, 0x10(%rsp)
movq %rax, %rdx
callq 0xe9b05
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xef1ed
movq %rax, (%r12)
leaq 0x100e30(%rip), %rsi    # 0x135f66
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xef14d
movl %eax, %r15d
movq %r12, 0x8(%rsp)
movzbl %al, %r12d
leaq 0x105f96(%rip), %rsi    # 0x13b0f7
movq %rbx, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xef14d
movzbl %al, %r13d
leaq 0xe2bf6(%rip), %rsi     # 0x117d7b
movq %rbx, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0xe9226
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 0x352cb
movb %r8b, 0x5(%rsp)
movb %dil, 0x6(%rsp)
movb %sil, 0x7(%rsp)
leaq 0x10c4dc(%rip), %rsi    # 0x1416d7
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movl %r13d, %eax
mulb %r15b
movq 0x8(%rsp), %r12
cmpb $0x0, 0xc(%r12)
setne %dil
cmpb $0x1, %al
sete %cl
movq 0x10(%rsp), %r15
cmpq %r15, %r14
sete %dl
andb %dil, %dl
andb %cl, %dl
cmpb $0x1, %dl
movb %al, 0x20(%rsp)
jne 0x35264
cmpq $0x80, %r14
je 0x35247
cmpq $0x5a, %r14
jne 0x35264
decq %r14
decq %r15
leaq 0xe2b7c(%rip), %rsi     # 0x117dd0
movq %rbx, %rdi
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xf241d
testl %eax, %eax
je 0x352ec
xorl %ecx, %ecx
cmpb $0x1, 0x20(%rsp)
setne %cl
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 0xf2ce6
movq %rax, %r15
testb %bpl, %bpl
je 0x352f1
movq 0x18(%rbx), %rdi
movq 0x18(%rsp), %rsi
movq (%r12), %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0xf3081
jmp 0x3534f
leaq 0xe2ab9(%rip), %rsi     # 0x117d8b
xorl %r15d, %r15d
movq %rbx, %rdi
movl %r13d, %edx
movl %r12d, %ecx
xorl %eax, %eax
callq 0xe9df7
movq 0x8(%rsp), %r12
jmp 0x35364
xorl %r15d, %r15d
jmp 0x35364
cmpb $0x0, 0x7(%rsp)
je 0x35386
movq %r12, %r14
movq 0x18(%rsp), %r12
movq (%r14), %r13
shlq $0x2, %r13
leaq 0x30(%rsp), %rbp
movl $0x10, %r8d
movl $0x32, %edi
xorl %esi, %esi
xorl %edx, %edx
movq %rbp, %rcx
xorl %r9d, %r9d
callq 0xecbbc
movq 0x18(%rbx), %rdi
movq (%r14), %r8
movl $0x4, %edx
movq %r12, %rsi
movq %r14, %r12
movq %r13, %rcx
movq %rbp, %r9
pushq $0x2
pushq %r15
callq 0xf36f9
addq $0x10, %rsp
movq 0x10(%r12), %rsi
movl 0x8(%r12), %edx
orl $0x2, %edx
movq %r15, %rdi
callq 0xf2917
movq %r15, %rdi
callq 0xf28d4
movq %rbx, %rdi
movq %r12, %rsi
callq 0xe9752
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x0, 0x6(%rsp)
je 0x354be
movq 0x18(%rsp), %r14
leaq 0x1c(%r12), %rcx
movl $0x8, %r8d
movl $0x32, %edi
movl $0x1, %esi
xorl %edx, %edx
xorl %r9d, %r9d
callq 0xecbbc
movq %r12, %rcx
addq $0x3fc, %rcx            # imm = 0x3FC
movl $0x8, %edx
movl $0x8, %r8d
movl $0x32, %edi
movl $0x1, %esi
xorl %r9d, %r9d
callq 0xecbbc
cmpb $0x0, 0x18(%r12)
jne 0x35403
movl $0x17, %eax
movl $0xfffe10fe, %ecx       # imm = 0xFFFE10FE
movl %ecx, (%r12,%rax,4)
incq %rax
addl $0x100, %ecx            # imm = 0x100
cmpq $0xff, %rax
jne 0x353ee
cmpq $0x0, 0x10(%r15)
jle 0x3534f
movq %r14, 0x20(%rsp)
movq %rbx, 0x10(%rsp)
xorl %r12d, %r12d
xorl %ebx, %ebx
movq 0x8(%rsp), %rbp
movq 0x20(%rsp), %r14
movq %r15, %rax
cmpq $0x0, 0x8(%r15)
jle 0x3548a
xorl %r13d, %r13d
movq %rax, %r15
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rdi
movq (%rbp), %rsi
imulq %r12, %rsi
addq %r14, %rsi
addq %r13, %rsi
callq 0xef0d5
leal -0x8(%rax), %ecx
cmpb $-0x10, %cl
movl %ebx, %ecx
movl $0x1, %edx
cmovbl %edx, %ecx
cmpb $0x0, 0x18(%rbp)
cmovel %ecx, %ebx
movzbl %al, %eax
movl 0x1c(%rbp,%rax,4), %ecx
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0xf2afd
incq %r13
cmpq 0x8(%r15), %r13
jl 0x35437
jmp 0x3548d
movq %rax, %r15
incq %r12
cmpq 0x10(%r15), %r12
jl 0x35427
testl %ebx, %ebx
movq 0x10(%rsp), %rbx
movq 0x8(%rsp), %r12
je 0x3534f
leaq 0xe293f(%rip), %rsi     # 0x117dee
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9b27
jmp 0x3534f
cmpb $0x0, 0x5(%rsp)
je 0x3534f
movq 0x18(%rsp), %rsi
movq 0x18(%rbx), %rdi
movq (%r12), %rdx
movl $0x4, %ecx
movq %r15, %r8
movl $0x1, %r9d
callq 0xf38d9
jmp 0x3534f