Function at 0x4079d0
Capabilities:
Access peb ldr_data
Encrypt data using rc4 ksa

Disassembly:
sub esp, 0x10
push ebx
mov ebx, dword [esp + 0x24]
push ebp
mov ebp, dword [esp + 0x2c]
push esi
mov esi, dword [esp + 0x28]
cmp esi, dword [esp + 0x24]
jne 0x4079f3
mov eax, dword [esp + 0x20]
pop esi
pop ebp
pop ebx
add esp, 0x10
ret
push edi
cmp esi, 1
jl 0x4079fe
cmp esi, 4
jle 0x407a1d
push 0x6e1
push str.v:kacat_bfclient_tga2png_stb_image.h
push str.req_comp___1__req_comp___4
call fcn.00422216
add esp, 0xc
test esi, esi
js 0x407db0
test ebx, ebx
js 0x407db0
je 0x407a38
xor edx, edx
mov eax, 0x7fffffff
div ebx
cmp esi, eax
jg 0x407db0
mov ecx, esi
imul ecx, ebx
mov dword [esp + 0x1c], ecx
test ecx, ecx
js 0x407db0
test ebp, ebp
js 0x407db0
je 0x407a64
xor edx, edx
mov eax, 0x7fffffff
div ebp
cmp ecx, eax
jg 0x407db0
mov eax, ecx
imul eax, ebp
push eax
call fcn.0041d0fe
mov edi, eax
add esp, 4
mov dword [esp + 0x18], edi
test edi, edi
je 0x407db0
mov ecx, dword [esp + 0x24]
mov dword [esp + 0x2c], 0
test ebp, ebp
jle 0x407d51
mov eax, dword [esp + 0x28]
mov dword [esp + 0x10], ecx
lea ebp, [eax*8 - 0xa]
add ebp, esi
imul eax, ebx
mov dword [esp + 0x28], eax
mov eax, edi
mov dword [esp + 0x14], eax
mov esi, ecx
cmp ebp, 0x19
ja case.0x407ac4.3
movzx ecx, byte [ebp + 0x407e14]
jmp dword [ecx*4 + 0x407de0]
lea edx, [ebx - 1]
test edx, edx
js 0x407d1e
sub edx, 1
mov cl, byte [esi]
mov byte [eax], cl
lea esi, [esi + 1]
mov byte [eax + 1], 0xff
lea eax, [eax + 2]
jns 0x407ad6
jmp 0x407d1e
lea edx, [ebx - 1]
test edx, edx
js 0x407d1e
nop dword [eax]
sub edx, 1
mov cl, byte [esi]
mov byte [eax + 2], cl
lea esi, [esi + 1]
mov byte [eax + 1], cl
lea eax, [eax + 3]
mov byte [eax - 3], cl
jns 0x407b00
jmp 0x407d1e
lea edx, [ebx - 1]
test edx, edx
js 0x407d1e
sub edx, 1
mov cl, byte [esi]
mov byte [eax + 2], cl
lea esi, [esi + 1]
mov byte [eax + 1], cl
lea eax, [eax + 4]
mov byte [eax - 4], cl
mov byte [eax - 1], 0xff
jns 0x407b26
jmp 0x407d1e
lea edx, [ebx - 1]
test edx, edx
js 0x407d1e
sub edx, 1
mov cl, byte [esi]
mov byte [eax], cl
lea esi, [esi + 2]
lea eax, [eax + 1]
jns 0x407b50
jmp 0x407d1e
lea edx, [ebx - 1]
test edx, edx
js 0x407d1e
nop
sub edx, 1
mov cl, byte [esi]
mov byte [eax + 2], cl
lea esi, [esi + 2]
mov byte [eax + 1], cl
lea eax, [eax + 3]
mov byte [eax - 3], cl
jns 0x407b70
jmp 0x407d1e
lea edx, [ebx - 1]
test edx, edx
js 0x407d1e
sub edx, 1
mov cl, byte [esi]
mov byte [eax + 2], cl
lea esi, [esi + 2]
mov byte [eax + 1], cl
lea eax, [eax + 4]
mov byte [eax - 4], cl
movzx ecx, byte [esi - 1]
mov byte [eax - 1], cl
jns 0x407b96
jmp 0x407d1e
lea edx, [ebx - 1]
test edx, edx
js 0x407d1e
sub edx, 1
movzx ecx, byte [esi]
mov byte [eax], cl
lea esi, [esi + 3]
movzx ecx, byte [esi - 2]
lea eax, [eax + 4]
mov byte [eax - 3], cl
movzx ecx, byte [esi - 1]
mov byte [eax - 2], cl
mov byte [eax - 1], 0xff
jns 0x407bc3
jmp 0x407d1e
lea edi, [ebx - 1]
test edi, edi
js 0x407d1e
nop word [eax + eax]
movzx ecx, byte [esi + 1]
lea esi, [esi + 3]
imul edx, ecx, 0x96
lea eax, [eax + 1]
movzx ecx, byte [esi - 1]
imul ecx, ecx, 0x1d
add edx, ecx
movzx ecx, byte [esi - 3]
imul ecx, ecx, 0x4d
add edx, ecx
shr edx, 8
sub edi, 1
mov byte [eax - 1], dl
jns 0x407c00
jmp 0x407d1e
lea edi, [ebx - 1]
test edi, edi
js 0x407d1e
nop dword [eax]
movzx ecx, byte [esi + 1]
lea esi, [esi + 3]
imul edx, ecx, 0x96
lea eax, [eax + 2]
movzx ecx, byte [esi - 1]
imul ecx, ecx, 0x1d
add edx, ecx
movzx ecx, byte [esi - 3]
imul ecx, ecx, 0x4d
mov byte [eax - 1], 0xff
add edx, ecx
shr edx, 8
sub edi, 1
mov byte [eax - 2], dl
jns 0x407c40
jmp 0x407d1e
lea edi, [ebx - 1]
test edi, edi
js 0x407d1e
movzx ecx, byte [esi + 1]
lea esi, [esi + 4]
imul edx, ecx, 0x96
lea eax, [eax + 1]
movzx ecx, byte [esi - 2]
imul ecx, ecx, 0x1d
add edx, ecx
movzx ecx, byte [esi - 4]
imul ecx, ecx, 0x4d
add edx, ecx
shr edx, 8
sub edi, 1
mov byte [eax - 1], dl
jns 0x407c81
jmp 0x407d1e
lea edi, [ebx - 1]
test edi, edi
js 0x407d1e
nop word [eax + eax]
movzx ecx, byte [esi + 1]
lea esi, [esi + 4]
imul edx, ecx, 0x96
lea eax, [eax + 2]
movzx ecx, byte [esi - 2]
imul ecx, ecx, 0x1d
add edx, ecx
movzx ecx, byte [esi - 4]
imul ecx, ecx, 0x4d
add edx, ecx
shr edx, 8
sub edi, 1
mov byte [eax - 2], dl
mov cl, byte [esi - 1]
mov byte [eax - 1], cl
jns 0x407cc0
jmp 0x407d1e
lea edx, [ebx - 1]
test edx, edx
js 0x407d1e
nop dword [eax]
sub edx, 1
movzx ecx, byte [esi]
mov byte [eax], cl
lea esi, [esi + 4]
movzx ecx, byte [esi - 3]
lea eax, [eax + 3]
mov byte [eax - 2], cl
movzx ecx, byte [esi - 2]
mov byte [eax - 1], cl
jns 0x407d00
mov esi, dword [esp + 0x2c]
mov ecx, dword [esp + 0x10]
inc esi
mov eax, dword [esp + 0x14]
add ecx, dword [esp + 0x28]
add eax, dword [esp + 0x1c]
mov dword [esp + 0x2c], esi
mov dword [esp + 0x10], ecx
mov dword [esp + 0x14], eax
cmp esi, dword [esp + 0x34]
jl 0x407ab2
mov edi, dword [esp + 0x18]
mov ecx, dword [esp + 0x24]
push ecx
call fcn.0041d0e3
add esp, 4
mov eax, edi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x10
ret
push 0x6fe
push str.v:kacat_bfclient_tga2png_stb_image.h
push 0x43a9f4
call fcn.00422216
push dword [esp + 0x30]
call fcn.0041d0e3
push dword [esp + 0x28]
call fcn.0041d0e3
mov ecx, dword [0x44b8a8]
add esp, 0x14
mov eax, dword fs:[0x2c]
pop edi
mov eax, dword [eax + ecx*4]
pop esi
pop ebp
pop ebx
mov dword [eax + 0xc], str.unsupported
xor eax, eax
add esp, 0x10
ret
push dword [esp + 0x24]
call fcn.0041d0e3
mov ecx, dword [0x44b8a8]
add esp, 4
mov eax, dword fs:[0x2c]
pop edi
mov eax, dword [eax + ecx*4]
pop esi
pop ebp
pop ebx
mov dword [eax + 0xc], str.outofmem
xor eax, eax
add esp, 0x10
ret