Function at 0x140054f90
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, 0x98
mov rax, qword [0x1400a6fc0]
xor rax, rsp
mov qword [rsp + 0x80], rax
mov rax, qword [rcx + 0xc0]
mov rbx, rcx
mov qword [rsp + 0x68], r9
mov qword [rsp + 0x70], r8
mov qword [rsp + 0x60], rdx
cmp rax, qword [rcx + 0xc8]
jae 0x140054fe7
movzx edx, byte [rax]
inc rax
mov qword [rcx + 0xc0], rax
jmp 0x14005500a
cmp dword [rcx + 0x30], 0
je 0x140055008
call fcn.140049dd0
mov rax, qword [rbx + 0xc0]
movzx edx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x14005500a
xor dl, dl
mov ecx, 0x30
mov r8, rbx
lea rdi, [rcx + rbx]
movzx ecx, dl
mov dword [rsp + 0x38], ecx
cmp rax, qword [rbx + 0xc8]
jae 0x140055039
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
mov byte [rsp + 0x20], cl
jmp 0x140055065
cmp dword [rdi], 0
je 0x140055060
mov rcx, rbx
call fcn.140049dd0
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
mov byte [rsp + 0x20], cl
jmp 0x140055065
mov byte [rsp + 0x20], 0
cmp rax, qword [rbx + 0xc8]
jae 0x14005507d
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x1400550a2
cmp dword [rdi], 0
je 0x1400550a0
mov rcx, rbx
call fcn.140049dd0
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x1400550a2
xor cl, cl
movzx eax, cl
mov rcx, rbx
mov dword [rsp + 0x2c], eax
mov esi, eax
call fcn.140049fe0
mov rcx, rbx
movsxd r15, eax
call fcn.140049fe0
mov rcx, qword [rbx + 0xc0]
mov dword [rsp + 0x40], eax
cmp rcx, qword [rbx + 0xc8]
jae 0x1400550e1
movzx edx, byte [rcx]
inc rcx
mov qword [rbx + 0xc0], rcx
jmp 0x140055106
cmp dword [rdi], 0
je 0x140055104
mov rcx, rbx
call fcn.140049dd0
mov rax, qword [rbx + 0xc0]
movzx edx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140055106
xor dl, dl
mov rcx, rbx
movzx r12d, dl
call fcn.140049fe0
mov rcx, rbx
call fcn.140049fe0
mov rcx, rbx
call fcn.140049fe0
mov rcx, rbx
mov dword [rsp + 0x30], eax
call fcn.140049fe0
mov dword [rsp + 0x28], eax
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x140055151
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140055176
cmp dword [rdi], 0
je 0x140055174
mov rcx, rbx
call fcn.140049dd0
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140055176
xor cl, cl
movzx edx, cl
mov dword [rsp + 0x54], edx
cmp rax, qword [rbx + 0xc8]
jae 0x140055195
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x1400551be
cmp dword [rdi], 0
je 0x1400551bc
mov rcx, rbx
call fcn.140049dd0
mov rax, qword [rbx + 0xc0]
mov edx, dword [rsp + 0x54]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x1400551be
xor cl, cl
xor ebp, ebp
movzx eax, cl
cmp dword [rsp + 0x28], 0x1000000
mov r14d, ebp
mov qword [rsp + 0x48], rbp
mov r13d, 1
mov dword [rsp + 0x78], ebp
mov dword [rsp + 0x50], ebp
jg 0x14005592b
mov r8d, dword [rsp + 0x30]
cmp r8d, 0x1000000
jg 0x14005592b
cmp esi, 8
jb 0x140055201
sub esi, 8
shr eax, 5
mov ecx, r13d
and eax, r13d
mov dword [rsp + 0x24], ebp
sub ecx, eax
mov dword [rsp + 0x58], ecx
cmp byte [rsp + 0x20], bpl
je 0x14005523c
mov ecx, r12d
sub ecx, 8
je 0x14005527f
sub ecx, 7
je 0x140055272
sub ecx, r13d
je 0x140055272
sub ecx, 8
je 0x14005525f
cmp ecx, 8
je 0x14005525f
mov r12d, ebp
jmp 0x140055282
mov ecx, edx
sub ecx, 8
je 0x14005527f
sub ecx, 7
je 0x140055272
sub ecx, r13d
je 0x140055265
sub ecx, 8
je 0x14005525c
cmp ecx, 8
je 0x14005525c
mov r12d, ebp
jmp 0x140055282
mov r12d, edx
shr r12d, 3
jmp 0x140055282
cmp esi, 3
jne 0x140055272
mov r12d, 2
jmp 0x140055282
mov r12d, 3
mov dword [rsp + 0x24], r13d
jmp 0x140055282
mov r12d, r13d
test r12d, r12d
jne 0x14005529f
mov rax, qword gs:[0x58]
mov rcx, qword [rax]
lea rax, str.bad_format
jmp 0x14005593e
mov rax, qword [rsp + 0x60]
mov esi, dword [rsp + 0x28]
mov dword [rax], r8d
mov rax, qword [rsp + 0x70]
mov dword [rax], esi
mov rax, qword [rsp + 0x68]
test rax, rax
je 0x1400552bf
mov dword [rax], r12d
test r8d, r8d
js 0x14005592b
test esi, esi
js 0x14005592b
je 0x1400552e3
mov eax, 0x7fffffff
cdq
idiv esi
cmp r8d, eax
jg 0x14005592b
mov ecx, esi
imul ecx, r8d
test ecx, ecx
js 0x14005592b
xor edx, edx
mov eax, 0x7fffffff
div r12d
cmp ecx, eax
jg 0x14005592b
test esi, esi
je 0x140055318
mov eax, 0x7fffffff
cdq
idiv esi
cmp r8d, eax
jg 0x140055916
mov eax, esi
imul eax, r12d
imul eax, r8d
movsxd rcx, eax
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
mov rdi, rax
test rax, rax
je 0x140055916
movsxd rdx, dword [rsp + 0x38]
test edx, edx
je 0x140055376
cmp qword [rbx + 0x10], rbp
je 0x14005536f
mov ecx, dword [rbx + 0xc8]
sub ecx, dword [rbx + 0xc0]
cmp ecx, edx
jge 0x14005536f
mov rax, qword [rbx + 0xc8]
sub edx, ecx
mov rcx, qword [rbx + 0x28]
mov qword [rbx + 0xc0], rax
call qword [rbx + 0x18]
jmp 0x140055376
add qword [rbx + 0xc0], rdx
cmp byte [rsp + 0x20], bpl
jne 0x140055430
mov edx, dword [rsp + 0x2c]
mov r15, rdi
mov qword [rsp + 0x38], rdi
cmp edx, 8
jae 0x14005562b
mov eax, dword [rsp + 0x24]
mov qword [rsp + 0x38], rdi
test eax, eax
jne 0x14005562b
mov r13, rdi
test esi, esi
jle 0x1400558d0
mov edx, dword [rsp + 0x30]
mov r14d, edx
imul r14d, r12d
cmp dword [rsp + 0x58], ebp
je 0x140055400
mov eax, r14d
neg eax
movsxd r15, eax
mov eax, dword [rsp + 0x28]
dec eax
imul eax, r12d
imul eax, edx
movsxd rbp, eax
add rbp, rdi
nop
mov r8d, r14d
mov rdx, rbp
mov rcx, rbx
call fcn.140049e50
add rbp, r15
sub rsi, 1
jne 0x1400553e0
mov esi, dword [rsp + 0x28]
jmp 0x1400558cc
movsxd rbp, r14d
nop dword [rax]
nop word [rax + rax]
mov r8d, r14d
mov rdx, rdi
mov rcx, rbx
call fcn.140049e50
add rdi, rbp
sub rsi, 1
jne 0x140055410
mov esi, dword [rsp + 0x28]
jmp 0x1400558cc
mov r8d, dword [rsp + 0x40]
test r8d, r8d
je 0x14005560a
test r15d, r15d
je 0x140055495
jns 0x140055455
mov rax, qword [rbx + 0xc8]
mov qword [rbx + 0xc0], rax
jmp 0x140055495
cmp qword [rbx + 0x10], rbp
je 0x14005548e
mov ecx, dword [rbx + 0xc8]
sub ecx, dword [rbx + 0xc0]
cmp ecx, r15d
jge 0x14005548e
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]
mov r8d, dword [rsp + 0x40]
jmp 0x140055495
add qword [rbx + 0xc0], r15
test r8d, r8d
js 0x14005590a
xor edx, edx
mov eax, 0x7fffffff
div r12d
cmp r8d, eax
jg 0x14005590a
mov r15, rdi
mov qword [rsp + 0x38], rdi
mov edi, r12d
imul edi, r8d
movsxd rcx, edi
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
mov qword [rsp + 0x48], rax
test rax, rax
je 0x14005590d
cmp dword [rsp + 0x24], ebp
je 0x1400555ec
mov rdi, rax
mov eax, dword [rsp + 0x40]
test eax, eax
jle 0x1400555e5
mov esi, eax
mov r15d, r12d
mov rax, qword [rsp + 0x38]
mov qword [rsp + 0x38], rax
nop
mov rcx, rbx
call fcn.140049fe0
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, r15
sub rsi, r13
jne 0x140055500
mov r15, qword [rsp + 0x38]
mov esi, dword [rsp + 0x28]
mov rdi, qword [rsp + 0x48]
mov edx, dword [rsp + 0x2c]
mov ecx, dword [rsp + 0x30]
mov eax, esi
imul eax, ecx
mov esi, r12d
test eax, eax
je 0x14005584f
lea r8, [rsp + 0x78]
mov ecx, r12d
sub r15, r8
mov qword [rsp + 0x60], rax
cmp edx, 8
jb 0x14005567d
test r14d, r14d
jne 0x14005566e
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x140055633
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140055658
mov qword [rsp + 0x38], r15
jmp 0x14005558c
mov r8d, edi
mov rdx, rax
mov rcx, rbx
mov rdi, rax
call fcn.140049e50
test eax, eax
jne 0x14005558c
mov rcx, r15
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov rcx, rdi
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov rax, qword gs:[0x58]
mov rcx, qword [rax]
lea rax, str.bad_palette
jmp 0x14005593e
mov rdi, rbp
jmp 0x140055590
cmp dword [rbx + 0x30], ebp
je 0x140055656
mov rcx, rbx
call fcn.140049dd0
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140055658
xor cl, cl
movzx eax, cl
mov r14d, eax
and r14d, 0x7f
inc r14d
shr eax, 7
mov dword [rsp + 0x50], eax
jmp 0x14005567d
cmp dword [rsp + 0x50], ebp
je 0x14005567d
test r13d, r13d
je 0x1400557fb
cmp byte [rsp + 0x20], bpl
je 0x140055714
cmp dword [rsp + 0x54], 8
jne 0x1400556de
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x1400556b1
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
movzx eax, cl
jmp 0x1400556e6
cmp dword [rbx + 0x30], ebp
je 0x1400556d7
mov rcx, rbx
call fcn.140049dd0
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
movzx eax, cl
jmp 0x1400556e6
xor cl, cl
movzx eax, cl
jmp 0x1400556e6
mov rcx, rbx
call fcn.140049fe0
test r12d, r12d
je 0x1400557f0
cmp eax, dword [rsp + 0x40]
mov ecx, ebp
mov r8, rsi
cmovl ecx, eax
imul ecx, r12d
movsxd rdx, ecx
lea rcx, [rsp + 0x78]
add rdx, rdi
call sub.VCRUNTIME140.dll_memcpy
jmp 0x1400557f0
cmp dword [rsp + 0x24], ebp
je 0x140055796
mov rcx, rbx
call fcn.140049fe0
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 0x1400557f0
mov rdi, rbp
test r12d, r12d
je 0x1400557f0
nop
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x1400557bf
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x1400557e4
cmp dword [rbx + 0x30], ebp
je 0x1400557e2
mov rcx, rbx
call fcn.140049dd0
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x1400557e4
xor cl, cl
mov byte [rsp + rdi + 0x78], cl
inc rdi
cmp rdi, rsi
jl 0x1400557a0
mov rax, qword [rsp + 0x60]
mov r13d, ebp
mov ecx, r12d
mov rdi, rbp
test r12d, r12d
je 0x140055828
lea rcx, [rsp + 0x78]
mov r8, rsi
add rcx, r15
lea rdx, [rsp + 0x78]
call sub.VCRUNTIME140.dll_memcpy
inc rdi
cmp rdi, rsi
jl 0x140055818
mov rax, qword [rsp + 0x60]
mov ecx, r12d
mov rdi, qword [rsp + 0x48]
dec r14d
mov edx, dword [rsp + 0x2c]
add r15, rcx
sub rax, 1
mov qword [rsp + 0x60], rax
jne 0x1400555b4
mov r15, qword [rsp + 0x38]
mov ecx, dword [rsp + 0x30]
mov esi, dword [rsp + 0x28]
cmp dword [rsp + 0x58], ebp
je 0x1400558b7
test esi, esi
jle 0x1400558b7
lea r10d, [rsi - 1]
mov r11d, r12d
imul r10d, r12d
mov ebx, ebp
imul r11d, ecx
imul r10d, ecx
mov r8d, r11d
test r11d, r11d
jle 0x1400558aa
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 0x140055890
add ebx, r11d
sub r10d, r11d
add ebp, 2
cmp ebp, esi
jl 0x140055872
mov rcx, qword [rsp + 0x48]
test rcx, rcx
je 0x1400558c7
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov r13, qword [rsp + 0x38]
mov eax, dword [rsp + 0x24]
cmp r12d, 3
jb 0x140055905
test eax, eax
jne 0x140055905
imul esi, dword [rsp + 0x30]
mov rdx, r13
test esi, esi
je 0x140055905
mov r9d, r12d
mov r8d, esi
nop dword [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 0x1400558f0
mov rax, r13
jmp 0x140055949
mov r15, rdi
mov rcx, r15
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov rax, qword gs:[0x58]
mov rcx, qword [rax]
lea rax, str.outofmem
jmp 0x14005593e
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 + 0x80]
xor rcx, rsp
call fcn.14006dfd0
add rsp, 0x98
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbp
pop rbx
ret