Function at 0x180046af0
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push rbx
push rbp
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x90
mov rax, qword [0x1800d7008]
xor rax, rsp
mov qword [rsp + 0x88], rax
mov rax, qword [rcx + 0xc0]
mov rbx, rcx
mov qword [rsp + 0x48], r8
mov qword [rsp + 0x58], rdx
cmp rax, qword [rcx + 0xc8]
jae 0x180046b41
movzx edx, byte [rax]
inc rax
mov qword [rcx + 0xc0], rax
jmp 0x180046b64
cmp dword [rcx + 0x30], 0
je 0x180046b62
call fcn.18003b9e0
mov rax, qword [rbx + 0xc0]
movzx edx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x180046b64
xor dl, dl
mov ecx, 0x30
mov r8, rbx
mov qword [rsp + 0xe8], rsi
lea r13, [rcx + rbx]
movzx ecx, dl
mov dword [rsp + 0x54], ecx
mov qword [rsp + 0x78], r13
cmp rax, qword [rbx + 0xc8]
jae 0x180046b9c
movzx esi, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x180046bc4
cmp dword [r13], 0
je 0x180046bc1
mov rcx, rbx
call fcn.18003b9e0
mov rax, qword [rbx + 0xc0]
movzx esi, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x180046bc4
xor sil, sil
mov byte [rsp + 0x30], sil
cmp rax, qword [rbx + 0xc8]
jae 0x180046be1
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x180046c08
cmp dword [r13], 0
je 0x180046c06
mov rcx, rbx
call fcn.18003b9e0
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x180046c08
xor cl, cl
movzx ebp, cl
mov rcx, rbx
mov dword [rsp + 0x40], ebp
call fcn.18003bbf0
mov rcx, rbx
mov dword [rsp + 0x38], eax
call fcn.18003bbf0
mov rcx, qword [rbx + 0xc0]
mov dword [rsp + 0x50], eax
cmp rcx, qword [rbx + 0xc8]
jae 0x180046c46
movzx edx, byte [rcx]
inc rcx
mov qword [rbx + 0xc0], rcx
jmp 0x180046c6d
cmp dword [r13], 0
je 0x180046c6b
mov rcx, rbx
call fcn.18003b9e0
mov rax, qword [rbx + 0xc0]
movzx edx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x180046c6d
xor dl, dl
mov rcx, rbx
movzx edi, dl
call fcn.18003bbf0
mov rcx, rbx
call fcn.18003bbf0
mov rcx, rbx
call fcn.18003bbf0
mov rcx, rbx
mov dword [rsp + 0x3c], eax
call fcn.18003bbf0
mov dword [rsp + 0x44], eax
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x180046cb7
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x180046cde
cmp dword [r13], 0
je 0x180046cdc
mov rcx, rbx
call fcn.18003b9e0
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x180046cde
xor cl, cl
movzx r10d, cl
mov dword [rsp + 0x64], r10d
cmp rax, qword [rbx + 0xc8]
jae 0x180046cff
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x180046d2b
cmp dword [r13], 0
je 0x180046d29
mov rcx, rbx
call fcn.18003b9e0
mov rax, qword [rbx + 0xc0]
mov r10d, dword [rsp + 0x64]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x180046d2b
xor cl, cl
mov r8d, dword [rsp + 0x44]
xor r14d, r14d
movzx eax, cl
mov r15d, r14d
mov qword [rsp + 0x70], r14
mov dword [rsp + 0x80], r14d
mov dword [rsp + 0x60], r14d
lea r12d, [r14 + 1]
cmp r8d, 0x1000000
jg 0x180047504
mov r9d, dword [rsp + 0x3c]
cmp r9d, 0x1000000
jg 0x180047504
cmp ebp, 8
lea edx, [rbp - 8]
mov ecx, r12d
cmovb edx, ebp
shr eax, 5
and eax, r12d
mov ebp, r14d
sub ecx, eax
mov dword [rsp + 0x68], ecx
test sil, sil
je 0x180046db0
mov ecx, edi
sub ecx, 8
je 0x180046dab
sub ecx, 7
je 0x180046e05
sub ecx, r12d
je 0x180046e05
sub ecx, 8
je 0x180046dcf
cmp ecx, 8
jne 0x180046dd8
jmp 0x180046dcf
mov edi, r12d
jmp 0x180046dd2
mov ecx, r10d
sub ecx, 8
je 0x180046e11
sub ecx, 7
je 0x180046e05
sub ecx, r12d
je 0x180046df7
sub ecx, 8
je 0x180046dcc
cmp ecx, 8
jne 0x180046dd8
mov edi, r10d
shr edi, 3
mov esi, edi
test edi, edi
jne 0x180046e17
mov edx, dword [0x1800d8620]
mov rax, qword gs:[0x58]
mov rax, qword [rax + rdx*8]
lea rdx, str.bad_format
jmp 0x18004751e
cmp edx, 3
jne 0x180046e05
mov edi, 2
mov esi, edi
jmp 0x180046e17
mov edi, 3
mov ebp, r12d
mov esi, edi
jmp 0x180046e17
mov edi, r12d
mov esi, r12d
mov rax, qword [rsp + 0x58]
mov dword [rax], r9d
mov rax, qword [rsp + 0x48]
mov dword [rax], r8d
test r9d, r9d
js 0x180047504
test r8d, r8d
js 0x180047504
je 0x180046e55
mov eax, 0x7fffffff
mov ecx, r14d
cdq
idiv r8d
cmp r9d, eax
setle cl
test ecx, ecx
je 0x180047504
mov ecx, r8d
imul ecx, r9d
test ecx, ecx
js 0x180047504
xor edx, edx
mov eax, 0x7fffffff
div edi
cmp ecx, eax
jg 0x180047504
test r8d, r8d
je 0x180046e94
mov eax, 0x7fffffff
mov ecx, r14d
cdq
idiv r8d
cmp r9d, eax
setle cl
test ecx, ecx
je 0x1800474e8
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 0x1800474e8
movsxd rdx, dword [rsp + 0x54]
test edx, edx
je 0x180046efc
cmp qword [rbx + 0x10], r14
je 0x180046ef5
mov ecx, dword [rbx + 0xc8]
sub ecx, dword [rbx + 0xc0]
cmp ecx, edx
jge 0x180046ef5
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 0x180046efc
add qword [rbx + 0xc0], rdx
cmp byte [rsp + 0x30], r14b
jne 0x180046fc8
mov edx, dword [rsp + 0x40]
mov dword [rsp + 0x38], ebp
mov dword [rsp + 0x34], edi
cmp edx, 8
jae 0x18004713f
mov dword [rsp + 0x38], ebp
mov dword [rsp + 0x34], edi
test ebp, ebp
jne 0x18004713f
mov r13d, dword [rsp + 0x44]
mov dword [rsp + 0x38], ebp
test r13d, r13d
jle 0x180046fb7
mov r15d, edi
mov dword [rsp + 0x38], ebp
imul r15d, dword [rsp + 0x3c]
cmp dword [rsp + 0x68], r14d
mov r14d, r13d
je 0x180046f98
mov eax, r15d
neg eax
movsxd r12, eax
lea eax, [r13 - 1]
imul eax, edi
imul eax, dword [rsp + 0x3c]
movsxd rsi, eax
add rsi, r8
nop
mov r8d, r15d
mov rdx, rsi
mov rcx, rbx
call fcn.18003ba60
add rsi, r12
sub r14, 1
jne 0x180046f70
mov edx, dword [rsp + 0x3c]
mov ecx, r13d
imul ecx, edx
mov esi, edi
jmp 0x180047484
movsxd r12, r15d
mov rsi, r8
nop
mov r8d, r15d
mov rdx, rsi
mov rcx, rbx
call fcn.18003ba60
add rsi, r12
sub r14, 1
jne 0x180046fa0
mov edx, dword [rsp + 0x3c]
mov ecx, r13d
imul ecx, edx
mov esi, edi
jmp 0x180047484
cmp dword [rsp + 0x50], r14d
jne 0x180046ff7
mov rcx, r8
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov edx, dword [0x1800d8620]
mov rax, qword gs:[0x58]
mov rax, qword [rax + rdx*8]
lea rdx, str.bad_palette
jmp 0x18004751e
movsxd rdx, dword [rsp + 0x38]
test edx, edx
je 0x180047048
jns 0x180047012
mov rax, qword [rbx + 0xc8]
mov qword [rbx + 0xc0], rax
jmp 0x180047048
cmp qword [rbx + 0x10], r14
je 0x180047041
mov ecx, dword [rbx + 0xc8]
sub ecx, dword [rbx + 0xc0]
cmp ecx, edx
jge 0x180047041
mov rax, qword [rbx + 0xc8]
sub edx, ecx
mov rcx, qword [rbx + 0x28]
mov qword [rbx + 0xc0], rax
call qword [rbx + 0x18]
jmp 0x180047048
add qword [rbx + 0xc0], rdx
mov r8d, dword [rsp + 0x50]
test r8d, r8d
js 0x1800474dd
xor edx, edx
mov eax, 0x7fffffff
div edi
mov ecx, r14d
cmp r8d, eax
setle cl
imul esi, r8d
test ecx, ecx
je 0x1800474dd
movsxd rcx, esi
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
mov qword [rsp + 0x70], rax
test rax, rax
je 0x1800474dd
mov dword [rsp + 0x38], ebp
mov dword [rsp + 0x34], edi
test ebp, ebp
je 0x1800471a4
mov ecx, dword [rsp + 0x50]
mov rsi, rax
test ecx, ecx
jle 0x18004713b
mov eax, edi
mov r13d, ecx
mov qword [rsp + 0x58], rax
mov rcx, rbx
call fcn.18003bbf0
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, r12
jne 0x1800470b4
mov r13, qword [rsp + 0x78]
mov edi, dword [rsp + 0x34]
mov edx, dword [rsp + 0x40]
mov eax, dword [rsp + 0x44]
mov ecx, dword [rsp + 0x3c]
imul eax, ecx
mov esi, edi
mov dword [rsp + 0x54], eax
test eax, eax
je 0x1800473f6
mov rbp, qword [rsp + 0x48]
lea rcx, [rsp + 0x80]
mov r8d, eax
sub rbp, rcx
mov qword [rsp + 0x58], r8
movsxd r9, edi
cmp edx, 8
jb 0x180047217
test r15d, r15d
jne 0x180047207
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x1800471cb
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x1800471f1
mov r8d, esi
mov rdx, rax
mov rcx, rbx
call fcn.18003ba60
test eax, eax
jne 0x18004713b
mov rcx, qword [rsp + 0x48]
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov rcx, qword [rsp + 0x70]
jmp 0x180046fd2
cmp dword [r13], r14d
je 0x1800471ef
mov rcx, rbx
call fcn.18003b9e0
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x1800471f1
xor cl, cl
movzx eax, cl
mov r15d, eax
and r15d, 0x7f
inc r15d
shr eax, 7
mov dword [rsp + 0x60], eax
jmp 0x180047217
cmp dword [rsp + 0x60], r14d
je 0x180047217
test r12d, r12d
je 0x1800473b3
cmp byte [rsp + 0x30], r14b
je 0x1800472b2
cmp dword [rsp + 0x64], 8
jne 0x180047279
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x18004724b
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
movzx eax, cl
jmp 0x180047281
cmp dword [r13], r14d
je 0x180047272
mov rcx, rbx
call fcn.18003b9e0
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
movzx eax, cl
jmp 0x180047281
xor cl, cl
movzx eax, cl
jmp 0x180047281
mov rcx, rbx
call fcn.18003bbf0
cmp eax, dword [rsp + 0x50]
cmovge eax, r14d
test rsi, rsi
je 0x1800473a8
imul eax, edi
lea rcx, [rsp + 0x80]
mov r8, rsi
movsxd rdx, eax
add rdx, qword [rsp + 0x70]
call sub.VCRUNTIME140.dll_memcpy
jmp 0x1800473a8
cmp dword [rsp + 0x38], r14d
je 0x180047342
mov rcx, rbx
call fcn.18003bbf0
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 + 0x80], 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 + 0x81], dl
imul ecx
add edx, ecx
sar edx, 4
mov eax, edx
shr eax, 0x1f
add edx, eax
mov byte [rsp + 0x82], dl
jmp 0x1800473a8
mov rdi, r14
test rsi, rsi
je 0x1800473a4
nop word [rax + rax]
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x18004736f
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x180047395
cmp dword [r13], r14d
je 0x180047393
mov rcx, rbx
call fcn.18003b9e0
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x180047395
xor cl, cl
mov byte [rsp + rdi + 0x80], cl
inc rdi
cmp rdi, rsi
jl 0x180047350
mov edi, dword [rsp + 0x34]
mov r8, qword [rsp + 0x58]
mov r12d, r14d
movsxd r9, edi
mov rdx, r14
test rsi, rsi
je 0x1800473d9
nop dword [rax + rax]
lea rcx, [rsp + 0x80]
add rcx, rdx
inc rdx
movzx eax, byte [rcx]
mov byte [rcx + rbp], al
cmp rdx, rsi
jl 0x1800473c0
mov edx, dword [rsp + 0x40]
dec r15d
add rbp, r9
sub r8, 1
mov qword [rsp + 0x58], r8
jne 0x180047173
mov ecx, dword [rsp + 0x3c]
mov r13d, dword [rsp + 0x44]
cmp dword [rsp + 0x68], r14d
je 0x180047469
test r13d, r13d
jle 0x180047469
mov rbp, qword [rsp + 0x48]
lea r10d, [r13 - 1]
imul r10d, edi
mov r11d, edi
imul r11d, ecx
mov ebx, r14d
imul r10d, ecx
mov r8d, r11d
test r11d, r11d
jle 0x18004745a
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 0x180047440
add ebx, r11d
sub r10d, r11d
add r14d, 2
cmp r14d, r13d
jl 0x180047422
mov rax, qword [rsp + 0x70]
test rax, rax
je 0x18004747c
mov rcx, rax
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov edx, dword [rsp + 0x3c]
mov ecx, dword [rsp + 0x54]
mov rax, qword [rsp + 0x48]
cmp edi, 3
jb 0x1800474be
cmp dword [rsp + 0x38], 0
jne 0x1800474be
mov r8, rax
test ecx, ecx
je 0x1800474be
mov r9d, ecx
nop
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 0x1800474a0
mov rax, qword [rsp + 0x48]
cmp edi, 4
je 0x180047529
mov r9d, edx
mov dword [rsp + 0x20], r13d
mov edx, edi
mov r8d, 4
mov rcx, rax
call fcn.18003bcb0
jmp 0x180047529
mov rcx, qword [rsp + 0x48]
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov edx, dword [0x1800d8620]
mov rax, qword gs:[0x58]
mov rax, qword [rax + rdx*8]
lea rdx, str.outofmem
jmp 0x18004751e
mov edx, dword [0x1800d8620]
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 rsi, qword [rsp + 0xe8]
mov rcx, qword [rsp + 0x88]
xor rcx, rsp
call fcn.180079530
add rsp, 0x90
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rbp
pop rbx
ret