// File: /workspace/github_c_makefile_star2_O1/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 0xe969b
movq %rax, %r14
leaq 0x14(%rsp), %rsi
movq %rbx, %rdi
callq 0xe958c
leaq 0x18(%rsp), %r15
movq $0x0, (%r15)
leaq 0x3b151(%rip), %rsi     # 0x12319f
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
leaq 0xa6692(%rip), %r13     # 0x18e700
leaq 0x5da75(%rip), %r12     # 0x145aea
xorl %ebp, %ebp
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef34e
movl %eax, 0x4(%r14,%rbp,4)
cmpl $0x8, %ebp
jg 0xe80af
cmpl $0x2, %ebp
je 0xe80e0
movl $0x0, %r8d
cmpl $0x7, %ebp
jne 0xe8113
testl %eax, %eax
leaq 0x3c51f(%rip), %r8      # 0x1245c5
leaq 0x349b8(%rip), %rax     # 0x11ca65
jmp 0xe810f
cmpl $0x9, %ebp
je 0xe80ff
movl $0x0, %r8d
cmpl $0xd, %ebp
jne 0xe8113
movl %eax, %ecx
andl $-0x2, %ecx
movl %ecx, 0x68(%r14)
leaq 0x43d9a(%rip), %r8      # 0x12be69
cmpl $0x5, %ecx
jae 0xe8113
andl $-0x2, %eax
leaq 0x5dbfe(%rip), %rcx     # 0x145cdc
jmp 0xe80f6
leaq 0x43d82(%rip), %r8      # 0x12be69
cmpl $0x3, %eax
jae 0xe8113
andl $0x3, %eax
leaq 0x5dbda(%rip), %rcx     # 0x145cd0
movslq (%rcx,%rax,4), %r8
addq %rcx, %r8
jmp 0xe8113
testl %eax, %eax
leaq 0x5d9d8(%rip), %r8      # 0x145ae0
leaq 0x5d9c7(%rip), %rax     # 0x145ad6
cmoveq %rax, %r8
leal -0xe(%rbp), %eax
cmpl $0x2, %eax
ja 0xe812c
movq (%r13), %rdx
movl 0x4(%r14,%rbp,4), %ecx
movq %rbx, %rdi
movq %r12, %rsi
jmp 0xe8154
movq (%r13), %rdx
movl 0x4(%r14,%rbp,4), %ecx
movq %rbx, %rdi
testq %r8, %r8
je 0xe814d
leaq 0x5d9b1(%rip), %rsi     # 0x145af5
xorl %eax, %eax
callq 0xe9226
jmp 0xe815b
leaq 0x38afe(%rip), %rsi     # 0x120c52
xorl %eax, %eax
callq 0xe9226
incq %rbp
addq $0x8, %r13
cmpq $0x19, %rbp
jne 0xe8077
movl 0x4(%r14), %ecx
cmpq $0x63, %rcx
jbe 0xe81a7
cmpl $0x7, 0x8(%r14)
jne 0xe81a7
movl 0x14(%r14), %eax
cmpq $0xf4240, %rax          # imm = 0xF4240
ja 0xe81a7
movl 0x18(%r14), %esi
cmpq $0xf4240, %rsi          # imm = 0xF4240
ja 0xe81a7
movl 0x34(%r14), %edx
cmpq $0xf4241, %rdx          # imm = 0xF4241
jb 0xe8751
movw $0x101, (%r14)          # imm = 0x101
movl 0x14(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
cmpb $0x0, (%r14)
jne 0xe8aef
leaq 0x14(%rsp), %rsi
movq %rbx, %rdi
callq 0xe958c
cmpl $0x1, 0xdc(%r14)
jne 0xe8201
movq 0xb0(%r14), %rcx
leaq -0x1(%rcx), %rax
cmpq $0x7, %rax
ja 0xe8201
leaq 0x108(%r14), %rdi
movl $0x1, %esi
shlq %cl, %rsi
xorl %edx, %edx
callq 0xf41f4
cmpq $0x0, 0x80(%r14)
jle 0xe82bd
movq 0x70(%r14), %rdx
leaq 0x53210(%rip), %rsi     # 0x13b42a
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movl 0x4c(%r14), %eax
movq 0x70(%r14), %rcx
movq %rcx, 0x18(%rsp)
testl %eax, %eax
je 0xe82bd
movl $0x100, %r13d           # imm = 0x100
cmpl %r13d, %eax
cmovbl %eax, %r13d
xorl %r15d, %r15d
leaq 0x18(%rsp), %r12
addq $0x4, 0x18(%rsp)
xorl %ebp, %ebp
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef14d
incq 0x18(%rsp)
movb %al, 0x11(%rsp,%rbp)
incq %rbp
cmpq $0x3, %rbp
jne 0xe825f
movzbl 0x11(%rsp), %eax
shll $0x10, %eax
movzbl 0x12(%rsp), %ecx
shll $0x8, %ecx
orl %eax, %ecx
movzbl 0x13(%rsp), %edx
orl %ecx, %edx
orl $0xff000000, %edx       # imm = 0xFF000000
movl %edx, 0x108(%r14,%r15,4)
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe9d68
addq $0x2, 0x18(%rsp)
incq %r15
cmpq %r13, %r15
jne 0xe8257
leaq 0x14(%rsp), %r15
movl (%r15), %esi
movq %rbx, %rdi
callq 0xe9595
movq 0x18(%rbx), %rax
movq %rax, 0x8(%rsp)
movq 0x88(%r14), %r13
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe958c
movq 0x88(%r14), %rdx
leaq 0x46222(%rip), %rsi     # 0x12e518
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0xb8(%r14), %rsi
movq 0xc0(%r14), %rdx
movq %rbx, %rdi
callq 0xf241d
testl %eax, %eax
je 0xe84f6
movq 0x98(%r14), %rcx
movabsq $0x5555555555555556, %rdx # imm = 0x5555555555555556
movq %rcx, %rax
imulq %rdx
cmpq 0x90(%r14), %rcx
je 0xe83c8
movq %rdx, %rax
shrq $0x3f, %rax
addq %rdx, %rax
leaq (%rax,%rax,2), %rax
subq %rax, %rcx
jne 0xe83c8
cmpl $0x2, 0xc(%r14)
jne 0xe83c8
cmpl $0x8, 0x10(%r14)
jne 0xe83c8
cmpl $0x0, 0x20(%r14)
jne 0xe83c8
cmpl $0x20, 0x24(%r14)
jne 0xe83c8
cmpl $0x0, 0x28(%r14)
jne 0xe83c8
cmpl $0x20, 0x2c(%r14)
jne 0xe83c8
cmpl $0x8, 0x30(%r14)
jne 0xe83c8
cmpl $0x3, 0x38(%r14)
jne 0xe83c8
cmpl $0x8, 0x48(%r14)
jne 0xe83c8
movq 0x18(%rbx), %rdi
movq 0x88(%r14), %rsi
callq 0xef169
testq %rax, %rax
jle 0xe83c8
cmpq 0xb8(%r14), %rax
jg 0xe83c8
movl $0x64, 0xd8(%r14)
cmpl $0x64, 0xd8(%r14)
jne 0xe83e3
leaq 0x5d8d5(%rip), %rsi     # 0x145cae
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
cmpl $0x0, 0xd8(%r14)
je 0xe8504
movq 0x90(%r14), %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0xf0faf
movq %rax, 0x28(%rsp)
movq %rax, %rdi
callq 0xf0e3f
movq 0x88(%r14), %rax
movq %rax, 0x18(%rsp)
movq 0xb8(%r14), %rax
movq 0xc8(%r14), %rcx
movq %rcx, 0x40(%rsp)
movq %rax, 0x38(%rsp)
subq %rax, %rcx
movq %rcx, 0x30(%rsp)
js 0xe850f
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rcx
xorl %r15d, %r15d
xorl %r12d, %r12d
movq %rcx, 0x8(%rsp)
movq 0x18(%rsp), %rax
addq $0x3, %rax
cmpq %rcx, %rax
jg 0xe84e9
cmpq 0x90(%r14), %r12
jge 0xe84e9
movq 0x18(%rbx), %rdi
leaq 0x18(%rsp), %r13
movq %r13, %rsi
callq 0xef193
movq %rax, %rbp
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xef14d
movzbl %al, %esi
movq 0x28(%rsp), %rdi
movq %rbp, %rdx
callq 0xf14bd
addq %rbp, %r12
addq %rbp, %r15
movq 0xb8(%r14), %rax
movb $0x1, %bpl
cmpq %rax, %r15
jl 0xe84e2
movq 0x40(%rsp), %rcx
cmpq 0x38(%rsp), %rcx
je 0xe84df
cmpq %rax, %r15
jne 0xe84df
movq 0x28(%rsp), %rdi
xorl %esi, %esi
movq 0x30(%rsp), %r15
movq %r15, %rdx
callq 0xf14bd
addq %r15, %r12
xorl %r15d, %r15d
movq 0x8(%rsp), %rcx
jmp 0xe84eb
xorl %ebp, %ebp
testb %bpl, %bpl
jne 0xe8457
jmp 0xe8512
movq $0x0, 0x28(%rsp)
jmp 0xe8ab4
movq $0x0, 0x28(%rsp)
jmp 0xe8547
xorl %r12d, %r12d
movq 0x18(%rsp), %rdx
subq 0x88(%r14), %rdx
leaq 0x2a763(%rip), %rsi     # 0x112c88
xorl %r13d, %r13d
movq %rbx, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0xe9226
movq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0xf0ea4
movq %r15, 0x8(%rsp)
cmpl $0x0, 0xd8(%r14)
jne 0xe858c
movq 0x90(%r14), %rax
addq 0x88(%r14), %rax
movq 0x18(%rbx), %rcx
movq 0x18(%rcx), %rcx
addq $0x10, %rcx
cmpq %rcx, %rax
jle 0xe858c
leaq 0x5d71d(%rip), %rsi     # 0x145c94
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
movb $0x1, (%r14)
jmp 0xe8ab4
movl 0xdc(%r14), %eax
cmpl $0x1, %eax
je 0xe85bb
cmpl $0x3, %eax
jne 0xe8744
movq 0xa8(%r14), %rcx
addq $-0x2, %rcx
cmpq $0x3, %rcx
jb 0xe85c9
cmpl $0x1, %eax
jne 0xe8744
cmpq $0x0, 0xb0(%r14)
jle 0xe8744
movl $0x3, %ecx
cmpl $0x1, %eax
jne 0xe85f2
leaq 0x108(%r14), %rdi
movl $0x100, %esi            # imm = 0x100
callq 0xf2544
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
leal 0x1(,%rcx,2), %ecx
movq %r13, 0x30(%rsp)
movq 0xb8(%r14), %rsi
movq 0xc0(%r14), %rdx
movq %rbx, %rdi
callq 0xf2cab
movq %rax, %rbp
movl 0xdc(%r14), %eax
cmpl $0x1, %eax
je 0xe897f
cmpl $0x3, %eax
jne 0xe8a9f
cmpq $0x0, 0xc0(%r14)
jle 0xe8a9f
xorl %r12d, %r12d
movq %rbp, 0x40(%rsp)
cmpq $0x0, 0xb8(%r14)
jle 0xe872f
movq 0xc8(%r14), %rax
imulq %r12, %rax
addq 0x30(%rsp), %rax
movq %rax, 0x38(%rsp)
xorl %r15d, %r15d
movq 0xa8(%r14), %rdx
cmpq $0x4, %rdx
jne 0xe868e
movq 0x38(%rsp), %rax
leaq (%rax,%r15,4), %rsi
movl 0xa0(%r14), %edx
movq 0x8(%rsp), %rdi
callq 0xef614
jmp 0xe86ae
movq %rdx, %rsi
imulq %r15, %rsi
addq 0x38(%rsp), %rsi
movl 0xa0(%r14), %ecx
movq 0x8(%rsp), %rdi
xorl %r8d, %r8d
callq 0xef6f2
movq %rax, %r13
xorl %ebp, %ebp
movl 0x3c(%r14,%rbp,4), %eax
andl %r13d, %eax
movb 0xe0(%r14,%rbp,4), %cl
shrl %cl, %eax
movq 0xf0(%r14,%rbp,8), %rdi
cmpq $0xff, %rdi
jne 0xe86db
movzbl %al, %eax
jmp 0xe86e5
movl %eax, %esi
callq 0xece35
movzbl %al, %eax
movl %eax, 0x18(%rsp,%rbp,4)
incq %rbp
cmpq $0x3, %rbp
jne 0xe86b3
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 0x40(%rsp), %rbp
movq %rbp, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0xf2afd
incq %r15
cmpq 0xb8(%r14), %r15
jl 0xe8665
incq %r12
cmpq 0xc0(%r14), %r12
jl 0xe863f
jmp 0xe8a9f
movw $0x101, (%r14)          # imm = 0x101
xorl %ebp, %ebp
jmp 0xe8ab4
movq %rcx, 0x70(%r14)
movq %rax, 0xb8(%r14)
movq %rsi, 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 %sil
movl $0x116, %edi            # imm = 0x116
shrl %cl, %edi
cmpl $0x0, 0xdc(%r14)
je 0xe89df
andb %dil, %sil
cmpl $0x0, 0xdc(%r14)
je 0xe8a2f
cmpl $0x0, 0xdc(%r14)
je 0xe8a50
cmpl $0x0, 0xdc(%r14)
jne 0xe880d
cmpl $0x4, 0x68(%r14)
jne 0xe880d
movl 0x30(%r14), %esi
cmpq $0x20, %rsi
je 0xe87e6
cmpl $0x18, %esi
jne 0xe880d
cmpq $0x20, %rcx
je 0xe87f1
cmpl $0x18, %ecx
jne 0xe880d
movl $0x3, 0xdc(%r14)
movq %rsi, 0xb0(%r14)
shrl $0x3, %esi
movq %rsi, 0xa8(%r14)
cmpl $0x0, 0xdc(%r14)
jne 0xe8840
cmpl $0x4, 0x68(%r14)
jne 0xe8840
cmpl $0x10, %ecx
jne 0xe8840
cmpl $0x10, 0x30(%r14)
jne 0xe8840
movl $0x3, 0xdc(%r14)
movq $0x2, 0xa8(%r14)
movb $0x1, %cl
cmpl $0x3, 0xdc(%r14)
jne 0xe8887
cmpq $0x3, 0xa8(%r14)
jne 0xe8887
cmpl $0x8, 0x2c(%r14)
jne 0xe8887
shll $0x2, %eax
cmpl %edx, %eax
jne 0xe8887
movq $0x4, 0xa8(%r14)
movq $0x0, 0xb0(%r14)
movl $0x3, 0xdc(%r14)
xorl %ecx, %ecx
cmpl $0x3, 0xdc(%r14)
jne 0xe88f4
xorl %eax, %eax
movl $0xff, %edx
xorl %esi, %esi
movl 0x3c(%r14,%rsi,4), %r10d
xorl %r11d, %r11d
xorl %r9d, %r9d
xorl %edi, %edi
xorl %r8d, %r8d
btl %r11d, %r10d
jae 0xe88c2
testl %r9d, %r9d
cmovel %r11d, %r8d
incl %r9d
leaq 0x1(,%rdi,2), %rdi
incl %r11d
cmpl $0x20, %r11d
jne 0xe88aa
addl $-0x11, %r9d
cmpl $-0x10, %r9d
cmovbl %eax, %r8d
cmovbq %rdx, %rdi
movl %r8d, 0xe0(%r14,%rsi,4)
movq %rdi, 0xf0(%r14,%rsi,8)
incq %rsi
cmpq $0x3, %rsi
jne 0xe889a
testb %cl, %cl
jne 0xe8909
leaq 0x5d2f8(%rip), %rsi     # 0x145bf7
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9b27
movq 0xc8(%r14), %rax
imulq 0xc0(%r14), %rax
imulq 0xd0(%r14), %rax
movq %rax, 0x90(%r14)
cmpq $0x0, 0xb0(%r14)
jne 0xe8943
movq 0xa8(%r14), %rax
shlq $0x3, %rax
movq %rax, 0xb0(%r14)
cmpl $0x0, 0xdc(%r14)
je 0xe8965
movl 0xb0(%r14), %edx
leaq 0x5d2dd(%rip), %rsi     # 0x145c38
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
cmpb $0x0, (%r14)
jne 0xe81ad
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe8c40
jmp 0xe81ad
movq 0xb0(%r14), %rdx
leaq -0x9(%rdx), %rax
cmpq $-0x8, %rax
jb 0xe8a9f
movq 0xc8(%r14), %rcx
movq 0xd0(%r14), %rax
xorl %r10d, %r10d
cmpl $0x0, 0x28(%r14)
sete %r10b
cmpq $0x1, %rax
jg 0xe8a71
movq %r14, %r8
addq $0x108, %r8             # imm = 0x108
subq $0x8, %rsp
movq 0x10(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq %rbp, %r9
pushq %r10
callq 0xf35b8
jmp 0xe8a9b
testl $0xfffffffd, 0x68(%r14) # imm = 0xFFFFFFFD
jne 0xe87a7
cmpl $0x1, 0xc(%r14)
jne 0xe87a7
leal -0x1(%rcx), %r8d
cmpl $0x7, %r8d
ja 0xe87a7
cmpl $0x1, 0x30(%r14)
jne 0xe87a7
movl $0x1, 0xdc(%r14)
movq %rcx, 0xb0(%r14)
movq %rcx, 0xd0(%r14)
jmp 0xe87a7
movl 0x68(%r14), %edi
testl %edi, %edi
je 0xe8b21
cmpl $0x2, %edi
sete %dil
testb %dil, %sil
je 0xe87b8
jmp 0xe8b2a
movl 0x68(%r14), %edi
testl %edi, %edi
je 0xe8b4d
cmpl $0x2, %edi
sete %dil
testb %dil, %sil
je 0xe87c6
jmp 0xe8b56
movq 0xc0(%r14), %r8
imulq %rcx, %r8
movq %r14, %r9
addq $0x108, %r9             # imm = 0x108
movq 0x8(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq %rax, %rdx
pushq %r10
pushq %rbp
callq 0xf36f9
addq $0x10, %rsp
cmpb $0x0, (%r14)
jne 0xe8ab4
movq %rbp, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0xf2923
cmpb $0x0, 0x1(%r14)
je 0xe8ad1
leaq 0x2ebb8(%rip), %rsi     # 0x11767a
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
movb $0x0, 0x1(%r14)
movq %rbp, %rdi
callq 0xf28d4
movq 0x28(%rsp), %rdi
callq 0xf0b13
movl 0x14(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
cmpb $0x0, 0x1(%r14)
je 0xe8b07
leaq 0x5cfbd(%rip), %rsi     # 0x145aba
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe9752
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testb %sil, %sil
je 0xe87b8
movl 0x30(%r14), %edi
cmpl %ecx, %edi
jne 0xe87b8
movl $0x1, 0xdc(%r14)
movq %rdi, 0xb0(%r14)
jmp 0xe87b8
testb %sil, %sil
je 0xe87c6
movl 0x30(%r14), %esi
cmpq $0x8, %rsi
setne %dil
cmpl $0x8, %ecx
setae %r8b
orb %dil, %r8b
jne 0xe87c6
movl $0x1, 0xdc(%r14)
movq %rsi, 0xb0(%r14)
jmp 0xe87c6