Function at 0x412170
Capabilities:
Encrypt data using rc4 ksa
Resolve function by parsing pe exports

Disassembly:
sub esp, 0x48c
mov eax, dword [0x49d548]
xor eax, esp
mov dword [esp + 0x488], eax
mov eax, dword [esp + 0x494]
push ebx
push ebp
mov ebp, dword [esp + 0x4a8]
xor ebx, ebx
mov dword [esp + 0x84], eax
mov eax, dword [esp + 0x4a0]
push esi
mov esi, dword [esp + 0x49c]
mov dword [esp + 0x8c], eax
mov eax, dword [esp + 0x4a8]
mov dword [esp + 0x90], eax
lea eax, [esp + 0x40]
push edi
push eax
push esi
mov dword [esp + 0x6c], esi
mov dword [esp + 0x90], ebp
mov dword [esp + 0x68], 0xff
call fcn.00412be0
add esp, 8
test eax, eax
je 0x412bb6
mov eax, dword [esi + 4]
mov ecx, dword [esp + 0x4c]
mov dword [esp + 0x84], eax
cdq
mov edi, eax
mov eax, dword [esp + 0x60]
xor edi, edx
mov dword [esp + 0x28], eax
mov eax, dword [esp + 0x48]
sub edi, edx
mov edx, dword [esp + 0x44]
mov dword [esi + 4], edi
mov dword [esp + 0x18], edx
cmp ecx, 0xc
jne 0x412234
cmp edx, 0x18
jge 0x412243
lea ecx, [eax - 0x26]
mov eax, 0x55555556
imul ecx
mov ebx, edx
shr ebx, 0x1f
add ebx, edx
jmp 0x412243
cmp edx, 0x10
jge 0x412243
mov ebx, eax
sub ebx, ecx
sub ebx, 0xe
sar ebx, 2
xor eax, eax
cmp dword [esp + 0x5c], eax
setne al
add eax, 3
mov dword [esp + 0x14], eax
mov dword [esi + 8], eax
test ebp, ebp
je 0x412265
cmp ebp, 3
jl 0x412265
mov eax, ebp
mov dword [esp + 0x14], eax
mov ecx, dword [esi]
test eax, eax
js 0x412bac
test ecx, ecx
js 0x412bac
je 0x41228f
mov eax, 0x7fffffff
cdq
idiv ecx
cmp dword [esp + 0x14], eax
jg 0x412bac
mov eax, dword [esp + 0x14]
mov ebp, ecx
imul ebp, eax
test ebp, ebp
js 0x412bac
test edi, edi
js 0x412bac
je 0x4122b6
mov eax, 0x7fffffff
cdq
idiv edi
cmp ebp, eax
jg 0x412bac
test ecx, ecx
js 0x412bd1
je 0x4122d2
mov eax, 0x7fffffff
cdq
idiv ecx
cmp dword [esp + 0x14], eax
jg 0x412bd1
test ebp, ebp
js 0x412bd1
test edi, edi
js 0x412bd1
je 0x4122f4
mov eax, 0x7fffffff
cdq
idiv edi
cmp ebp, eax
jg 0x412bd1
imul ecx, edi
imul ecx, dword [esp + 0x14]
push ecx
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
mov edi, eax
add esp, 4
mov dword [esp + 0x10], edi
test edi, edi
je 0x412bd1
cmp dword [esp + 0x18], 0x10
jge 0x412656
xor edi, edi
test ebx, ebx
je 0x412b9a
cmp ebx, 0x100
jg 0x412b9a
xor ebp, ebp
test ebx, ebx
jle 0x41243f
mov eax, dword [esi + 0xa8]
mov ecx, dword [esi + 0xac]
cmp eax, ecx
jae 0x41235a
mov dl, byte [eax]
inc eax
mov dword [esi + 0xa8], eax
jmp 0x412381
cmp dword [esi + 0x20], edi
je 0x41237f
push esi
call fcn.0041d7f0
mov eax, dword [esi + 0xa8]
add esp, 4
mov ecx, dword [esi + 0xac]
mov dl, byte [eax]
inc eax
mov dword [esi + 0xa8], eax
jmp 0x412381
xor dl, dl
mov byte [esp + ebp*4 + 0x9a], dl
cmp eax, ecx
jae 0x412397
mov dl, byte [eax]
inc eax
mov dword [esi + 0xa8], eax
jmp 0x4123be
cmp dword [esi + 0x20], edi
je 0x4123bc
push esi
call fcn.0041d7f0
mov eax, dword [esi + 0xa8]
add esp, 4
mov ecx, dword [esi + 0xac]
mov dl, byte [eax]
inc eax
mov dword [esi + 0xa8], eax
jmp 0x4123be
xor dl, dl
mov byte [esp + ebp*4 + 0x99], dl
cmp eax, ecx
jae 0x4123d4
mov cl, byte [eax]
inc eax
mov dword [esi + 0xa8], eax
jmp 0x4123f5
cmp dword [esi + 0x20], edi
je 0x4123f3
push esi
call fcn.0041d7f0
mov eax, dword [esi + 0xa8]
add esp, 4
mov cl, byte [eax]
inc eax
mov dword [esi + 0xa8], eax
jmp 0x4123f5
xor cl, cl
cmp dword [esp + 0x4c], 0xc
mov byte [esp + ebp*4 + 0x98], cl
je 0x41242e
cmp eax, dword [esi + 0xac]
jae 0x412414
inc eax
mov dword [esi + 0xa8], eax
jmp 0x41242e
cmp dword [esi + 0x20], edi
je 0x41242e
push esi
call fcn.0041d7f0
add esp, 4
inc dword [esi + 0xa8]
mov eax, dword [esi + 0xa8]
mov byte [esp + ebp*4 + 0x9b], 0xff
inc ebp
cmp ebp, ebx
jl 0x412345
mov ecx, dword [esp + 0x48]
xor eax, eax
cmp dword [esp + 0x4c], 0xc
setne al
add eax, 3
imul eax, ebx
sub ecx, eax
sub ecx, dword [esp + 0x4c]
sub ecx, 0xe
push ecx
push esi
call fcn.0041dec0
mov eax, dword [esp + 0x20]
add esp, 8
cmp eax, 4
jne 0x412476
mov edx, dword [esi]
inc edx
shr edx, 1
jmp 0x412481
cmp eax, 8
jne 0x412b9e
mov edx, dword [esi]
mov ecx, dword [esi + 4]
neg edx
and edx, 3
xor ebx, ebx
mov dword [esp + 0x24], edx
mov dword [esp + 0x20], ebx
test ecx, ecx
jle 0x412a9f
nop dword [eax + eax]
xor ebp, ebp
cmp dword [esi], ebp
jle 0x412607
nop word [eax + eax]
mov eax, dword [esi + 0xa8]
cmp eax, dword [esi + 0xac]
jae 0x4124c9
mov cl, byte [eax]
inc eax
mov dword [esi + 0xa8], eax
jmp 0x412528
cmp dword [esi + 0x20], 0
je 0x412526
push dword [esi + 0x24]
mov eax, dword [esi + 0x10]
lea ebx, [esi + 0x28]
push ebx
push dword [esi + 0x1c]
call eax
add esp, 0xc
mov dword [esi + 0xa8], ebx
test eax, eax
jne 0x41250d
mov dword [esi + 0x20], eax
lea eax, [esi + 0x29]
mov dword [esi + 0xac], eax
mov eax, ebx
mov byte [eax], 0
mov eax, dword [esi + 0xa8]
mov cl, byte [eax]
inc eax
mov dword [esi + 0xa8], eax
jmp 0x412528
add eax, ebx
mov dword [esi + 0xac], eax
mov eax, dword [esi + 0xa8]
mov cl, byte [eax]
inc eax
mov dword [esi + 0xa8], eax
jmp 0x412528
xor cl, cl
xor edx, edx
movzx ecx, cl
cmp dword [esp + 0x18], 4
jne 0x41253c
mov edx, ecx
and edx, 0xf
shr ecx, 4
mov ebx, dword [esp + 0x10]
movzx eax, byte [esp + ecx*4 + 0x98]
mov byte [edi + ebx], al
movzx eax, byte [esp + ecx*4 + 0x99]
mov byte [edi + ebx + 1], al
movzx eax, byte [esp + ecx*4 + 0x9a]
mov byte [edi + ebx + 2], al
add edi, 3
cmp dword [esp + 0x14], 4
jne 0x412572
mov byte [edi + ebx], 0xff
inc edi
lea eax, [ebp + 1]
cmp eax, dword [esi]
je 0x4125ff
cmp dword [esp + 0x18], 8
jne 0x4125c2
mov eax, dword [esi + 0xa8]
cmp eax, dword [esi + 0xac]
jae 0x41259d
mov cl, byte [eax]
inc eax
mov dword [esi + 0xa8], eax
jmp 0x4125bf
cmp dword [esi + 0x20], 0
je 0x4125bd
push esi
call fcn.0041d7f0
mov eax, dword [esi + 0xa8]
add esp, 4
mov cl, byte [eax]
inc eax
mov dword [esi + 0xa8], eax
jmp 0x4125bf
xor cl, cl
movzx edx, cl
movzx eax, byte [esp + edx*4 + 0x98]
mov byte [edi + ebx], al
movzx eax, byte [esp + edx*4 + 0x99]
mov byte [edi + ebx + 1], al
movzx eax, byte [esp + edx*4 + 0x9a]
mov byte [edi + ebx + 2], al
add edi, 3
cmp dword [esp + 0x14], 4
jne 0x4125f4
mov byte [edi + ebx], 0xff
inc edi
add ebp, 2
cmp ebp, dword [esi]
jl 0x4124b0
mov edx, dword [esp + 0x24]
mov ebx, dword [esp + 0x20]
cmp dword [esi + 0x10], 0
je 0x41263b
mov eax, dword [esi + 0xac]
mov ecx, eax
sub ecx, dword [esi + 0xa8]
cmp ecx, edx
jge 0x41263b
mov dword [esi + 0xa8], eax
mov eax, edx
sub eax, ecx
push eax
push dword [esi + 0x1c]
mov eax, dword [esi + 0x14]
call eax
mov edx, dword [esp + 0x2c]
add esp, 8
jmp 0x412641
add dword [esi + 0xa8], edx
mov ecx, dword [esi + 4]
inc ebx
mov dword [esp + 0x20], ebx
cmp ebx, ecx
jl 0x4124a0
jmp 0x412a9f
xor eax, eax
xor ebp, ebp
mov dword [esp + 0x24], eax
xor ebx, ebx
mov dword [esp + 0x68], eax
mov dword [esp + 0x30], eax
mov eax, dword [esp + 0x48]
sub eax, dword [esp + 0x4c]
sub eax, 0xe
mov dword [esp + 0x34], ebp
push eax
push esi
mov dword [esp + 0x44], ebp
mov dword [esp + 0x28], ebp
mov dword [esp + 0x74], ebp
mov dword [esp + 0x40], ebp
mov dword [esp + 0x48], ebp
mov dword [esp + 0x24], ebx
call fcn.0041dec0
mov ecx, dword [esp + 0x20]
add esp, 8
cmp ecx, 0x18
jne 0x4126a9
mov eax, dword [esi]
lea eax, [eax + eax*2]
jmp 0x4126b6
cmp ecx, 0x10
jne 0x4126b4
mov eax, dword [esi]
add eax, eax
jmp 0x4126b6
xor eax, eax
mov edx, dword [esp + 0x54]
neg eax
and eax, 3
cmp ecx, 0x18
mov ecx, dword [esp + 0x58]
mov dword [esp + 0x80], eax
mov eax, dword [esp + 0x50]
jne 0x4126e1
mov edx, 1
mov dword [esp + 0x30], edx
jmp 0x4127ae
cmp dword [esp + 0x18], 0x20
jne 0x41271b
cmp ecx, 0xff
jne 0x41271b
cmp edx, 0xff00
jne 0x41271b
cmp eax, 0xff0000
jne 0x41271b
mov ebp, dword [esp + 0x5c]
cmp ebp, 0xff000000
jne 0x412737
mov edx, 2
xor ebp, ebp
mov dword [esp + 0x30], edx
jmp 0x4127ae
test eax, eax
je 0x412ba2
test edx, edx
je 0x412ba2
test ecx, ecx
je 0x412ba2
mov ebp, dword [esp + 0x5c]
push eax
call fcn.004171a0
push dword [esp + 0x54]
sub eax, 7
mov dword [esp + 0x3c], eax
call fcn.00412120
push dword [esp + 0x5c]
mov dword [esp + 0x44], eax
call fcn.004171a0
push dword [esp + 0x60]
sub eax, 7
mov dword [esp + 0x4c], eax
call fcn.00412120
push dword [esp + 0x68]
mov dword [esp + 0x54], eax
call fcn.004171a0
push dword [esp + 0x6c]
sub eax, 7
mov dword [esp + 0x38], eax
call fcn.00412120
push ebp
mov dword [esp + 0x40], eax
call fcn.004171a0
sub eax, 7
push ebp
mov dword [esp + 0x8c], eax
call fcn.00412120
mov ebp, dword [esp + 0x54]
add esp, 0x20
mov dword [esp + 0x68], eax
xor edx, edx
mov ecx, dword [esi + 4]
mov dword [esp + 0x2c], ebx
test ecx, ecx
jle 0x412a9f
mov eax, ebp
neg eax
mov dword [esp + 0x74], eax
mov eax, dword [esp + 0x3c]
neg eax
mov dword [esp + 0x78], eax
mov eax, dword [esp + 0x20]
neg eax
mov dword [esp + 0x7c], eax
nop dword [eax]
mov eax, dword [esi]
test edx, edx
je 0x41292a
xor ebp, ebp
test eax, eax
jle 0x412a77
nop dword [eax]
nop dword [eax + eax]
mov eax, dword [esi + 0xa8]
cmp eax, dword [esi + 0xac]
jae 0x412819
mov cl, byte [eax]
inc eax
mov dword [esi + 0xa8], eax
jmp 0x41283b
cmp dword [esi + 0x20], 0
je 0x412839
push esi
call fcn.0041d7f0
mov eax, dword [esi + 0xa8]
add esp, 4
mov cl, byte [eax]
inc eax
mov dword [esi + 0xa8], eax
jmp 0x41283b
xor cl, cl
mov byte [edi + ebx + 2], cl
mov eax, dword [esi + 0xa8]
cmp eax, dword [esi + 0xac]
jae 0x412858
mov cl, byte [eax]
inc eax
mov dword [esi + 0xa8], eax
jmp 0x41287a
cmp dword [esi + 0x20], 0
je 0x412878
push esi
call fcn.0041d7f0
mov eax, dword [esi + 0xa8]
add esp, 4
mov cl, byte [eax]
inc eax
mov dword [esi + 0xa8], eax
jmp 0x41287a
xor cl, cl
mov byte [edi + ebx + 1], cl
mov eax, dword [esi + 0xa8]
cmp eax, dword [esi + 0xac]
jae 0x412897
mov cl, byte [eax]
inc eax
mov dword [esi + 0xa8], eax
jmp 0x4128b9
cmp dword [esi + 0x20], 0
je 0x4128b7
push esi
call fcn.0041d7f0
mov eax, dword [esi + 0xa8]
add esp, 4
mov cl, byte [eax]
inc eax
mov dword [esi + 0xa8], eax
jmp 0x4128b9
xor cl, cl
mov byte [ebx + edi], cl
add ebx, 3
cmp dword [esp + 0x30], 2
jne 0x412903
mov eax, dword [esi + 0xa8]
cmp eax, dword [esi + 0xac]
jae 0x4128df
mov cl, byte [eax]
inc eax
mov dword [esi + 0xa8], eax
jmp 0x412906
cmp dword [esi + 0x20], 0
je 0x4128ff
push esi
call fcn.0041d7f0
mov eax, dword [esi + 0xa8]
add esp, 4
mov cl, byte [eax]
inc eax
mov dword [esi + 0xa8], eax
jmp 0x412906
xor cl, cl
jmp 0x412906
or cl, 0xff
movzx eax, cl
or dword [esp + 0x28], eax
cmp dword [esp + 0x14], 4
jne 0x412918
mov byte [ebx + edi], cl
inc ebx
inc ebp
cmp ebp, dword [esi]
jl 0x412800
mov dword [esp + 0x1c], ebx
jmp 0x412a77
mov dword [esp + 0x70], 0
test eax, eax
jle 0x412a77
nop word [eax + eax]
push esi
call fcn.00415650
add esp, 4
mov ebp, eax
cmp dword [esp + 0x18], 0x10
je 0x412960
push esi
call fcn.00415650
shl eax, 0x10
add esp, 4
add ebp, eax
mov ebx, dword [esp + 0x34]
mov edx, ebp
and edx, dword [esp + 0x50]
mov ecx, ebx
mov eax, edx
sar eax, cl
mov ecx, dword [esp + 0x74]
shl edx, cl
test ebx, ebx
mov ecx, dword [esp + 0x38]
cmovns edx, eax
mov ebx, edx
cmp ecx, 8
jge 0x412999
mov edi, ecx
mov eax, edx
sar eax, cl
add ecx, edi
add ebx, eax
cmp ecx, 8
jl 0x412988
mov edi, dword [esp + 0x10]
mov eax, dword [esp + 0x1c]
mov edx, dword [esp + 0x3c]
mov ecx, edx
mov byte [eax + edi], bl
mov edi, ebp
and edi, dword [esp + 0x54]
mov ebx, eax
mov eax, edi
sar eax, cl
mov ecx, dword [esp + 0x78]
shl edi, cl
test edx, edx
mov ecx, dword [esp + 0x40]
cmovns edi, eax
mov edx, edi
cmp ecx, 8
jge 0x4129e1
mov esi, ecx
nop word [eax + eax]
mov eax, edi
sar eax, cl
add ecx, esi
add edx, eax
cmp ecx, 8
jl 0x4129d0
mov esi, dword [esp + 0x64]
mov ecx, dword [esp + 0x10]
mov edi, ebp
and edi, dword [esp + 0x58]
mov eax, edi
mov byte [ebx + ecx + 1], dl
mov edx, dword [esp + 0x20]
mov ecx, edx
sar eax, cl
mov ecx, dword [esp + 0x7c]
shl edi, cl
test edx, edx
mov ecx, dword [esp + 0x24]
cmovns edi, eax
mov edx, edi
cmp ecx, 8
jge 0x412a22
mov esi, ecx
mov eax, edi
sar eax, cl
add ecx, esi
add edx, eax
cmp ecx, 8
jl 0x412a11
mov esi, dword [esp + 0x64]
mov edi, dword [esp + 0x10]
mov eax, dword [esp + 0x5c]
mov byte [ebx + edi + 2], dl
add ebx, 3
mov dword [esp + 0x1c], ebx
test eax, eax
je 0x412a4e
push dword [esp + 0x68]
and ebp, eax
push dword [esp + 0x70]
push ebp
call fcn.0041de80
add esp, 0xc
jmp 0x412a53
mov eax, 0xff
or dword [esp + 0x28], eax
cmp dword [esp + 0x14], 4
jne 0x412a66
mov byte [ebx + edi], al
inc ebx
mov dword [esp + 0x1c], ebx
mov eax, dword [esp + 0x70]
inc eax
mov dword [esp + 0x70], eax
cmp eax, dword [esi]
jl 0x412940
push dword [esp + 0x80]
push esi
call fcn.0041dec0
mov eax, dword [esp + 0x34]
add esp, 8
mov ecx, dword [esi + 4]
inc eax
mov edx, dword [esp + 0x30]
mov dword [esp + 0x2c], eax
cmp eax, ecx
jl 0x4127e0
mov edi, dword [esp + 0x14]
mov edx, dword [esp + 0x10]
cmp edi, 4
jne 0x412acc
cmp dword [esp + 0x28], 0
jne 0x412acc
mov eax, dword [esi]
imul eax, ecx
lea eax, [eax*4 - 1]
test eax, eax
js 0x412acc
mov byte [eax + edx], 0xff
sub eax, 4
jns 0x412ac3
cmp dword [esp + 0x84], 0
jle 0x412b46
mov ecx, dword [esi + 4]
xor ebp, ebp
mov dword [esp + 0x2c], ebp
test ecx, 0xfffffffe
jle 0x412b46
mov eax, dword [esi]
sub ecx, ebp
dec ecx
mov ebx, eax
imul ecx, eax
imul eax, dword [esp + 0x14]
imul ebx, ebp
imul ecx, edi
imul ebx, edi
xor edi, edi
add edx, ecx
test eax, eax
jle 0x412b2e
mov ebp, dword [esp + 0x14]
sub ebx, ecx
nop dword [eax]
mov al, byte [edx]
lea edx, [edx + 1]
mov cl, byte [ebx + edx - 1]
inc edi
mov byte [ebx + edx - 1], al
mov byte [edx - 1], cl
mov eax, dword [esi]
imul eax, ebp
cmp edi, eax
jl 0x412b10
mov ebp, dword [esp + 0x2c]
mov ecx, dword [esi + 4]
inc ebp
mov edx, dword [esp + 0x10]
mov eax, ecx
mov edi, dword [esp + 0x14]
sar eax, 1
mov dword [esp + 0x2c], ebp
cmp ebp, eax
jl 0x412ae7
mov eax, dword [esp + 0x88]
mov ecx, dword [esp + 0x10]
test eax, eax
je 0x412b6f
cmp eax, edi
je 0x412b6f
push dword [esi + 4]
push dword [esi]
push eax
push edi
push ecx
call fcn.00413920
mov ecx, eax
add esp, 0x14
test ecx, ecx
je 0x412bb6
mov edx, dword [esp + 0x8c]
mov eax, dword [esi]
mov dword [edx], eax
mov edx, dword [esp + 0x90]
mov eax, dword [esi + 4]
mov dword [edx], eax
mov edx, dword [esp + 0x94]
test edx, edx
je 0x412b96
mov eax, dword [esi + 8]
mov dword [edx], eax
mov eax, ecx
jmp 0x412bb8
mov edi, eax
jmp 0x412ba2
mov edi, dword [esp + 0x10]
push edi
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
add esp, 4
mov dword [0x49ddd0], str.Corrupt_BMP
xor eax, eax
mov ecx, dword [esp + 0x498]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.00478d37
add esp, 0x48c
ret
mov dword [0x49ddd0], str.Out_of_memory
jmp 0x412bb6