// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/dlmaker.c
// Function: de_run_dlmaker
static void de_run_dlmaker(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	i64 pos = 0;
	i64 k;
	i64 anim_cmds_size;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);
	d = de_malloc(c, sizeof(lctx));
	d->input_encoding = de_get_input_encoding(c, NULL, DE_ENCODING_CP437);
	d->input_encoding = DE_EXTENC_MAKE(d->input_encoding, DE_ENCSUBTYPE_HYBRID);
	d->v12.opt_montage = de_get_ext_option_bool(c, "dlmaker:montage", 0);

	d->fi = de_finfo_create(c);
	d->fi->density.code = DE_DENSITY_UNK_UNITS;
	d->fi->density.xdens = 6.0;
	d->fi->density.ydens = 5.0;

	if(!do_read_header(c, d)) goto done;
	pos = d->hdr_size;

	if(d->ver==3) {
		for(k=0; k<d->num_images; k++) {
			i64 xsize, ysize;

			if(pos >= c->infile->len) goto done;
			de_dbg(c, "image #%u at %"I64_FMT, (UI)k, pos);
			de_dbg_indent(c, 1);
			xsize = de_getu16le_p(&pos);
			ysize = de_getu16le_p(&pos);
			de_dbg_dimensions(c, xsize, ysize);
			do_extract_v3_image(c, d, pos, xsize, ysize);
			pos += xsize*ysize;
			de_dbg_indent(c, -1);
		}
	}
	else {
		for(k=0; k<d->v12.num_screens; k++) {
			if(pos >= c->infile->len) goto done;
			de_dbg(c, "screen #%u at %"I64_FMT, (UI)k, pos);
			de_dbg_indent(c, 1);
			if(pos+V12_SCREEN_SIZE_IN_BYTES > c->infile->len) goto done;
			do_v12screen(c, d, pos);
			pos += V12_SCREEN_SIZE_IN_BYTES;
			de_dbg_indent(c, -1);
		}
	}

	anim_cmds_size = d->num_anim_code_units * d->anim_code_unit_size;
	de_dbg(c, "anim commands at %"I64_FMT", len=%"I64_FMT, pos, anim_cmds_size);
	pos += anim_cmds_size;
	if(d->ver==3) {
		do_audio(c, d, pos);
	}

