Function at 0x18000e220
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
mov qword [rsp + 0x20], r9
mov qword [rsp + 0x18], r8
mov qword [rsp + 0x10], rdx
push rbx
push rsi
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x90
mov rax, qword [rcx + 0xc0]
mov rbx, rcx
cmp rax, qword [rcx + 0xc8]
jae 0x18000e264
movzx r9d, byte [rax]
inc rax
mov qword [rcx + 0xc0], rax
jmp 0x18000e289
cmp dword [rcx + 0x30], 0
je 0x18000e286
call fcn.180002eb0
mov rax, qword [rbx + 0xc0]
movzx r9d, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e289
xor r9b, r9b
mov ecx, 0x30
mov rdx, rbx
mov qword [rsp + 0x88], rbp
lea rsi, [rcx + rbx]
movzx ecx, r9b
mov dword [rsp + 0xe8], ecx
mov qword [rsp + 0x70], rsi
cmp rax, qword [rbx + 0xc8]
jae 0x18000e2c5
movzx ebp, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e2eb
cmp dword [rsi], 0
je 0x18000e2e8
mov rcx, rbx
call fcn.180002eb0
mov rax, qword [rbx + 0xc0]
movzx ebp, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e2eb
xor bpl, bpl
mov byte [rsp + 0xf0], bpl
cmp rax, qword [rbx + 0xc8]
jae 0x18000e30b
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e330
cmp dword [rsi], 0
je 0x18000e32e
mov rcx, rbx
call fcn.180002eb0
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e330
xor cl, cl
movzx eax, cl
mov rcx, rbx
mov dword [rsp + 0x30], eax
call fcn.1800030c0
mov rcx, rbx
movsxd r13, eax
call fcn.1800030c0
mov rcx, qword [rbx + 0xc0]
mov dword [rsp + 0x48], eax
cmp rcx, qword [rbx + 0xc8]
jae 0x18000e36d
movzx edx, byte [rcx]
inc rcx
mov qword [rbx + 0xc0], rcx
jmp 0x18000e392
cmp dword [rsi], 0
je 0x18000e390
mov rcx, rbx
call fcn.180002eb0
mov rax, qword [rbx + 0xc0]
movzx edx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e392
xor dl, dl
mov rcx, rbx
movzx edi, dl
call fcn.1800030c0
mov rcx, rbx
call fcn.1800030c0
mov rcx, rbx
call fcn.1800030c0
mov rcx, rbx
mov dword [rsp + 0xf8], eax
call fcn.1800030c0
mov dword [rsp + 0x34], eax
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x18000e3df
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e404
cmp dword [rsi], 0
je 0x18000e402
mov rcx, rbx
call fcn.180002eb0
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e404
xor cl, cl
movzx r10d, cl
mov dword [rsp + 0x50], r10d
cmp rax, qword [rbx + 0xc8]
jae 0x18000e425
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e44f
cmp dword [rsi], 0
je 0x18000e44d
mov rcx, rbx
call fcn.180002eb0
mov rax, qword [rbx + 0xc0]
mov r10d, dword [rsp + 0x50]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e44f
xor cl, cl
mov r8d, dword [rsp + 0x34]
xor r14d, r14d
movzx eax, cl
mov r12d, r14d
mov qword [rsp + 0x60], r14
mov dword [rsp + 0xd0], r14d
mov dword [rsp + 0x4c], r14d
lea r15d, [r14 + 1]
cmp r8d, 0x1000000
jg 0x18000ec85
mov r9d, dword [rsp + 0xf8]
cmp r9d, 0x1000000
jg 0x18000ec85
mov ecx, dword [rsp + 0x30]
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 + 0x54], ecx
mov ebp, r14d
je 0x18000e4db
mov ecx, edi
sub ecx, 8
je 0x18000e4d6
sub ecx, 7
je 0x18000e530
sub ecx, r15d
je 0x18000e530
sub ecx, 8
je 0x18000e4fa
cmp ecx, 8
jne 0x18000e503
jmp 0x18000e4fa
mov edi, r15d
jmp 0x18000e4fd
mov ecx, r10d
sub ecx, 8
je 0x18000e53c
sub ecx, 7
je 0x18000e530
sub ecx, r15d
je 0x18000e522
sub ecx, 8
je 0x18000e4f7
cmp ecx, 8
jne 0x18000e503
mov edi, r10d
shr edi, 3
mov esi, edi
test edi, edi
jne 0x18000e542
mov edx, dword [0x180130024]
mov rax, qword gs:[0x58]
mov rax, qword [rax + rdx*8]
lea rdx, str.bad_format
jmp 0x18000ec9f
cmp edx, 3
jne 0x18000e530
mov edi, 2
mov esi, edi
jmp 0x18000e542
mov edi, 3
mov ebp, r15d
mov esi, edi
jmp 0x18000e542
mov edi, r15d
mov esi, r15d
mov rax, qword [rsp + 0xd8]
mov dword [rax], r9d
mov rax, qword [rsp + 0xe0]
mov dword [rax], r8d
test r9d, r9d
js 0x18000ec85
test r8d, r8d
js 0x18000ec85
je 0x18000e57e
mov eax, 0x7fffffff
cdq
idiv r8d
cmp r9d, eax
jg 0x18000ec85
mov ecx, r8d
imul ecx, r9d
test ecx, ecx
js 0x18000ec85
xor edx, edx
mov eax, 0x7fffffff
div edi
cmp ecx, eax
jg 0x18000ec85
test r8d, r8d
je 0x18000e5b5
mov eax, 0x7fffffff
cdq
idiv r8d
cmp r9d, eax
jg 0x18000ec69
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 + 0x40], rax
mov r8, rax
test rax, rax
je 0x18000ec69
movsxd rdx, dword [rsp + 0xe8]
test edx, edx
je 0x18000e620
cmp qword [rbx + 0x10], r12
je 0x18000e619
mov ecx, dword [rbx + 0xc8]
sub ecx, dword [rbx + 0xc0]
cmp ecx, edx
jge 0x18000e619
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 + 0x40]
jmp 0x18000e620
add qword [rbx + 0xc0], rdx
cmp byte [rsp + 0xf0], r12b
jne 0x18000e70f
mov edx, dword [rsp + 0x30]
mov r13d, edi
mov dword [rsp + 0xe8], ebp
cmp edx, 8
jae 0x18000e877
mov dword [rsp + 0xe8], ebp
test ebp, ebp
jne 0x18000e877
mov ecx, dword [rsp + 0x34]
mov dword [rsp + 0xe8], ebp
test ecx, ecx
jle 0x18000e6f7
mov r15d, edi
mov dword [rsp + 0xe8], ebp
imul r15d, dword [rsp + 0xf8]
mov r14d, ecx
cmp dword [rsp + 0x54], r12d
je 0x18000e6cf
mov eax, r15d
neg eax
movsxd r12, eax
lea eax, [rcx - 1]
imul eax, edi
imul eax, dword [rsp + 0xf8]
movsxd rsi, eax
add rsi, r8
mov r8d, r15d
mov rdx, rsi
mov rcx, rbx
call fcn.180002f30
add rsi, r12
sub r14, 1
jne 0x18000e6a0
mov edi, dword [rsp + 0x34]
mov ecx, edi
mov edx, dword [rsp + 0xf8]
imul ecx, edx
mov esi, r13d
jmp 0x18000ebf7
movsxd r12, r15d
mov rsi, r8
nop word [rax + rax]
mov r8d, r15d
mov rdx, rsi
mov rcx, rbx
call fcn.180002f30
add rsi, r12
sub r14, 1
jne 0x18000e6e0
mov edi, dword [rsp + 0x34]
mov ecx, edi
mov edx, dword [rsp + 0xf8]
imul ecx, edx
mov esi, r13d
jmp 0x18000ebf7
cmp dword [rsp + 0x48], r12d
jne 0x18000e73e
mov rcx, r8
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov edx, dword [0x180130024]
mov rax, qword gs:[0x58]
mov rax, qword [rax + rdx*8]
lea rdx, str.bad_palette
jmp 0x18000ec9f
test r13d, r13d
je 0x18000e790
jns 0x18000e755
mov rax, qword [rbx + 0xc8]
mov qword [rbx + 0xc0], rax
jmp 0x18000e790
cmp qword [rbx + 0x10], r12
je 0x18000e789
mov ecx, dword [rbx + 0xc8]
sub ecx, dword [rbx + 0xc0]
cmp ecx, r13d
jge 0x18000e789
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 0x18000e790
add qword [rbx + 0xc0], r13
mov r13d, dword [rsp + 0x48]
test r13d, r13d
js 0x18000ec5e
xor edx, edx
imul esi, r13d
mov eax, 0x7fffffff
div edi
cmp r13d, eax
jg 0x18000ec5e
movsxd rcx, esi
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
mov qword [rsp + 0x60], rax
test rax, rax
je 0x18000ec5e
mov dword [rsp + 0xe8], ebp
test ebp, ebp
je 0x18000e8eb
mov rsi, rax
test r13d, r13d
jle 0x18000e8e6
mov eax, edi
mov dword [rsp + 0x38], edi
mov edi, eax
nop
mov rcx, rbx
call fcn.1800030c0
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 0x18000e7f0
mov r13d, dword [rsp + 0x38]
mov edx, dword [rsp + 0x30]
mov edi, dword [rsp + 0x34]
mov ecx, edi
mov eax, dword [rsp + 0xf8]
imul ecx, eax
mov esi, r13d
mov dword [rsp + 0x38], ecx
test ecx, ecx
je 0x18000eb72
mov rax, qword [rsp + 0x40]
lea r8, [rsp + 0xd0]
mov rbp, qword [rsp + 0x70]
sub rax, r8
mov qword [rsp + 0x68], rax
mov qword [rsp + 0x58], rcx
cmp edx, 8
jb 0x18000e965
test r12d, r12d
jne 0x18000e955
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x18000e919
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e93f
mov r13d, edi
jmp 0x18000e873
mov r8d, esi
mov rdx, rax
mov rcx, rbx
mov r13d, edi
call fcn.180002f30
test eax, eax
jne 0x18000e873
mov rcx, qword [rsp + 0x40]
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov rcx, qword [rsp + 0x60]
jmp 0x18000e719
cmp dword [rbp], r14d
je 0x18000e93d
mov rcx, rbx
call fcn.180002eb0
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000e93f
xor cl, cl
movzx eax, cl
mov r12d, eax
and r12d, 0x7f
inc r12d
shr eax, 7
mov dword [rsp + 0x4c], eax
jmp 0x18000e965
cmp dword [rsp + 0x4c], r14d
je 0x18000e965
test r15d, r15d
je 0x18000eb11
cmp byte [rsp + 0xf0], r14b
je 0x18000ea06
cmp dword [rsp + 0x50], 8
jne 0x18000e9ca
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x18000e99c
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
movzx eax, cl
jmp 0x18000e9d2
cmp dword [rbp], r14d
je 0x18000e9c3
mov rcx, rbx
call fcn.180002eb0
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
movzx eax, cl
jmp 0x18000e9d2
xor cl, cl
movzx eax, cl
jmp 0x18000e9d2
mov rcx, rbx
call fcn.1800030c0
test r13d, r13d
je 0x18000eb04
cmp eax, dword [rsp + 0x48]
mov ecx, r14d
mov r8, rsi
cmovl ecx, eax
imul ecx, r13d
movsxd rdx, ecx
lea rcx, [rsp + 0xd0]
add rdx, qword [rsp + 0x60]
call sub.VCRUNTIME140.dll_memcpy
jmp 0x18000eb04
cmp dword [rsp + 0xe8], r14d
je 0x18000ea99
mov rcx, rbx
call fcn.1800030c0
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 + 0xd0], 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 + 0xd1], dl
imul ecx
add edx, ecx
sar edx, 4
mov eax, edx
shr eax, 0x1f
add edx, eax
mov byte [rsp + 0xd2], dl
jmp 0x18000eb04
mov rdi, r14
test r13d, r13d
je 0x18000eb04
nop dword [rax]
nop word [rax + rax]
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x18000eacf
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000eaf5
cmp dword [rbp], r14d
je 0x18000eaf3
mov rcx, rbx
call fcn.180002eb0
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x18000eaf5
xor cl, cl
mov byte [rsp + rdi + 0xd0], cl
inc rdi
cmp rdi, rsi
jl 0x18000eab0
mov rax, qword [rsp + 0x68]
mov r15d, r14d
mov rcx, qword [rsp + 0x58]
mov rdi, r14
test r13d, r13d
je 0x18000eb46
lea rcx, [rsp + 0xd0]
mov r8, rsi
add rcx, rax
lea rdx, [rsp + 0xd0]
call sub.VCRUNTIME140.dll_memcpy
inc rdi
cmp rdi, rsi
jl 0x18000eb34
mov rax, qword [rsp + 0x68]
mov rcx, qword [rsp + 0x58]
movsxd rdx, r13d
dec r12d
add rax, rdx
mov edx, dword [rsp + 0x30]
sub rcx, 1
mov qword [rsp + 0x68], rax
mov qword [rsp + 0x58], rcx
jne 0x18000e8b5
mov edi, dword [rsp + 0x34]
mov eax, dword [rsp + 0xf8]
cmp dword [rsp + 0x54], r14d
je 0x18000ebd9
test edi, edi
jle 0x18000ebd9
mov rbp, qword [rsp + 0x40]
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 0x18000ebca
movsxd rax, ebx
movsxd r9, r10d
sub r9, rax
lea rdx, [rax + rbp]
nop dword [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 0x18000ebb0
add ebx, r11d
sub r10d, r11d
add r14d, 2
cmp r14d, edi
jl 0x18000eb98
mov rax, qword [rsp + 0x60]
test rax, rax
je 0x18000ebec
mov rcx, rax
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov edx, dword [rsp + 0xf8]
mov ecx, dword [rsp + 0x38]
mov rax, qword [rsp + 0x40]
cmp r13d, 3
jb 0x18000ec3e
cmp dword [rsp + 0xe8], 0
jne 0x18000ec3e
mov r8, rax
test ecx, ecx
je 0x18000ec3e
mov r10d, ecx
nop word [rax + rax]
movzx ecx, byte [r8]
movzx eax, byte [r8 + 2]
mov byte [r8], al
mov byte [r8 + 2], cl
add r8, rsi
sub r10, 1
jne 0x18000ec20
mov rax, qword [rsp + 0x40]
cmp r13d, 4
je 0x18000ecaa
mov r9d, edx
mov dword [rsp + 0x20], edi
mov edx, r13d
mov r8d, 4
mov rcx, rax
call fcn.180003180
jmp 0x18000ecaa
mov rcx, qword [rsp + 0x40]
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov edx, dword [0x180130024]
mov rax, qword gs:[0x58]
mov rax, qword [rax + rdx*8]
lea rdx, str.outofmem
jmp 0x18000ec9f
mov edx, dword [0x180130024]
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 + 0x88]
add rsp, 0x90
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbx
ret