Function at 0x140040238
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
mov rax, rsp
push rbp
push rbx
push rsi
push rdi
push r12
push r13
push r14
push r15
lea rbp, [rax - 0x78]
sub rsp, 0x138
movaps xmmword [rax - 0x58], xmm6
mov rdi, rcx
movsd xmm6, qword [0x140136520]
xorps xmm5, xmm5
xorps xmm4, xmm4
xorps xmm3, xmm3
movaps xmm2, xmm3
movaps xmm1, xmm3
mulsd xmm2, qword [0x140135ed8]
movaps xmm0, xmm3
mulsd xmm1, qword [0x140135240]
mulsd xmm0, xmm3
mulsd xmm2, xmm3
mulsd xmm1, xmm3
subsd xmm2, xmm0
addsd xmm1, qword [0x1401356a8]
divsd xmm2, xmm1
addsd xmm4, xmm2
comisd xmm4, xmmword [0x140135a28]
jbe 0x1400402bc
movaps xmm0, xmm3
mulsd xmm0, qword [0x1401350a8]
subsd xmm4, xmm0
addsd xmm3, qword [0x1401350c0]
comisd xmm6, xmm3
ja 0x14004026a
comisd xmm5, xmm4
jbe 0x1400402df
call fcn.140041c88
call fcn.140041ca2
jmp 0x1400406c8
xor eax, eax
lea rcx, [rsp + 0x20]
lea r15d, [rax + 1]
mov byte [rcx], al
add eax, r15d
add rcx, r15
cmp eax, 0x100
jb 0x1400402ea
xor r10d, r10d
mov r9d, 0xff
xor cl, cl
xor ebx, ebx
mov r11d, r15d
cmp r9d, r15d
jbe 0x14004031b
lea r11d, [r11*2 + 1]
cmp r11d, r9d
jb 0x14004030e
movzx eax, cl
mov dl, byte [rsp + rax + 0x20]
mov eax, r10d
test r10d, r10d
je 0x140040367
sub eax, r15d
je 0x14004035d
sub eax, r15d
je 0x140040353
cmp eax, r15d
je 0x140040349
lea ecx, [r10 - 4]
lea rax, [fcn.140041ca2]
mov al, byte [rcx + rax]
jmp 0x14004036c
cvttsd2si rax, xmm4
shr eax, 0x18
jmp 0x14004036c
cvttsd2si rax, xmm4
shr eax, 0x10
jmp 0x14004036c
cvttsd2si rax, xmm4
shr eax, 8
jmp 0x14004036c
cvttsd2si rax, xmm4
add al, dl
lea r8d, [r10 + 1]
movzx edx, al
cmp r8d, 0x14
lea eax, [rdx + 0x14]
movzx ecx, al
cmovb ecx, edx
sbb r10d, r10d
movzx r14d, cl
and r10d, r8d
mov eax, r14d
add ebx, r15d
and eax, r11d
cmp ebx, 0xb
jbe 0x1400403a1
xor edx, edx
div r9d
mov eax, edx
mov cl, r14b
cmp eax, r9d
ja 0x14004031b
je 0x1400403cc
mov edx, eax
mov ecx, r9d
mov al, byte [rsp + rdx + 0x20]
xor byte [rsp + rcx + 0x20], al
mov al, byte [rsp + rcx + 0x20]
xor byte [rsp + rdx + 0x20], al
mov al, byte [rsp + rdx + 0x20]
xor byte [rsp + rcx + 0x20], al
mov cl, r14b
add r9d, 0xffffffff
jne 0x140040304
movzx r10d, byte [rsp + r14 + 0x20]
lea rsi, fcn.140041c88
movzx edx, byte [rsp + 0x27]
movzx r14d, byte [rsp + 0x21]
mov r13b, byte [rsp + 0x23]
movzx r11d, byte [rsp + r10 + 0x20]
mov r12b, byte [rsp + 0x25]
add r13b, byte [rsp + r14 + 0x20]
add r14b, r15b
mov bl, byte [rsi]
mov cl, byte [rsi + r15]
add bl, 6
sub cl, 0x4c
movzx r9d, r13b
shl bl, 4
add r13b, r11b
or bl, cl
mov qword [rbp + 0x90], 5
movzx ecx, r14b
add r14b, r15b
mov al, byte [rsp + r9 + 0x20]
mov byte [rsp + r10 + 0x20], al
mov al, byte [rsp + rdx + 0x20]
mov byte [rsp + r9 + 0x20], al
mov al, byte [rsp + rcx + 0x20]
mov byte [rsp + rdx + 0x20], al
mov byte [rsp + rcx + 0x20], r11b
add r12b, byte [rsp + r11 + 0x20]
movzx eax, r12b
movzx ecx, byte [rsp + rax + 0x20]
movzx eax, byte [rsp + r10 + 0x20]
add rcx, rax
movzx r10d, r13b
movzx eax, byte [rsp + rdx + 0x20]
add rcx, rax
movzx eax, cl
movzx ecx, byte [rsp + rax + 0x20]
movzx eax, byte [rsp + r9 + 0x20]
add rax, r11
movzx r9d, bl
movzx eax, al
mov dl, byte [rsp + rcx + 0x20]
lea rcx, [rsi + 2]
mov sil, byte [rsi + 3]
mov qword [rbp + 0x98], rcx
sub sil, 0x4c
xor dl, byte [rsp + rax + 0x20]
mov al, byte [rcx]
xor dl, bl
movzx ebx, byte [rsp + r9 + 0x20]
add al, 6
shl al, 4
or sil, al
movzx r8d, dl
mov al, byte [rsp + r10 + 0x20]
mov byte [rsp + r9 + 0x20], al
movzx ecx, r14b
mov al, byte [rsp + r8 + 0x20]
mov byte [rsp + r10 + 0x20], al
mov byte [rbp + 0x80], sil
mov al, byte [rsp + rcx + 0x20]
mov byte [rsp + r8 + 0x20], al
mov byte [rsp + rcx + 0x20], bl
add r12b, byte [rsp + rbx + 0x20]
movzx eax, r12b
movzx ecx, byte [rsp + rax + 0x20]
movzx eax, byte [rsp + r8 + 0x20]
add rcx, rax
movzx eax, byte [rsp + r9 + 0x20]
add rcx, rax
movzx eax, cl
movzx ecx, byte [rsp + rax + 0x20]
movzx eax, byte [rsp + r10 + 0x20]
add rax, rbx
movzx eax, al
mov dl, byte [rsp + rcx + 0x20]
mov cl, byte [rbp + 0x80]
xor dl, byte [rsp + rax + 0x20]
xor dl, sil
mov rsi, qword [rbp + 0x98]
mov byte [rdi], dl
mov r8b, bl
movzx r10d, cl
lea rsi, [rsi + 2]
mov al, byte [rsi]
add r13b, r8b
mov r11b, byte [rsi + 1]
add al, 6
shl al, 4
sub r11b, 0x4c
movzx ebx, byte [rsp + r10 + 0x20]
or r11b, al
movzx r8d, dl
inc r14b
movzx r9d, r13b
inc r15
movzx ecx, r14b
mov al, byte [rsp + r9 + 0x20]
mov byte [rsp + r10 + 0x20], al
mov al, byte [rsp + r8 + 0x20]
mov byte [rsp + r9 + 0x20], al
mov al, byte [rsp + rcx + 0x20]
mov byte [rsp + r8 + 0x20], al
mov byte [rsp + rcx + 0x20], bl
add r12b, byte [rsp + rbx + 0x20]
movzx eax, r12b
movzx ecx, byte [rsp + rax + 0x20]
movzx eax, byte [rsp + r8 + 0x20]
add rcx, rax
movzx eax, byte [rsp + r10 + 0x20]
add rcx, rax
movzx eax, cl
movzx ecx, byte [rsp + rax + 0x20]
movzx eax, byte [rsp + r9 + 0x20]
add rax, rbx
movzx eax, al
mov dl, byte [rsp + rcx + 0x20]
mov cl, r11b
xor dl, byte [rsp + rax + 0x20]
xor dl, r11b
test r15, r15
jle 0x1400405de
mov byte [rdi + r15 - 1], dl
sub qword [rbp + 0x90], 1
mov r8b, bl
jne 0x14004053c
mov r15d, 6
lea rsi, fcn.140041c88
add rsi, 0xc
mov qword [rbp + 0x88], r15
movzx r10d, cl
lea rsi, [rsi + 2]
mov al, byte [rsi + 1]
add r13b, bl
mov r11b, byte [rsi]
sub al, 0x4c
movzx r8d, dl
add r11b, 6
movzx r9d, r13b
inc r14b
movzx ecx, r14b
inc r15
shl r11b, 4
or r11b, al
mov al, byte [rsp + r10 + 0x20]
mov byte [rbp + 0x80], al
mov al, byte [rsp + r9 + 0x20]
movzx ebx, byte [rbp + 0x80]
mov byte [rsp + r10 + 0x20], al
mov al, byte [rsp + r8 + 0x20]
mov byte [rsp + r9 + 0x20], al
mov al, byte [rsp + rcx + 0x20]
mov byte [rsp + r8 + 0x20], al
mov byte [rsp + rcx + 0x20], bl
add r12b, byte [rsp + rbx + 0x20]
movzx eax, r12b
movzx ecx, byte [rsp + rax + 0x20]
movzx eax, byte [rsp + r8 + 0x20]
add rcx, rax
movzx eax, byte [rsp + r10 + 0x20]
add rcx, rax
movzx eax, cl
movzx ecx, byte [rsp + rax + 0x20]
movzx eax, byte [rsp + r9 + 0x20]
add rax, rbx
movzx eax, al
mov dl, byte [rsp + rcx + 0x20]
mov cl, r11b
xor dl, byte [rsp + rax + 0x20]
xor dl, r11b
test r15, r15
jle 0x1400406b6
mov byte [rdi + r15 - 1], dl
sub qword [rbp + 0x88], 1
jne 0x140040607
mov byte [rdi + 0xc], 0
movaps xmm6, xmmword [rsp + 0x120]
mov rax, rdi
add rsp, 0x138
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbx
pop rbp
ret