done:
	de_dbg_indent_restore(c, saved_indent_level);
	if(d) {
		de_bitmap_destroy(d->v12.screen_img);
		de_bitmap_destroy(d->v12.img);
		de_finfo_destroy(c, d->fi);
		de_free(c, d);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %r15
xorl %ebx, %ebx
movq %rbx, 0x20(%rsp)
leaq 0x44(%rsp), %rsi
callq 0xe8a1c
movl $0x470, %esi            # imm = 0x470
movq %r15, %rdi
callq 0xe8b2b
movq %rax, %r12
movq %rax, %r14
movq %r15, %rdi
xorl %esi, %esi
movl $0xd, %edx
callq 0xeb220
movzbl %al, %eax
orl $0x300, %eax            # imm = 0x300
movl %eax, (%r12)
leaq 0xc52ee(%rip), %rsi     # 0x122e60
movq %r15, %rdi
xorl %edx, %edx
callq 0xe9bd0
movl %eax, 0x8(%r12)
movq %r15, %rdi
callq 0xea504
movq %rax, 0x68(%r12)
movl $0x1, 0x78(%rax)
movaps 0xc5294(%rip), %xmm0    # 0x122e30
movups %xmm0, 0x80(%rax)
leaq 0x18(%rsp), %rsi
movq %rbx, (%rsi)
movq %r15, %rbx
movq 0x18(%r15), %rdi
callq 0xeeb4b
movb %al, 0x4(%r12)
movzbl %al, %edx
leaq 0xd91be(%rip), %rsi     # 0x136d84
movq %r15, %rdi
xorl %eax, %eax
callq 0xe8617
movzbl 0x4(%r12), %eax
leal -0x4(%rax), %ecx
cmpb $-0x3, %cl
jae 0x5dbfb
leaq 0xc52cc(%rip), %rsi     # 0x122eb1
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
xorl %edi, %edi
callq 0xf6753
jmp 0x5e39e
movq %r12, %r13
cmpl $0x2, %eax
je 0x5dc95
cmpl $0x1, %eax
jne 0x5dcff
movb $0x1, 0xc(%r14)
movl $0x64, %esi
movl $0xa0, %edi
xorl %ecx, %ecx
movq %rdi, 0x10(%r14)
movq %rsi, 0x18(%r14)
movw $0x140, %ax             # imm = 0x140
xorl %edx, %edx
divw %di
movzwl %ax, %edx
movb $-0x38, %al
movzbl %al, %eax
divb %sil
movzbl %al, %eax
imulq %rdx, %rax
movq %rax, 0x20(%r14)
testb %cl, %cl
je 0x5dd10
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
movq %rbx, %rdi
callq 0xe8f88
movl 0x20(%r14), %edx
leaq 0xc5277(%rip), %rsi     # 0x122eef
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movb 0x4(%r14), %al
jmp 0x5dcf4
movq 0x18(%rbx), %rdi
leaq 0x18(%rsp), %rsi
callq 0xeeb4b
movb %al, 0xc(%r14)
movzbl %al, %edx
leaq 0xc520e(%rip), %rsi     # 0x122ebf
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movb 0x4(%r14), %al
cmpb $0x2, %al
ja 0x5dcf4
movzbl 0xc(%r14), %eax
sete %cl
testl %eax, %eax
je 0x5e3f1
cmpl $0x2, %eax
je 0x5e3e2
cmpl $0x1, %eax
jne 0x5e400
movl $0x64, %esi
movl $0xa0, %edi
jmp 0x5dc21
cmpb $0x3, %al
jne 0x5dd10
movq 0x18(%rsp), %rax
jmp 0x5dd07
movq 0x18(%rsp), %rax
incq %rax
addq $0x32, %rax
movq %rax, 0x18(%rsp)
movq %rbx, %rdi
callq 0xf6410
movq %rax, %r12
cmpb $0x3, 0x4(%r14)
movl $0x28, %eax
movl $0x14, %r15d
cmoveq %rax, %r15
movq 0x18(%rsp), %rdx
movq 0x18(%rbx), %rdi
movq %r14, %rsi
movq %r12, %rcx
movq %r15, %r8
callq 0x5e57d
movq %r12, %rdi
callq 0xf70f6
leaq 0xca424(%rip), %rsi     # 0x128179
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
addq %r15, 0x18(%rsp)
cmpb $0x1, 0x4(%r14)
je 0x5dddc
movq %r12, %rdi
callq 0xf6423
movq 0x18(%rsp), %rdx
movq 0x18(%rbx), %rdi
movq %r14, %rsi
movq %r12, %rcx
movq %r15, %r8
callq 0x5e57d
movq %r12, %rdi
callq 0xf70f6
leaq 0xc5165(%rip), %rsi     # 0x122f01
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
addq %r15, 0x18(%rsp)
cmpb $0x3, 0x4(%r14)
jne 0x5dddc
movq 0x18(%rbx), %rdi
leaq 0x18(%rsp), %rsi
callq 0xeebeb
movq %rax, 0x60(%r14)
leaq 0xc5140(%rip), %rsi     # 0x122f0e
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
jmp 0x5de20
movq 0x18(%rbx), %rdi
leaq 0x18(%rsp), %rsi
callq 0xeeb4b
movzbl %al, %edx
movq %rdx, 0x28(%r14)
leaq 0xc5125(%rip), %rsi     # 0x122f1d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x20(%r14), %rdx
imulq 0x28(%r14), %rdx
movq %rdx, 0x60(%r14)
leaq 0xc5117(%rip), %rsi     # 0x122f2d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movzbl 0x4(%r14), %eax
movq 0x18(%rbx), %rdi
leaq 0x18(%rsp), %rsi
cmpl $0x3, %eax
je 0x5de44
cmpl $0x1, %eax
jne 0x5de4b
callq 0xeebeb
movl $0x1, %ecx
jmp 0x5de55
callq 0xeebeb
jmp 0x5de50
callq 0xeed83
movl $0x2, %ecx
movq %rax, 0x48(%r14)
movq %rcx, 0x50(%r14)
leaq 0xc50e6(%rip), %rsi     # 0x122f4a
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
cmpb $0x3, 0x4(%r14)
jne 0x5de9e
movq 0x18(%rbx), %rdi
leaq 0x18(%rsp), %rsi
callq 0xeebeb
movq %rax, 0x58(%r14)
leaq 0xc50c9(%rip), %rsi     # 0x122f5a
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rsi
movq 0x18(%rsp), %rdx
movq %r13, %r9
addq $0x70, %r9
movl $0x0, 0x10(%rsp)
movl $0x2, 0x8(%rsp)
movq $0x100, (%rsp)          # imm = 0x100
movl $0x100, %ecx            # imm = 0x100
movl $0x3, %r8d
movq %rbx, %rdi
movq %r9, 0x30(%rsp)
callq 0xf2cb1
movl $0x300, %eax            # imm = 0x300
addq 0x18(%rsp), %rax
movq %rax, 0x18(%rsp)
movq %rax, 0x40(%r14)
movq %r12, %rdi
callq 0xf6753
movq 0x40(%r14), %r13
movq %r13, 0x20(%rsp)
cmpb $0x3, 0x4(%r14)
movq %r14, 0x28(%rsp)
jne 0x5e030
cmpq $0x0, 0x60(%r14)
jle 0x5e253
xorl %ebp, %ebp
movq 0x20(%rsp), %rcx
movq 0x18(%rbx), %rax
cmpq 0x18(%rax), %rcx
jge 0x5e39e
movq %rbx, %rdi
leaq 0xc4f34(%rip), %rsi     # 0x122e70
movl %ebp, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%rbx), %rdi
leaq 0x20(%rsp), %r14
movq %r14, %rsi
callq 0xeebeb
movq %rax, %r12
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeebeb
movq %rax, %r15
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0xe8f88
movq 0x20(%rsp), %r13
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xf1db1
testl %eax, %eax
je 0x5dfeb
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movl $0x3, %ecx
callq 0xf266a
movq %rbx, %r14
movq %rax, %rbx
movq 0x18(%r14), %rdi
movl $0x0, (%rsp)
movl $0x8, %edx
movq %r13, %rsi
movq %r12, %rcx
movq 0x30(%rsp), %r8
movq %rax, %r9
callq 0xf2f79
movq 0x28(%rsp), %r13
movq 0x68(%r13), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0xf22d0
jmp 0x5dff5
movq %rbx, %r14
xorl %ebx, %ebx
movq 0x28(%rsp), %r13
movq %rbx, %rdi
callq 0xf228d
imulq %r12, %r15
addq %r15, 0x20(%rsp)
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
incq %rbp
cmpq 0x60(%r13), %rbp
movq %r14, %rbx
movq %r13, %r14
jl 0x5df1f
movq 0x20(%rsp), %r13
jmp 0x5e253
cmpq $0x0, 0x28(%r14)
jle 0x5e253
xorl %ebp, %ebp
movq %rbx, 0x38(%rsp)
movq 0x18(%rbx), %rax
cmpq 0x18(%rax), %r13
jge 0x5e39e
movq %r13, %r12
movq %rbx, %rdi
leaq 0xc4e24(%rip), %rsi     # 0x122e81
movl %ebp, %edx
movq %r13, %rcx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
addq $0xfa00, %r13           # imm = 0xFA00
movq 0x18(%rbx), %rdi
cmpq 0x18(%rdi), %r13
jg 0x5e39e
cmpq $0x2, 0x20(%r14)
jge 0x5e0b9
movq 0x30(%r14), %r9
testq %r9, %r9
je 0x5e0ed
movl $0x0, (%rsp)
movl $0x8, %edx
movl $0x140, %ecx            # imm = 0x140
movq %r12, %rsi
movq 0x30(%rsp), %r8
jmp 0x5e159
movl 0x8(%r14), %ebx
movq 0x30(%r14), %r9
testq %r9, %r9
je 0x5e10a
movl $0x0, (%rsp)
movl $0x8, %edx
movl $0x140, %ecx            # imm = 0x140
movq %r12, %rsi
movq 0x30(%rsp), %r8
callq 0xf2f79
testl %ebx, %ebx
jne 0x5e15e
jmp 0x5e1c4
movl $0x140, %esi            # imm = 0x140
movl $0xc8, %edx
movq %rbx, %rdi
movl $0x3, %ecx
callq 0xf266a
movq %rax, 0x30(%r14)
jmp 0x5e139
movl $0x140, %esi            # imm = 0x140
movl $0xc8, %edx
movq %r14, %r15
movq 0x38(%rsp), %r14
movq %r14, %rdi
movl $0x3, %ecx
callq 0xf266a
movq %rax, 0x30(%r15)
testl %ebx, %ebx
je 0x5e196
movq %r14, %rbx
movq 0x28(%rsp), %r14
movq 0x18(%rbx), %rdi
movl $0x0, (%rsp)
movl $0x8, %edx
movl $0x140, %ecx            # imm = 0x140
movq %r12, %rsi
movq 0x30(%rsp), %r8
movq %rax, %r9
callq 0xf2f79
movq 0x30(%r14), %rdi
movq 0x68(%r14), %rsi
xorl %edx, %edx
callq 0xf22d0
movq %r13, 0x20(%rsp)
movq 0x38(%rsp), %rbx
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
incq %rbp
cmpq 0x28(%r14), %rbp
jl 0x5e042
jmp 0x5e253
movb $0x1, 0x38(%rax)
movq 0x18(%r14), %rdi
movl $0x0, (%rsp)
movl $0x8, %edx
movl $0x140, %ecx            # imm = 0x140
movq %r12, %rsi
movq 0x30(%rsp), %r8
movq %rax, %r9
callq 0xf2f79
movq 0x28(%rsp), %r14
cmpq $0x0, 0x38(%r14)
jne 0x5e1e6
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
movq 0x38(%rsp), %rdi
movl $0x3, %ecx
callq 0xf266a
movq %rax, 0x38(%r14)
cmpq $0x0, 0x20(%r14)
jle 0x5e16d
movq 0x10(%r14), %r8
xorl %r15d, %r15d
xorl %r12d, %r12d
xorl %ebx, %ebx
movq 0x18(%r14), %r9
movq 0x30(%r14), %rdi
movq 0x38(%r14), %rsi
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
movl $0x0, 0x10(%rsp)
movq %r12, %rdx
movq %r15, %rcx
callq 0xf36d0
movq 0x38(%r14), %rdi
movq 0x68(%r14), %rsi
xorl %edx, %edx
callq 0xf22d0
movq 0x10(%r14), %r8
addq %r8, %r12
cmpq $0x140, %r12            # imm = 0x140
jl 0x5e245
addq 0x18(%r14), %r15
xorl %r12d, %r12d
incq %rbx
cmpq 0x20(%r14), %rbx
jl 0x5e1f9
jmp 0x5e16d
movq 0x50(%r14), %r15
imulq 0x48(%r14), %r15
leaq 0xc4c30(%rip), %rsi     # 0x122e93
movq %rbx, %rdi
movq %r13, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0xe8617
addq 0x20(%rsp), %r15
movq %r15, 0x20(%rsp)
cmpb $0x3, 0x4(%r14)
jne 0x5e39e
movq %r15, 0x18(%rsp)
cmpq $0x0, 0x58(%r14)
jle 0x5e399
leaq 0xe7416(%rip), %rbp     # 0x1456b5
xorl %r14d, %r14d
leaq 0x5(%r15), %rax
movq 0x18(%rbx), %rcx
cmpq 0x18(%rcx), %rax
jg 0x5e399
movq %rbx, %rdi
leaq 0xc4cb6(%rip), %rsi     # 0x122f74
movq %r15, %rdx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%rbx), %rdi
leaq 0x18(%rsp), %rsi
callq 0xeed83
movq %rax, %r15
movq %rbx, %rdi
movq %rbp, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rsp), %r12
leaq 0x1(%r12), %rax
movq %rax, 0x18(%rsp)
cmpq $0x1b, %r15
jl 0x5e365
leaq (%r12,%r15), %rax
incq %rax
movq 0x18(%rbx), %rcx
movl $0x0, %r13d
cmpq 0x18(%rcx), %rax
jg 0x5e368
movq %rbx, %rdi
leaq 0xc4c5f(%rip), %rsi     # 0x122f8b
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xefda1
movq %rax, %r13
movl $0x14, %edx
movq %rax, %rdi
leaq 0xc4c48(%rip), %rsi     # 0x122f8f
callq 0xef547
movq 0x18(%rbx), %rdi
addq $0x15, %r12
leaq -0x14(%r15), %rdx
movq %r12, %rsi
movq %r13, %rcx
callq 0xef481
jmp 0x5e368
xorl %r13d, %r13d
movq %r13, %rdi
callq 0xf052b
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
addq 0x18(%rsp), %r15
movq %r15, 0x18(%rsp)
incq %r14
movq 0x28(%rsp), %rax
cmpq 0x58(%rax), %r14
jl 0x5e2a2
movq 0x28(%rsp), %r14
movl 0x44(%rsp), %esi
movq %rbx, %rdi
callq 0xe8a25
movq 0x30(%r14), %rdi
callq 0xf228d
movq 0x38(%r14), %rdi
callq 0xf228d
movq 0x68(%r14), %rsi
movq %rbx, %rdi
callq 0xea50e
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe8be2
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x32, %esi
movl $0x50, %edi
jmp 0x5dc21
movl $0xc8, %esi
movl $0x140, %edi            # imm = 0x140
jmp 0x5dc21
leaq 0xc4aca(%rip), %rsi     # 0x122ed1
jmp 0x5dbe5