Function at 0x40d100
Capabilities:
Encode data using xor
Hash data with crc32

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x3c
mov eax, dword [0x4c0760]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 0xc]
push ebx
mov ebx, dword [ebp + 8]
mov dword [ebp - 0x30], ebx
push esi
push edi
mov edi, ecx
mov dword [ebp - 0x28], edi
cmp eax, 0x55555555
ja 0x40d41e
lea eax, [eax + eax*2]
mov dword [ebp - 0x34], eax
test eax, eax
je 0x40d40b
mov ecx, 0xffff
nop
test ebx, ebx
je 0x40d46e
mov eax, dword [edi + 0x14]
cmp eax, dword [edi + 4]
jae 0x40d446
cmp word [edi + 0x1c], 0
jne 0x40d1e5
mov eax, dword [edi + 0x18]
mov ecx, 0xffff
cmp eax, ecx
jae 0x40d16e
movzx ecx, ax
mov ax, cx
mov byte [ebp - 0x1f], cl
setbe byte [ebp - 0x20]
not cl
shr ax, 8
mov byte [ebp - 0x1e], al
not al
push 0
mov byte [ebp - 0x1c], al
lea eax, [ebp - 0x20]
push 5
mov byte [ebp - 0x1d], cl
mov ecx, dword [edi + 0xc]
push eax
call fcn.0040d500
mov edx, dword [edi + 0x20]
xor eax, eax
not edx
mov dword [ebp - 0x2c], eax
mov dword [edi + 0x20], edx
movzx esi, byte [ebp + eax - 0x20]
xor ebx, ebx
lea ecx, [ecx]
mov cl, bl
mov eax, esi
shr eax, cl
inc ebx
xor eax, edx
shr edx, 1
and eax, 1
neg eax
and eax, 0xedb88320
xor edx, eax
cmp ebx, 8
jl 0x40d1b0
mov eax, dword [ebp - 0x2c]
inc eax
mov dword [ebp - 0x2c], eax
cmp eax, 5
jb 0x40d1a6
mov ebx, dword [ebp - 0x30]
not edx
mov dword [edi + 0x20], edx
mov ecx, 0xffff
mov esi, dword [edi + 0x10]
test esi, esi
jne 0x40d269
mov ecx, dword [edi + 0xc]
lea eax, [ebp - 0x21]
push esi
push 1
push eax
mov byte [ebp - 0x21], 0
call fcn.0040d500
mov edx, dword [edi + 0x20]
xor ebx, ebx
not edx
mov dword [edi + 0x20], edx
movzx edi, byte [ebp - 0x21]
mov dword [ebp - 0x2c], edi
mov cl, bl
mov eax, edi
shr eax, cl
inc ebx
xor eax, edx
shr edx, 1
and eax, 1
neg eax
and eax, 0xedb88320
xor edx, eax
cmp ebx, 8
jl 0x40d210
mov edi, dword [ebp - 0x28]
not edx
mov ebx, 0xfff1
mov esi, dword [edi + 0x24]
mov dword [edi + 0x20], edx
xor edx, edx
movzx eax, si
add eax, dword [ebp - 0x2c]
div ebx
shr esi, 0x10
mov ecx, edx
inc dword [edi + 0x10]
xor edx, edx
dec dword [edi + 0x18]
lea eax, [esi + ecx]
div ebx
shl edx, 0x10
or edx, ecx
inc word [edi + 0x1c]
mov dword [edi + 0x24], edx
jmp 0x40d31b
sub cx, word [edi + 0x1c]
movzx edx, cx
mov ecx, dword [edi + 8]
sub ecx, esi
movzx eax, dx
mov dword [ebp - 0x2c], edx
cmp ecx, eax
jae 0x40d28c
mov ax, word [edi + 8]
sub ax, si
movzx edx, ax
mov dword [ebp - 0x2c], edx
mov ecx, dword [ebp - 0x34]
movzx eax, dx
cmp ecx, eax
jae 0x40d29c
movzx edx, cx
mov dword [ebp - 0x2c], edx
mov ecx, dword [edi + 0xc]
movzx esi, dx
mov eax, esi
cdq
push edx
push eax
push ebx
call fcn.0040d500
push esi
push ebx
mov ecx, edi
call fcn.0040d4a0
mov ecx, dword [edi + 0x24]
xor ebx, ebx
movzx eax, cx
shr ecx, 0x10
mov dword [ebp - 0x38], eax
test esi, esi
je 0x40d300
mov edi, eax
lea ebx, [ebx]
mov eax, dword [ebp - 0x30]
xor edx, edx
movzx eax, byte [eax + ebx]
inc ebx
add eax, edi
mov edi, 0xfff1
div edi
mov edi, edx
xor edx, edx
lea eax, [ecx + edi]
mov ecx, 0xfff1
div ecx
mov ecx, edx
cmp ebx, esi
jb 0x40d2d0
mov dword [ebp - 0x38], edi
mov edi, dword [ebp - 0x28]
mov eax, dword [ebp - 0x38]
sub dword [ebp - 0x34], esi
add dword [ebp - 0x30], esi
add dword [edi + 0x10], esi
sub dword [edi + 0x18], esi
shl ecx, 0x10
or ecx, eax
mov eax, dword [ebp - 0x2c]
add word [edi + 0x1c], ax
mov dword [edi + 0x24], ecx
mov ecx, 0xffff
cmp word [edi + 0x1c], cx
jb 0x40d32c
xor eax, eax
mov word [edi + 0x1c], ax
mov eax, dword [edi + 0x10]
cmp eax, dword [edi + 8]
jne 0x40d3fe
inc dword [edi + 0x14]
mov eax, dword [edi + 0x14]
mov dword [edi + 0x10], 0
cmp eax, dword [edi + 4]
jne 0x40d3fe
mov ecx, dword [edi + 0x24]
mov eax, ecx
shr eax, 0x18
mov byte [ebp - 0x18], al
mov eax, ecx
shr eax, 0x10
mov byte [ebp - 0x17], al
mov eax, ecx
shr eax, 8
mov byte [ebp - 0x16], al
mov eax, dword [edi + 0x20]
mov byte [ebp - 0x15], cl
not eax
xor ecx, ecx
mov dword [ebp - 0x14], 0
mov dword [ebp - 0x10], 0
mov dword [ebp - 0xc], 0x444e4549
mov dword [ebp - 8], 0x826042ae
mov dword [edi + 0x20], eax
mov dword [ebp - 0x2c], ecx
movzx esi, byte [ebp + ecx - 0x18]
xor ebx, ebx
lea esp, [esp]
mov cl, bl
mov edx, esi
shr edx, cl
inc ebx
xor edx, eax
shr eax, 1
and edx, 1
neg edx
and edx, 0xedb88320
xor eax, edx
cmp ebx, 8
jl 0x40d3a0
mov ecx, dword [ebp - 0x2c]
inc ecx
mov dword [ebp - 0x2c], ecx
cmp ecx, 4
jb 0x40d395
not eax
mov ecx, eax
mov dword [edi + 0x20], eax
shr ecx, 0x18
mov byte [ebp - 0x14], cl
mov ecx, eax
shr ecx, 0x10
mov byte [ebp - 0x13], cl
mov ecx, eax
push 0
shr ecx, 8
mov byte [ebp - 0x11], al
lea eax, [ebp - 0x18]
push 0x14
mov byte [ebp - 0x12], cl
mov ecx, dword [edi + 0xc]
push eax
call fcn.0040d500
mov ecx, 0xffff
cmp dword [ebp - 0x34], 0
mov ebx, dword [ebp - 0x30]
ja 0x40d140
mov ecx, dword [ebp - 4]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.0045fbcc
mov esp, ebp
pop ebp
ret 8
lea eax, [ebp - 0x28]
mov dword [ebp - 0x28], str.Invalid_argument
push eax
lea ecx, [ebp - 0x10]
call fcn.0045fc7f
push 0x4bde08
lea eax, [ebp - 0x10]
mov dword [ebp - 0x10], vtable.std::length_error.0
push eax
call fcn.00466c44
lea eax, [ebp - 0x28]
mov dword [ebp - 0x28], str.All_image_pixels_already_written
push eax
lea ecx, [ebp - 0x10]
call fcn.0045fc7f
push 0x4bdf60
lea eax, [ebp - 0x10]
mov dword [ebp - 0x10], vtable.std::logic_error.0
push eax
call fcn.00466c44
lea eax, [ebp - 0x28]
mov dword [ebp - 0x28], str.Null_pointer
push eax
lea ecx, [ebp - 0x10]
call fcn.0045fc7f
push 0x4bdf08
lea eax, [ebp - 0x10]
mov dword [ebp - 0x10], vtable.std::invalid_argument.0
push eax
call fcn.00466c44
int3