Function at 0x140013390
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push rbx
push rbp
push rsi
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x88
mov rax, qword [0x1400f6240]
xor rax, rsp
mov qword [rsp + 0x70], rax
mov rax, qword [rcx + 0xc0]
mov rbx, rcx
mov qword [rsp + 0x38], r9
mov qword [rsp + 0x40], r8
mov qword [rsp + 0x60], rdx
cmp rax, qword [rcx + 0xc8]
jae 0x1400133e4
movzx edx, byte [rax]
inc rax
mov qword [rcx + 0xc0], rax
jmp 0x140013407
cmp dword [rcx + 0x30], 0
je 0x140013405
call fcn.140007e20
mov rax, qword [rbx + 0xc0]
movzx edx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140013407
xor dl, dl
mov ecx, 0x30
mov r8, rbx
lea rsi, [rcx + rbx]
movzx ecx, dl
mov dword [rsp + 0x24], ecx
cmp rax, qword [rbx + 0xc8]
jae 0x140013436
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
mov byte [rsp + 0x20], cl
jmp 0x140013462
cmp dword [rsi], 0
je 0x14001345d
mov rcx, rbx
call fcn.140007e20
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
mov byte [rsp + 0x20], cl
jmp 0x140013462
mov byte [rsp + 0x20], 0
cmp rax, qword [rbx + 0xc8]
jae 0x14001347a
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x14001349f
cmp dword [rsi], 0
je 0x14001349d
mov rcx, rbx
call fcn.140007e20
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x14001349f
xor cl, cl
movzx eax, cl
mov rcx, rbx
mov dword [rsp + 0x2c], eax
mov r12d, eax
call fcn.140008030
mov rcx, rbx
movsxd r15, eax
call fcn.140008030
mov rcx, qword [rbx + 0xc0]
mov dword [rsp + 0x50], eax
cmp rcx, qword [rbx + 0xc8]
jae 0x1400134df
movzx edx, byte [rcx]
inc rcx
mov qword [rbx + 0xc0], rcx
jmp 0x140013504
cmp dword [rsi], 0
je 0x140013502
mov rcx, rbx
call fcn.140007e20
mov rax, qword [rbx + 0xc0]
movzx edx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140013504
xor dl, dl
mov rcx, rbx
movzx edi, dl
call fcn.140008030
mov rcx, rbx
call fcn.140008030
mov rcx, rbx
call fcn.140008030
mov rcx, rbx
mov dword [rsp + 0x30], eax
call fcn.140008030
mov ebp, eax
mov dword [rsp + 0x28], eax
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x140013550
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140013575
cmp dword [rsi], 0
je 0x140013573
mov rcx, rbx
call fcn.140007e20
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140013575
xor cl, cl
movzx edx, cl
mov dword [rsp + 0x58], edx
cmp rax, qword [rbx + 0xc8]
jae 0x140013594
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x1400135bd
cmp dword [rsi], 0
je 0x1400135bb
mov rcx, rbx
call fcn.140007e20
mov rax, qword [rbx + 0xc0]
mov edx, dword [rsp + 0x58]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x1400135bd
xor cl, cl
xor r14d, r14d
movzx eax, cl
mov qword [rsp + 0x48], r14
mov dword [rsp + 0x6c], r14d
mov dword [rsp + 0x54], r14d
lea r13d, [r14 + 1]
cmp ebp, 0x1000000
jg 0x140013dad
mov r8d, dword [rsp + 0x30]
cmp r8d, 0x1000000
jg 0x140013dad
cmp r12d, 8
jb 0x1400135fe
sub r12d, 8
shr eax, 5
mov ecx, r13d
and eax, r13d
mov ebp, r14d
sub ecx, eax
mov dword [rsp + 0x5c], ecx
cmp byte [rsp + 0x20], r14b
je 0x140013639
mov ecx, edi
sub ecx, 8
je 0x140013634
sub ecx, 7
je 0x140013682
sub ecx, r13d
je 0x140013682
sub ecx, 8
je 0x140013656
cmp ecx, 8
jne 0x14001365d
jmp 0x140013656
mov edi, r13d
jmp 0x140013659
mov ecx, edx
sub ecx, 8
je 0x14001368c
sub ecx, 7
je 0x140013682
sub ecx, r13d
je 0x140013675
sub ecx, 8
je 0x140013654
cmp ecx, 8
jne 0x14001365d
mov edi, edx
shr edi, 3
test edi, edi
jne 0x14001368f
mov rax, qword gs:[0x58]
mov rcx, qword [rax]
lea rax, str.bad_format
jmp 0x140013dc0
cmp r12d, 3
jne 0x140013682
lea edi, [r12 - 1]
jmp 0x14001368f
mov ebp, r13d
mov edi, 3
jmp 0x14001368f
mov edi, r13d
mov rax, qword [rsp + 0x60]
mov r12d, dword [rsp + 0x28]
mov dword [rax], r8d
mov rax, qword [rsp + 0x40]
mov dword [rax], r12d
mov rax, qword [rsp + 0x38]
test rax, rax
je 0x1400136b0
mov dword [rax], edi
test r8d, r8d
js 0x140013dad
test r12d, r12d
js 0x140013dad
je 0x1400136d6
mov eax, 0x7fffffff
cdq
idiv r12d
cmp r8d, eax
jg 0x140013dad
mov ecx, r12d
imul ecx, r8d
test ecx, ecx
js 0x140013dad
xor edx, edx
mov eax, 0x7fffffff
div edi
cmp ecx, eax
jg 0x140013dad
test r12d, r12d
je 0x14001370d
mov eax, 0x7fffffff
cdq
idiv r12d
cmp r8d, eax
jg 0x140013d98
mov eax, r12d
imul eax, edi
imul eax, r8d
movsxd rcx, eax
call qword [sym.imp.ucrtbased.dll_malloc]
mov qword [rsp + 0x40], rax
mov rsi, rax
test rax, rax
je 0x140013d98
movsxd rdx, dword [rsp + 0x24]
test edx, edx
je 0x140013770
cmp qword [rbx + 0x10], r14
je 0x140013769
mov ecx, dword [rbx + 0xc8]
sub ecx, dword [rbx + 0xc0]
cmp ecx, edx
jge 0x140013769
mov rax, qword [rbx + 0xc8]
sub edx, ecx
mov rcx, qword [rbx + 0x28]
mov qword [rbx + 0xc0], rax
call qword [rbx + 0x18]
jmp 0x140013770
add qword [rbx + 0xc0], rdx
cmp byte [rsp + 0x20], r14b
jne 0x140013834
mov edx, dword [rsp + 0x2c]
mov r15d, edi
mov dword [rsp + 0x24], ebp
mov dword [rsp + 0x38], edi
cmp edx, 8
jae 0x140013a5f
mov dword [rsp + 0x24], ebp
mov dword [rsp + 0x38], edi
test ebp, ebp
jne 0x140013a5f
mov r13d, ebp
test r12d, r12d
jle 0x140013d48
imul r15d, dword [rsp + 0x30]
cmp dword [rsp + 0x5c], r14d
je 0x140013804
mov ecx, dword [rsp + 0x28]
mov eax, r15d
neg eax
mov r14d, ecx
movsxd r12, eax
lea eax, [rcx - 1]
imul eax, edi
imul eax, dword [rsp + 0x30]
movsxd rsi, eax
add rsi, qword [rsp + 0x40]
nop
mov r8d, r15d
mov rdx, rsi
mov rcx, rbx
call fcn.140007ea0
add rsi, r12
sub r14, 1
jne 0x1400137e0
mov r12d, dword [rsp + 0x28]
mov r15d, edi
jmp 0x140013d43
mov r14d, dword [rsp + 0x28]
movsxd r12, r15d
nop dword [rax]
mov r8d, r15d
mov rdx, rsi
mov rcx, rbx
call fcn.140007ea0
add rsi, r12
sub r14, 1
jne 0x140013810
mov r12d, dword [rsp + 0x28]
mov r15d, edi
jmp 0x140013d43
cmp dword [rsp + 0x50], r14d
jne 0x14001385c
mov rcx, rsi
call qword [sym.imp.ucrtbased.dll_free]
mov rax, qword gs:[0x58]
mov rcx, qword [rax]
lea rax, str.bad_palette
jmp 0x140013dc0
test r15d, r15d
je 0x1400138ae
jns 0x140013873
mov rax, qword [rbx + 0xc8]
mov qword [rbx + 0xc0], rax
jmp 0x1400138ae
cmp qword [rbx + 0x10], r14
je 0x1400138a7
mov ecx, dword [rbx + 0xc8]
sub ecx, dword [rbx + 0xc0]
cmp ecx, r15d
jge 0x1400138a7
mov rax, qword [rbx + 0xc8]
sub r15d, ecx
mov rcx, qword [rbx + 0x28]
mov edx, r15d
mov qword [rbx + 0xc0], rax
call qword [rbx + 0x18]
jmp 0x1400138ae
add qword [rbx + 0xc0], r15
mov r15d, dword [rsp + 0x50]
test r15d, r15d
js 0x140013d8f
xor edx, edx
mov eax, 0x7fffffff
div edi
cmp r15d, eax
jg 0x140013d8f
mov esi, edi
imul esi, r15d
movsxd rcx, esi
call qword [sym.imp.ucrtbased.dll_malloc]
mov qword [rsp + 0x48], rax
test rax, rax
je 0x140013d8a
test ebp, ebp
je 0x140013a28
mov rsi, rax
cmp edi, 3
je 0x140013915
mov r8d, 0x1743
lea rdx, str.C:TomProgrammierenSkyEngine_templatesWindowsTemplatedependencies_stb_stb_image.h
lea rcx, str.tga_comp__STBI_rgb
call qword [sym.imp.ucrtbased.dll__wassert]
mov dword [rsp + 0x24], ebp
mov dword [rsp + 0x38], edi
test r15d, r15d
jle 0x140013a20
mov r12d, edi
nop dword [rax]
mov rcx, rbx
call fcn.140008030
movzx r8d, ax
mov eax, r8d
shr eax, 0xa
and eax, 0x1f
imul ecx, eax, 0xff
mov eax, 0x84210843
imul ecx
add edx, ecx
sar edx, 4
mov eax, edx
shr eax, 0x1f
add edx, eax
mov eax, r8d
shr eax, 5
and r8d, 0x1f
and eax, 0x1f
mov byte [rsi], dl
imul ecx, eax, 0xff
mov eax, 0x84210843
imul ecx
add edx, ecx
imul ecx, r8d, 0xff
sar edx, 4
mov eax, edx
shr eax, 0x1f
add edx, eax
mov eax, 0x84210843
mov byte [rsi + 1], dl
imul ecx
add edx, ecx
sar edx, 4
mov eax, edx
shr eax, 0x1f
add edx, eax
mov byte [rsi + 2], dl
add rsi, r12
sub r15, r13
jne 0x140013930
mov r12d, dword [rsp + 0x28]
mov r15d, edi
mov rdi, qword [rsp + 0x48]
mov edx, dword [rsp + 0x2c]
mov ecx, dword [rsp + 0x30]
mov eax, r12d
imul eax, ecx
mov esi, r15d
test eax, eax
je 0x140013cb6
mov r12, qword [rsp + 0x40]
lea r8, [rsp + 0x6c]
sub r12, r8
movsxd rcx, r15d
mov qword [rsp + 0x60], rax
mov ebp, r14d
nop dword [rax]
cmp edx, 8
jb 0x140013ab0
test ebp, ebp
jne 0x140013aa0
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x140013a67
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140013a8d
mov r15d, edi
mov rdi, rsi
jmp 0x1400139bb
mov r15d, edi
mov dword [rsp + 0x38], edi
mov r8d, esi
mov dword [rsp + 0x24], ebp
mov rdx, rax
mov rcx, rbx
mov rdi, rax
call fcn.140007ea0
test eax, eax
jne 0x1400139bb
mov rcx, qword [rsp + 0x40]
call qword [sym.imp.ucrtbased.dll_free]
mov rcx, rdi
jmp 0x14001383e
mov rdi, r14
jmp 0x1400139bf
cmp dword [rbx + 0x30], r14d
je 0x140013a8b
mov rcx, rbx
call fcn.140007e20
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140013a8d
xor cl, cl
movzx eax, cl
mov ebp, eax
and ebp, 0x7f
inc ebp
shr eax, 7
mov dword [rsp + 0x54], eax
jmp 0x140013ab0
cmp dword [rsp + 0x54], r14d
je 0x140013ab0
test r13d, r13d
je 0x140013c5c
cmp byte [rsp + 0x20], r14b
je 0x140013b49
cmp dword [rsp + 0x58], 8
jne 0x140013b12
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x140013ae4
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
movzx eax, cl
jmp 0x140013b1a
cmp dword [rbx + 0x30], r14d
je 0x140013b0b
mov rcx, rbx
call fcn.140007e20
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
movzx eax, cl
jmp 0x140013b1a
xor cl, cl
movzx eax, cl
jmp 0x140013b1a
mov rcx, rbx
call fcn.140008030
test r15d, r15d
je 0x140013c51
cmp eax, dword [rsp + 0x50]
mov ecx, r14d
mov r8, rsi
cmovl ecx, eax
imul ecx, r15d
movsxd rdx, ecx
lea rcx, [rsp + 0x6c]
add rdx, rdi
call sub.VCRUNTIME140D.dll_memcpy
jmp 0x140013c51
cmp dword [rsp + 0x24], r14d
je 0x140013bf0
cmp r15d, 3
je 0x140013b74
mov r8d, 0x1774
lea rdx, str.C:TomProgrammierenSkyEngine_templatesWindowsTemplatedependencies_stb_stb_image.h
lea rcx, str.tga_comp__STBI_rgb
call qword [sym.imp.ucrtbased.dll__wassert]
mov rcx, rbx
call fcn.140008030
movzx r8d, ax
mov eax, r8d
shr eax, 0xa
and eax, 0x1f
imul ecx, eax, 0xff
mov eax, 0x84210843
imul ecx
add edx, ecx
sar edx, 4
mov eax, edx
shr eax, 0x1f
add edx, eax
mov eax, r8d
shr eax, 5
and r8d, 0x1f
and eax, 0x1f
mov byte [rsp + 0x6c], dl
imul ecx, eax, 0xff
mov eax, 0x84210843
imul ecx
add edx, ecx
imul ecx, r8d, 0xff
sar edx, 4
mov eax, edx
shr eax, 0x1f
add edx, eax
mov eax, 0x84210843
mov byte [rsp + 0x6d], dl
imul ecx
add edx, ecx
sar edx, 4
mov eax, edx
shr eax, 0x1f
add edx, eax
mov byte [rsp + 0x6e], dl
jmp 0x140013c51
mov rdi, r14
test r15d, r15d
je 0x140013c51
nop dword [rax + rax]
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x140013c1f
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140013c45
cmp dword [rbx + 0x30], r14d
je 0x140013c43
mov rcx, rbx
call fcn.140007e20
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140013c45
xor cl, cl
mov byte [rsp + rdi + 0x6c], cl
inc rdi
cmp rdi, rsi
jl 0x140013c00
mov rax, qword [rsp + 0x60]
mov r13d, r14d
movsxd rcx, r15d
mov rdi, r14
test r15d, r15d
je 0x140013c90
lea rcx, [rsp + 0x6c]
mov r8, rsi
add rcx, r12
lea rdx, [rsp + 0x6c]
call sub.VCRUNTIME140D.dll_memcpy
nop dword [rax]
inc rdi
cmp rdi, rsi
jl 0x140013c80
mov rax, qword [rsp + 0x60]
movsxd rcx, r15d
mov rdi, qword [rsp + 0x48]
dec ebp
mov edx, dword [rsp + 0x2c]
add r12, rcx
sub rax, 1
mov qword [rsp + 0x60], rax
jne 0x1400139f0
mov r12d, dword [rsp + 0x28]
mov ecx, dword [rsp + 0x30]
cmp dword [rsp + 0x5c], r14d
je 0x140013d2e
test r12d, r12d
jle 0x140013d2e
mov r11d, r15d
lea r10d, [r12 - 1]
imul r10d, r15d
mov ebx, r14d
mov r15, qword [rsp + 0x40]
imul r11d, ecx
imul r10d, ecx
nop
mov r8d, r11d
test r11d, r11d
jle 0x140013d1a
movsxd rax, ebx
movsxd r9, r10d
sub r9, rax
lea rdx, [rax + r15]
nop word [rax + rax]
movzx eax, byte [rdx + r9]
dec r8d
movzx ecx, byte [rdx]
mov byte [rdx], al
mov byte [rdx + r9], cl
lea rdx, [rdx + 1]
test r8d, r8d
jg 0x140013d00
add ebx, r11d
sub r10d, r11d
add r14d, 2
cmp r14d, r12d
jl 0x140013ce0
mov r15d, dword [rsp + 0x38]
mov rcx, qword [rsp + 0x48]
test rcx, rcx
je 0x140013d3e
call qword [sym.imp.ucrtbased.dll_free]
mov r13d, dword [rsp + 0x24]
mov rsi, qword [rsp + 0x40]
cmp r15d, 3
jb 0x140013d85
test r13d, r13d
jne 0x140013d85
imul r12d, dword [rsp + 0x30]
mov rdx, rsi
test r12d, r12d
je 0x140013d85
mov r9d, r15d
mov r8d, r12d
nop word [rax + rax]
movzx ecx, byte [rdx]
movzx eax, byte [rdx + 2]
mov byte [rdx], al
mov byte [rdx + 2], cl
add rdx, r9
sub r8, 1
jne 0x140013d70
mov rax, rsi
jmp 0x140013dcb
mov rsi, qword [rsp + 0x40]
mov rcx, rsi
call qword [sym.imp.ucrtbased.dll_free]
mov rax, qword gs:[0x58]
mov rcx, qword [rax]
lea rax, str.outofmem
jmp 0x140013dc0
mov rax, qword gs:[0x58]
mov rcx, qword [rax]
lea rax, str.too_large
mov edx, 0x28
mov qword [rdx + rcx], rax
xor eax, eax
mov rcx, qword [rsp + 0x70]
xor rcx, rsp
call fcn.14009a7a0
add rsp, 0x88
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbp
pop rbx
ret