// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmi.c
// Function: de_run_bmi
static void de_run_bmi(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	i64 pos = 0;

	d = de_malloc(c, sizeof(lctx));

	d->input_encoding = de_get_input_encoding(c, NULL, DE_ENCODING_WINDOWS1252);

	if(!do_header(c, d, pos)) goto done;
	pos += d->fixed_header_size;

	if(d->globalimg.num_pal_entries>0) {
		read_palette(c, d, &d->globalimg, pos);
		pos += 4*d->globalimg.num_pal_entries;
	}

	if(!do_read_table(c, d, pos)) goto done;
	do_comments(c, d);
	do_bitmaps(c, d);

done:
	if(d) {
		de_free(c, d->table);
		de_free(c, d);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x478, %rsp            # imm = 0x478
movq %rdi, %rbx
movl $0x448, %esi            # imm = 0x448
callq 0xe969b
movq %rax, %rbp
movq %rbx, %rdi
xorl %esi, %esi
movl $0x9, %edx
callq 0xeb7d1
movl %eax, (%rbp)
leaq 0x50(%rsp), %r14
movq $0x0, (%r14)
leaq 0x106e1c(%rip), %rsi    # 0x13935e
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
addq $0x9, (%r14)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef1ed
movq %rax, 0x20(%rbp)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef1ed
movq %rax, 0x28(%rbp)
movq 0x20(%rbp), %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0xe9b05
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef1ed
movl %eax, 0x30(%rbp)
leaq 0xe4fe9(%rip), %rsi     # 0x11758d
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef1ed
movq %rax, 0x38(%rbp)
leaq 0x11367d(%rip), %rsi    # 0x145c44
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
cmpl $0x0, 0x30(%rbp)
je 0x325f0
movq 0x38(%rbp), %rdi
leaq -0x1(%rdi), %rax
cmpq $0x7, %rax
ja 0x325f0
callq 0xea7f2
movq %rax, 0x40(%rbp)
leaq 0x50(%rsp), %rsi
addq $0x2, (%rsi)
movq 0x18(%rbx), %rdi
callq 0xef1ed
movq %rax, 0x10(%rbp)
cmpq $0x64, %rax
jle 0x3262f
leaq 0xe4f8b(%rip), %rsi     # 0x11759e
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
jmp 0x32bfc
movq 0x50(%rsp), %rax
movq %rax, 0x8(%rbp)
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq 0x8(%rbp), %r14
cmpq $0x0, 0x40(%rbp)
jle 0x32667
leaq 0x20(%rbp), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x32c4b
movq 0x40(%rbp), %rax
leaq (%r14,%rax,4), %r14
movq %r14, 0x50(%rsp)
movl 0x10(%rbp), %ecx
leaq 0xe4f58(%rip), %rsi     # 0x1175ce
movq %rbx, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x10(%rbp), %rsi
movl $0x10, %edx
movq %rbx, %rdi
callq 0xea259
movq %rax, 0x18(%rbp)
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
cmpq $0x0, 0x10(%rbp)
jle 0x3270b
leaq 0x50(%rsp), %r14
leaq 0xe4f2c(%rip), %r15     # 0x1175e4
xorl %r13d, %r13d
xorl %r12d, %r12d
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef1ed
movq 0x18(%rbp), %rcx
movl %eax, (%rcx,%r13)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef3a0
movq 0x18(%rbp), %rcx
movq %rax, 0x8(%rcx,%r13)
movl (%rcx,%r13), %ecx
movq %rbx, %rdi
movq %r15, %rsi
movl %r12d, %edx
movq %rax, %r8
xorl %eax, %eax
callq 0xe9226
incq %r12
addq $0x10, %r13
cmpq 0x10(%rbp), %r12
jl 0x326be
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
cmpq $0x0, 0x10(%rbp)
movq %rbp, 0x18(%rsp)
jle 0x327d9
movl $0x8, %r15d
leaq 0xe4ece(%rip), %r14     # 0x117603
xorl %r12d, %r12d
movq 0x18(%rbp), %rax
cmpl $0x3, -0x8(%rax,%r15)
jne 0x327c8
movq (%rax,%r15), %rax
addq $0x2, %rax
movq %rax, 0x50(%rsp)
movq 0x18(%rbx), %rdi
leaq 0x50(%rsp), %rsi
callq 0xef3a0
movq %rax, %rbp
addq $0x2, 0x50(%rsp)
movq %rbx, %rdi
callq 0xf6870
movq %rax, %r13
movq 0x18(%rbx), %rdi
movq 0x50(%rsp), %rsi
movq 0x18(%rsp), %rax
movl (%rax), %eax
movl %eax, (%rsp)
movl $0x1f4, %ecx            # imm = 0x1F4
movq %rbp, %rdx
movq 0x18(%rsp), %rbp
movq %r13, %r8
movl $0x1, %r9d
callq 0xf0203
movq %r13, %rdi
callq 0xf7557
movq %rbx, %rdi
movq %r14, %rsi
movl %r12d, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe9226
movq %r13, %rdi
callq 0xf6bb0
incq %r12
addq $0x10, %r15
cmpq 0x10(%rbp), %r12
jl 0x32738
cmpq $0x0, 0x10(%rbp)
jle 0x32bfc
movq %rbp, %rax
addq $0x48, %rax
movq %rax, 0x48(%rsp)
xorl %r13d, %r13d
movq 0x18(%rbp), %rax
movq %r13, %rcx
shlq $0x4, %rcx
cmpl $0x1, (%rax,%rcx)
jne 0x32bef
addq %rcx, %rax
movq 0x8(%rax), %r14
movq %r14, 0x10(%rsp)
movl $0x428, %edx            # imm = 0x428
leaq 0x50(%rsp), %rdi
xorl %esi, %esi
callq 0x18140
movq %rbx, %rdi
leaq 0x24(%rsp), %rsi
callq 0xe958c
movq %rbx, %rdi
leaq 0x103986(%rip), %rsi    # 0x1361c2
movq %r14, %rdx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %r12
movq %r12, %rsi
callq 0xef1ed
movq %rax, 0x50(%rsp)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef1ed
movq %rax, 0x58(%rsp)
movq 0x50(%rsp), %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0xe9b05
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef1ed
movq %rax, 0x68(%rsp)
movq %rbx, %rdi
leaq 0x11339f(%rip), %rsi    # 0x145c44
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef1ed
movl %eax, 0x60(%rsp)
movq %rbx, %rdi
leaq 0xe4cc5(%rip), %rsi     # 0x11758d
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
cmpl $0x0, 0x60(%rsp)
leaq 0x78(%rsp), %rbp
cmoveq 0x48(%rsp), %rbp
setne %al
movq 0x68(%rsp), %rdi
leaq -0x1(%rdi), %rcx
cmpq $0x8, %rcx
setb %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x32905
callq 0xea7f2
movq %rax, 0x70(%rsp)
addq $0x2, 0x10(%rsp)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef3a0
movq %rax, %r15
movq %rbx, %rdi
leaq 0xe4cf8(%rip), %rsi     # 0x11761c
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x68(%rsp), %rdi
imulq 0x50(%rsp), %rdi
movl $0x20, %esi
callq 0xea80b
leaq 0x7(%rax), %rcx
testq %rax, %rax
cmovnsq %rax, %rcx
sarq $0x3, %rcx
movq 0x58(%rsp), %r14
movq %rcx, 0x28(%rsp)
imulq %rcx, %r14
movq %rbx, %rdi
leaq 0xe4cd3(%rip), %rsi     # 0x11763d
movq %r14, %rdx
xorl %eax, %eax
callq 0xe9226
cmpq $0x5f5e100, %r15        # imm = 0x5F5E100
jg 0x32bc9
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef1ed
movq %rax, %r12
movq %rbx, %rdi
leaq 0xe4cc6(%rip), %rsi     # 0x117660
movl %r12d, %edx
xorl %eax, %eax
callq 0xe9226
cmpq %r14, %r12
cmovgeq %r14, %r12
movq %r12, 0x30(%rsp)
cmpq $0x0, 0x70(%rsp)
jle 0x329d8
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
leaq 0x50(%rsp), %rsi
callq 0x32c4b
movq 0x70(%rsp), %rax
shlq $0x2, %rax
addq %rax, 0x10(%rsp)
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
movq %rbx, %rdi
callq 0xf241d
testl %eax, %eax
je 0x32bc9
movq 0x68(%rsp), %rax
cmpq $0x18, %rax
ja 0x32bb8
movl $0x1000112, %ecx        # imm = 0x1000112
btq %rax, %rcx
jae 0x32bb8
movq %rbp, 0x38(%rsp)
movq %rbx, %rdi
movq %r14, 0x40(%rsp)
movq %r14, %rsi
movl $0x1, %edx
callq 0xf0faf
movq %rax, %rbp
movl $0x4, %r12d
cmpq %r15, 0x18(%rbp)
jge 0x32b32
movq 0x10(%rsp), %rdx
movq 0x18(%rbx), %rax
movl $0x2, %r12d
cmpq 0x18(%rax), %rdx
jge 0x32b32
movq %rbx, %rdi
leaq 0x10d069(%rip), %rsi    # 0x13fac9
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0xef1ed
movq %rax, %r14
movq %rbx, %rdi
leaq 0xe4c02(%rip), %rsi     # 0x117691
movl %r14d, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x10(%rsp), %rax
leaq 0x1(%rax), %rsi
movq %rsi, 0x10(%rsp)
cmpq 0x30(%rsp), %r14
jg 0x32b32
addq %r14, %rax
incq %rax
movq 0x18(%rbx), %rdi
cmpq 0x18(%rdi), %rax
jg 0x32b32
movq 0x18(%rbp), %r12
cmpq 0x40(%rsp), %r12
jge 0x32b1d
movl $0x3, (%rsp)
movq %r14, %rdx
movq %rbp, %rcx
movq 0x30(%rsp), %r8
xorl %r9d, %r9d
callq 0x100d18
testl %eax, %eax
je 0x32b13
movq 0x18(%rbp), %rcx
movq %rcx, %rdx
subq %r12, %rdx
xorl %r12d, %r12d
movq %rbx, %rdi
leaq 0xe4b9d(%rip), %rsi     # 0x11769f
movl %eax, 0x20(%rsp)
xorl %eax, %eax
callq 0xe9226
movl 0x20(%rsp), %eax
jmp 0x32b19
movl $0x2, %r12d
testl %eax, %eax
je 0x32b32
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
addq %r14, 0x10(%rsp)
xorl %r12d, %r12d
testl %r12d, %r12d
je 0x32a2d
cmpl $0x2, %r12d
je 0x32bcb
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
movq %rbx, %rdi
movl $0x3, %ecx
callq 0xf2cab
movq %rax, %r14
movq 0x68(%rsp), %rdx
cmpq $0x18, %rdx
jne 0x32b89
movl $0x3, %ecx
movq %rbp, %rdi
xorl %esi, %esi
movq 0x28(%rsp), %rdx
movq %r14, %r8
movl $0x1, %r9d
callq 0xf38d9
jmp 0x32ba7
movl $0x0, (%rsp)
movq %rbp, %rdi
xorl %esi, %esi
movq 0x28(%rsp), %rcx
movq 0x38(%rsp), %r8
movq %r14, %r9
callq 0xf35b8
movq %r14, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0xf2923
jmp 0x32bce
movq %rbx, %rdi
leaq 0xe4ab8(%rip), %rsi     # 0x11767a
xorl %eax, %eax
callq 0xe9df7
xorl %ebp, %ebp
xorl %r14d, %r14d
movq %r14, %rdi
callq 0xf28d4
movq %rbp, %rdi
callq 0xf0b13
movl 0x24(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
movq 0x18(%rsp), %rbp
incq %r13
cmpq 0x10(%rbp), %r13
jl 0x327f3
movq 0x18(%rbp), %rsi
movq %rbx, %rdi
callq 0xe9752
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xe9752
addq $0x478, %rsp            # imm = 0x478
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq