Function at 0x51a6fb
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
mov eax, 0x618f0c
call fcn.005d261c
sub esp, 0xb4
mov eax, dword [ebp + 0x18]
push ebx
and eax, 2
push esi
cmp al, 2
push edi
sete byte [ebp - 0x38]
xor ebx, ebx
mov edi, ecx
cmp byte [ebp - 0x38], bl
mov dword [ebp - 0x20], edi
jne 0x51a736
cmp dword [ebp + 0x14], ebx
jne 0x51a736
mov dword [edi], 5
jmp 0x51ad41
mov eax, dword [ebp + 0x10]
mov dword [edi], ebx
mov esi, dword [ebp + 8]
mov dword [ebp - 0x84], ebx
mov dword [eax], ebx
mov eax, dword [ebp + 0xc]
mov dword [ebp - 0x7c], ebx
mov dword [ebp - 0x80], ebx
mov dword [eax], ebx
mov al, byte [ebp + 0x18]
and al, 1
mov dword [ebp - 0x8e], ebx
mov byte [ebp - 0x11], al
lea eax, [ebp - 0x74]
push eax
push 0x102
push esi
mov dword [ebp - 0x74], ebx
mov dword [ebp - 0x78], ebx
mov dword [ebp - 0x4c], ebx
mov dword [ebp - 0x64], ebx
call fcn.00532b02
add esp, 0xc
cmp word [ebp - 0x74], 1
je 0x51a78f
mov dword [edi], 0x1c
jmp 0x51ad41
lea eax, [ebp - 0x78]
push eax
push 0x115
push esi
call fcn.00532b02
lea eax, [ebp - 0x84]
push eax
lea eax, [ebp - 0x7c]
push eax
push 0x152
push esi
call fcn.00532b02
movzx eax, word [ebp - 0x78]
movzx ecx, word [ebp - 0x7c]
sub eax, ecx
mov dword [ebp - 0x40], eax
lea eax, [ebp - 0x8e]
push eax
push 0x103
push esi
call fcn.00532b02
lea eax, [ebp - 0x80]
push eax
push 0x11c
push esi
call fcn.00532b02
lea eax, [ebp - 0x64]
push eax
push 0x106
push esi
call fcn.0052fc74
add esp, 0x40
test eax, eax
jne 0x51a821
mov eax, dword [ebp - 0x40]
dec eax
je 0x51a811
push str.Cant_determine_TIFF_photometric
push 3
call fcn.00538eb0
pop ecx
pop ecx
jmp 0x51a784
push esi
mov ecx, edi
call fcn.0051aebc
neg eax
sbb eax, eax
inc eax
mov dword [ebp - 0x64], eax
lea eax, [ebp - 0x1c]
push eax
push 0x100
push esi
call fcn.0052fc74
lea eax, [ebp - 0x10]
push eax
push 0x101
push esi
call fcn.0052fc74
lea eax, [ebp - 0x4c]
push eax
push 0x112
push esi
call fcn.00532b02
add esp, 0x24
cmp byte [ebp - 0x11], bl
je 0x51a85d
mov dword [ebp - 0x4c], 1
lea eax, [ebp - 0x70]
mov ecx, edi
push eax
lea eax, [ebp - 0x66]
push eax
lea eax, [ebp - 0x65]
push eax
movzx eax, word [ebp - 0x4c]
push eax
call fcn.00519b1e
lea eax, [ebp - 0x8a]
push eax
push 0x128
push esi
call fcn.0052fc74
lea eax, [ebp - 0xa4]
push eax
push 0x11a
push esi
call fcn.0052fc74
lea eax, [ebp - 0xa0]
push eax
push 0x11b
push esi
call fcn.0052fc74
add esp, 0x24
cmp word [ebp - 0x80], 2
jne 0x51a8bf
cmp dword [ebp - 0x40], 1
jg 0x51a784
push esi
mov byte [ebp - 0x11], bl
call fcn.005399c3
test eax, eax
pop ecx
je 0x51a8d1
mov byte [ebp - 0x11], 1
lea ecx, [ebp - 0x88]
call fcn.0050b90c
mov eax, dword [ebp - 0x1c]
mov dword [ebp - 0x44], ebx
lea esi, [eax + 7]
shr esi, 3
cmp byte [ebp - 0x38], bl
je 0x51a8fd
lea esi, [eax + 0x1f]
mov dword [ebp - 0x44], 0x30
shr esi, 5
shl esi, 2
mov eax, esi
mov dword [ebp - 0x54], esi
imul eax, dword [ebp - 0x10]
add eax, dword [ebp - 0x44]
cmp dword [ebp - 0x70], 0xffffffff
mov ecx, eax
je 0x51a93c
mov edx, dword [ebp - 0x10]
lea ecx, [edx + 7]
shr ecx, 3
cmp byte [ebp - 0x38], bl
mov dword [ebp - 0x54], ecx
je 0x51a92e
lea ecx, [edx + 0x1f]
shr ecx, 5
shl ecx, 2
mov dword [ebp - 0x54], ecx
imul ecx, dword [ebp - 0x1c]
add ecx, dword [ebp - 0x44]
mov dword [ebp - 0x40], eax
cmp eax, ecx
ja 0x51a93f
mov dword [ebp - 0x40], ecx
lea ecx, [ebp - 0x60]
call fcn.0051aff2
push dword [ebp - 0x40]
lea ecx, [ebp - 0x60]
call fcn.0051affe
mov eax, dword [ebp - 0x58]
cmp eax, ebx
jne 0x51a964
mov dword [edi], 1
jmp 0x51ad41
cmp byte [ebp - 0x38], bl
mov dword [ebp - 0x24], eax
je 0x51a974
mov ecx, dword [ebp - 0x44]
add eax, ecx
mov dword [ebp - 0x24], eax
push dword [ebp - 0x10]
mov ecx, edi
push 1
call fcn.0051ae98
mov dword [ebp - 0x2c], eax
mov eax, dword [ebp + 0x18]
shr eax, 3
and al, 1
cmp byte [ebp - 0x11], bl
mov byte [ebp + 0x1b], al
jne 0x51ab0d
mov eax, dword [ebp - 0x1c]
push dword [ebp + 8]
mov dword [ebp - 0x28], eax
mov eax, esi
neg eax
add eax, eax
mov dword [ebp - 0x6c], eax
call fcn.005394a1
push eax
call fcn.00538625
pop ecx
cmp eax, ebx
pop ecx
mov dword [ebp - 0x3c], eax
jne 0x51a9de
push str.No_space_for_strip_buffer
push dword [ebp + 8]
call fcn.005399bc
pop ecx
push eax
call fcn.0053953e
pop ecx
mov dword [edi], 1
pop ecx
jmp 0x51ac84
lea eax, [ebp - 0x50]
push eax
push 0x116
push dword [ebp + 8]
call fcn.00532b02
push dword [ebp + 8]
call fcn.005394e8
mov dword [ebp - 0x48], eax
mov eax, dword [ebp - 0x28]
mov ecx, eax
add esp, 0x10
sub ecx, dword [ebp - 0x1c]
cmp dword [ebp - 0x1c], eax
sbb eax, eax
and eax, ecx
cmp byte [ebp + 0x1b], bl
mov dword [ebp - 0x30], eax
je 0x51aa17
mov dword [ebp - 0x6c], ebx
mov eax, dword [ebp - 0x10]
mov dword [ebp - 0x18], ebx
cmp eax, ebx
jbe 0x51ac70
mov ecx, dword [ebp - 0x50]
mov edi, 0x6a2280
mov edx, dword [ebp - 0x18]
add edx, ecx
cmp edx, eax
jbe 0x51aa3e
sub eax, dword [ebp - 0x18]
mov dword [ebp - 0x28], eax
jmp 0x51aa41
mov dword [ebp - 0x28], ecx
mov eax, dword [ebp - 0x28]
imul eax, dword [ebp - 0x48]
push eax
push dword [ebp - 0x3c]
push ebx
push dword [ebp - 0x18]
push dword [ebp + 8]
call fcn.005392bd
add esp, 0xc
push eax
push dword [ebp + 8]
call fcn.00538684
add esp, 0x10
test eax, eax
jge 0x51aa74
mov eax, dword [ebp - 0x20]
mov dword [eax], 0x14
mov eax, dword [ebp - 0x2c]
imul eax, esi
add eax, dword [ebp - 0x24]
cmp byte [ebp + 0x1b], bl
je 0x51aa8f
mov eax, dword [ebp - 0x10]
sub eax, dword [ebp - 0x2c]
dec eax
imul eax, esi
add eax, dword [ebp - 0x24]
push dword [ebp - 0x3c]
mov ecx, dword [ebp - 0x20]
push dword [ebp - 0x6c]
push dword [ebp - 0x30]
push dword [ebp - 0x28]
push esi
push dword [ebp - 0x48]
push eax
call fcn.0051ae42
mov eax, dword [ebp - 0x28]
mov ecx, edi
sub dword [ebp - 0x2c], eax
call fcn.00506f83
cmp dword [eax + 4], 1
jne 0x51aaec
mov ecx, edi
call fcn.00506f83
cmp dword [eax], ebx
je 0x51aaec
mov ecx, edi
call fcn.00506f83
mov ecx, edi
mov dword [ebp - 0x28], eax
call fcn.00506f83
push dword [eax + 8]
mov eax, dword [ebp - 0x28]
push dword [ebp - 0x10]
push dword [ebp - 0x18]
call dword [eax]
neg eax
sbb eax, eax
inc eax
jmp 0x51aaee
xor eax, eax
cmp eax, ebx
jne 0x51ac64
mov ecx, dword [ebp - 0x50]
mov eax, dword [ebp - 0x10]
add dword [ebp - 0x18], ecx
cmp dword [ebp - 0x18], eax
jb 0x51aa2d
jmp 0x51ac6d
lea ecx, [ebp - 0xc0]
call fcn.0051dd22
lea eax, [ebp - 0x50]
push eax
push 0x142
push dword [ebp + 8]
call fcn.0052fc74
lea eax, [ebp - 0x2c]
push eax
push 0x143
push dword [ebp + 8]
call fcn.0052fc74
push dword [ebp + 8]
call fcn.0053926e
push eax
call fcn.00538625
add esp, 0x20
cmp eax, ebx
mov dword [ebp - 0x3c], eax
jne 0x51ab5c
push str.No_space_for_tile_buffer
jmp 0x51a9c2
mov ecx, dword [ebp - 0x10]
mov dword [ebp - 0x18], ebx
cmp ecx, ebx
jbe 0x51ac70
mov eax, dword [ebp - 0x18]
mov edi, dword [ebp - 0x2c]
xor edx, edx
div edi
mov eax, dword [ebp - 0x18]
sub edi, edx
lea edx, [edi + eax]
cmp edx, ecx
jbe 0x51ab87
sub ecx, eax
mov dword [ebp - 0x48], ecx
jmp 0x51ab8a
mov dword [ebp - 0x48], edi
xor edi, edi
cmp dword [ebp - 0x1c], ebx
jbe 0x51ac05
mov al, byte [ebp + 0x1b]
neg al
sbb eax, eax
and al, 0xf8
add eax, 8
mov dword [ebp - 0x30], eax
push ebx
push ebx
push dword [ebp - 0x18]
push edi
push dword [ebp - 0x3c]
push dword [ebp + 8]
call fcn.005389aa
add esp, 0x18
test eax, eax
jge 0x51abc1
mov eax, dword [ebp - 0x20]
mov dword [eax], 0x14
mov eax, dword [ebp - 0x10]
sub eax, dword [ebp - 0x18]
sub eax, dword [ebp - 0x2c]
cmp byte [ebp + 0x1b], bl
je 0x51abd2
mov eax, dword [ebp - 0x18]
push dword [ebp - 0x30]
push eax
mov eax, dword [ebp - 0x50]
push edi
lea ecx, [eax + 7]
shr ecx, 3
push ecx
lea ecx, [ebp - 0xc0]
push dword [ebp - 0x2c]
push eax
push dword [ebp - 0x3c]
push esi
push dword [ebp - 0x10]
push dword [ebp - 0x1c]
push dword [ebp - 0x24]
call fcn.0051e071
add edi, dword [ebp - 0x50]
cmp edi, dword [ebp - 0x1c]
jb 0x51aba0
mov edi, 0x6a2280
mov ecx, edi
call fcn.00506f83
cmp dword [eax + 4], 1
jne 0x51ac48
mov ecx, edi
call fcn.00506f83
cmp dword [eax], ebx
je 0x51ac48
mov ecx, edi
call fcn.00506f83
mov ecx, edi
mov dword [ebp - 0x30], eax
call fcn.00506f83
push dword [eax + 8]
mov eax, dword [ebp - 0x30]
push dword [ebp - 0x10]
push dword [ebp - 0x18]
call dword [eax]
neg eax
sbb eax, eax
inc eax
jmp 0x51ac4a
xor eax, eax
cmp eax, ebx
jne 0x51ac64
mov eax, dword [ebp - 0x18]
mov ecx, dword [ebp - 0x10]
add eax, dword [ebp - 0x48]
cmp eax, ecx
mov dword [ebp - 0x18], eax
jb 0x51ab6a
jmp 0x51ac6d
mov eax, dword [ebp - 0x20]
mov dword [eax], 0xe
mov edi, dword [ebp - 0x20]
push dword [ebp - 0x3c]
call fcn.0053862a
mov eax, dword [edi]
pop ecx
cmp eax, ebx
je 0x51ac91
cmp eax, 0x14
je 0x51ac91
lea ecx, [ebp - 0x60]
call fcn.0051b0fb
jmp 0x51ae29
cmp dword [ebp - 0x70], 0xffffffff
jne 0x51acb6
push dword [ebp - 0x38]
lea eax, [ebp - 0x10]
mov ecx, edi
push esi
push 1
push eax
lea eax, [ebp - 0x1c]
push eax
push dword [ebp - 0x24]
push dword [ebp - 0x4c]
call fcn.00519bb7
mov dword [edi], eax
jmp 0x51ad35
mov dword [ebp - 0x30], ebx
mov dword [ebp - 0x34], ebx
mov eax, dword [ebp - 0x40]
lea ecx, [ebp - 0x34]
sub eax, dword [ebp - 0x44]
mov dword [ebp - 4], ebx
push eax
mov dword [ebp + 0x18], eax
call fcn.00507914
xor eax, eax
cmp dword [ebp - 0x34], ebx
jle 0x51ace4
mov ecx, dword [ebp - 0x30]
mov byte [ecx + eax], bl
inc eax
cmp eax, dword [ebp - 0x34]
jl 0x51acd8
cmp dword [ebp - 0x30], ebx
jne 0x51acf1
mov dword [edi], 1
jmp 0x51ad29
push dword [ebp - 0x38]
lea eax, [ebp - 0x10]
mov ecx, edi
push dword [ebp - 0x54]
push esi
push 1
push eax
lea eax, [ebp - 0x1c]
push eax
push dword [ebp - 0x30]
push dword [ebp - 0x24]
push dword [ebp - 0x4c]
call fcn.00519d42
push dword [ebp + 0x18]
mov dword [edi], eax
push dword [ebp - 0x30]
push dword [ebp - 0x24]
call dword [0x6a2224]
mov esi, dword [ebp - 0x54]
add esp, 0xc
or dword [ebp - 4], 0xffffffff
lea ecx, [ebp - 0x34]
call fcn.00522010
cmp dword [edi], ebx
je 0x51ad48
lea ecx, [ebp - 0x60]
call fcn.0051b0fb
xor eax, eax
jmp 0x51ae31
cmp word [ebp - 0x64], 1
jne 0x51ad71
mov eax, esi
xor ecx, ecx
imul eax, dword [ebp - 0x10]
test eax, eax
jbe 0x51ad71
mov eax, dword [ebp - 0x24]
or dl, 0xff
sub dl, byte [eax]
mov byte [eax], dl
mov edx, esi
imul edx, dword [ebp - 0x10]
inc eax
inc ecx
cmp ecx, edx
jb 0x51ad5e
cmp byte [ebp - 0x38], bl
je 0x51ae02
lea eax, [ebp - 0x9c]
mov ecx, edi
push eax
push dword [ebp + 8]
call fcn.00519f14
push 4
lea eax, [ebp - 0x9c]
push 1
push eax
lea ecx, [ebp - 0x88]
call fcn.0050b912
mov eax, dword [ebp - 0x58]
mov dword [eax], 0x28
mov ecx, dword [ebp - 0x1c]
mov dword [eax + 4], ecx
mov ecx, dword [ebp - 0x10]
mov dword [eax + 8], ecx
mov word [eax + 0xc], 1
mov word [eax + 0xe], 1
mov dword [eax + 0x10], ebx
imul esi, dword [ebp - 0x10]
mov dword [eax + 0x14], esi
mov ecx, dword [ebp - 0x9c]
mov dword [eax + 0x18], ecx
mov ecx, dword [ebp - 0x98]
mov dword [eax + 0x1c], ecx
mov dword [eax + 0x20], 2
mov dword [eax + 0x24], ebx
mov eax, dword [ebp - 0x58]
or byte [eax + 0x28], 0xff
or byte [eax + 0x29], 0xff
or byte [eax + 0x2a], 0xff
mov byte [eax + 0x2c], bl
mov byte [eax + 0x2d], bl
mov byte [eax + 0x2e], bl
jmp 0x51ae19
mov eax, dword [ebp + 0x14]
or byte [eax], 0xff
or byte [eax + 1], 0xff
or byte [eax + 2], 0xff
mov byte [eax + 4], bl
mov byte [eax + 5], bl
mov byte [eax + 6], bl
mov ecx, dword [ebp + 0xc]
mov eax, dword [ebp - 0x1c]
mov dword [ecx], eax
mov eax, dword [ebp + 0x10]
mov ecx, dword [ebp - 0x10]
mov dword [eax], ecx
lea ecx, [ebp - 0x60]
call fcn.0051b15f
mov ecx, dword [ebp - 0xc]
pop edi
pop esi
pop ebx
mov dword fs:[0], ecx
leave
ret 0x14