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

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

	if(mparams) {
		// if in_params.flags & 0x2, then the parent module wants the decoded
		// image to be returned, instead of written to a file.
		// in_params.obj1 points to an fmtutil_bmp_mparams_indata struct,
		// allocated by the caller, that will be filled in by the bmp module.
		// [It's acknowledged that out_params seems more appropriate for data
		// going from the child to the parent. But I don't think it's right
		// for the parent to put stuff in out_params, and I want the parent
		// to both allocate and free the container struct. Some rethinking of this
		// data passing system is probably in order.]
		if(mparams->in_params.flags & 0x02) {
			d->want_returned_img = 1;
		}
	}

	d->fi = de_finfo_create(c);

	if(dbuf_memcmp(c->infile, 0, "BM", 2)) {
		de_err(c, "Not a BMP file.");
		goto done;
	}

	if(!detect_bmp_version(c, d)) {
		de_err(c, "Unidentified BMP version.");
		goto done;
	}

	switch(d->version) {
	case DE_BMPVER_OS2V1:
		if(d->fsize==26) {
			de_declare_fmt(c, "BMP, OS/2 v1");
		}
		else {
			de_declare_fmt(c, "BMP, OS/2 v1 or Windows v2");
		}
		break;
	case DE_BMPVER_OS2V2: de_declare_fmt(c, "BMP, OS/2 v2"); break;
	case DE_BMPVER_WINV345:
		switch(d->infohdrsize) {
		case 40: de_declare_fmt(c, "BMP, Windows v3"); break;
		case 108: de_declare_fmt(c, "BMP, Windows v4"); break;
		case 124: de_declare_fmt(c, "BMP, Windows v5"); break;
		default: de_declare_fmt(c, "BMP, Windows v3+");
		}
		break;
	case DE_BMPVER_64BIT:
		de_declare_fmt(c, "BMP, 64-bit");
		break;
	}

	pos = 0;
	if(!read_fileheader(c, d, pos)) goto done;
	pos += FILEHEADER_SIZE;
	if(!read_infoheader(c, d, pos)) goto done;
	pos += d->infohdrsize;
	if(d->bitfields_type==BF_SEGMENT) {
		de_dbg(c, "bitfields segment at %"I64_FMT", len=%"I64_FMT, pos, d->bitfields_segment_len);
		if(pos+d->bitfields_segment_len > d->bits_offset) {
			de_warn(c, "BITFIELDS segment at %"I64_FMT" (size %"I64_FMT") overlaps bitmap at %"I64_FMT,
				pos, d->bitfields_segment_len, d->bits_offset);
		}
		de_dbg_indent(c, 1);
		do_read_bitfields(c, d, pos, d->bitfields_segment_len);
		de_dbg_indent(c, -1);
		pos += d->bitfields_segment_len;
	}
	d->pal_pos = pos;
	do_read_palette(c, d);
	do_image(c, d);
	do_read_profile(c, d);

	if(d->want_returned_img && mparams && mparams->in_params.obj1) {
		struct fmtutil_bmp_mparams_indata *idata =
			(struct fmtutil_bmp_mparams_indata*)mparams->in_params.obj1;
		idata->img = d->img;
		d->img = NULL;
		idata->fi = d->fi;
		d->fi = NULL;
		idata->createflags = d->createflags;
	}

