// File: /workspace/github_c_makefile_star2_O3/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 0xe8b2b
movq %rax, %r14
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
callq 0xe8a1c
leaq 0x10(%rsp), %r15
movq $0x0, (%r15)
leaq 0x3bed9(%rip), %rsi     # 0x12337f
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
leaq 0xa723a(%rip), %r13     # 0x18e700
leaq 0x5eb12(%rip), %r12     # 0x145fdf
xorl %ebp, %ebp
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeed31
movl %eax, 0x4(%r14,%rbp,4)
cmpl $0x8, %ebp
jg 0xe7501
cmpl $0x2, %ebp
je 0xe7544
cmpl $0x7, %ebp
jne 0xe752c
testl %eax, %eax
leaq 0x3d2ed(%rip), %r8      # 0x1247e5
leaq 0x35676(%rip), %rax     # 0x11cb75
jmp 0xe7573
cmpl $0x9, %ebp
je 0xe7563
cmpl $0xd, %ebp
jne 0xe752c
movl %eax, %ecx
andl $-0x2, %ecx
movl %ecx, 0x68(%r14)
leaq 0x44c36(%rip), %r8      # 0x12c151
cmpl $0x5, %ecx
jae 0xe7577
andl $-0x2, %eax
leaq 0x5ec9e(%rip), %rcx     # 0x1461c8
jmp 0xe755a
leal -0xe(%rbp), %ecx
movq (%r13), %rdx
movq %rbx, %rdi
cmpl $0x2, %ecx
ja 0xe75a0
leaq 0x5ea92(%rip), %rsi     # 0x145fd4
jmp 0xe75a7
leaq 0x44c06(%rip), %r8      # 0x12c151
cmpl $0x3, %eax
jae 0xe7577
andl $0x3, %eax
leaq 0x5ec62(%rip), %rcx     # 0x1461bc
movslq (%rcx,%rax,4), %r8
addq %rcx, %r8
jmp 0xe7577
testl %eax, %eax
leaq 0x5ea5e(%rip), %r8      # 0x145fca
leaq 0x5ea4d(%rip), %rax     # 0x145fc0
cmoveq %rax, %r8
movq (%r13), %rdx
movl 0x4(%r14,%rbp,4), %ecx
movq %rbx, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0xe8617
incq %rbp
addq $0x8, %r13
cmpq $0x19, %rbp
jne 0xe74cf
jmp 0xe75b2
leaq 0x397d3(%rip), %rsi     # 0x120d7a
movl %eax, %ecx
xorl %eax, %eax
callq 0xe8617
jmp 0xe758d
movl 0x4(%r14), %ecx
cmpq $0x63, %rcx
jbe 0xe75ed
cmpl $0x7, 0x8(%r14)
jne 0xe75ed
movl 0x14(%r14), %edi
cmpq $0xf4240, %rdi          # imm = 0xF4240
ja 0xe75ed
movl 0x18(%r14), %eax
cmpq $0xf4240, %rax          # imm = 0xF4240
ja 0xe75ed
movl 0x34(%r14), %edx
cmpq $0xf4241, %rdx          # imm = 0xF4241
jb 0xe7bd4
movw $0x101, (%r14)          # imm = 0x101
movl 0xc(%rsp), %esi
movq %rbx, %rdi
callq 0xe8a25
cmpb $0x0, (%r14)
jne 0xe7e4a
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
callq 0xe8a1c
cmpl $0x1, 0xdc(%r14)
jne 0xe7647
movq 0xb0(%r14), %rcx
leaq -0x1(%rcx), %rax
cmpq $0x7, %rax
ja 0xe7647
leaq 0x108(%r14), %rdi
movl $0x1, %esi
shlq %cl, %rsi
xorl %edx, %edx
callq 0xf3bdb
cmpq $0x0, 0x80(%r14)
jle 0xe7712
movq 0x70(%r14), %rdx
leaq 0x54182(%rip), %rsi     # 0x13b7e2
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movl 0x4c(%r14), %ecx
movq 0x70(%r14), %rax
movq %rax, 0x10(%rsp)
testl %ecx, %ecx
je 0xe7712
movl $0x100, %r13d           # imm = 0x100
cmpl %r13d, %ecx
cmovbl %ecx, %r13d
xorl %r15d, %r15d
leaq 0x10(%rsp), %r12
addq $0x4, %rax
movq %rax, 0x10(%rsp)
xorl %ebp, %ebp
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xeeb4b
incq 0x10(%rsp)
movb %al, 0x9(%rsp,%rbp)
incq %rbp
cmpq $0x3, %rbp
jne 0xe76ac
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 0xe91fc
movq 0x10(%rsp), %rax
addq $0x2, %rax
movq %rax, 0x10(%rsp)
incq %r15
cmpq %r13, %r15
jne 0xe76a1
leaq 0xc(%rsp), %r15
movl (%r15), %esi
movq %rbx, %rdi
callq 0xe8a25
movq 0x18(%rbx), %r12
movq 0x88(%r14), %r13
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe8a1c
movq 0x88(%r14), %rdx
leaq 0x470ca(%rip), %rsi     # 0x12e810
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0xb8(%r14), %rsi
movq 0xc0(%r14), %rdx
movq %rbx, %rdi
callq 0xf1db1
testl %eax, %eax
je 0xe795e
movq 0x98(%r14), %rcx
movabsq $0x5555555555555556, %rdx # imm = 0x5555555555555556
movq %rcx, %rax
imulq %rdx
cmpq 0x90(%r14), %rcx
je 0xe7818
movq %rdx, %rax
shrq $0x3f, %rax
addq %rdx, %rax
leaq (%rax,%rax,2), %rax
subq %rax, %rcx
jne 0xe7818
cmpl $0x2, 0xc(%r14)
jne 0xe7818
cmpl $0x8, 0x10(%r14)
jne 0xe7818
cmpl $0x0, 0x20(%r14)
jne 0xe7818
cmpl $0x20, 0x24(%r14)
jne 0xe7818
cmpl $0x0, 0x28(%r14)
jne 0xe7818
cmpl $0x20, 0x2c(%r14)
jne 0xe7818
cmpl $0x8, 0x30(%r14)
jne 0xe7818
cmpl $0x3, 0x38(%r14)
jne 0xe7818
cmpl $0x8, 0x48(%r14)
jne 0xe7818
movq 0x18(%rbx), %rdi
movq 0x88(%r14), %rsi
callq 0xeeb67
testq %rax, %rax
jle 0xe7818
cmpq 0xb8(%r14), %rax
jg 0xe7818
movl $0x64, 0xd8(%r14)
movl 0xd8(%r14), %eax
cmpl $0x64, %eax
jne 0xe783c
leaq 0x5e96d(%rip), %rsi     # 0x146198
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movl 0xd8(%r14), %eax
movq 0x90(%r14), %rsi
testl %eax, %eax
je 0xe79a4
movq %rbx, %rdi
movl $0x1, %edx
callq 0xf09c5
movq %rax, %r13
movq %rax, %rdi
callq 0xf0855
movq 0x88(%r14), %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rbx), %rcx
movq 0x18(%rcx), %rsi
movq 0xb8(%r14), %rcx
movq 0xc8(%r14), %rdx
movq %rdx, 0x20(%rsp)
movq %rcx, 0x38(%rsp)
subq %rcx, %rdx
movq %rdx, 0x40(%rsp)
sets %cl
movq %rax, %rdx
addq $0x3, %rdx
movq %rsi, 0x28(%rsp)
cmpq %rsi, %rdx
setg %dl
orb %cl, %dl
movq %r13, 0x30(%rsp)
jne 0xe7966
cmpq $0x0, 0x90(%r14)
jle 0xe7966
xorl %ebp, %ebp
xorl %r12d, %r12d
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %r13
movq %r13, %rsi
callq 0xeeb91
movq %rax, %r15
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xeeb4b
movzbl %al, %esi
movq 0x30(%rsp), %rdi
movq %r15, %rdx
callq 0xf0eba
addq %r15, %r12
addq %r15, %rbp
movq 0xb8(%r14), %rax
cmpq %rax, %rbp
jl 0xe7938
movq 0x20(%rsp), %rcx
cmpq 0x38(%rsp), %rcx
je 0xe7936
cmpq %rax, %rbp
jne 0xe7936
movq 0x30(%rsp), %rdi
xorl %esi, %esi
movq 0x40(%rsp), %r15
movq %r15, %rdx
callq 0xf0eba
addq %r15, %r12
xorl %ebp, %ebp
movq 0x10(%rsp), %rdx
leaq 0x3(%rdx), %rax
cmpq 0x28(%rsp), %rax
jg 0xe7955
cmpq 0x90(%r14), %r12
jl 0xe78cc
movq 0x88(%r14), %rax
jmp 0xe796c
xorl %r15d, %r15d
jmp 0xe7e11
xorl %r12d, %r12d
movq %rax, %rdx
subq %rax, %rdx
leaq 0x2b322(%rip), %rsi     # 0x112c98
movq %rbx, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0xe8617
movq 0x30(%rsp), %r12
movq %r12, %rdi
callq 0xf08ba
cmpl $0x0, 0xd8(%r14)
je 0xe79af
movq %r12, 0x20(%rsp)
xorl %r13d, %r13d
jmp 0xe79f2
movq $0x0, 0x20(%rsp)
jmp 0xe79be
movq 0x90(%r14), %rsi
xorl %r13d, %r13d
movq %r12, 0x20(%rsp)
addq 0x88(%r14), %rsi
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rax
addq $0x10, %rax
cmpq %rax, %rsi
jle 0xe79f2
leaq 0x5e7a1(%rip), %rsi     # 0x14617e
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
movb $0x1, (%r14)
jmp 0xe7e0c
movl 0xdc(%r14), %eax
cmpl $0x1, %eax
je 0xe7a22
cmpl $0x3, %eax
jne 0xe7bc7
movq 0xa8(%r14), %rax
addq $-0x2, %rax
movl $0x3, %ecx
cmpq $0x3, %rax
jb 0xe7a4f
jmp 0xe7bc7
cmpq $0x0, 0xb0(%r14)
jle 0xe7bc7
leaq 0x108(%r14), %rdi
movl $0x100, %esi            # imm = 0x100
callq 0xf1ed8
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 0xf266a
movq %rax, %rbp
movl 0xdc(%r14), %eax
cmpl $0x1, %eax
je 0xe7d11
cmpl $0x3, %eax
jne 0xe7df7
movq 0xc0(%r14), %rcx
testq %rcx, %rcx
jle 0xe7df7
movq 0xb8(%r14), %rax
movq $0x0, 0x28(%rsp)
movq %r12, 0x30(%rsp)
movq %r13, 0x40(%rsp)
movq %rbp, 0x38(%rsp)
testq %rax, %rax
jle 0xe7bac
movq 0xc8(%r14), %rbp
imulq 0x28(%rsp), %rbp
addq %r13, %rbp
xorl %r13d, %r13d
movq 0xa8(%r14), %rdx
cmpq $0x4, %rdx
jne 0xe7af5
leaq (,%r13,4), %rsi
addq %rbp, %rsi
movl 0xa0(%r14), %edx
movq %r12, %rdi
callq 0xeeff3
jmp 0xe7b11
movq %rdx, %rsi
imulq %r13, %rsi
addq %rbp, %rsi
movl 0xa0(%r14), %ecx
movq %r12, %rdi
xorl %r8d, %r8d
callq 0xef0f6
movq %rax, %r15
xorl %r12d, %r12d
movl 0x3c(%r14,%r12,4), %eax
andl %r15d, %eax
movb 0xe0(%r14,%r12,4), %cl
shrl %cl, %eax
movq 0xf0(%r14,%r12,8), %rdi
cmpq $0xff, %rdi
jne 0xe7b3f
movzbl %al, %eax
jmp 0xe7b49
movl %eax, %esi
callq 0xec7dc
movzbl %al, %eax
movl %eax, 0x10(%rsp,%r12,4)
incq %r12
cmpq $0x3, %r12
jne 0xe7b17
movl 0x10(%rsp), %eax
movl 0x14(%rsp), %ecx
shll $0x10, %eax
shll $0x8, %ecx
orl %eax, %ecx
orl 0x18(%rsp), %ecx
orl $0xff000000, %ecx       # imm = 0xFF000000
movq 0x38(%rsp), %rdi
movq %r13, %rsi
movq 0x28(%rsp), %rdx
callq 0xf24ba
incq %r13
movq 0xb8(%r14), %rax
cmpq %rax, %r13
movq 0x30(%rsp), %r12
jl 0xe7acc
movq 0xc0(%r14), %rcx
movq 0x40(%rsp), %r13
movq 0x38(%rsp), %rbp
movq 0x28(%rsp), %rsi
incq %rsi
movq %rsi, 0x28(%rsp)
cmpq %rcx, %rsi
jl 0xe7ab0
jmp 0xe7df7
movw $0x101, (%r14)          # imm = 0x101
xorl %ebp, %ebp
jmp 0xe7e0c
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
cmpq $0x9, %rcx
setb %r8b
movl $0x116, %r9d            # imm = 0x116
shrl %cl, %r9d
movl 0xdc(%r14), %r10d
movl $0x1, %esi
testl %r10d, %r10d
je 0xe7d6d
cmpl $0x3, %r10d
jne 0xe7f4c
movq 0xa8(%r14), %r8
movb $0x1, %cl
cmpq $0x3, %r8
jne 0xe7c7d
cmpl $0x8, 0x2c(%r14)
jne 0xe7c7d
shll $0x2, %edi
cmpl %edx, %edi
jne 0xe7c7d
movq $0x4, 0xa8(%r14)
movq $0x0, 0xb0(%r14)
movl $0x3, 0xdc(%r14)
xorl %ecx, %ecx
xorl %edi, %edi
movl $0xff, %r8d
xorl %r9d, %r9d
movl 0x3c(%r14,%r9,4), %r15d
xorl %r12d, %r12d
xorl %ebp, %ebp
xorl %r10d, %r10d
xorl %r11d, %r11d
btl %r12d, %r15d
jae 0xe7cae
testl %ebp, %ebp
cmovel %r12d, %r11d
incl %ebp
leaq 0x1(,%r10,2), %r10
incl %r12d
cmpl $0x20, %r12d
jne 0xe7c98
addl $-0x11, %ebp
cmpl $-0x10, %ebp
cmovbl %edi, %r11d
cmovbq %r8, %r10
movl %r11d, 0xe0(%r14,%r9,4)
movq %r10, 0xf0(%r14,%r9,8)
incq %r9
cmpq $0x3, %r9
jne 0xe7c88
testb %cl, %cl
jne 0xe7f4c
leaq 0x5e3f4(%rip), %rsi     # 0x1460e1
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8faa
movq 0xc0(%r14), %rax
movq 0xc8(%r14), %rdx
movq 0xd0(%r14), %rsi
jmp 0xe7f4c
movq 0xb0(%r14), %rdx
leaq -0x9(%rdx), %rax
cmpq $-0x8, %rax
jb 0xe7df7
movq 0xc8(%r14), %rcx
movq 0xd0(%r14), %rax
xorl %r10d, %r10d
cmpl $0x0, 0x28(%r14)
sete %r10b
cmpq $0x1, %rax
jg 0xe7dcd
movq %r14, %r8
addq $0x108, %r8             # imm = 0x108
subq $0x8, %rsp
movq %r12, %rdi
movq %r13, %rsi
movq %rbp, %r9
pushq %r10
callq 0xf2f79
jmp 0xe7df3
movl 0x68(%r14), %r10d
testl %r10d, %r10d
je 0xe7d8a
cmpl $0x4, %r10d
je 0xe7e97
cmpl $0x2, %r10d
jne 0xe7f4c
cmpl $0x1, 0xc(%r14)
jne 0xe7e7c
leal -0x1(%rcx), %edi
cmpl $0x7, %edi
ja 0xe7e7c
cmpl $0x1, 0x30(%r14)
jne 0xe7e7c
movl $0x1, 0xdc(%r14)
movq %rcx, 0xb0(%r14)
movq %rcx, 0xd0(%r14)
movq %rcx, %rsi
jmp 0xe7f4c
movq 0xc0(%r14), %r8
imulq %rcx, %r8
movq %r14, %r9
addq $0x108, %r9             # imm = 0x108
movq %r12, %rdi
movq %r13, %rsi
movq %rax, %rdx
pushq %r10
pushq %rbp
callq 0xf30b3
addq $0x10, %rsp
cmpb $0x0, (%r14)
jne 0xe7e0c
movq %rbp, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0xf22dc
movq 0x20(%rsp), %r15
cmpb $0x0, 0x1(%r14)
je 0xe7e2e
leaq 0x2f8fb(%rip), %rsi     # 0x11771a
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
movb $0x0, 0x1(%r14)
movq %rbp, %rdi
callq 0xf228d
movq %r15, %rdi
callq 0xf052b
movl 0xc(%rsp), %esi
movq %rbx, %rdi
callq 0xe8a25
cmpb $0x0, 0x1(%r14)
je 0xe7e62
leaq 0x5e14c(%rip), %rsi     # 0x145fa4
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe8be2
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
andb %r9b, %r8b
testl %r10d, %r10d
je 0xe7ed8
cmpl $0x2, %r10d
sete %dil
testb %dil, %r8b
je 0xe7f4c
jmp 0xe7edd
movl 0x30(%r14), %r8d
cmpq $0x20, %r8
je 0xe7ea7
cmpl $0x18, %r8d
jne 0xe7f23
cmpq $0x20, %rcx
je 0xe7eb6
cmpl $0x18, %ecx
jne 0xe7f4c
movl $0x3, 0xdc(%r14)
movq %r8, 0xb0(%r14)
shrl $0x3, %r8d
movq %r8, 0xa8(%r14)
jmp 0xe7c44
testb %r8b, %r8b
je 0xe7f4c
movl 0x30(%r14), %edi
cmpl %ecx, %edi
jne 0xe7ef9
movl $0x1, 0xdc(%r14)
movq %rcx, 0xb0(%r14)
jmp 0xe7f4c
cmpl $0x8, %edi
setne %dil
cmpl $0x8, %ecx
setae %cl
orb %dil, %cl
jne 0xe7f4c
movl $0x1, 0xdc(%r14)
movq $0x8, 0xb0(%r14)
jmp 0xe7f4c
xorl $0x10, %r8d
xorl $0x10, %ecx
orl %r8d, %ecx
jne 0xe7f4c
movl $0x3, 0xdc(%r14)
movq $0x2, 0xa8(%r14)
movb $0x1, %cl
jmp 0xe7c7d
imulq %rax, %rdx
imulq %rsi, %rdx
movq %rdx, 0x90(%r14)
movq 0xb0(%r14), %rdx
testq %rdx, %rdx
jne 0xe7f79
movq 0xa8(%r14), %rdx
shlq $0x3, %rdx
movq %rdx, 0xb0(%r14)
cmpl $0x0, 0xdc(%r14)
je 0xe7f94
leaq 0x5e198(%rip), %rsi     # 0x146122
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
cmpb $0x0, (%r14)
jne 0xe75f3
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe8065
jmp 0xe75f3