Function at 0x140015520
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
mov qword [rsp + 0x20], rbx
push rbp
push rsi
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x90
mov rax, qword [0x14017b088]
xor rax, rsp
mov qword [rsp + 0x80], rax
mov rax, qword [rcx + 0xc0]
mov rbx, rcx
mov rcx, qword [rcx + 0xc8]
mov rsi, r8
mov rdi, rdx
cmp rax, rcx
jae 0x140015574
movzx edx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x1400155a1
cmp dword [rbx + 0x30], 0
je 0x14001559f
mov rcx, rbx
call fcn.140009e30
mov rax, qword [rbx + 0xc0]
mov rcx, qword [rbx + 0xc8]
movzx edx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x1400155a1
xor dl, dl
movzx edx, dl
mov dword [rsp + 0x68], edx
cmp rax, rcx
jae 0x1400155c0
movzx edx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
mov byte [rsp + 0x30], dl
jmp 0x1400155f4
cmp dword [rbx + 0x30], 0
je 0x1400155ef
mov rcx, rbx
call fcn.140009e30
mov rax, qword [rbx + 0xc0]
mov rcx, qword [rbx + 0xc8]
movzx edx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
mov byte [rsp + 0x30], dl
jmp 0x1400155f4
mov byte [rsp + 0x30], 0
cmp rax, rcx
jae 0x140015608
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x14001562e
cmp dword [rbx + 0x30], 0
je 0x14001562c
mov rcx, rbx
call fcn.140009e30
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x14001562e
xor cl, cl
movzx eax, cl
mov rcx, rbx
mov dword [rsp + 0x3c], eax
call fcn.14000a0c0
mov rcx, rbx
mov r14d, eax
call fcn.14000a0c0
mov rcx, qword [rbx + 0xc0]
mov dword [rsp + 0x40], eax
cmp rcx, qword [rbx + 0xc8]
jae 0x14001566b
movzx edx, byte [rcx]
inc rcx
mov qword [rbx + 0xc0], rcx
jmp 0x140015691
cmp dword [rbx + 0x30], 0
je 0x14001568f
mov rcx, rbx
call fcn.140009e30
mov rax, qword [rbx + 0xc0]
movzx edx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140015691
xor dl, dl
mov rcx, rbx
movzx r15d, dl
call fcn.14000a0c0
mov rcx, rbx
call fcn.14000a0c0
mov rcx, rbx
call fcn.14000a0c0
mov rcx, rbx
mov dword [rsp + 0x38], eax
call fcn.14000a0c0
mov rcx, qword [rbx + 0xc8]
mov dword [rsp + 0x44], eax
mov rax, qword [rbx + 0xc0]
cmp rax, rcx
jae 0x1400156df
movzx edx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x14001570c
cmp dword [rbx + 0x30], 0
je 0x14001570a
mov rcx, rbx
call fcn.140009e30
mov rax, qword [rbx + 0xc0]
mov rcx, qword [rbx + 0xc8]
movzx edx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x14001570c
xor dl, dl
movzx r10d, dl
mov dword [rsp + 0x5c], r10d
cmp rax, rcx
jae 0x140015729
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140015754
cmp dword [rbx + 0x30], 0
je 0x140015752
mov rcx, rbx
call fcn.140009e30
mov rax, qword [rbx + 0xc0]
mov r10d, dword [rsp + 0x5c]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140015754
xor cl, cl
mov r8d, dword [rsp + 0x44]
xor ebp, ebp
movzx eax, cl
mov r13d, ebp
mov qword [rsp + 0x48], rbp
mov dword [rsp + 0x78], ebp
mov dword [rsp + 0x58], ebp
lea r12d, [rbp + 1]
cmp r8d, 0x1000000
jg 0x140015e8d
mov r9d, dword [rsp + 0x38]
cmp r9d, 0x1000000
jg 0x140015e8d
mov ecx, dword [rsp + 0x3c]
cmp ecx, 8
mov dword [rsp + 0x34], ebp
lea edx, [rcx - 8]
cmovb edx, ecx
shr eax, 5
and eax, r12d
mov ecx, r12d
sub ecx, eax
mov dword [rsp + 0x60], ecx
cmp byte [rsp + 0x30], bpl
je 0x1400157d6
mov ecx, r15d
sub ecx, 8
je 0x14001582e
sub ecx, 7
je 0x140015821
sub ecx, r12d
je 0x140015821
sub ecx, 8
je 0x1400157f5
cmp ecx, 8
jne 0x1400157fe
jmp 0x1400157f5
mov ecx, r10d
sub ecx, 8
je 0x14001582e
sub ecx, 7
je 0x140015821
sub ecx, r12d
je 0x140015816
sub ecx, 8
je 0x1400157f2
cmp ecx, 8
jne 0x1400157fe
mov r15d, r10d
shr r15d, 3
test r15d, r15d
jne 0x140015831
mov rax, qword gs:[0x58]
mov rcx, qword [rax]
lea rax, str.bad_format
jmp 0x140015ea0
cmp edx, 3
jne 0x140015821
lea r15d, [rdx - 1]
jmp 0x140015831
mov r15d, 3
mov dword [rsp + 0x34], r12d
jmp 0x140015831
mov r15d, r12d
mov dword [rdi], r9d
mov dword [rsi], r8d
test r9d, r9d
js 0x140015e8d
test r8d, r8d
js 0x140015e8d
je 0x140015864
mov eax, 0x7fffffff
mov ecx, ebp
cdq
idiv r8d
cmp r9d, eax
setle cl
test ecx, ecx
je 0x140015e8d
mov ecx, r8d
imul ecx, r9d
mov dword [rsp + 0x64], ecx
test ecx, ecx
js 0x140015e8d
xor edx, edx
mov eax, 0x7fffffff
div r15d
mov edi, eax
cmp ecx, eax
jg 0x140015e8d
test r8d, r8d
je 0x1400158a2
mov eax, 0x7fffffff
cdq
idiv r8d
cmp r9d, eax
jg 0x140015e78
test ecx, ecx
js 0x140015e78
cmp ecx, edi
jg 0x140015e78
mov eax, r15d
imul eax, r8d
imul eax, r9d
movsxd rcx, eax
call fcn.140067440
mov qword [rsp + 0x50], rax
mov rsi, rax
test rax, rax
je 0x140015e78
mov edx, dword [rsp + 0x68]
mov rcx, rbx
call fcn.140009eb0
cmp byte [rsp + 0x30], bpl
jne 0x14001598c
mov edx, dword [rsp + 0x3c]
cmp edx, 8
jae 0x140015b4b
mov eax, dword [rsp + 0x34]
test eax, eax
jne 0x140015b4b
mov r13d, dword [rsp + 0x44]
mov r12d, dword [rsp + 0x38]
test r13d, r13d
jle 0x140015e15
mov ebp, r12d
mov edi, r13d
imul ebp, r15d
cmp dword [rsp + 0x60], eax
je 0x14001596c
mov eax, ebp
neg eax
movsxd r14, eax
lea eax, [r13 - 1]
imul eax, r15d
imul eax, r12d
movsxd rsi, eax
add rsi, qword [rsp + 0x50]
nop dword [rax]
nop dword [rax + rax]
mov r8d, ebp
mov rdx, rsi
mov rcx, rbx
call fcn.140009f10
add rsi, r14
sub rdi, 1
jne 0x140015950
jmp 0x140015e0c
movsxd r14, ebp
nop
mov r8d, ebp
mov rdx, rsi
mov rcx, rbx
call fcn.140009f10
add rsi, r14
sub rdi, 1
jne 0x140015970
jmp 0x140015e0c
cmp dword [rsp + 0x40], ebp
jne 0x1400159b2
mov rcx, rsi
call fcn.140066740
mov rax, qword gs:[0x58]
mov rcx, qword [rax]
lea rax, str.bad_palette
jmp 0x140015ea0
mov edx, r14d
mov rcx, rbx
call fcn.140009eb0
mov r14d, dword [rsp + 0x40]
test r14d, r14d
js 0x140015e70
cmp r14d, edi
mov eax, ebp
setle al
test eax, eax
je 0x140015e70
mov edi, r15d
imul edi, r14d
movsxd rcx, edi
call fcn.140067440
mov qword [rsp + 0x48], rax
test rax, rax
je 0x140015e70
cmp dword [rsp + 0x34], ebp
je 0x140015b21
mov rdi, rax
cmp r15d, 3
je 0x140015a24
mov r8d, 0x1791
lea rdx, str.e:codecppocean2ocean2guiimgui_stb_image.h
lea rcx, str.tga_comp__STBI_rgb
call fcn.140067378
test r14d, r14d
jle 0x140015b46
mov esi, dword [rsp + 0x40]
mov r14d, r15d
mov rcx, rbx
call fcn.14000a0c0
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 [rdi], 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 [rdi + 1], dl
imul ecx
add edx, ecx
sar edx, 4
mov eax, edx
shr eax, 0x1f
add edx, eax
mov byte [rdi + 2], dl
add rdi, r14
sub rsi, r12
jne 0x140015a34
mov rdi, qword [rsp + 0x48]
mov edx, dword [rsp + 0x3c]
mov ecx, dword [rsp + 0x64]
mov esi, r15d
test ecx, ecx
jle 0x140015d88
mov rax, qword [rsp + 0x50]
mov r10d, ecx
mov r14, rax
mov r9d, r15d
neg r14
mov qword [rsp + 0x68], rax
mov r8, rax
mov qword [rsp + 0x70], rcx
nop dword [rax + rax]
cmp edx, 8
jb 0x140015b9d
test r13d, r13d
jne 0x140015b8e
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x140015b53
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140015b78
mov r8d, edi
mov rdx, rax
mov rcx, rbx
mov rdi, rax
call fcn.140009f10
test eax, eax
jne 0x140015ab7
mov rcx, rsi
call fcn.140066740
mov rcx, rdi
jmp 0x140015995
jmp 0x140015ab7
mov rdi, rbp
jmp 0x140015abb
cmp dword [rbx + 0x30], ebp
je 0x140015b76
mov rcx, rbx
call fcn.140009e30
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140015b78
xor cl, cl
movzx eax, cl
mov r13d, eax
and r13d, 0x7f
inc r13d
shr eax, 7
mov dword [rsp + 0x58], eax
jmp 0x140015b9d
cmp dword [rsp + 0x58], ebp
je 0x140015b9d
test r12d, r12d
je 0x140015d40
cmp byte [rsp + 0x30], bpl
je 0x140015c32
cmp dword [rsp + 0x5c], 8
jne 0x140015bfe
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x140015bd1
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
movzx eax, cl
jmp 0x140015c06
cmp dword [rbx + 0x30], ebp
je 0x140015bf7
mov rcx, rbx
call fcn.140009e30
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
movzx eax, cl
jmp 0x140015c06
xor cl, cl
movzx eax, cl
jmp 0x140015c06
mov rcx, rbx
call fcn.14000a0c0
cmp eax, dword [rsp + 0x40]
cmovge eax, ebp
test r15d, r15d
je 0x140015d30
imul eax, r15d
lea rcx, [rsp + 0x78]
mov r8, rsi
movsxd rdx, eax
add rdx, rdi
call fcn.14005e110
jmp 0x140015d30
cmp dword [rsp + 0x34], ebp
je 0x140015cd7
cmp r15d, 3
je 0x140015c5b
mov r8d, 0x17c6
lea rdx, str.e:codecppocean2ocean2guiimgui_stb_image.h
lea rcx, str.tga_comp__STBI_rgb
call fcn.140067378
mov rcx, rbx
call fcn.14000a0c0
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 + 0x78], 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 + 0x79], dl
imul ecx
add edx, ecx
sar edx, 4
mov eax, edx
shr eax, 0x1f
add edx, eax
mov byte [rsp + 0x7a], dl
jmp 0x140015d30
mov rdi, rbp
test r15d, r15d
je 0x140015d30
nop
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x140015cff
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140015d24
cmp dword [rbx + 0x30], ebp
je 0x140015d22
mov rcx, rbx
call fcn.140009e30
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140015d24
xor cl, cl
mov byte [rsp + rdi + 0x78], cl
inc rdi
cmp rdi, rsi
jl 0x140015ce0
mov r8, qword [rsp + 0x68]
mov r12d, ebp
mov r10, qword [rsp + 0x70]
mov r9d, r15d
test r15d, r15d
je 0x140015d62
lea rdx, [rsp + 0x78]
mov rcx, r8
add rdx, r14
movzx eax, byte [rdx + rcx]
mov byte [rcx], al
inc rcx
lea rax, [r14 + rcx]
cmp rax, rsi
jl 0x140015d50
mov rdi, qword [rsp + 0x48]
add r8, r9
mov edx, dword [rsp + 0x3c]
dec r13d
sub r14, r9
mov qword [rsp + 0x68], r8
sub r10, 1
mov qword [rsp + 0x70], r10
jne 0x140015af0
mov r13d, dword [rsp + 0x44]
cmp dword [rsp + 0x60], ebp
je 0x140015df8
test r13d, r13d
jle 0x140015df8
mov r12, qword [rsp + 0x50]
lea r10d, [r13 - 1]
imul r10d, r15d
mov r11d, r15d
imul r11d, dword [rsp + 0x38]
mov ebx, ebp
imul r10d, dword [rsp + 0x38]
mov r8d, r11d
test r11d, r11d
jle 0x140015dea
movsxd rax, ebx
movsxd r9, r10d
sub r9, rax
lea rdx, [rax + r12]
nop dword [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 0x140015dd0
add ebx, r11d
sub r10d, r11d
add ebp, 2
cmp ebp, r13d
jl 0x140015db6
mov rcx, qword [rsp + 0x48]
test rcx, rcx
je 0x140015e07
call fcn.140066740
mov r12d, dword [rsp + 0x38]
mov eax, dword [rsp + 0x34]
mov rsi, qword [rsp + 0x50]
cmp r15d, 3
jb 0x140015e49
test eax, eax
jne 0x140015e49
mov eax, dword [rsp + 0x64]
mov r8, rsi
test eax, eax
jle 0x140015e49
mov edx, r15d
mov r10d, eax
movzx ecx, byte [r8]
movzx eax, byte [r8 + 2]
mov byte [r8], al
mov byte [r8 + 2], cl
add r8, rdx
sub r10, 1
jne 0x140015e30
cmp r15d, 4
je 0x140015e6b
mov r9d, r12d
mov dword [rsp + 0x20], r13d
mov r8d, 4
mov edx, r15d
mov rcx, rsi
call fcn.14000a170
mov rsi, rax
mov rax, rsi
jmp 0x140015eab
mov rcx, rsi
call fcn.140066740
mov rax, qword gs:[0x58]
mov rcx, qword [rax]
lea rax, str.outofmem
jmp 0x140015ea0
mov rax, qword gs:[0x58]
mov rcx, qword [rax]
lea rax, str.too_large
mov edx, 0x20
mov qword [rdx + rcx], rax
xor eax, eax
mov rcx, qword [rsp + 0x80]
xor rcx, rsp
call fcn.14005c070
mov rbx, qword [rsp + 0xe8]
add rsp, 0x90
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbp
ret