done:
	if(d) {
		de_bitmap_destroy(d->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 $0xb8, %rsp
movq %rsi, %rbx
movq %rdi, %r13
movl $0x540, %esi            # imm = 0x540
callq 0xe8b2b
movq %rax, %r14
testq %rbx, %rbx
je 0x32b24
testb $0x2, 0x8(%rbx)
je 0x32b24
movb $0x1, 0x4(%r14)
movq %r13, %rdi
callq 0xea504
movq %rax, 0x8(%r14)
movq 0x18(%r13), %rdi
leaq 0xe95d3(%rip), %rdx     # 0x11c10e
movl $0x2, %ecx
xorl %esi, %esi
callq 0xefc85
testl %eax, %eax
je 0x32b61
leaq 0xe4e9b(%rip), %rsi     # 0x1179ed
movq %r13, %rdi
xorl %eax, %eax
callq 0xe9295
jmp 0x333a4
movq 0x18(%r13), %rdi
movl $0x2, %esi
callq 0xeed61
movq %rax, 0x20(%r14)
movq 0x18(%r13), %rdi
movl $0xe, %esi
callq 0xeed61
movq %rax, 0x30(%r14)
xorl %ecx, %ecx
cmpq $0xd, %rax
setge %cl
movq 0x18(%r13), %rdi
leaq 0x18(,%rcx,4), %rsi
callq 0xeebc8
movq %rax, 0x38(%r14)
movq 0x30(%r14), %rdx
cmpq $0xc, %rdx
jne 0x32ca4
movl $0x1, (%r14)
cmpq $0x1a, 0x20(%r14)
leaq 0xe4e53(%rip), %rax     # 0x117a17
leaq 0xe4e59(%rip), %rsi     # 0x117a24
cmoveq %rax, %rsi
movq %r13, %rdi
callq 0xeb125
leaq 0xe9b31(%rip), %rsi     # 0x11c70f
movq %r13, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xe8617
movq %r13, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x20(%r14), %rdx
leaq 0xe4ef4(%rip), %rsi     # 0x117af6
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x18(%r13), %rdi
movl $0xa, %esi
callq 0xeed61
movq %rax, 0x28(%r14)
leaq 0xe4edd(%rip), %rsi     # 0x117b02
movq %r13, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq %r13, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
leaq 0xe4ecb(%rip), %rsi     # 0x117b11
movl $0xe, %edx
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8617
movq %r13, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x30(%r14), %rdx
leaq 0xe4eb7(%rip), %rsi     # 0x117b24
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8617
cmpl $0x1, (%r14)
movq 0x18(%r13), %rdi
movl $0x12, %esi
jne 0x32cba
callq 0xeebc8
movq %rax, 0x50(%r14)
movq 0x18(%r13), %rdi
movl $0x14, %esi
callq 0xeebc8
movl $0x16, %esi
jmp 0x32ce6
cmpq $0x10, %rdx
jge 0x32e30
leaq 0xe4d48(%rip), %rsi     # 0x1179fd
jmp 0x32b52
callq 0xeedfa
movq %rax, 0x50(%r14)
movq 0x18(%r13), %rdi
movl $0x16, %esi
callq 0xeedfa
movl $0x1a, %esi
testq %rax, %rax
jns 0x32ce6
movl $0x1, 0x68(%r14)
negq %rax
movq %rax, 0x60(%r14)
movq 0x18(%r13), %rdi
callq 0xeebc8
movq %rax, %r15
movq 0x50(%r14), %rsi
movq 0x60(%r14), %rdx
movq %rsi, 0x58(%r14)
movq %r13, %rdi
callq 0xe8f88
cmpl $0x0, 0x68(%r14)
je 0x32d24
leaq 0xe4e22(%rip), %rsi     # 0x117b3a
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8617
jmp 0x32d29
orb $0x4, 0x18(%r14)
leaq 0x10877f(%rip), %rsi    # 0x13b4af
movq %r13, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xe8617
movl 0x38(%r14), %edx
leaq 0x1133e6(%rip), %rsi    # 0x14612e
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x38(%r14), %rax
leaq -0x4(%rax), %rcx
cmpq $0x3c, %rcx
ja 0x32d7e
movl $0x10101011, %edx       # imm = 0x10101011
btq %rcx, %rdx
jb 0x32d88
cmpq $0x3c, %rcx
jne 0x32d7e
movl (%r14), %eax
movb $0x1, %bpl
cmpl $0xa, %eax
je 0x32d88
jmp 0x32d8d
cmpq $0x3, %rax
jae 0x32f5c
xorl %ebp, %ebp
movl (%r14), %eax
movl $0x3, %ecx
cmpl $0x1, %eax
je 0x32dd2
movl 0x40(%r14), %edi
xorl %ecx, %ecx
cmpl $0x2, %eax
sete %cl
leaq 0x50(%rsp), %r15
movl $0x50, %edx
movq %r15, %rsi
callq 0xf73b0
movl 0x40(%r14), %edx
leaq 0xe4d90(%rip), %rsi     # 0x117b50
movq %r13, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0xe8617
movl $0x4, %ecx
movq %rcx, 0x80(%r14)
movl $0x0, 0xa8(%r14)
movl 0x40(%r14), %eax
movb $0x1, %r12b
cmpq $0x6, %rax
ja 0x33059
leaq 0xe4a44(%rip), %rcx     # 0x117840
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x38(%r14), %rax
cmpq $0x20, %rax
je 0x32e15
cmpq $0x10, %rax
jne 0x32e20
movl $0x1, 0x8c(%r14)
movl $0x0, 0xa8(%r14)
jmp 0x33056
cmpq $0x14, %rdx
jb 0x32e7a
movq 0x18(%r13), %rdi
movl $0x1e, %esi
callq 0xeed61
movq %rax, %rcx
movl %ecx, 0x40(%r14)
movq 0x30(%r14), %rdx
movq 0x38(%r14), %rax
movq %rax, %rsi
xorq $0x40, %rsi
movq %rdx, %rdi
xorq $0x28, %rdi
orq %rsi, %rdi
jne 0x32e7a
testl %ecx, %ecx
je 0x32fbc
movl $0x40, %eax
movl $0x28, %edx
jmp 0x32e88
leaq -0x10(%rdx), %rcx
cmpq $0x30, %rcx
ja 0x32ff7
leaq 0xe(%rdx), %rcx
cmpq %rcx, 0x20(%r14)
jne 0x32f64
movl $0x2, (%r14)
leaq 0xe4b9b(%rip), %rsi     # 0x117a3f
jmp 0x32bcf
cmpl $0x2, (%r14)
jne 0x32f7e
cmpq $0x18, 0x38(%r14)
jne 0x33059
movl $0xd, 0xa8(%r14)
jmp 0x33056
movl $0xb, 0xa8(%r14)
jmp 0x33056
cmpl $0x2, (%r14)
movq 0x38(%r14), %rax
jne 0x32f8e
cmpq $0x1, %rax
jne 0x33059
movl $0x10, 0xa8(%r14)
jmp 0x33056
movl $0xc, 0xa8(%r14)
jmp 0x33056
movl $0xf, 0xa8(%r14)
jmp 0x33056
movq 0x38(%r14), %rax
cmpq $0x20, %rax
je 0x32f3a
cmpq $0x10, %rax
jne 0x33059
cmpq $0x37, 0x30(%r14)
jg 0x32fa9
movl $0x2, 0x8c(%r14)
movq $0x10, 0x90(%r14)
jmp 0x33056
movb $0x1, %bpl
jmp 0x32d8a
movl 0x40(%r14), %ecx
cmpl $0x4, %ecx
je 0x32fcf
cmpl $0x3, %ecx
jne 0x32fd9
cmpq $0x1, %rax
je 0x32e96
jmp 0x32fd9
movl $0xe, 0xa8(%r14)
jmp 0x33056
cmpq $0x20, %rax
je 0x32f9e
cmpq $0x10, %rax
jne 0x33059
cmpq $0x33, 0x30(%r14)
jle 0x33040
movl $0x3, 0x8c(%r14)
xorl %r12d, %r12d
jmp 0x33064
movl $0xa, (%r14)
leaq 0xe4ac3(%rip), %rsi     # 0x117a8d
jmp 0x32bcf
cmpq $0x18, %rax
je 0x32e96
cmpq $0x38, %rdx
ja 0x32e96
movabsq $0x110010000000000, %rax # imm = 0x110010000000000
btq %rdx, %rax
jae 0x32e96
movl $0x3, (%r14)
cmpq $0x28, %rdx
je 0x33028
cmpq $0x7c, %rdx
je 0x3301c
cmpq $0x6c, %rdx
jne 0x33034
leaq 0xe4a45(%rip), %rsi     # 0x117a5c
jmp 0x32bcf
leaq 0xe4a49(%rip), %rsi     # 0x117a6c
jmp 0x32bcf
leaq 0xe4a1d(%rip), %rsi     # 0x117a4c
jmp 0x32bcf
leaq 0xe4a41(%rip), %rsi     # 0x117a7c
jmp 0x32bcf
movl $0x2, 0x8c(%r14)
movq $0xc, 0x90(%r14)
xorl %r12d, %r12d
cmpq $0x17, 0x30(%r14)
jle 0x33164
movq 0x18(%r13), %rdi
movl $0x22, %esi
callq 0xeed61
movq %rax, 0x48(%r14)
leaq 0xe4aef(%rip), %rsi     # 0x117b6c
xorl %r15d, %r15d
movq %r13, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
cmpq $0x20, 0x30(%r14)
jl 0x33167
movq 0x18(%r13), %rdi
movl $0x26, %esi
callq 0xeedfa
movq %rax, 0x98(%r14)
movq 0x18(%r13), %rdi
movl $0x2a, %esi
callq 0xeedfa
movq %rax, 0xa0(%r14)
movl 0x98(%r14), %edx
leaq 0xe4aad(%rip), %rsi     # 0x117b7d
movq %r13, %rdi
movl %eax, %ecx
xorl %eax, %eax
callq 0xe8617
movq 0x98(%r14), %rax
testq %rax, %rax
jle 0x3314a
movq 0xa0(%r14), %rcx
testq %rcx, %rcx
jle 0x3314a
movq 0x8(%r14), %rdx
movl $0x2, 0x78(%rdx)
movq %rcx, %xmm0
movq %rax, %xmm1
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
movdqa 0xe465b(%rip), %xmm0    # 0x117770
pand %xmm1, %xmm0
por 0xe465f(%rip), %xmm0    # 0x117780
psrlq $0x20, %xmm1
por 0xe4662(%rip), %xmm1    # 0x117790
subpd 0xe466a(%rip), %xmm1    # 0x1177a0
addpd %xmm0, %xmm1
mulpd 0xe466e(%rip), %xmm1    # 0x1177b0
movupd %xmm1, 0x80(%rdx)
cmpq $0x24, 0x30(%r14)
jl 0x33164
movq 0x18(%r13), %rdi
movl $0x2e, %esi
callq 0xeed61
movq %rax, %r15
jmp 0x33167
xorl %r15d, %r15d
movq 0x38(%r14), %rcx
testq %rcx, %rcx
jle 0x33187
movl $0x1, %eax
shlq %cl, %rax
testq %r15, %r15
cmovneq %r15, %rax
cmpq $0x9, %rcx
cmovbq %rax, %r15
movq %r15, 0x70(%r14)
leaq 0xde231(%rip), %rsi     # 0x1113c3
movq %r13, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xe8617
movl 0x8c(%r14), %eax
cmpl $0x3, %eax
jne 0x331d4
xorl %eax, %eax
cmpq $0x38, 0x30(%r14)
setge %al
leaq 0xc(,%rax,4), %rcx
movl $0x36, %edx
movq %r13, %rdi
movq %r14, %rsi
callq 0x355e6
movl 0x8c(%r14), %eax
cmpl $0x1, %eax
jne 0x33226
movq 0x38(%r14), %rax
cmpq $0x10, %rax
je 0x331fa
cmpq $0x20, %rax
jne 0x33226
movl $0xff, %eax
movl $0xff00, %ecx           # imm = 0xFF00
movl $0xff0000, %edx         # imm = 0xFF0000
jmp 0x33209
movl $0x1f, %eax
movl $0x3e0, %ecx            # imm = 0x3E0
movl $0x7c00, %edx           # imm = 0x7C00
movl %edx, 0x100(%r14)
movl %ecx, 0x110(%r14)
movl %eax, 0x120(%r14)
movq %r14, %rdi
callq 0x3567e
cmpl $0x3, (%r14)
jne 0x3336b
cmpq $0x6c, 0x30(%r14)
jl 0x3336b
movq 0x18(%r13), %rdi
leaq 0xac(%r14), %rdx
movl $0x46, %esi
movl $0x4, %ecx
movl $0x1, %r8d
callq 0xf1762
movl 0xb0(%r14), %ecx
cmpl $0x10000, %ecx          # imm = 0x10000
jb 0x3327a
leaq 0xbc(%r14), %r8
leaq 0xe49a4(%rip), %rdx     # 0x117c1c
jmp 0x33295
testl %ecx, %ecx
leaq 0xe49a7(%rip), %rax     # 0x117c2a
leaq 0xf8ec7(%rip), %r8      # 0x12c151
cmoveq %rax, %r8
leaq 0xe21cb(%rip), %rdx     # 0x115460
leaq 0x50(%rsp), %rdi
movl $0x50, %esi
xorl %eax, %eax
callq 0xe8193
leaq 0xe48ed(%rip), %rsi     # 0x117b9a
leaq 0x50(%rsp), %rdx
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8617
cmpl $0x3, (%r14)
jne 0x3336b
cmpq $0x7c, 0x30(%r14)
jl 0x3336b
movq 0x18(%r13), %rdi
movl $0x7a, %esi
callq 0xeed61
leaq 0xe48bf(%rip), %rsi     # 0x117ba5
movq %r13, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
cmpl $0x3, (%r14)
jne 0x3336b
cmpq $0x7c, 0x30(%r14)
jl 0x3336b
movl 0xb0(%r14), %eax
cmpl $0x4d424544, %eax       # imm = 0x4D424544
je 0x33314
cmpl $0x4c494e4b, %eax       # imm = 0x4C494E4B
jne 0x3336b
movq 0x18(%r13), %rdi
movl $0x7e, %esi
callq 0xeed61
movq %rax, 0xe0(%r14)
leaq 0xe4880(%rip), %rsi     # 0x117bb0
movq %r13, %rdi
movl $0xe, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%r13), %rdi
movl $0x82, %esi
callq 0xeed61
movq %rax, 0xf0(%r14)
leaq 0xe4869(%rip), %rsi     # 0x117bc7
movq %r13, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
testb %bpl, %bpl
je 0x3337d
movl 0x38(%r14), %edx
leaq 0xe485e(%rip), %rsi     # 0x117bd9
jmp 0x3338d
testb %r12b, %r12b
je 0x333d6
movl 0x40(%r14), %edx
leaq 0xe486e(%rip), %rsi     # 0x117bfb
movq %r13, %rdi
xorl %eax, %eax
callq 0xe9295
movq %r13, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq 0x10(%r14), %rdi
callq 0xf228d
movq 0x8(%r14), %rsi
movq %r13, %rdi
callq 0xea50e
movq %r13, %rdi
movq %r14, %rsi
callq 0xe8be2
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x50(%r14), %rsi
movq 0x60(%r14), %rdx
movq %r13, %rdi
callq 0xf1db1
movl %eax, %ebp
movq %r13, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
testl %ebp, %ebp
je 0x333a4
movq 0x30(%r14), %r15
addq $0xe, %r15
cmpl $0x2, 0x8c(%r14)
jne 0x33484
movq 0x90(%r14), %rcx
leaq 0xe4680(%rip), %rsi     # 0x117a99
movq %r13, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x28(%r14), %r8
movq 0x90(%r14), %rcx
leaq (%rcx,%r15), %rax
cmpq %r8, %rax
jle 0x3344e
leaq 0xe467a(%rip), %rsi     # 0x117abb
movq %r13, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe8faa
movq %r13, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x90(%r14), %rcx
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x355e6
movq %r13, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
addq 0x90(%r14), %r15
movq %r15, 0x78(%r14)
movq 0x70(%r14), %rcx
testq %rcx, %rcx
movq %r14, 0x40(%rsp)
jle 0x335eb
movq %rbx, %rbp
imulq 0x80(%r14), %rcx
leaq (%rcx,%r15), %rax
movq 0x28(%r14), %r8
cmpq %r8, %rax
movq %r14, %r12
jle 0x33568
leaq 0xe478e(%rip), %rsi     # 0x117c4e
movq %r13, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe8faa
cmpl $0x2, (%r12)
jne 0x33568
movq 0x70(%r12), %rax
testq %rax, %rax
jle 0x33568
movq 0x28(%r12), %rcx
subq 0x78(%r12), %rcx
leaq (,%rax,4), %rdx
cmpq %rdx, %rcx
jge 0x33568
leaq (%rax,%rax,2), %rbx
cmpq %rbx, %rcx
setl %al
leaq 0x1(%rbx), %rdx
cmpq %rdx, %rcx
setg %cl
orb %al, %cl
jne 0x33568
movl $0x3, %r14d
movq 0x18(%r13), %rdi
movq 0x78(%r12), %rsi
addq %r14, %rsi
callq 0xeead3
testb %al, %al
jne 0x33546
leaq 0x4(%r14), %rax
incq %r14
cmpq %r14, %rbx
movq %rax, %r14
movq 0x40(%rsp), %r12
ja 0x3351b
jmp 0x33568
leaq 0xe4752(%rip), %rsi     # 0x117c9f
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8faa
movq 0x40(%rsp), %r12
movq $0x3, 0x80(%r12)
movq 0x70(%r12), %rcx
movq 0x78(%r12), %rdx
leaq 0xe4706(%rip), %rsi     # 0x117c7f
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8617
movq %r13, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%r13), %rdi
movq 0x70(%r12), %rdx
movq 0x78(%r12), %rsi
movq 0x80(%r12), %rcx
leaq 0x140(%r12), %r15
movl $0x1, (%rsp)
movl $0x100, %r9d            # imm = 0x100
movq %r15, %r8
callq 0xf2c4e
movq 0x70(%r12), %rsi
movq %r15, %rdi
callq 0xf1ed8
movl %eax, 0x88(%r12)
movq %r13, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq %r12, %r14
movq %rbp, %rbx
movq 0x28(%r14), %rdx
leaq 0x10300f(%rip), %rsi    # 0x136605
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x28(%r14), %rax
movq 0x18(%r13), %rcx
movq %rax, 0x20(%rsp)
movq %rcx, 0x10(%rsp)
cmpq 0x18(%rcx), %rax
jge 0x33680
movq 0x38(%r14), %rcx
movq 0x50(%r14), %rsi
movq %rsi, %rax
imulq %rcx, %rax
leaq 0x1f(%rax), %rdx
addq $0x3e, %rax
testq %rdx, %rdx
cmovnsq %rdx, %rax
sarq $0x5, %rax
leaq (,%rax,4), %rdx
movq %rdx, 0xf8(%r14)
movl 0xa8(%r14), %edi
cmpl $0xb, %edi
movq %r13, 0x48(%rsp)
jg 0x33696
testl %edi, %edi
je 0x336c9
cmpl $0xb, %edi
jne 0x33c42
cmpq $0x1, %rcx
je 0x33709
cmpq $0x4, %rcx
je 0x33709
jmp 0x33c42
leaq 0xe464d(%rip), %rsi     # 0x117cd4
movq %r13, %rdi
xorl %eax, %eax
callq 0xe9295
jmp 0x340e5
cmpl $0xc, %edi
je 0x336ff
cmpl $0xd, %edi
jne 0x33c42
cmpq $0x21, %rcx
setb %al
movl $0x1000000, %edx        # imm = 0x1000000
shrq %cl, %rdx
andb %al, %dl
cmpb $0x1, %dl
je 0x33709
cmpl $0xa, (%r14)
je 0x33c4c
jmp 0x33e61
cmpb $0x0, 0x4(%r14)
je 0x33bae
leaq -0x1(%rcx), %r8
cmpq $0x7, %r8
ja 0x33c0b
movq %r13, %rdi
movq %r14, %rsi
movq 0x10(%rsp), %rdx
movq 0x20(%rsp), %rcx
xorl %r8d, %r8d
callq 0x356d9
jmp 0x340c1
cmpq $0x8, %rcx
jne 0x33c42
movl $0x68, %esi
movq %r13, %rdi
callq 0xe8b2b
movq %rax, %r12
movl 0xa8(%r14), %eax
addl $-0xb, %eax
cmpl $0x2, %eax
ja 0x33780
movl %eax, %eax
leaq 0xe4207(%rip), %rcx     # 0x117938
movq (%rcx,%rax,8), %rsi
movq %rsi, 0x8(%r12)
movq 0x38(%r14), %rdi
cmpq %rdi, %rsi
movq %rbx, 0x28(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdi, 0xa8(%rsp)
jne 0x3378e
movq 0x50(%r14), %rsi
movq 0x60(%r14), %rdx
movq %r13, %rdi
movl $0x1, %ecx
callq 0xf266a
movq %rax, 0x48(%r12)
movq 0x38(%r14), %rdi
movq 0x8(%r12), %rsi
movb $0x1, %al
movl %eax, 0x1c(%rsp)
jmp 0x3379b
testq %r12, %r12
jne 0x340a2
jmp 0x340c1
movb $0x1, (%r12)
movl $0x0, 0x1c(%rsp)
imulq 0x50(%r14), %rdi
callq 0xe9cb4
cqto
idivq 0x8(%r12)
movq %rax, 0x10(%r12)
movq 0x60(%r14), %rax
movq %rax, 0x18(%r12)
movq 0xf8(%r14), %rsi
movq %rsi, 0x20(%r12)
movq 0x10(%rsp), %rdx
movq %rdx, 0x28(%r12)
movq 0x20(%rsp), %rcx
movq %rcx, 0x30(%r12)
movq 0x18(%rdx), %rcx
movq %rcx, 0x38(%r12)
imulq %rax, %rsi
movq %r13, %rdi
movl $0x1, %edx
callq 0xf09c5
movq %rax, 0x40(%r12)
movq %rax, %rdi
callq 0xf0855
movq 0x30(%r12), %rax
movq %rax, 0x50(%rsp)
cmpq 0x38(%r12), %rax
jge 0x33ff5
movq 0x18(%r12), %rax
movq 0x58(%r12), %rcx
cmpq %rax, %rcx
jge 0x33ff5
decq %rax
cmpq %rax, %rcx
jne 0x33841
movq 0x50(%r12), %rax
cmpq 0x10(%r12), %rax
jge 0x33ff5
movq 0x28(%r12), %rdi
leaq 0x50(%rsp), %rbx
movq %rbx, %rsi
callq 0xeeb4b
movl %eax, %ebp
movq 0x28(%r12), %rdi
movq %rbx, %rsi
callq 0xeeb4b
movl %eax, %r15d
movl %ebp, %eax
orb %r15b, %al
jne 0x3388f
movq $0x0, 0x50(%r12)
movq 0x58(%r12), %rsi
incq %rsi
movq %rsi, 0x58(%r12)
movq %r12, %rdi
callq 0x359b2
jmp 0x33979
movl %r15d, %eax
xorb $0x1, %al
orb %bpl, %al
je 0x33ff5
movl %r15d, %eax
xorb $0x2, %al
orb %bpl, %al
jne 0x33998
movb $0x1, 0x65(%r12)
cmpb $0x0, (%r12)
jne 0x33fef
movq 0x28(%r12), %rdi
leaq 0x50(%rsp), %r15
movq %r15, %rsi
callq 0xeeb4b
movzbl %al, %ebx
addq 0x50(%r12), %rbx
movq 0x28(%r12), %rdi
movq %r15, %rsi
callq 0xeeb4b
movq 0x10(%r12), %rcx
movq 0x58(%r12), %rsi
movzbl %al, %r15d
addq %rsi, %r15
cmpq %rcx, %rbx
cmovgeq %rcx, %rbx
cmpq 0x18(%r12), %r15
jge 0x33ff5
testb %al, %al
je 0x33972
incq %rsi
movq %rsi, 0x58(%r12)
movq $0x0, 0x50(%r12)
movq %r12, %rdi
callq 0x359b2
movq 0x58(%r12), %rsi
cmpq %r15, %rsi
jl 0x3390a
jmp 0x33972
movq 0x8(%r12), %rax
cmpq $0x18, %rax
je 0x3394e
cmpq $0x4, %rax
jne 0x33961
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x359f5
jmp 0x33972
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x35a64
jmp 0x33972
movq 0x40(%r12), %rdi
xorl %esi, %esi
callq 0xf0bd6
incq 0x50(%r12)
cmpq %rbx, 0x50(%r12)
jl 0x3392f
movq 0x50(%rsp), %rax
cmpq 0x38(%r12), %rax
movq 0x48(%rsp), %r13
movq 0x40(%rsp), %r14
jl 0x33816
jmp 0x33ff5
testb %bpl, %bpl
je 0x33a1a
movzbl %bpl, %ebx
movq 0x8(%r12), %rax
cmpq $0x4, %rax
je 0x33aba
movzbl %r15b, %ebp
cmpq $0x18, %rax
jne 0x33a01
movq 0x28(%r12), %rdi
leaq 0x50(%rsp), %r14
movq %r14, %rsi
callq 0xeeb4b
movl %eax, %r15d
movq 0x28(%r12), %rdi
movq %r14, %rsi
callq 0xeeb4b
movl %eax, %r13d
movzbl %r13b, %esi
movzbl %r15b, %edx
movq %r12, %rdi
movl %ebp, %ecx
movl $0x1, %r8d
callq 0x35a64
decq %rbx
jne 0x339df
jmp 0x33979
movq %r12, %rdi
movl %ebp, %esi
movl $0x1, %edx
callq 0x35ac8
decq %rbx
jne 0x33a01
jmp 0x33979
movq 0x8(%r12), %rax
movzbl %r15b, %r14d
cmpq $0x18, %rax
je 0x33af4
cmpq $0x4, %rax
jne 0x33b67
leal 0x3(%r14), %eax
shrl %eax
andl $-0x2, %eax
movq %rax, 0x38(%rsp)
je 0x33979
xorl %r13d, %r13d
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movq 0x28(%r12), %rdi
leaq 0x50(%rsp), %rsi
callq 0xeeb4b
cmpq %r14, %r13
jge 0x33aa6
movl %eax, %ebx
movl %eax, %r15d
shrb $0x4, %r15b
andb $0xf, %bl
movb $0x1, %bpl
movzbl %r15b, %eax
movzbl %bl, %ecx
testb $0x1, %bpl
cmovnel %eax, %ecx
movzbl %cl, %esi
movq %r12, %rdi
movl $0x1, %edx
callq 0x359f5
incq %r13
testb $0x1, %bpl
je 0x33aa6
xorl %ebp, %ebp
cmpq %r14, %r13
jl 0x33a78
movq 0x10(%rsp), %rax
incq %rax
cmpq 0x38(%rsp), %rax
jne 0x33a50
jmp 0x33979
movl %r15d, %ebp
shrb $0x4, %bpl
andb $0xf, %r15b
xorl %r14d, %r14d
testb $0x1, %r14b
movzbl %bpl, %eax
movzbl %r15b, %ecx
cmovel %eax, %ecx
movzbl %cl, %esi
movq %r12, %rdi
movl $0x1, %edx
callq 0x359f5
incq %r14
cmpq %r14, %rbx
jne 0x33ac8
jmp 0x33979
testb %r15b, %r15b
je 0x33979
movq %r14, %rbp
movq %r14, %rbx
leaq 0x50(%rsp), %r14
movq 0x28(%r12), %rdi
movq %r14, %rsi
callq 0xeeb4b
movl %eax, %r15d
movq 0x28(%r12), %rdi
movq %r14, %rsi
callq 0xeeb4b
movl %eax, %r13d
movq 0x28(%r12), %rdi
movq %r14, %rsi
callq 0xeeb4b
movzbl %r15b, %ecx
movzbl %r13b, %edx
movzbl %al, %esi
movq %r12, %rdi
movl $0x1, %r8d
callq 0x35a64
decq %rbx
jne 0x33b08
testb $0x1, %bpl
je 0x33979
incq 0x50(%rsp)
jmp 0x33979
movq %r14, %rdi
callq 0xe9c7e
testq %rax, %rax
jle 0x33979
movq %rax, %r15
xorl %ebx, %ebx
movq 0x28(%r12), %rdi
leaq 0x50(%rsp), %rsi
callq 0xeeb4b
cmpq %r14, %rbx
jge 0x33ba4
movzbl %al, %esi
movq %r12, %rdi
movl $0x1, %edx
callq 0x35ac8
incq %rbx
decq %r15
jne 0x33b7d
jmp 0x33979
cmpb $0x0, 0xd6(%r13)
setne %r8b
cmpq $0x18, %rcx
sete %r9b
andb %r8b, %r9b
cmpb $0x1, %r9b
jne 0x33bef
orq $0x2, %rdx
movabsq $0x5555555555555556, %rcx # imm = 0x5555555555555556
movq %rdx, %rax
imulq %rcx
movq %rdx, %rax
shrq $0x3f, %rax
addq %rdx, %rax
movq %rax, 0x58(%r14)
jmp 0x33c25
leaq -0x1(%rcx), %r8
cmpq $0x17, %r8
ja 0x33c0b
shlq $0x5, %rax
cqto
idivq %rcx
movq %rax, 0x58(%r14)
jmp 0x336d8
cmpq $0x10, %rcx
je 0x33e8d
cmpq $0x20, %rcx
je 0x33e8d
cmpq $0x18, %rcx
jne 0x33c42
movq %r13, %rdi
movq %r14, %rsi
movq 0x10(%rsp), %rdx
movq 0x20(%rsp), %rcx
xorl %r8d, %r8d
callq 0x3574f
jmp 0x340c1
cmpl $0xa, (%r14)
jne 0x33e3c
cmpb $0x0, 0x4(%r14)
jne 0x340c1
movq 0x58(%r14), %rdx
movq 0x60(%r14), %rcx
movq %r13, %rdi
movl $0x4, %r8d
callq 0xf26a5
movq %rax, 0x38(%rsp)
movq 0x50(%r14), %rsi
movq 0x58(%r14), %rdx
movq 0x60(%r14), %rcx
movq %r13, %rdi
movl $0x4, %r8d
callq 0xf26a5
movq %rax, 0x30(%rsp)
movq 0x60(%r14), %rcx
testq %rcx, %rcx
jle 0x33dff
movq %rbx, 0x28(%rsp)
movq 0x58(%r14), %rax
xorl %ebx, %ebx
leaq 0xb0(%rsp), %r15
movl $0x1, %ebp
xorl %r12d, %r12d
movq 0xf8(%r14), %rdx
imulq %r12, %rdx
addq 0x20(%rsp), %rdx
movq %rdx, 0xb0(%rsp)
testq %rax, %rax
jle 0x33dd9
xorl %r13d, %r13d
movq 0x10(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0xeecce
movl %eax, 0x58(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0xeecce
movl %eax, 0x54(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0xeecce
movl %eax, 0x50(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0xeecce
movl %eax, 0x5c(%rsp)
xorl %r14d, %r14d
movl 0x50(%rsp,%r14,4), %esi
cmpl $0x2001, %esi           # imm = 0x2001
movzbl %bl, %ebx
cmovael %ebp, %ebx
leaq (%rsp,%r14), %rdx
addq $0xc, %rdx
leaq (%rsp,%r14), %rcx
addq $0x8, %rcx
movl $0x2000, %edi           # imm = 0x2000
callq 0xec812
incq %r14
cmpq $0x4, %r14
jne 0x33d21
movzbl 0xf(%rsp), %eax
shll $0x18, %eax
movzbl 0xc(%rsp), %ecx
shll $0x10, %ecx
orl %eax, %ecx
movzbl 0xd(%rsp), %eax
shll $0x8, %eax
orl %ecx, %eax
movzbl 0xe(%rsp), %ecx
orl %eax, %ecx
movq 0x38(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0xf24bf
movzbl 0xb(%rsp), %eax
shll $0x18, %eax
movzbl 0x8(%rsp), %ecx
shll $0x10, %ecx
orl %eax, %ecx
movzbl 0x9(%rsp), %eax
shll $0x8, %eax
orl %ecx, %eax
movzbl 0xa(%rsp), %ecx
orl %eax, %ecx
movq 0x30(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0xf24bf
incq %r13
movq 0x40(%rsp), %r14
movq 0x58(%r14), %rax
cmpq %rax, %r13
jl 0x33cdd
movq 0x60(%r14), %rcx
movq 0x48(%rsp), %r13
incq %r12
cmpq %rcx, %r12
jl 0x33cb9
testb %bl, %bl
movq 0x28(%rsp), %rbx
je 0x33dff
leaq 0xe3f55(%rip), %rsi     # 0x117d4a
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8faa
movq 0x8(%r14), %rdx
movb $0x1, 0xf(%rdx)
movl 0x18(%r14), %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%r14)
movq 0x38(%rsp), %r15
movq %r15, %rdi
movq 0x30(%rsp), %r12
movq %r12, %rsi
callq 0xf1f1a
movq %r15, %rdi
callq 0xf228d
movq %r12, %rdi
callq 0xf228d
jmp 0x340c1
cmpl $0xe, %edi
je 0x33e76
cmpl $0xf, %edi
je 0x33e6d
cmpl $0x10, %edi
jne 0x33e61
cmpq $0x1, %rcx
jne 0x33e61
movq %r13, %rdi
movq %r14, %rsi
callq 0x3584b
jmp 0x340c1
leaq 0xe3e82(%rip), %rsi     # 0x117cea
jmp 0x33687
leaq 0xf48bc(%rip), %rdx     # 0x128730
jmp 0x33e7d
leaq 0xffa35(%rip), %rdx     # 0x1338b2
movq %r13, %rdi
movq %r14, %rsi
callq 0x35969
jmp 0x340c1
movq %rbx, %rbp
movl 0x8c(%r14), %eax
cmpl $0x3, %eax
je 0x33eab
cmpl $0x2, %eax
jne 0x33ebb
cmpq $0x10, 0x90(%r14)
jl 0x33ebb
movl $0x4, %r8d
cmpl $0x0, 0x130(%r14)
jne 0x33ec1
movl $0x3, %r8d
movq 0x58(%r14), %rdx
movq 0x60(%r14), %rcx
movq %r13, %rdi
callq 0xf26a5
movq %rax, 0x10(%r14)
movq 0x60(%r14), %rcx
testq %rcx, %rcx
jle 0x33fe7
movq 0x58(%r14), %rax
movq %r14, %rbx
addq $0x108, %rbx            # imm = 0x108
xorl %r15d, %r15d
testq %rax, %rax
jle 0x33fdb
xorl %r12d, %r12d
movq 0xf8(%r14), %rax
imulq %r15, %rax
cmpq $0x10, 0x38(%r14)
jne 0x33f29
movq 0x20(%rsp), %rcx
leaq (%rcx,%r12,2), %rsi
addq %rax, %rsi
movq 0x10(%rsp), %rdi
callq 0xeebc8
jmp 0x33f3f
movq 0x20(%rsp), %rcx
leaq (%rcx,%r12,4), %rsi
addq %rax, %rsi
movq 0x10(%rsp), %rdi
callq 0xeed61
movq %rbx, %rdx
xorl %esi, %esi
movsd 0xe38e4(%rip), %xmm1    # 0x117830
movl -0x8(%rdx), %edi
testl %edi, %edi
je 0x33f70
andl %eax, %edi
movb -0x4(%rdx), %cl
shrl %cl, %edi
xorps %xmm0, %xmm0
cvtsi2sd %rdi, %xmm0
mulsd (%rdx), %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
jmp 0x33f78
cmpq $0x3, %rsi
je 0x33f93
xorl %ecx, %ecx
movb %cl, 0x50(%rsp,%rsi)
incq %rsi
addq $0x10, %rdx
cmpq $0x4, %rsi
jne 0x33f4c
movzbl 0x53(%rsp), %eax
shll $0x18, %eax
jmp 0x33f9d
movb $-0x1, 0x53(%rsp)
movl $0xff000000, %eax       # imm = 0xFF000000
movq 0x10(%r14), %rdi
movzbl 0x50(%rsp), %edx
shll $0x10, %edx
orl %eax, %edx
movzbl 0x51(%rsp), %eax
shll $0x8, %eax
movzbl 0x52(%rsp), %ecx
orl %eax, %ecx
orl %edx, %ecx
movq %r12, %rsi
movq %r15, %rdx
callq 0xf24bf
incq %r12
movq 0x58(%r14), %rax
cmpq %rax, %r12
jl 0x33eff
movq 0x60(%r14), %rcx
incq %r15
cmpq %rcx, %r15
jl 0x33ef3
movq %rbp, %rbx
jmp 0x340c1
movb $0x1, 0x66(%r12)
movq 0x18(%r12), %rsi
movq %r12, %rdi
callq 0x359b2
movq 0x40(%r12), %rdi
callq 0xf08ba
cmpb $0x0, 0x66(%r12)
je 0x34034
leaq 0xded52(%rip), %rsi     # 0x112d6d
movq %r13, %rdi
xorl %eax, %eax
callq 0xe9295
cmpb $0x0, 0x66(%r12)
movq 0x28(%rsp), %rbx
jne 0x340a2
jmp 0x34039
movq 0x28(%rsp), %rbx
movq 0xa8(%rsp), %rax
cmpq %rax, 0x30(%rsp)
je 0x34059
leaq 0xe3cc3(%rip), %rsi     # 0x117d12
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8faa
cmpq $0x8, 0x38(%r14)
movq 0x40(%r12), %rdx
jg 0x3407a
movzbl 0x1c(%rsp), %r8d
movq %r13, %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x356d9
jmp 0x3408d
movzbl 0x1c(%rsp), %r8d
movq %r13, %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x3574f
movq 0x48(%r12), %rsi
testq %rsi, %rsi
je 0x340a2
movq 0x10(%r14), %rdi
xorl %edx, %edx
callq 0xf37bd
movq 0x40(%r12), %rdi
callq 0xf052b
movq 0x48(%r12), %rdi
callq 0xf228d
movq %r13, %rdi
movq %r12, %rsi
callq 0xe8be2
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0x340e5
cmpb $0x0, 0x4(%r14)
jne 0x340e5
movl 0x18(%r14), %edx
orl $0x2, %edx
movl %edx, 0x18(%r14)
movq 0x8(%r14), %rsi
callq 0xf22d0
cmpb $0x0, 0x4(%r14)
jne 0x3415a
cmpl $0x3, (%r14)
jne 0x3415a
cmpq $0x7c, 0x30(%r14)
jl 0x3415a
movq 0xe0(%r14), %rax
testq %rax, %rax
je 0x3415a
movq 0xf0(%r14), %rcx
testq %rcx, %rcx
je 0x3415a
leaq 0xe(%rax), %rdx
movq %rdx, 0xe8(%r14)
addq %rcx, %rax
addq $0xe, %rax
movq 0x18(%r13), %rcx
cmpq 0x18(%rcx), %rax
jg 0x3415a
movl 0xb0(%r14), %eax
cmpl $0x4d424544, %eax       # imm = 0x4D424544
je 0x3414f
cmpl $0x4c494e4b, %eax       # imm = 0x4C494E4B
jne 0x3415a
movq %r13, %rdi
movq %r14, %rsi
callq 0x35b03
jmp 0x3415a
movq %r13, %rdi
movq %r14, %rsi
callq 0x35ba5
testq %rbx, %rbx
je 0x333a4
cmpb $0x0, 0x4(%r14)
je 0x333a4
movq 0x38(%rbx), %rax
testq %rax, %rax
je 0x333a4
movdqu 0x8(%r14), %xmm0
xorl %ecx, %ecx
movq %rcx, 0x10(%r14)
pshufd $0x4e, %xmm0, %xmm0     # xmm0 = xmm0[2,3,0,1]
movdqu %xmm0, (%rax)
movq %rcx, 0x8(%r14)
movl 0x18(%r14), %ecx
movl %ecx, 0x10(%rax)
jmp 0x333a4