Function at 0x511770
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x20
push esi
mov esi, dword [esp + 0x30]
test esi, esi
jne 0x511796
push str.We_need_an_image_previously_created._n
push 1
push dword [esp + 0x3c]
call fcn.0051c870
add esp, 0xc
xor eax, eax
pop esi
add esp, 0x20
ret
mov ecx, dword [esp + 0x28]
mov eax, dword [esi + 0x10]
mov ecx, dword [ecx + 0x48]
cmp eax, dword [ecx + 0x10]
jae 0x5117bf
push str.Image_has_less_components_than_codestream._n
push 1
push dword [esp + 0x3c]
call fcn.0051c870
add esp, 0xc
xor eax, eax
pop esi
add esp, 0x20
ret
mov ecx, dword [esp + 0x28]
mov edx, dword [esp + 0x38]
push edi
mov eax, dword [ecx + 0x6c]
mov edi, dword [ecx + 0x68]
imul eax, edi
cmp edx, eax
jb 0x5117f3
dec eax
push eax
push edx
push str.Tile_index_provided_by_the_user_is_incorrect__d__max___d___n
push 1
push dword [esp + 0x48]
call fcn.0051c870
add esp, 0x14
xor eax, eax
pop edi
pop esi
add esp, 0x20
ret
mov eax, edx
mov dword [esp + 0x14], 0
xor edx, edx
div edi
mov edi, ecx
push ebx
mov ebx, edx
mov edx, dword [ecx + 0x5c]
imul edx, ebx
push ebp
mov ebp, eax
add edx, dword [ecx + 0x54]
mov dword [esi], edx
mov ecx, edx
mov eax, dword [edi + 0x48]
cmp edx, dword [eax]
lea edx, [ebx + 1]
cmovb ecx, dword [eax]
mov dword [esi], ecx
imul edx, dword [edi + 0x5c]
add edx, dword [edi + 0x54]
mov dword [esi + 8], edx
mov ecx, edx
mov eax, dword [edi + 0x48]
cmp edx, dword [eax + 8]
cmova ecx, dword [eax + 8]
mov dword [esi + 8], ecx
mov edx, dword [edi + 0x60]
imul edx, ebp
add edx, dword [edi + 0x58]
mov dword [esi + 4], edx
mov ecx, edx
mov eax, dword [edi + 0x48]
cmp edx, dword [eax + 4]
lea edx, [ebp + 1]
cmovb ecx, dword [eax + 4]
mov dword [esi + 4], ecx
imul edx, dword [edi + 0x60]
add edx, dword [edi + 0x58]
mov dword [esi + 0xc], edx
mov ecx, edx
mov eax, dword [edi + 0x48]
cmp edx, dword [eax + 0xc]
cmova ecx, dword [eax + 0xc]
mov dword [esi + 0xc], ecx
mov ebp, dword [edi + 0x48]
mov ecx, dword [esi + 0x18]
mov dword [esp + 0x3c], ecx
cmp dword [ebp + 0x10], 0
jbe 0x5119ed
xor edx, edx
mov dword [esp + 0x20], edx
nop dword [eax]
mov eax, dword [ebp + 0x18]
mov ebp, dword [eax + edx + 0x28]
mov eax, dword [ecx]
cdq
mov ebx, eax
mov dword [ecx + 0x28], ebp
mov eax, dword [esi]
mov ecx, edx
cdq
add eax, ebx
mov dword [esp + 0x10], ebp
push ecx
adc edx, ecx
mov dword [esp + 0x1c], ebx
sub eax, 1
mov dword [esp + 0x28], ecx
push ebx
sbb edx, 0
push edx
push eax
call fcn.00577fc0
mov ecx, dword [esp + 0x3c]
mov dword [esp + 0x28], eax
mov dword [ecx + 0x10], eax
mov eax, dword [ecx + 4]
cdq
mov ebx, eax
mov edi, edx
mov eax, dword [esi + 4]
cdq
add eax, ebx
push edi
adc edx, edi
sub eax, 1
push ebx
sbb edx, 0
push edx
push eax
call fcn.00577fc0
mov ecx, dword [esp + 0x3c]
mov dword [esp + 0x2c], eax
push edi
push ebx
mov dword [ecx + 0x14], eax
mov eax, dword [esi + 0xc]
cdq
add eax, ebx
adc edx, edi
sub eax, 1
sbb edx, 0
push edx
push eax
call fcn.00577fc0
mov ecx, ebp
xor edi, edi
xor ebp, ebp
mov ebx, eax
mov eax, dword [esi + 8]
bts ebp, ecx
cmp ecx, 0x20
cdq
cmovae edi, ebp
xor ebp, edi
cmp ecx, 0x40
mov ecx, dword [esp + 0x24]
cmovae edi, ebp
add eax, dword [esp + 0x18]
push ecx
push dword [esp + 0x1c]
adc edx, ecx
mov dword [esp + 0x1c], edi
sub eax, 1
sbb edx, 0
push edx
push eax
call fcn.00577fc0
cdq
add eax, ebp
adc edx, edi
sub eax, 1
sbb edx, 0
mov ecx, dword [esp + 0x10]
call fcn.00578360
mov ecx, dword [esp + 0x10]
mov edi, eax
mov eax, dword [esp + 0x28]
cdq
add eax, ebp
adc edx, dword [esp + 0x14]
sub eax, 1
sbb edx, 0
call fcn.00578360
mov ecx, dword [esp + 0x10]
sub edi, eax
mov eax, dword [esp + 0x3c]
mov dword [eax + 8], edi
mov eax, dword [esp + 0x2c]
cdq
add eax, ebp
adc edx, dword [esp + 0x14]
sub eax, 1
sbb edx, 0
call fcn.00578360
mov ecx, dword [esp + 0x10]
mov edi, eax
mov eax, ebx
cdq
add eax, ebp
adc edx, dword [esp + 0x14]
sub eax, 1
sbb edx, 0
call fcn.00578360
mov ecx, dword [esp + 0x3c]
sub eax, edi
mov edi, dword [esp + 0x34]
mov edx, dword [esp + 0x20]
add edx, 0x34
mov dword [ecx + 0xc], eax
add ecx, 0x34
mov eax, dword [esp + 0x1c]
mov ebp, dword [edi + 0x48]
inc eax
mov dword [esp + 0x3c], ecx
mov dword [esp + 0x1c], eax
mov dword [esp + 0x20], edx
cmp eax, dword [ebp + 0x10]
jb 0x511890
mov ebp, dword [ebp + 0x10]
cmp dword [esi + 0x10], ebp
jbe 0x511a2c
imul ebx, ebp, 0x34
nop dword [eax + eax]
mov eax, dword [esi + 0x18]
push dword [eax + ebx + 0x2c]
call fcn.0050aab0
mov eax, dword [esi + 0x18]
lea ebx, [ebx + 0x34]
inc ebp
add esp, 4
mov dword [eax + ebx - 8], 0
cmp ebp, dword [esi + 0x10]
jb 0x511a00
mov eax, dword [edi + 0x48]
mov eax, dword [eax + 0x10]
mov dword [esi + 0x10], eax
mov eax, dword [edi + 0x4c]
test eax, eax
je 0x511a3c
push eax
call fcn.0050b9a0
add esp, 4
call fcn.0050b990
mov dword [edi + 0x4c], eax
test eax, eax
je 0x511a9c
push eax
push esi
call fcn.0050b6e0
mov ebx, dword [esp + 0x48]
mov eax, dword [esp + 0x4c]
push ebx
push 0x510000
push dword [edi + 0xb8]
mov dword [edi + 0x2c], eax
call fcn.00525c30
add esp, 0x14
test eax, eax
je 0x511a9c
push ebx
push dword [esp + 0x3c]
push dword [edi + 0xb8]
push edi
call fcn.00511290
add esp, 0x10
test eax, eax
jne 0x511aa6
push dword [edi + 0x48]
call fcn.0050b9a0
add esp, 4
mov dword [edi + 0x48], 0
pop ebp
pop ebx
pop edi
xor eax, eax
pop esi
add esp, 0x20
ret
push esi
push edi
call fcn.005124a0
add esp, 8
pop ebp
pop ebx
pop edi
pop esi
add esp, 0x20
ret