Function at 0x563a10
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x380
mov eax, dword [0x675978]
xor eax, ebp
mov dword [ebp - 4], eax
push esi
mov esi, dword [ebp + 8]
mov dword [ebp - 0x32c], esi
test esi, esi
jne 0x563a42
xor eax, eax
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.005b6a10
mov esp, ebp
pop ebp
ret
push ebx
push edi
push esi
call sym.BZDPatcher.exe_SDL_RWtell
push 1
mov dword [ebp - 0x380], eax
lea eax, [ebp - 0x328]
push 4
push eax
push esi
mov dword [ebp - 0x37c], edx
call sym.BZDPatcher.exe_SDL_RWread
add esp, 0x14
test eax, eax
jne 0x563a7a
mov esi, str.error_reading_IFF_chunk
xor ebx, ebx
jmp 0x5643d3
push 1
push 4
lea eax, [ebp - 0x320]
push eax
push esi
call sym.BZDPatcher.exe_SDL_RWread
add esp, 0x10
test eax, eax
jne 0x563a9e
mov esi, str.error_reading_IFF_chunk_size
xor ebx, ebx
jmp 0x5643d3
push 4
lea eax, [ebp - 0x328]
push str.FORM
push eax
call sym.BZDPatcher.exe_SDL_memcmp
add esp, 0xc
test eax, eax
je 0x563ac4
mov esi, str.not_a_IFF_file
xor ebx, ebx
jmp 0x5643d3
push 1
push 4
lea eax, [ebp - 0x328]
push eax
push esi
call sym.BZDPatcher.exe_SDL_RWread
add esp, 0x10
test eax, eax
jne 0x563ae8
mov esi, str.error_reading_IFF_chunk
xor ebx, ebx
jmp 0x5643d3
push 4
lea eax, [ebp - 0x328]
mov byte [ebp - 0x31b], 0
push str.PBM
push eax
call sym.BZDPatcher.exe_SDL_memcmp
add esp, 0xc
test eax, eax
jne 0x563d79
mov byte [ebp - 0x31b], 1
push 0x14
xor edi, edi
lea eax, [ebp - 0x318]
push edi
push eax
call sym.BZDPatcher.exe_SDL_memset
push 4
lea eax, [ebp - 0x328]
mov byte [ebp - 0x340], 0
push str.BODY
xor bl, bl
push eax
mov dword [ebp - 0x324], ebx
call sym.BZDPatcher.exe_SDL_memcmp
add esp, 0x18
lea ecx, [edi + 1]
test eax, eax
je 0x563dca
push 1
push 4
lea eax, [ebp - 0x328]
push eax
push esi
call sym.BZDPatcher.exe_SDL_RWread
add esp, 0x10
test eax, eax
je 0x563a6e
push 1
push 4
lea eax, [ebp - 0x320]
push eax
push esi
call sym.BZDPatcher.exe_SDL_RWread
add esp, 0x10
test eax, eax
je 0x563a92
mov eax, dword [ebp - 0x320]
xor esi, esi
bswap eax
push 4
mov dword [ebp - 0x320], eax
lea eax, [ebp - 0x328]
push str.BMHD
push eax
call sym.BZDPatcher.exe_SDL_memcmp
add esp, 0xc
test eax, eax
jne 0x563c5f
push 1
push 0x14
lea eax, [ebp - 0x318]
push eax
push dword [ebp - 0x32c]
call sym.BZDPatcher.exe_SDL_RWread
add esp, 0x10
test eax, eax
je 0x563e4d
movzx eax, word [ebp - 0x318]
mov esi, 0x14
mov ch, al
mov cl, ah
movzx eax, word [ebp - 0x316]
mov word [ebp - 0x318], cx
mov ch, al
mov cl, ah
movzx eax, word [ebp - 0x314]
mov word [ebp - 0x316], cx
mov ch, al
mov cl, ah
movzx eax, word [ebp - 0x312]
mov word [ebp - 0x314], cx
mov ch, al
mov cl, ah
movzx eax, word [ebp - 0x30c]
mov word [ebp - 0x312], cx
mov ch, al
mov cl, ah
movzx eax, word [ebp - 0x308]
mov word [ebp - 0x30c], cx
mov ch, al
mov cl, ah
movzx eax, word [ebp - 0x306]
mov word [ebp - 0x308], cx
mov ch, al
mov cl, ah
mov word [ebp - 0x306], cx
push 4
lea eax, [ebp - 0x328]
push str.CMAP
push eax
call sym.BZDPatcher.exe_SDL_memcmp
add esp, 0xc
test eax, eax
jne 0x563cbb
mov eax, dword [ebp - 0x320]
cmp eax, 0x300
ja 0x563e65
push 1
push eax
lea eax, [ebp - 0x304]
push eax
push dword [ebp - 0x32c]
call sym.BZDPatcher.exe_SDL_RWread
add esp, 0x10
test eax, eax
je 0x563e59
mov esi, dword [ebp - 0x320]
mov eax, 0xaaaaaaab
mul esi
mov edi, edx
shr edi, 1
push 4
lea eax, [ebp - 0x328]
push str.CAMG
push eax
call sym.BZDPatcher.exe_SDL_memcmp
add esp, 0xc
test eax, eax
jne 0x563d34
push 1
push 4
lea eax, [ebp - 0x34c]
push eax
push dword [ebp - 0x32c]
call sym.BZDPatcher.exe_SDL_RWread
add esp, 0x10
test eax, eax
je 0x563e71
mov eax, dword [ebp - 0x34c]
mov ecx, 1
mov edx, dword [ebp - 0x340]
mov esi, dword [ebp - 0x320]
bswap eax
test eax, 0x800
movzx edx, dl
movzx ebx, bl
cmovne edx, ecx
mov dword [ebp - 0x34c], eax
test al, 0x80
mov dword [ebp - 0x340], edx
cmovne ebx, ecx
mov dword [ebp - 0x324], ebx
push 4
lea eax, [ebp - 0x328]
push str.BODY
push eax
call sym.BZDPatcher.exe_SDL_memcmp
add esp, 0xc
test eax, eax
je 0x563da3
mov eax, dword [ebp - 0x320]
test al, 1
je 0x563d59
inc eax
sub eax, esi
mov esi, dword [ebp - 0x32c]
mov dword [ebp - 0x320], eax
je 0x563da9
push 1
push 0
push eax
push esi
call sym.BZDPatcher.exe_SDL_RWseek
add esp, 0x10
jmp 0x563da9
push 4
lea eax, [ebp - 0x328]
push str.ILBM
push eax
call sym.BZDPatcher.exe_SDL_memcmp
add esp, 0xc
test eax, eax
je 0x563b14
mov esi, str.not_a_IFF_picture
xor ebx, ebx
jmp 0x5643d3
mov esi, dword [ebp - 0x32c]
push 4
lea eax, [ebp - 0x328]
push str.BODY
push eax
call sym.BZDPatcher.exe_SDL_memcmp
add esp, 0xc
test eax, eax
jne 0x563b55
lea ecx, [eax + 1]
movzx eax, word [ebp - 0x318]
movzx esi, byte [ebp - 0x310]
add eax, 0xf
mov edx, eax
mov dword [ebp - 0x350], 2
and edx, 0xfffffff0
shr eax, 4
mov dword [ebp - 0x344], edx
mov dl, byte [ebp - 0x31b]
test dl, dl
movzx edx, byte [ebp - 0x30f]
cmovne esi, ecx
mov ecx, 0x10
cmove ecx, dword [ebp - 0x350]
and edx, 1
imul ecx, eax
add edx, esi
mov dword [ebp - 0x330], esi
mov dword [ebp - 0x354], edx
mov dword [ebp - 0x360], ecx
imul ecx, edx
push ecx
call sym.BZDPatcher.exe_SDL_malloc
add esp, 4
mov dword [ebp - 0x358], eax
test eax, eax
jne 0x563e7d
mov esi, str.not_enough_memory_for_temporary_buffer
xor ebx, ebx
jmp 0x5643d3
mov esi, str.error_reading_BMHD_chunk
xor ebx, ebx
jmp 0x5643d3
mov esi, str.error_reading_CMAP_chunk
xor ebx, ebx
jmp 0x5643d3
mov esi, str.colormap_size_is_too_large
xor ebx, ebx
jmp 0x5643d3
mov esi, str.error_reading_CAMG_chunk
xor ebx, ebx
jmp 0x5643d3
mov eax, 0x13000801
cmp esi, 0x18
je 0x563e90
cmp byte [ebp - 0x340], 1
jne 0x563e95
mov eax, 0x17401803
push eax
movzx eax, word [ebp - 0x316]
push 0
push eax
push dword [ebp - 0x344]
push 0
call sym.BZDPatcher.exe_SDL_CreateRGBSurfaceWithFormat
add esp, 0x14
mov dword [ebp - 0x334], eax
test eax, eax
je 0x5643b9
test byte [ebp - 0x30f], 2
je 0x563eda
movzx ecx, word [ebp - 0x30c]
push ecx
push 1
push eax
call sym.BZDPatcher.exe_SDL_SetColorKey
add esp, 0xc
test edi, edi
je 0x564054
cmp byte [ebp - 0x340], 0
jne 0x564054
mov ecx, dword [ebp - 0x354]
lea edx, [ebp - 0x304]
mov eax, 1
xor esi, esi
shl eax, cl
mov dword [ebp - 0x350], eax
test edi, edi
je 0x563f54
mov ebx, dword [ebp - 0x334]
mov eax, dword [ebx + 4]
lea edx, [edx + 3]
mov eax, dword [eax + 4]
mov ecx, dword [eax + 4]
movzx eax, byte [edx - 3]
mov byte [ecx + esi*4], al
mov eax, dword [ebx + 4]
mov eax, dword [eax + 4]
mov ecx, dword [eax + 4]
movzx eax, byte [edx - 2]
mov byte [ecx + esi*4 + 1], al
mov eax, dword [ebx + 4]
mov eax, dword [eax + 4]
mov ecx, dword [eax + 4]
movzx eax, byte [edx - 1]
mov byte [ecx + esi*4 + 2], al
inc esi
cmp esi, edi
jb 0x563f14
mov ebx, dword [ebp - 0x324]
cmp edi, 0x20
je 0x563f5d
test bl, bl
je 0x563fc6
mov ecx, dword [ebp - 0x330]
mov eax, 1
shl eax, cl
cmp eax, 0x40
jne 0x563fc6
mov ebx, dword [ebp - 0x334]
lea edx, [ebp - 0x304]
mov edi, eax
lea esi, [eax + 0x40]
mov eax, dword [ebx + 4]
lea edx, [edx + 3]
movzx ecx, byte [edx - 3]
shr cl, 1
mov eax, dword [eax + 4]
mov eax, dword [eax + 4]
mov byte [esi + eax], cl
mov eax, dword [ebx + 4]
movzx ecx, byte [edx - 2]
shr cl, 1
mov eax, dword [eax + 4]
mov eax, dword [eax + 4]
mov byte [eax + esi + 1], cl
mov eax, dword [ebx + 4]
movzx ecx, byte [edx - 1]
shr cl, 1
mov eax, dword [eax + 4]
mov eax, dword [eax + 4]
mov byte [eax + esi + 2], cl
add esi, 4
cmp esi, 0x100
jb 0x563f80
mov ecx, dword [ebp - 0x330]
mov esi, 1
shl esi, cl
mov ebx, edi
cmp dword [ebp - 0x350], esi
cmovle esi, dword [ebp - 0x350]
cmp edi, esi
jae 0x564037
mov eax, ebx
xor edx, edx
div edi
mov eax, dword [ebp - 0x334]
mov eax, dword [eax + 4]
mov eax, dword [eax + 4]
mov ecx, dword [eax + 4]
movzx eax, byte [ecx + edx*4]
mov byte [ecx + ebx*4], al
mov eax, dword [ebp - 0x334]
mov eax, dword [eax + 4]
mov eax, dword [eax + 4]
mov ecx, dword [eax + 4]
movzx eax, byte [ecx + edx*4 + 1]
mov byte [ecx + ebx*4 + 1], al
mov eax, dword [ebp - 0x334]
mov eax, dword [eax + 4]
mov eax, dword [eax + 4]
mov ecx, dword [eax + 4]
movzx eax, byte [ecx + edx*4 + 2]
mov byte [ecx + ebx*4 + 2], al
inc ebx
cmp ebx, esi
jb 0x563fe6
cmp byte [ebp - 0x31b], 0
jne 0x56404e
mov eax, dword [ebp - 0x334]
mov eax, dword [eax + 4]
mov eax, dword [eax + 4]
mov dword [eax], esi
mov esi, dword [ebp - 0x330]
xor eax, eax
mov dword [ebp - 0x350], 0
cmp ax, word [ebp - 0x316]
jae 0x5643b9
lea eax, [esi - 2]
xor ebx, ebx
mov dword [ebp - 0x368], eax
mov eax, 0x1a
sub eax, esi
mov dword [ebp - 0x348], ebx
mov dword [ebp - 0x36c], eax
mov eax, 0xa
sub eax, esi
mov dword [ebp - 0x370], eax
mov eax, 0x12
sub eax, esi
xor edi, edi
mov dword [ebp - 0x374], eax
mov eax, dword [ebp - 0x344]
mov dword [ebp - 0x34c], edi
lea eax, [eax + eax*2]
mov dword [ebp - 0x378], eax
lea esp, [esp]
cmp dword [ebp - 0x354], 0
mov dword [ebp - 0x324], 0
jbe 0x564207
mov ebx, dword [ebp - 0x358]
lea ecx, [ecx]
cmp byte [ebp - 0x30e], 1
mov esi, ebx
mov eax, dword [ebp - 0x360]
mov edi, eax
jne 0x5641bc
jmp 0x564100
push 1
push 1
lea eax, [ebp - 0x31a]
push eax
push dword [ebp - 0x32c]
call sym.BZDPatcher.exe_SDL_RWread
add esp, 0x10
test eax, eax
je 0x5645c9
mov al, byte [ebp - 0x31a]
test al, al
jns 0x56417c
not al
add al, 2
mov byte [ebp - 0x31a], al
movzx eax, al
cmp eax, edi
ja 0x5645c9
push 1
push 1
lea eax, [ebp - 0x31c]
push eax
push dword [ebp - 0x32c]
call sym.BZDPatcher.exe_SDL_RWread
add esp, 0x10
test eax, eax
je 0x5645c9
movzx eax, byte [ebp - 0x31a]
push eax
movzx eax, byte [ebp - 0x31c]
push eax
push esi
call sym.BZDPatcher.exe_SDL_memset
add esp, 0xc
jmp 0x5641a9
inc al
mov byte [ebp - 0x31a], al
movzx eax, al
cmp eax, edi
ja 0x5645c9
push 1
push eax
push esi
push dword [ebp - 0x32c]
call sym.BZDPatcher.exe_SDL_RWread
add esp, 0x10
test eax, eax
je 0x5645c9
movzx eax, byte [ebp - 0x31a]
add esi, eax
sub edi, eax
jne 0x564100
jmp 0x5641d6
push 1
push eax
push ebx
push dword [ebp - 0x32c]
call sym.BZDPatcher.exe_SDL_RWread
add esp, 0x10
test eax, eax
je 0x5645c9
mov eax, dword [ebp - 0x324]
add ebx, dword [ebp - 0x360]
inc eax
mov dword [ebp - 0x324], eax
cmp eax, dword [ebp - 0x354]
jb 0x5640e0
mov esi, dword [ebp - 0x330]
mov ebx, dword [ebp - 0x348]
mov edi, dword [ebp - 0x34c]
mov eax, dword [ebp - 0x334]
mov edx, dword [ebp - 0x340]
mov ecx, dword [eax + 0x14]
cmp esi, 0x18
je 0x564222
mov eax, ebx
cmp dl, 1
jne 0x564224
mov eax, edi
cmp byte [ebp - 0x31b], 0
lea edi, [eax + ecx]
mov dword [ebp - 0x35c], edi
je 0x564250
push dword [ebp - 0x344]
push dword [ebp - 0x358]
push edi
call sym.BZDPatcher.exe_SDL_memcpy
add esp, 0xc
jmp 0x56437f
cmp esi, 0x18
je 0x564426
test dl, dl
jne 0x564426
mov eax, dword [ebp - 0x344]
xor ebx, ebx
shr eax, 3
mov dword [ebp - 0x320], eax
mov dword [ebp - 0x35c], ebx
test eax, eax
je 0x564379
mov esi, edi
neg esi
mov dword [ebp - 0x338], esi
lea ebx, [ebx]
push 8
push 0
push edi
call sym.BZDPatcher.exe_SDL_memset
add esp, 0xc
mov dword [ebp - 0x33c], 0
cmp dword [ebp - 0x354], 0
jbe 0x564354
mov eax, dword [ebp - 0x358]
add eax, ebx
mov dword [ebp - 0x324], eax
mov dl, byte [eax]
mov dh, 0x80
mov byte [ebp - 0x319], dl
xor ebx, ebx
mov byte [ebp - 0x31c], dl
mov eax, edi
jmp 0x5642e0
mov dl, dh
lea ecx, [esi + eax]
and dl, byte [ebp - 0x319]
cmp ecx, 7
ja 0x5642fe
mov cl, 7
sub cl, bl
sub cl, byte [ebp - 0x33c]
shr dl, cl
jmp 0x564303
add ecx, 0xfffffff9
shl dl, cl
or byte [eax], dl
inc ebx
shr dh, 1
inc eax
cmp ebx, 8
jae 0x56431c
mov cl, byte [ebp - 0x31c]
mov byte [ebp - 0x319], cl
jmp 0x5642e0
mov ecx, dword [ebp - 0x33c]
inc esi
mov eax, dword [ebp - 0x324]
inc ecx
add eax, dword [ebp - 0x360]
mov dword [ebp - 0x33c], ecx
mov dword [ebp - 0x324], eax
cmp ecx, dword [ebp - 0x354]
jb 0x5642c2
mov ebx, dword [ebp - 0x35c]
mov esi, dword [ebp - 0x338]
inc ebx
sub esi, 8
add edi, 8
mov dword [ebp - 0x338], esi
mov dword [ebp - 0x35c], ebx
cmp ebx, dword [ebp - 0x320]
jb 0x564290
mov esi, dword [ebp - 0x330]
mov ebx, dword [ebp - 0x348]
mov ecx, dword [ebp - 0x350]
mov edi, dword [ebp - 0x34c]
inc ecx
add ebx, dword [ebp - 0x344]
add edi, dword [ebp - 0x378]
movzx eax, word [ebp - 0x316]
mov dword [ebp - 0x350], ecx
mov dword [ebp - 0x348], ebx
mov dword [ebp - 0x34c], edi
cmp ecx, eax
jb 0x5640c0
xor esi, esi
push dword [ebp - 0x358]
call sym.BZDPatcher.exe_SDL_free
mov ebx, dword [ebp - 0x334]
add esp, 4
test esi, esi
je 0x564413
push 0
push dword [ebp - 0x37c]
push dword [ebp - 0x380]
push dword [ebp - 0x32c]
call sym.BZDPatcher.exe_SDL_RWseek
add esp, 0x10
test ebx, ebx
je 0x5643fc
push ebx
call sym.BZDPatcher.exe_SDL_FreeSurface
add esp, 4
push esi
push 0x652d7c
call sym.BZDPatcher.exe_SDL_SetError
xor eax, eax
add esp, 8
test ebx, ebx
cmove eax, ebx
mov ebx, eax
mov ecx, dword [ebp - 4]
mov eax, ebx
pop edi
pop ebx
xor ecx, ebp
pop esi
call fcn.005b6a10
mov esp, ebp
pop ebp
ret
mov ecx, dword [ebp - 0x344]
xor ebx, ebx
mov dword [ebp - 0x338], ebx
lea eax, [ecx + 7]
shr eax, 3
mov dword [ebp - 0x324], eax
mov dword [ebp - 0x320], eax
xor eax, eax
mov dword [ebp - 0x33c], eax
test ecx, ecx
je 0x564379
jmp 0x564460
mov cl, 0x80
mov esi, 8
mov byte [ebp - 0x319], cl
mov dword [ebp - 0x364], esi
xor edx, edx
lea edi, [edx + 1]
cmp dword [ebp - 0x330], edx
jbe 0x5644bf
mov ebx, dword [ebp - 0x330]
mov esi, eax
shr esi, 3
add esi, dword [ebp - 0x358]
mov al, byte [esi]
and al, cl
mov ecx, edi
or ecx, edx
test al, al
cmove ecx, edx
add esi, dword [ebp - 0x324]
add edi, edi
mov edx, ecx
mov cl, byte [ebp - 0x319]
sub ebx, 1
jne 0x564491
mov ebx, dword [ebp - 0x338]
mov esi, dword [ebp - 0x364]
cmp byte [ebp - 0x340], 0
je 0x56458d
mov ecx, dword [ebp - 0x368]
mov eax, edx
shr eax, cl
cmp eax, 3
ja case.default.0x5644db
jmp dword [eax*4 + 0x5645d4]
lea ecx, [edx + edx*2]
movzx ebx, byte [ebp + ecx - 0x302]
movzx eax, byte [ebp + ecx - 0x303]
shl ebx, 8
add ebx, eax
movzx eax, byte [ebp + ecx - 0x304]
shl ebx, 8
add ebx, eax
jmp 0x564516
mov ecx, dword [ebp - 0x36c]
shl edx, cl
movzx ebx, bx
or ebx, edx
mov dword [ebp - 0x338], ebx
mov cl, byte [ebp - 0x319]
mov edi, dword [ebp - 0x35c]
mov eax, ebx
shr eax, 0x10
shr cl, 1
mov byte [ebp - 0x319], cl
mov byte [edi], al
mov eax, ebx
shr eax, 8
mov byte [edi + 1], al
mov byte [edi + 2], bl
add edi, 3
sub esi, 1
mov dword [ebp - 0x35c], edi
mov dword [ebp - 0x364], esi
je 0x564597
mov eax, dword [ebp - 0x320]
mov dword [ebp - 0x324], eax
mov eax, dword [ebp - 0x33c]
jmp 0x564473
mov ecx, dword [ebp - 0x370]
shl edx, cl
and ebx, 0xffff00
jmp 0x564514
mov ecx, dword [ebp - 0x374]
shl edx, cl
and ebx, 0xff00ff
jmp 0x564514
mov ebx, edx
mov dword [ebp - 0x338], ebx
jmp 0x564522
mov eax, dword [ebp - 0x33c]
add eax, 8
mov dword [ebp - 0x33c], eax
cmp eax, dword [ebp - 0x344]
jae 0x564373
mov eax, dword [ebp - 0x320]
mov dword [ebp - 0x324], eax
mov eax, dword [ebp - 0x33c]
jmp 0x564460
mov esi, str.error_reading_BODY_chunk
jmp 0x5643bb