Function at 0x18000e120
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push rbx
push rsi
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0xa0
mov rax, qword [0x18007d010]
xor rax, rsp
mov qword [rsp + 0x90], rax
mov rax, qword [rcx + 0xc0]
mov rbx, rcx
mov qword [rsp + 0x70], r8
mov qword [rsp + 0x58], rdx
cmp rax, qword [rcx + 0xc8]
jae 0x18000e171
movzx edx, byte [rax]
inc rax
mov qword [rcx + 0xc0], rax
jmp 0x18000e194
cmp dword [rcx + 0x30], 0
je 0x18000e192
call fcn.180002c80
mov rax, qword [rbx + 0xc0]
movzx edx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e194
xor dl, dl
mov ecx, 0x30
mov r8, rbx
mov qword [rsp + 0xf8], rbp
lea rsi, [rcx + rbx]
movzx ecx, dl
mov dword [rsp + 0x40], ecx
mov qword [rsp + 0x80], rsi
cmp rax, qword [rbx + 0xc8]
jae 0x18000e1cf
movzx ebp, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e1f5
cmp dword [rsi], 0
je 0x18000e1f2
mov rcx, rbx
call fcn.180002c80
mov rax, qword [rbx + 0xc0]
movzx ebp, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e1f5
xor bpl, bpl
mov byte [rsp + 0x30], bpl
cmp rax, qword [rbx + 0xc8]
jae 0x18000e212
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e237
cmp dword [rsi], 0
je 0x18000e235
mov rcx, rbx
call fcn.180002c80
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e237
xor cl, cl
movzx eax, cl
mov rcx, rbx
mov dword [rsp + 0x3c], eax
call fcn.180002e90
mov rcx, rbx
movsxd r13, eax
call fcn.180002e90
mov rcx, qword [rbx + 0xc0]
mov dword [rsp + 0x50], eax
cmp rcx, qword [rbx + 0xc8]
jae 0x18000e274
movzx edx, byte [rcx]
inc rcx
mov qword [rbx + 0xc0], rcx
jmp 0x18000e299
cmp dword [rsi], 0
je 0x18000e297
mov rcx, rbx
call fcn.180002c80
mov rax, qword [rbx + 0xc0]
movzx edx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e299
xor dl, dl
mov rcx, rbx
movzx edi, dl
call fcn.180002e90
mov rcx, rbx
call fcn.180002e90
mov rcx, rbx
call fcn.180002e90
mov rcx, rbx
mov dword [rsp + 0x38], eax
call fcn.180002e90
mov dword [rsp + 0x44], eax
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x18000e2e3
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e308
cmp dword [rsi], 0
je 0x18000e306
mov rcx, rbx
call fcn.180002c80
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e308
xor cl, cl
movzx r10d, cl
mov dword [rsp + 0x64], r10d
cmp rax, qword [rbx + 0xc8]
jae 0x18000e329
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e353
cmp dword [rsi], 0
je 0x18000e351
mov rcx, rbx
call fcn.180002c80
mov rax, qword [rbx + 0xc0]
mov r10d, dword [rsp + 0x64]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e353
xor cl, cl
mov r8d, dword [rsp + 0x44]
xor r14d, r14d
movzx eax, cl
mov r12d, r14d
mov qword [rsp + 0x78], r14
mov dword [rsp + 0x88], r14d
mov dword [rsp + 0x60], r14d
lea r15d, [r14 + 1]
cmp r8d, 0x1000000
jg 0x18000eb45
mov r9d, dword [rsp + 0x38]
cmp r9d, 0x1000000
jg 0x18000eb45
mov ecx, dword [rsp + 0x3c]
cmp ecx, 8
lea edx, [rcx - 8]
cmovb edx, ecx
shr eax, 5
and eax, r15d
mov ecx, r15d
sub ecx, eax
test bpl, bpl
mov dword [rsp + 0x68], ecx
mov ebp, r14d
je 0x18000e3dc
mov ecx, edi
sub ecx, 8
je 0x18000e3d7
sub ecx, 7
je 0x18000e431
sub ecx, r15d
je 0x18000e431
sub ecx, 8
je 0x18000e3fb
cmp ecx, 8
jne 0x18000e404
jmp 0x18000e3fb
mov edi, r15d
jmp 0x18000e3fe
mov ecx, r10d
sub ecx, 8
je 0x18000e43d
sub ecx, 7
je 0x18000e431
sub ecx, r15d
je 0x18000e423
sub ecx, 8
je 0x18000e3f8
cmp ecx, 8
jne 0x18000e404
mov edi, r10d
shr edi, 3
mov esi, edi
test edi, edi
jne 0x18000e443
mov edx, dword [0x1801138ac]
mov rax, qword gs:[0x58]
mov rax, qword [rax + rdx*8]
lea rdx, str.bad_format
jmp 0x18000eb5f
cmp edx, 3
jne 0x18000e431
mov edi, 2
mov esi, edi
jmp 0x18000e443
mov edi, 3
mov ebp, r15d
mov esi, edi
jmp 0x18000e443
mov edi, r15d
mov esi, r15d
mov rax, qword [rsp + 0x58]
mov dword [rax], r9d
mov rax, qword [rsp + 0x70]
mov dword [rax], r8d
test r9d, r9d
js 0x18000eb45
test r8d, r8d
js 0x18000eb45
je 0x18000e481
mov eax, 0x7fffffff
mov ecx, r14d
cdq
idiv r8d
cmp r9d, eax
setle cl
test ecx, ecx
je 0x18000eb45
mov ecx, r8d
imul ecx, r9d
test ecx, ecx
js 0x18000eb45
xor edx, edx
mov eax, 0x7fffffff
div edi
cmp ecx, eax
jg 0x18000eb45
test r8d, r8d
je 0x18000e4c0
mov eax, 0x7fffffff
mov ecx, r14d
cdq
idiv r8d
cmp r9d, eax
setle cl
test ecx, ecx
je 0x18000eb29
mov eax, r8d
imul eax, edi
imul eax, r9d
movsxd rcx, eax
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
mov qword [rsp + 0x48], rax
mov r8, rax
test rax, rax
je 0x18000eb29
movsxd rdx, dword [rsp + 0x40]
test edx, edx
je 0x18000e528
cmp qword [rbx + 0x10], r12
je 0x18000e521
mov ecx, dword [rbx + 0xc8]
sub ecx, dword [rbx + 0xc0]
cmp ecx, edx
jge 0x18000e521
mov rax, qword [rbx + 0xc8]
sub edx, ecx
mov rcx, qword [rbx + 0x28]
mov qword [rbx + 0xc0], rax
call qword [rbx + 0x18]
mov r8, qword [rsp + 0x48]
jmp 0x18000e528
add qword [rbx + 0xc0], rdx
cmp byte [rsp + 0x30], r12b
jne 0x18000e5ee
mov edx, dword [rsp + 0x3c]
mov r13d, edi
mov dword [rsp + 0x34], ebp
cmp edx, 8
jae 0x18000e759
mov dword [rsp + 0x34], ebp
test ebp, ebp
jne 0x18000e759
mov ecx, dword [rsp + 0x44]
mov dword [rsp + 0x34], ebp
test ecx, ecx
jle 0x18000e5d9
mov r15d, edi
mov dword [rsp + 0x34], ebp
imul r15d, dword [rsp + 0x38]
mov r14d, ecx
cmp dword [rsp + 0x68], r12d
je 0x18000e5bc
mov eax, r15d
neg eax
movsxd r12, eax
lea eax, [rcx - 1]
imul eax, edi
imul eax, dword [rsp + 0x38]
movsxd rsi, eax
add rsi, r8
nop
mov r8d, r15d
mov rdx, rsi
mov rcx, rbx
call fcn.180002d00
add rsi, r12
sub r14, 1
jne 0x18000e590
mov edi, dword [rsp + 0x44]
mov ecx, edi
mov edx, dword [rsp + 0x38]
imul ecx, edx
mov esi, r13d
jmp 0x18000eac4
movsxd r12, r15d
mov rsi, r8
mov r8d, r15d
mov rdx, rsi
mov rcx, rbx
call fcn.180002d00
add rsi, r12
sub r14, 1
jne 0x18000e5c2
mov edi, dword [rsp + 0x44]
mov ecx, edi
mov edx, dword [rsp + 0x38]
imul ecx, edx
mov esi, r13d
jmp 0x18000eac4
cmp dword [rsp + 0x50], r12d
jne 0x18000e61d
mov rcx, r8
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov edx, dword [0x1801138ac]
mov rax, qword gs:[0x58]
mov rax, qword [rax + rdx*8]
lea rdx, str.bad_palette
jmp 0x18000eb5f
test r13d, r13d
je 0x18000e66f
jns 0x18000e634
mov rax, qword [rbx + 0xc8]
mov qword [rbx + 0xc0], rax
jmp 0x18000e66f
cmp qword [rbx + 0x10], r12
je 0x18000e668
mov ecx, dword [rbx + 0xc8]
sub ecx, dword [rbx + 0xc0]
cmp ecx, r13d
jge 0x18000e668
mov rax, qword [rbx + 0xc8]
sub r13d, ecx
mov rcx, qword [rbx + 0x28]
mov edx, r13d
mov qword [rbx + 0xc0], rax
call qword [rbx + 0x18]
jmp 0x18000e66f
add qword [rbx + 0xc0], r13
mov r13d, dword [rsp + 0x50]
test r13d, r13d
js 0x18000eb1e
xor edx, edx
mov eax, 0x7fffffff
div edi
mov ecx, r14d
cmp r13d, eax
setle cl
imul esi, r13d
test ecx, ecx
je 0x18000eb1e
movsxd rcx, esi
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
mov qword [rsp + 0x78], rax
test rax, rax
je 0x18000eb1e
mov dword [rsp + 0x34], ebp
test ebp, ebp
je 0x18000e7cd
mov rsi, rax
test r13d, r13d
jle 0x18000e7c8
mov eax, edi
mov dword [rsp + 0x40], edi
mov edi, eax
mov rcx, rbx
call fcn.180002e90
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, rdi
sub r13, r15
jne 0x18000e6d2
mov r13d, dword [rsp + 0x40]
mov edx, dword [rsp + 0x3c]
mov edi, dword [rsp + 0x44]
mov ecx, edi
mov eax, dword [rsp + 0x38]
imul ecx, eax
mov esi, r13d
mov dword [rsp + 0x40], ecx
test ecx, ecx
je 0x18000ea3f
mov rax, qword [rsp + 0x48]
lea r8, [rsp + 0x88]
mov rbp, qword [rsp + 0x80]
sub rax, r8
mov qword [rsp + 0x70], rax
mov qword [rsp + 0x58], rcx
cmp edx, 8
jb 0x18000e847
test r12d, r12d
jne 0x18000e837
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x18000e7fb
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e821
mov r13d, edi
jmp 0x18000e755
mov r8d, esi
mov rdx, rax
mov rcx, rbx
mov r13d, edi
call fcn.180002d00
test eax, eax
jne 0x18000e755
mov rcx, qword [rsp + 0x48]
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov rcx, qword [rsp + 0x78]
jmp 0x18000e5f8
cmp dword [rbp], r14d
je 0x18000e81f
mov rcx, rbx
call fcn.180002c80
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e821
xor cl, cl
movzx eax, cl
mov r12d, eax
and r12d, 0x7f
inc r12d
shr eax, 7
mov dword [rsp + 0x60], eax
jmp 0x18000e847
cmp dword [rsp + 0x60], r14d
je 0x18000e847
test r15d, r15d
je 0x18000e9e1
cmp byte [rsp + 0x30], r14b
je 0x18000e8e3
cmp dword [rsp + 0x64], 8
jne 0x18000e8a9
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x18000e87b
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
movzx eax, cl
jmp 0x18000e8b1
cmp dword [rbp], r14d
je 0x18000e8a2
mov rcx, rbx
call fcn.180002c80
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
movzx eax, cl
jmp 0x18000e8b1
xor cl, cl
movzx eax, cl
jmp 0x18000e8b1
mov rcx, rbx
call fcn.180002e90
cmp eax, dword [rsp + 0x50]
cmovge eax, r14d
test r13d, r13d
je 0x18000e9d4
imul eax, r13d
lea rcx, [rsp + 0x88]
mov r8, rsi
movsxd rdx, eax
add rdx, qword [rsp + 0x78]
call sub.VCRUNTIME140.dll_memcpy
jmp 0x18000e9d4
cmp dword [rsp + 0x34], r14d
je 0x18000e973
mov rcx, rbx
call fcn.180002e90
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 + 0x88], 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 + 0x89], dl
imul ecx
add edx, ecx
sar edx, 4
mov eax, edx
shr eax, 0x1f
add edx, eax
mov byte [rsp + 0x8a], dl
jmp 0x18000e9d4
mov rdi, r14
test r13d, r13d
je 0x18000e9d4
nop dword [rax + rax]
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x18000e99f
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e9c5
cmp dword [rbp], r14d
je 0x18000e9c3
mov rcx, rbx
call fcn.180002c80
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e9c5
xor cl, cl
mov byte [rsp + rdi + 0x88], cl
inc rdi
cmp rdi, rsi
jl 0x18000e980
mov rax, qword [rsp + 0x70]
mov r15d, r14d
mov rcx, qword [rsp + 0x58]
mov rdi, r14
test r13d, r13d
je 0x18000ea16
lea rcx, [rsp + 0x88]
mov r8, rsi
add rcx, rax
lea rdx, [rsp + 0x88]
call sub.VCRUNTIME140.dll_memcpy
inc rdi
cmp rdi, rsi
jl 0x18000ea04
mov rax, qword [rsp + 0x70]
mov rcx, qword [rsp + 0x58]
movsxd rdx, r13d
dec r12d
add rax, rdx
mov edx, dword [rsp + 0x3c]
sub rcx, 1
mov qword [rsp + 0x70], rax
mov qword [rsp + 0x58], rcx
jne 0x18000e797
mov edi, dword [rsp + 0x44]
mov eax, dword [rsp + 0x38]
cmp dword [rsp + 0x68], r14d
je 0x18000eaa9
test edi, edi
jle 0x18000eaa9
mov rbp, qword [rsp + 0x48]
lea r10d, [rdi - 1]
imul r10d, r13d
mov r11d, r13d
imul r11d, eax
mov ebx, r14d
imul r10d, eax
mov r8d, r11d
test r11d, r11d
jle 0x18000ea9a
movsxd rax, ebx
movsxd r9, r10d
sub r9, rax
lea rdx, [rax + rbp]
nop word [rax + rax]
movzx eax, byte [r9 + rdx]
dec r8d
movzx ecx, byte [rdx]
mov byte [rdx], al
mov byte [r9 + rdx], cl
lea rdx, [rdx + 1]
test r8d, r8d
jg 0x18000ea80
add ebx, r11d
sub r10d, r11d
add r14d, 2
cmp r14d, edi
jl 0x18000ea65
mov rax, qword [rsp + 0x78]
test rax, rax
je 0x18000eabc
mov rcx, rax
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov edx, dword [rsp + 0x38]
mov ecx, dword [rsp + 0x40]
mov rax, qword [rsp + 0x48]
cmp r13d, 3
jb 0x18000eafe
cmp dword [rsp + 0x34], 0
jne 0x18000eafe
mov r8, rax
test ecx, ecx
je 0x18000eafe
mov r9d, ecx
movzx ecx, byte [r8]
movzx eax, byte [r8 + 2]
mov byte [r8], al
mov byte [r8 + 2], cl
add r8, rsi
sub r9, 1
jne 0x18000eae0
mov rax, qword [rsp + 0x48]
cmp r13d, 4
je 0x18000eb6a
mov r9d, edx
mov dword [rsp + 0x20], edi
mov edx, r13d
mov r8d, 4
mov rcx, rax
call fcn.180002f50
jmp 0x18000eb6a
mov rcx, qword [rsp + 0x48]
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov edx, dword [0x1801138ac]
mov rax, qword gs:[0x58]
mov rax, qword [rax + rdx*8]
lea rdx, str.outofmem
jmp 0x18000eb5f
mov edx, dword [0x1801138ac]
mov rax, qword gs:[0x58]
mov rax, qword [rax + rdx*8]
lea rdx, str.too_large
mov ecx, 0x28
mov qword [rcx + rax], rdx
xor eax, eax
mov rbp, qword [rsp + 0xf8]
mov rcx, qword [rsp + 0x90]
xor rcx, rsp
call fcn.180064e10
add rsp, 0xa0
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbx
ret