// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/xwd.c
// Function: de_run_xwd
static void de_run_xwd(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;

	d = de_malloc(c, sizeof(lctx));
	do_header(c, d);
	if(d->errflag) goto done;
	// TODO?: Do something with the name that may appear after the header.

	read_or_construct_colormap(c, d);

	do_xwd_image(c, d);

done:
	if(d) {
		if(d->need_errmsg) {
			de_err(c, "Bad or unsupported XWD file");
		}
		de_free(c, d);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movl $0x508, %esi            # imm = 0x508
callq 0xdecaf
movq %rax, %r14
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
callq 0xdebae
leaq 0x18(%rsp), %r15
andq $0x0, (%r15)
leaq 0x38a14(%rip), %rsi     # 0x1161bf
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
leaq 0xb3f37(%rip), %r13     # 0x191700
leaq 0x5b3bf(%rip), %r12     # 0x138b8f
xorl %ebp, %ebp
cmpq $0x19, %rbp
je 0xdd8b7
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xe4071
movl %eax, 0x4(%r14,%rbp,4)
cmpl $0xd, %ebp
je 0xdd845
cmpl $0x7, %ebp
je 0xdd81d
cmpl $0x9, %ebp
je 0xdd82f
cmpl $0x2, %ebp
jne 0xdd88d
leaq 0x416d5(%rip), %r8      # 0x11eee1
cmpl $0x3, %eax
jae 0xdd86b
andl $0x3, %eax
leaq 0x5b551(%rip), %rcx     # 0x138d6c
jmp 0xdd864
testl %eax, %eax
leaq 0x39dbf(%rip), %r8      # 0x1175e5
leaq 0x32258(%rip), %rax     # 0x10fa85
jmp 0xdd83f
testl %eax, %eax
leaq 0x5b342(%rip), %r8      # 0x138b7a
leaq 0x5b331(%rip), %rax     # 0x138b70
cmoveq %rax, %r8
jmp 0xdd86b
movl %eax, %ecx
andl $-0x2, %ecx
movl %ecx, 0x68(%r14)
leaq 0x4168c(%rip), %r8      # 0x11eee1
cmpl $0x5, %ecx
jae 0xdd86b
andl $-0x2, %eax
leaq 0x5b514(%rip), %rcx     # 0x138d78
movslq (%rcx,%rax,4), %r8
addq %rcx, %r8
movq (%r13), %rdx
movl 0x4(%r14,%rbp,4), %ecx
movq %rbx, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0xde896
incq %rbp
addq $0x8, %r13
jmp 0xdd7d2
leal -0xe(%rbp), %ecx
movq (%r13), %rdx
movq %rbx, %rdi
cmpl $0x2, %ecx
ja 0xdd8a5
leaq 0x5b2e1(%rip), %rsi     # 0x138b84
jmp 0xdd8ac
leaq 0x363de(%rip), %rsi     # 0x113c8a
movl %eax, %ecx
xorl %eax, %eax
callq 0xde896
jmp 0xdd881
movl 0x4(%r14), %ecx
cmpq $0x63, %rcx
jbe 0xdd8f2
cmpl $0x7, 0x8(%r14)
jne 0xdd8f2
movl 0x14(%r14), %edi
cmpq $0xf4240, %rdi          # imm = 0xF4240
ja 0xdd8f2
movl 0x18(%r14), %eax
cmpq $0xf4240, %rax          # imm = 0xF4240
ja 0xdd8f2
movl 0x34(%r14), %edx
cmpq $0xf4241, %rdx          # imm = 0xF4241
jb 0xddee4
movw $0x101, (%r14)          # imm = 0x101
movl 0xc(%rsp), %esi
movq %rbx, %rdi
callq 0xdebb7
cmpb $0x0, (%r14)
jne 0xddeb2
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
callq 0xdebae
cmpl $0x1, 0xdc(%r14)
jne 0xdd94a
movq 0xb0(%r14), %rcx
leaq -0x1(%rcx), %rax
cmpq $0x7, %rax
ja 0xdd94a
leaq 0x108(%r14), %rdi
pushq $0x1
popq %rsi
shlq %cl, %rsi
xorl %edx, %edx
callq 0xe87a8
cmpq $0x0, 0x80(%r14)
jle 0xdda0e
movq 0x70(%r14), %rdx
leaq 0x50b8f(%rip), %rsi     # 0x12e4f2
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movl 0x4c(%r14), %eax
movl $0x100, %r13d           # imm = 0x100
cmpl %r13d, %eax
cmovbl %eax, %r13d
movq 0x70(%r14), %rax
leaq 0x18(%rsp), %r12
movq %rax, (%r12)
cmpq %r13, %r15
je 0xdda0e
addq $0x4, %rax
movq %rax, 0x18(%rsp)
xorl %ebp, %ebp
cmpq $0x3, %rbp
je 0xdd9c9
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xe3f2a
movb %al, 0x9(%rsp,%rbp)
incq 0x18(%rsp)
incq %rbp
jmp 0xdd9a9
movzbl 0x9(%rsp), %eax
shll $0x10, %eax
movzbl 0xa(%rsp), %ecx
shll $0x8, %ecx
orl %eax, %ecx
movzbl 0xb(%rsp), %edx
orl %ecx, %edx
orl $0xff000000, %edx       # imm = 0xFF000000
movl %edx, 0x108(%r14,%r15,4)
movq %rbx, %rdi
movq %r15, %rsi
callq 0xdf23b
movq 0x18(%rsp), %rax
addq $0x2, %rax
movq %rax, 0x18(%rsp)
incq %r15
jmp 0xdd999
leaq 0xc(%rsp), %r15
movl (%r15), %esi
movq %rbx, %rdi
callq 0xdebb7
movq 0x18(%rbx), %r13
movq 0x88(%r14), %rax
movq %rax, 0x28(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0xdebae
movq 0x88(%r14), %rdx
leaq 0x43b59(%rip), %rsi     # 0x1215a0
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq 0xb8(%r14), %rsi
movq 0xc0(%r14), %rdx
movq %rbx, %rdi
callq 0xe6be1
testl %eax, %eax
je 0xddc29
movq 0x98(%r14), %rcx
pushq $0x3
popq %rsi
movq %rcx, %rax
cqto
idivq %rsi
cmpq 0x90(%r14), %rcx
je 0xddb02
testq %rdx, %rdx
jne 0xddb02
cmpl $0x2, 0xc(%r14)
jne 0xddb02
cmpl $0x8, 0x10(%r14)
jne 0xddb02
cmpl $0x0, 0x20(%r14)
jne 0xddb02
cmpl $0x20, 0x24(%r14)
jne 0xddb02
cmpl $0x0, 0x28(%r14)
jne 0xddb02
cmpl $0x20, 0x2c(%r14)
jne 0xddb02
cmpl $0x8, 0x30(%r14)
jne 0xddb02
cmpl $0x3, 0x38(%r14)
jne 0xddb02
cmpl $0x8, 0x48(%r14)
jne 0xddb02
movq 0x18(%rbx), %rdi
movq 0x88(%r14), %rsi
callq 0xe3f46
testq %rax, %rax
jle 0xddb02
cmpq 0xb8(%r14), %rax
jg 0xddb02
movl $0x64, 0xd8(%r14)
movl 0xd8(%r14), %eax
cmpl $0x64, %eax
jne 0xddb26
leaq 0x5b233(%rip), %rsi     # 0x138d48
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movl 0xd8(%r14), %eax
movq 0x90(%r14), %rsi
testl %eax, %eax
je 0xddc42
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0xe59cd
movq %rax, %r13
movq %rax, %rdi
callq 0xe589c
movq 0x88(%r14), %rax
movq %rax, 0x18(%rsp)
movq 0xb8(%r14), %rcx
movq 0xc8(%r14), %rdx
movq %rdx, 0x28(%rsp)
movq %rcx, 0x30(%rsp)
subq %rcx, %rdx
movq %rdx, 0x10(%rsp)
js 0xddc4d
movq %r13, 0x38(%rsp)
movq 0x18(%rbx), %rcx
movq 0x18(%rcx), %rcx
movq %rcx, 0x40(%rsp)
xorl %ebp, %ebp
movq %rax, %rdx
xorl %r12d, %r12d
leaq 0x3(%rdx), %rax
cmpq 0x40(%rsp), %rax
jg 0xddc34
cmpq 0x90(%r14), %r12
jge 0xddc34
movq 0x18(%rbx), %rdi
leaq 0x18(%rsp), %r13
movq %r13, %rsi
callq 0xe3f6e
movq %rax, %r15
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xe3f2a
movzbl %al, %esi
movq 0x38(%rsp), %rdi
movq %r15, %rdx
callq 0xe5e40
addq %r15, %r12
addq %r15, %rbp
movq 0xb8(%r14), %rax
cmpq %rax, %rbp
jl 0xddc1f
movq 0x28(%rsp), %rcx
cmpq 0x30(%rsp), %rcx
je 0xddc1d
cmpq %rax, %rbp
jne 0xddc1d
movq 0x38(%rsp), %rdi
xorl %esi, %esi
movq 0x10(%rsp), %r15
movq %r15, %rdx
callq 0xe5e40
addq %r15, %r12
xorl %ebp, %ebp
movq 0x18(%rsp), %rdx
jmp 0xddb97
xorl %r15d, %r15d
xorl %r12d, %r12d
jmp 0xdde79
movq 0x88(%r14), %rax
movq 0x38(%rsp), %r13
jmp 0xddc53
movq $0x0, 0x10(%rsp)
jmp 0xddca1
xorl %r12d, %r12d
movq %rax, %rdx
subq %rax, %rdx
leaq 0x2801b(%rip), %rsi     # 0x105c78
movq $0x0, 0x28(%rsp)
movq %rbx, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0xde896
movq %r13, %rdi
callq 0xe58e8
cmpl $0x0, 0xd8(%r14)
je 0xddc8c
movq %r13, 0x10(%rsp)
jmp 0xddcd6
movq 0x90(%r14), %rsi
movq $0x0, 0x28(%rsp)
movq %r13, 0x10(%rsp)
addq 0x88(%r14), %rsi
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rax
addq $0x10, %rax
cmpq %rax, %rsi
jle 0xddcd6
leaq 0x5b06e(%rip), %rsi     # 0x138d2e
xorl %r12d, %r12d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
movb $0x1, (%r14)
jmp 0xdde74
movl 0xdc(%r14), %eax
cmpl $0x1, %eax
je 0xddd05
cmpl $0x3, %eax
jne 0xdde6b
movq 0xa8(%r14), %rax
addq $-0x2, %rax
cmpq $0x3, %rax
jae 0xdde6b
pushq $0x3
popq %rcx
jmp 0xddd32
cmpq $0x0, 0xb0(%r14)
jle 0xdde6b
leaq 0x108(%r14), %rdi
movl $0x100, %esi            # imm = 0x100
callq 0xe6d06
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
leal 0x1(,%rcx,2), %ecx
movq 0xb8(%r14), %rsi
movq 0xc0(%r14), %rdx
movq %rbx, %rdi
callq 0xe7437
movq %rax, 0x30(%rsp)
movl 0xdc(%r14), %eax
cmpl $0x1, %eax
je 0xddff6
cmpl $0x3, %eax
jne 0xde112
xorl %ebp, %ebp
movq %r13, 0x38(%rsp)
cmpq 0xc0(%r14), %rbp
jge 0xde112
movq 0xc8(%r14), %rax
imulq %rbp, %rax
addq 0x28(%rsp), %rax
movq %rax, 0x40(%rsp)
xorl %r12d, %r12d
cmpq 0xb8(%r14), %r12
jge 0xdde63
movq 0xa8(%r14), %rdx
cmpq $0x4, %rdx
jne 0xdddc6
movq 0x40(%rsp), %rax
leaq (%rax,%r12,4), %rsi
movl 0xa0(%r14), %edx
movq %r13, %rdi
callq 0xe41cb
jmp 0xddde4
movq %rdx, %rsi
imulq %r12, %rsi
addq 0x40(%rsp), %rsi
movl 0xa0(%r14), %ecx
movq %r13, %rdi
xorl %r8d, %r8d
callq 0xe424b
movq %rax, %r15
xorl %r13d, %r13d
cmpq $0x3, %r13
je 0xdde2c
movl 0x3c(%r14,%r13,4), %eax
andl %r15d, %eax
movb 0xe0(%r14,%r13,4), %cl
shrl %cl, %eax
movq 0xf0(%r14,%r13,8), %rdi
cmpq $0xff, %rdi
jne 0xdde18
movzbl %al, %eax
jmp 0xdde22
movl %eax, %esi
callq 0xe1d3e
movzbl %al, %eax
movl %eax, 0x18(%rsp,%r13,4)
incq %r13
jmp 0xdddea
movl 0x18(%rsp), %eax
movl 0x1c(%rsp), %ecx
shll $0x10, %eax
shll $0x8, %ecx
orl %eax, %ecx
orl 0x20(%rsp), %ecx
orl $0xff000000, %ecx       # imm = 0xFF000000
movq 0x30(%rsp), %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0xe7287
incq %r12
movq 0x38(%rsp), %r13
jmp 0xddd92
incq %rbp
jmp 0xddd6d
movw $0x101, (%r14)          # imm = 0x101
xorl %r12d, %r12d
movq 0x10(%rsp), %r15
cmpb $0x0, 0x1(%r14)
je 0xdde96
leaq 0x2c803(%rip), %rsi     # 0x10a68a
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
movb $0x0, 0x1(%r14)
movq %r12, %rdi
callq 0xe7084
movq %r15, %rdi
callq 0xe5591
movl 0xc(%rsp), %esi
movq %rbx, %rdi
callq 0xdebb7
cmpb $0x0, 0x1(%r14)
je 0xddeca
leaq 0x5ac94(%rip), %rsi     # 0x138b54
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
movq %rbx, %rdi
movq %r14, %rsi
callq 0xded32
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %rsi
movq %rcx, 0x70(%r14)
movq %rdi, 0xb8(%r14)
movq %rax, 0xc0(%r14)
xorl %ecx, %ecx
cmpl $0x0, 0x20(%r14)
sete %cl
movl %ecx, 0xa0(%r14)
movq $0x1, 0xd0(%r14)
movq %rdx, 0xc8(%r14)
movl 0x10(%r14), %ecx
movl 0xdc(%r14), %r10d
cmpq $0x9, %rcx
setb %r8b
movl $0x116, %r9d            # imm = 0x116
shrl %cl, %r9d
testl %r10d, %r10d
je 0xde089
cmpl $0x3, %r10d
jne 0xde20e
movq 0xa8(%r14), %r8
movb $0x1, %cl
cmpq $0x3, %r8
jne 0xddf88
cmpl $0x8, 0x2c(%r14)
jne 0xddf88
shll $0x2, %edi
cmpl %edx, %edi
jne 0xddf88
movq $0x4, 0xa8(%r14)
andq $0x0, 0xb0(%r14)
movl $0x3, 0xdc(%r14)
xorl %ecx, %ecx
xorl %edi, %edi
movl $0xff, %r8d
xorl %r9d, %r9d
cmpq $0x3, %r9
je 0xde056
movl 0x3c(%r14,%r9,4), %ebp
xorl %r10d, %r10d
xorl %r11d, %r11d
xorl %r15d, %r15d
xorl %r12d, %r12d
cmpl $0x20, %r12d
je 0xddfd1
btl %r12d, %ebp
jae 0xddfcc
testl %r15d, %r15d
cmovel %r12d, %r10d
incl %r15d
leaq 0x1(,%r11,2), %r11
incl %r12d
jmp 0xddfae
addl $-0x11, %r15d
cmpl $-0x10, %r15d
cmovbl %edi, %r10d
cmovbq %r8, %r11
movl %r10d, 0xe0(%r14,%r9,4)
movq %r11, 0xf0(%r14,%r9,8)
incq %r9
jmp 0xddf93
movq 0xb0(%r14), %rdx
leaq -0x9(%rdx), %rax
cmpq $-0x8, %rax
jb 0xde112
movq 0xc8(%r14), %rcx
movq 0xd0(%r14), %rax
xorl %r10d, %r10d
cmpl $0x0, 0x28(%r14)
sete %r10b
cmpq $0x1, %rax
jg 0xde0e5
movq %r14, %r8
addq $0x108, %r8             # imm = 0x108
subq $0x8, %rsp
movq %r13, %rdi
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %r9
pushq %r10
callq 0xe7cbc
jmp 0xde110
testb %cl, %cl
jne 0xde20e
leaq 0x5ac2c(%rip), %rsi     # 0x138c91
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf05a
movq 0xc0(%r14), %rax
movq 0xc8(%r14), %rdx
movq 0xd0(%r14), %rsi
jmp 0xde20e
movl 0x68(%r14), %r10d
testl %r10d, %r10d
je 0xde0a6
cmpl $0x4, %r10d
je 0xde159
cmpl $0x2, %r10d
jne 0xde20e
cmpl $0x1, 0xc(%r14)
jne 0xde13e
leal -0x1(%rcx), %edi
cmpl $0x7, %edi
ja 0xde13e
cmpl $0x1, 0x30(%r14)
jne 0xde13e
movl $0x1, 0xdc(%r14)
movq %rcx, 0xb0(%r14)
movq %rcx, 0xd0(%r14)
movq %rcx, %rsi
jmp 0xde20e
movq 0xc0(%r14), %r8
imulq %rcx, %r8
movq %r14, %r9
addq $0x108, %r9             # imm = 0x108
movq %r13, %rdi
movq 0x28(%rsp), %rsi
movq %rax, %rdx
pushq %r10
pushq 0x38(%rsp)
callq 0xe7de1
popq %rax
popq %rcx
cmpb $0x0, (%r14)
je 0xde127
movq 0x10(%rsp), %r15
movq 0x30(%rsp), %r12
jmp 0xdde79
pushq $0x2
popq %rdx
movq 0x30(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
callq 0xe70b7
jmp 0xdde74
andb %r9b, %r8b
testl %r10d, %r10d
je 0xde19a
cmpl $0x2, %r10d
sete %dil
testb %dil, %r8b
je 0xde20e
jmp 0xde19f
movl 0x30(%r14), %r8d
cmpq $0x20, %r8
je 0xde169
cmpl $0x18, %r8d
jne 0xde1e5
cmpq $0x20, %rcx
je 0xde178
cmpl $0x18, %ecx
jne 0xde20e
movl $0x3, 0xdc(%r14)
movq %r8, 0xb0(%r14)
shrl $0x3, %r8d
movq %r8, 0xa8(%r14)
jmp 0xddf52
testb %r8b, %r8b
je 0xde20e
movl 0x30(%r14), %edi
cmpl %ecx, %edi
jne 0xde1bb
movl $0x1, 0xdc(%r14)
movq %rcx, 0xb0(%r14)
jmp 0xde20e
cmpl $0x8, %edi
setne %dil
cmpl $0x8, %ecx
setae %cl
orb %dil, %cl
jne 0xde20e
movl $0x1, 0xdc(%r14)
movq $0x8, 0xb0(%r14)
jmp 0xde20e
xorl $0x10, %r8d
xorl $0x10, %ecx
orl %r8d, %ecx
jne 0xde20e
movl $0x3, 0xdc(%r14)
movq $0x2, 0xa8(%r14)
movb $0x1, %cl
jmp 0xddf88
imulq %rax, %rdx
imulq %rsi, %rdx
movq %rdx, 0x90(%r14)
movq 0xb0(%r14), %rdx
testq %rdx, %rdx
jne 0xde23b
movq 0xa8(%r14), %rdx
shlq $0x3, %rdx
movq %rdx, 0xb0(%r14)
cmpl $0x0, 0xdc(%r14)
je 0xde256
leaq 0x5aa86(%rip), %rsi     # 0x138cd2
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
cmpb $0x0, (%r14)
jne 0xdd8f8
movl 0x4c(%r14), %esi
movl 0x50(%r14), %edx
movq %rsi, 0x78(%r14)
imulq $0xc, %rsi, %rdi
movq %rdi, 0x80(%r14)
movq 0x70(%r14), %rax
movq 0x18(%rbx), %rcx
cmpl %esi, %edx
jae 0xde299
movq 0x18(%rcx), %r8
movq 0x90(%r14), %rsi
addq %rax, %rsi
subq %rsi, %r8
cmpq %r8, %rdi
jne 0xde2c0
movq %rdi, %rsi
movq %rsi, 0x80(%r14)
addq %rsi, %rax
movq %rax, 0x88(%r14)
movq 0x18(%rcx), %rcx
subq %rax, %rcx
movq %rcx, 0x98(%r14)
jmp 0xdd8f8
imulq $0xc, %rdx, %rsi
cmpq %r8, %rsi
jne 0xde2cf
movq %rdx, 0x78(%r14)
jmp 0xde29c
cmpq %r8, %rdi
jle 0xde2dd
cmpq %r8, %rsi
jge 0xde2dd
movq %rdx, 0x78(%r14)
leaq 0x5aa09(%rip), %rsi     # 0x138ced
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf05a
imulq $0xc, 0x78(%r14), %rsi
movq 0x70(%r14), %rax
movq 0x18(%rbx), %rcx
jmp 0xde29c