Function at 0x41bc45
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x50
push ebx
push esi
push edi
mov edi, dword [0x15638f8]
mov dword [ebp - 0x14], edi
mov edi, dword [0x15638fc]
mov dword [ebp - 0x18], edi
cmp dword [0x157b830], 0
jne 0x41bc83
movsx edi, byte [0x158100c]
push edi
push str.M3dGetAndSetBgTexture___called_when_d3drm_NULL
call fcn.00420212
add esp, 8
jmp 0x41c27d
cmp dword [0x157b834], 0
jne 0x41bca6
movsx edi, byte [0x158100c]
push edi
push str.M3dGetAndSetBgTexture___called_when_scene_NULL
call fcn.00420212
add esp, 8
jmp 0x41c27d
cmp dword [0x877c24], 0
je 0x41bcd2
cmp dword [0x157e3e8], 0
jne 0x41bcd2
movsx edi, byte [0x158100c]
push edi
push str.M3dGetAndSetBgTexture___called_when_surface_NULL
call fcn.00420212
add esp, 8
jmp 0x41c27d
cmp dword [0x877c24], 0
jne 0x41bcfe
cmp dword [0x157e3ec], 0
jne 0x41bcfe
movsx edi, byte [0x158100c]
push edi
push str.M3dGetAndSetBgTexture___called_when_back_surface_NULL
call fcn.00420212
add esp, 8
jmp 0x41c27d
cmp dword [ebp + 8], 2
jne 0x41bd5a
cmp dword [0x157b84c], 0
je 0x41c27d
push dword [0x157b84c]
mov edi, dword [0x157b834]
push dword [0x157b834]
mov edi, dword [edi]
call dword [edi + 0xcc]
mov dword [ebp - 0x10], eax
cmp dword [ebp - 0x10], 0
je 0x41c27d
movsx edi, byte [0x158100b]
push edi
push 0x157db28
push dword [ebp - 0x10]
call fcn.0041c6f8
add esp, 0xc
jmp 0x41c27d
push 0x3c
push 0
push 0x877be8
call sub.CRTDLL.DLL_memset
add esp, 0xc
mov edi, dword [ebp - 0x14]
mov dword [0x877be8], edi
mov edi, dword [ebp - 0x18]
mov dword [0x877bec], edi
mov dword [0x877bf0], 1
mov dword [0x877bf4], 1
mov edi, dword [0x157e3f8]
mov dword [0x877bf8], edi
mov edi, dword [ebp - 0x14]
mov eax, dword [0x157e3f8]
mov ecx, 8
cdq
idiv ecx
imul edi, eax
mov dword [0x877c00], edi
mov dword [0x877c04], 0
mov dword [0x877c08], 0
mov dword [0x877c0c], 0
mov dword [0x877c10], 0
mov dword [0x877c14], 0
mov dword [0x877c18], 0
cmp dword [0x157e3f8], 8
jne 0x41be6c
mov dword [0x877bfc], 0
mov dword [0x877c1c], 0x100
cmp dword [0x877c24], 0
je 0x41be2d
push 0x8777e8
push dword [0x157e3e8]
call fcn.0041e8d2
add esp, 8
jmp 0x41be40
push 0x8777e8
push dword [0x157e3ec]
call fcn.0041e8d2
add esp, 8
mov dword [ebp - 4], 0
mov ebx, dword [ebp - 4]
mov byte [ebx*4 + 0x8777eb], 0
inc dword [ebp - 4]
cmp dword [ebp - 4], 0x100
jl 0x41be47
lea edi, [0x8777e8]
mov dword [0x877c20], edi
jmp 0x41be8a
mov dword [0x877bfc], 1
mov dword [0x877c1c], 0
mov dword [0x877c20], 0
mov edi, dword [ebp - 0x14]
imul edi, dword [ebp - 0x18]
mov eax, edi
imul eax, dword [0x157e3f8]
mov ecx, 8
cdq
idiv ecx
mov dword [ebp - 0xc], eax
cmp dword [0x157b840], 0
je 0x41beb9
push dword [0x157b840]
call sub.KERNEL32.DLL_GlobalFree
push dword [ebp - 0xc]
push 0
call sub.KERNEL32.DLL_GlobalAlloc
mov dword [0x157b840], eax
cmp dword [0x157b840], 0
je 0x41c27d
fld1
fcomp dword [ebp + 0xc]
fnstsw ax
sahf
je 0x41bf27
fld qword [0x157db20]
fmul dword [ebp + 0xc]
fstp qword [ebp - 0x20]
fld qword [0x157db18]
fstp qword [ebp - 0x28]
fld qword [ebp - 0x28]
fcomp qword [ebp - 0x20]
fnstsw ax
sahf
ja 0x41bf17
fld qword [ebp - 0x20]
fsub qword [ebp - 0x28]
mov edi, eax
call fcn.0043143c
xchg edi, eax
mov ebx, edi
add ebx, 0x80000000
jmp 0x41bf22
fld qword [ebp - 0x20]
mov ebx, eax
call fcn.0043143c
xchg ebx, eax
mov byte [ebp - 6], bl
jmp 0x41bf2b
mov byte [ebp - 6], 0xff
fld1
fcomp dword [ebp + 0x10]
fnstsw ax
sahf
je 0x41bf7d
fld qword [0x157db20]
fmul dword [ebp + 0x10]
fstp qword [ebp - 0x30]
fld qword [0x157db18]
fstp qword [ebp - 0x38]
fld qword [ebp - 0x38]
fcomp qword [ebp - 0x30]
fnstsw ax
sahf
ja 0x41bf6d
fld qword [ebp - 0x30]
fsub qword [ebp - 0x38]
mov edi, eax
call fcn.0043143c
xchg edi, eax
mov ebx, edi
add ebx, 0x80000000
jmp 0x41bf78
fld qword [ebp - 0x30]
mov ebx, eax
call fcn.0043143c
xchg ebx, eax
mov byte [ebp - 7], bl
jmp 0x41bf81
mov byte [ebp - 7], 0xff
fld1
fcomp dword [ebp + 0x14]
fnstsw ax
sahf
je 0x41bfd3
fld qword [0x157db20]
fmul dword [ebp + 0x14]
fstp qword [ebp - 0x40]
fld qword [0x157db18]
fstp qword [ebp - 0x48]
fld qword [ebp - 0x48]
fcomp qword [ebp - 0x40]
fnstsw ax
sahf
ja 0x41bfc3
fld qword [ebp - 0x40]
fsub qword [ebp - 0x48]
mov edi, eax
call fcn.0043143c
xchg edi, eax
mov ebx, edi
add ebx, 0x80000000
jmp 0x41bfce
fld qword [ebp - 0x40]
mov ebx, eax
call fcn.0043143c
xchg ebx, eax
mov byte [ebp - 8], bl
jmp 0x41bfd7
mov byte [ebp - 8], 0xff
mov byte [ebp - 5], 0
mov dword [ebp - 4], 0
mov dword [ebp - 0x4c], 8
mov ebx, dword [ebp - 4]
movzx ebx, byte [ebx*4 + 0x8777e8]
movzx edi, byte [ebp - 6]
mov esi, ebx
sub esi, edi
push esi
call sub.CRTDLL.DLL_abs
add esp, 4
cmp eax, dword [ebp - 0x4c]
jge 0x41c052
mov ebx, dword [ebp - 4]
movzx ebx, byte [ebx*4 + 0x8777e9]
movzx edi, byte [ebp - 7]
mov esi, ebx
sub esi, edi
push esi
call sub.CRTDLL.DLL_abs
add esp, 4
cmp eax, dword [ebp - 0x4c]
jge 0x41c052
mov ebx, dword [ebp - 4]
movzx ebx, byte [ebx*4 + 0x8777ea]
movzx edi, byte [ebp - 8]
mov esi, ebx
sub esi, edi
push esi
call sub.CRTDLL.DLL_abs
add esp, 4
cmp eax, dword [ebp - 0x4c]
jge 0x41c052
mov ebx, dword [ebp - 4]
mov byte [ebp - 5], bl
inc dword [ebp - 4]
cmp dword [ebp - 4], 0x100
jl 0x41bfe2
movzx edi, byte [ebp - 5]
cmp edi, 0
je 0x41c07b
cmp edi, dword [0x157e3f4]
je 0x41c07b
movzx edi, byte [ebp - 5]
mov dword [0x157b85c], edi
jmp 0x41c087
mov edi, dword [0x157e3f4]
mov dword [0x157b85c], edi
cmp dword [ebp + 8], 0
je 0x41c0f3
cmp byte [ebp - 5], 0
je 0x41c0b9
fldz
fstp qword [ebp - 0x50]
fld qword [ebp - 0x50]
fcomp dword [ebp + 0xc]
fnstsw ax
sahf
jne 0x41c0d2
fld qword [ebp - 0x50]
fcomp dword [ebp + 0x10]
fnstsw ax
sahf
jne 0x41c0d2
fld qword [ebp - 0x50]
fcomp dword [ebp + 0x14]
fnstsw ax
sahf
jne 0x41c0d2
push dword [ebp - 0xc]
push dword [0x157e3f4]
push dword [0x157b840]
call sub.CRTDLL.DLL_memset
add esp, 0xc
jmp 0x41c138
cmp dword [0x157e3f8], 8
jne 0x41c138
push dword [ebp - 0xc]
movzx edi, byte [ebp - 5]
push edi
push dword [0x157b840]
call sub.CRTDLL.DLL_memset
add esp, 0xc
jmp 0x41c138
cmp dword [0x877c24], 0
je 0x41c11b
push dword [ebp - 0xc]
push dword [ebp - 0x18]
push dword [ebp - 0x14]
push dword [0x157b840]
push dword [0x157e3e8]
call fcn.0041ed90
add esp, 0x14
jmp 0x41c138
push dword [ebp - 0xc]
push dword [ebp - 0x18]
push dword [ebp - 0x14]
push dword [0x157b840]
push dword [0x157e3e8]
call fcn.0041ed90
add esp, 0x14
movzx edi, byte [ebp - 5]
cmp edi, 0
je 0x41c1a7
cmp edi, dword [0x157e3f4]
je 0x41c1a7
cmp dword [ebp + 8], 0
jne 0x41c1a7
cmp dword [0x157e3f8], 8
jne 0x41c1a7
cmp byte [ebp - 6], 0
jne 0x41c16a
cmp byte [ebp - 7], 0
jne 0x41c16a
cmp byte [ebp - 8], 0
je 0x41c1a7
mov dword [ebp - 4], 0
jmp 0x41c19f
mov edi, dword [ebp - 4]
mov ebx, dword [0x157b840]
movzx edi, byte [ebx + edi]
cmp edi, 0
je 0x41c18d
cmp edi, dword [0x157e3f4]
jne 0x41c19c
mov edi, dword [ebp - 4]
mov ebx, dword [0x157b840]
mov dl, byte [ebp - 5]
mov byte [ebx + edi], dl
inc dword [ebp - 4]
mov edi, dword [ebp - 0xc]
cmp dword [ebp - 4], edi
jl 0x41c173
mov edi, dword [0x157b840]
mov dword [0x877c04], edi
cmp dword [0x157b84c], 0
je 0x41c1e5
cmp dword [0x157b84c], 0
je 0x41c1e5
mov edi, dword [0x157b84c]
push dword [0x157b84c]
mov edi, dword [edi]
call dword [edi + 8]
mov dword [0x157b84c], 0
push 0x157b84c
push 0x877be8
mov edi, dword [0x157b830]
push dword [0x157b830]
mov edi, dword [edi]
call dword [edi + 0x28]
mov dword [ebp - 0x10], eax
cmp dword [ebp - 0x10], 0
je 0x41c23d
movsx edi, byte [0x158100b]
push edi
push 0x157db08
push dword [ebp - 0x10]
call fcn.0041c6f8
add esp, 0xc
push dword [0x157b840]
call sub.KERNEL32.DLL_GlobalFree
mov dword [0x157b840], 0
jmp 0x41c27d
push dword [0x157b84c]
mov edi, dword [0x157b834]
push dword [0x157b834]
mov edi, dword [edi]
call dword [edi + 0xcc]
mov dword [ebp - 0x10], eax
cmp dword [ebp - 0x10], 0
je 0x41c27d
movsx edi, byte [0x158100b]
push edi
push 0x157db28
push dword [ebp - 0x10]
call fcn.0041c6f8
add esp, 0xc
pop edi
pop esi
pop ebx
leave
ret