Function at 0x140051140
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
mov word [rsp + 0x10], dx
mov qword [rsp + 8], rcx
push rbx
push rbp
push rsi
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0xa8
xor eax, eax
mov rbp, rcx
movzx r12d, dx
mov qword [rsp + 0x70], rax
mov rax, qword [rcx]
movzx ecx, byte [rcx + 0x39]
mov rdx, qword [rax]
mov r14d, 1
xor si, si
xor r13w, r13w
cmp ecx, r14d
mov dword [rsp + 0x50], 0
mov qword [rsp + 0x78], rdx
mov qword [rsp + 0x90], rax
mov dword [rsp + 0x54], ecx
jg 0x1400511a5
mov edi, r14d
jmp 0x1400511b5
mov edi, 0xa
mov eax, 5
cmp ecx, 2
cmove edi, eax
mov rax, qword [rbp + 0x10]
mov dword [rsp + 0x108], edi
test rax, rax
je 0x1400511d0
test r12w, r12w
je 0x1400511d0
mov r15d, dword [rax]
jmp 0x1400511d3
xor r15d, r15d
lea eax, [rcx + 4]
mov dword [rsp + 0x68], r15d
imul eax, edi
lea ecx, [r15 + rax*8]
add ecx, ecx
test rdx, rdx
movsxd rbx, ecx
je 0x1400511f6
cmp byte [rdx + 0x51], 0
jne 0x140051bb8
test ecx, ecx
je 0x140051baf
cmp rbx, 0x7fffff00
jae 0x140051baf
cmp dword [0x1400bf010], 0
je 0x140051251
mov rcx, qword [0x1400c52b8]
test rcx, rcx
je 0x140051226
call qword [0x1400bf098]
lea rdx, [rsp + 0x100]
mov ecx, ebx
call fcn.140011830
mov rcx, qword [0x1400c52b8]
test rcx, rcx
je 0x140051247
call qword [0x1400bf0a8]
mov rdx, qword [rsp + 0x100]
jmp 0x14005125c
mov ecx, ebx
call qword [0x1400bf038]
mov rdx, rax
test rdx, rdx
mov qword [rsp + 0x48], rdx
je 0x140051baa
xor eax, eax
movsxd rcx, edi
mov r10, rdx
shl rcx, 5
mov qword [rsp + 0x58], rdx
lea r9, [rdx + rcx]
add rcx, r9
mov qword [rsp + 0x80], r9
mov qword [r9], rax
mov qword [r9 + 8], rax
mov qword [r9 + 0x10], rax
mov qword [r9 + 0x18], rax
lea eax, [rdi + rdi]
test eax, eax
jle 0x1400512c3
movsxd rdi, dword [rsp + 0x54]
mov r8, rdi
shl r8, 3
add rdx, 0x18
mov qword [rdx], rcx
sub eax, r14d
add rdx, 0x20
add rcx, r8
test eax, eax
jg 0x1400512b0
jmp 0x1400512c7
mov edi, dword [rsp + 0x54]
test r15d, r15d
je 0x1400512eb
movsxd r8, r15d
xor edx, edx
mov qword [rsp + 0x70], rcx
add r8, r8
call sub.msvcrt.dll_memset
mov r10, qword [rsp + 0x58]
mov r9, qword [rsp + 0x80]
mov rax, qword [rsp + 0x90]
mov ecx, 0x30
mov edx, r14d
mov eax, dword [rax + 0x1cc]
mov dword [rsp + 0x60], edx
cmp eax, ecx
cmovb ecx, eax
test r15d, r15d
mov word [r9 + 0x10], cx
je 0x140051324
or ecx, 0xffffffff
movzx eax, r15b
test edi, edi
cmovg eax, ecx
mov byte [r9 + 0x16], al
xor ecx, ecx
test edi, edi
mov dword [rsp + 0x100], ecx
jle 0x140051983
lea r12, [0x140000000]
nop
xor eax, eax
xor r15d, r15d
test edx, edx
mov rdi, r9
mov qword [rsp + 0x40], r9
mov dword [rsp + 0x64], eax
jle 0x140051888
nop
nop
mov r14, qword [rbp + 0x20]
test r14, r14
je 0x140051861
nop
mov r9, qword [rdi]
movzx r11d, byte [rdi + 0x16]
mov qword [rsp + 0x88], 0
mov rax, r9
not rax
test qword [r14], rax
jne 0x140051844
mov rbp, qword [r14 + 8]
test r9, rbp
jne 0x140051844
movzx r10d, word [rdi + 0x10]
movzx edx, word [r14 + 0x14]
mov bx, word [r14 + 0x12]
add dx, r10w
cmp bx, dx
jl 0x1400513ee
movsx ecx, dx
movsx r8d, bx
lea eax, [rcx + 0x31]
cmp r8d, eax
jg 0x140051426
lea eax, [rcx + 0x1f]
cmp r8d, eax
jle 0x1400513d5
add bx, 1
jmp 0x140051426
movsx rcx, bx
movsx rax, dx
sub rcx, rax
movzx eax, byte [rcx + r12 + 0xabce0]
add bx, ax
jmp 0x140051426
movsx ecx, bx
movsx r8d, dx
lea eax, [rcx + 0x31]
cmp r8d, eax
jle 0x140051402
mov bx, dx
jmp 0x140051426
lea eax, [rcx + 0x1f]
cmp r8d, eax
jle 0x14005140f
lea ebx, [rdx + 1]
jmp 0x140051426
movsx rax, bx
movsx rcx, dx
sub rcx, rax
movzx ebx, byte [rcx + r12 + 0xabce0]
add bx, dx
movzx edx, word [rdi + 0x14]
cmp bx, dx
jl 0x140051465
movsx ecx, dx
movsx r8d, bx
lea eax, [rcx + 0x31]
cmp r8d, eax
jg 0x14005149d
lea eax, [rcx + 0x1f]
cmp r8d, eax
jle 0x14005144c
add bx, 1
jmp 0x14005149d
movsx rax, dx
movsx rcx, bx
sub rcx, rax
movzx eax, byte [rcx + r12 + 0xabce0]
add bx, ax
jmp 0x14005149d
movsx ecx, bx
movsx r8d, dx
lea eax, [rcx + 0x31]
cmp r8d, eax
jle 0x140051479
mov bx, dx
jmp 0x14005149d
lea eax, [rcx + 0x1f]
cmp r8d, eax
jle 0x140051486
lea ebx, [rdx + 1]
jmp 0x14005149d
movsx rax, bx
movsx rcx, dx
sub rcx, rax
movzx ebx, byte [rcx + r12 + 0xabce0]
add bx, dx
movzx r12d, word [r14 + 0x16]
or rbp, r9
add r12w, r10w
test r11b, r11b
jns 0x1400514f5
lea rax, [rsp + 0x88]
mov r8, rdi
mov qword [rsp + 0x30], rax
mov eax, dword [rsp + 0x100]
mov qword [rsp + 0x28], r14
mov word [rsp + 0x20], ax
mov rax, qword [rsp + 0xf0]
movzx r9d, word [rax + 0x32]
mov rdx, qword [rax + 0x10]
mov rcx, rax
call fcn.14004d550
mov r9, qword [rsp + 0x88]
mov r11b, al
jmp 0x1400514f9
mov r9, qword [rdi + 8]
test r11b, r11b
js 0x140051707
mov edi, dword [rsp + 0x68]
movsx ecx, r11b
cmp ecx, edi
jge 0x140051707
mov r10, qword [rsp + 0x70]
movsx r8, r11b
cmp word [r10 + r8*2], 0
jne 0x140051683
mov eax, edi
sub eax, ecx
mov cx, 0x28
imul eax, eax, 0x64
cdq
idiv edi
cdqe
cmp rax, 8
jae 0x14005155f
cmp rax, 2
jae 0x140051550
xor dx, dx
jmp 0x1400515b6
add rax, rax
add cx, 0xfff6
cmp rax, 8
jb 0x140051550
jmp 0x14005159d
cmp rax, 0xff
jbe 0x140051580
nop
nop
nop
shr rax, 4
add cx, 0x28
cmp rax, 0xff
ja 0x140051570
cmp rax, 0xf
jbe 0x14005159d
nop
nop
nop
shr rax, 1
add cx, 0xa
cmp rax, 0xf
ja 0x140051590
and eax, 7
lea rdx, [0x140000000]
movzx edx, word [rdx + rax*2 + 0xbf298]
add dx, cx
sub dx, 0xa
mov di, word [rsp + 0xf8]
sub dx, 0x42
cmp di, 0xa
jg 0x1400515cf
xor eax, eax
jmp 0x140051660
movsx rax, di
mov cx, 0x28
cmp rax, 8
jae 0x1400515ff
cmp rax, 2
jae 0x1400515f0
xor ax, ax
jmp 0x14005165c
add rax, rax
add cx, 0xfff6
cmp rax, 8
jb 0x1400515f0
jmp 0x14005163d
cmp rax, 0xff
jbe 0x140051620
nop
nop
nop
shr rax, 4
add cx, 0x28
cmp rax, 0xff
ja 0x140051610
cmp rax, 0xf
jbe 0x14005163d
nop
nop
nop
shr rax, 1
add cx, 0xa
cmp rax, 0xf
ja 0x140051630
and eax, 7
lea r10, [0x140000000]
movzx eax, word [r10 + rax*2 + 0xbf298]
mov r10, qword [rsp + 0x70]
add ax, cx
sub ax, 0xa
cwde
sub eax, 0x21
mov rcx, qword [rsp + 0xf0]
add ax, dx
add ax, di
add ax, 0x10
bt word [rcx + 0x32], 0xa
jae 0x14005167e
add ax, 0x10
mov word [r10 + r8*2], ax
mov dx, word [r10 + r8*2]
cmp bx, dx
jl 0x1400516c8
movsx ecx, dx
movsx r8d, bx
lea eax, [rcx + 0x31]
cmp r8d, eax
jg 0x140051707
lea eax, [rcx + 0x1f]
cmp r8d, eax
jle 0x1400516a9
lea edx, [rbx + 1]
jmp 0x14005170a
movsx rax, dx
movsx rcx, bx
sub rcx, rax
lea rax, [0x140000000]
movzx edx, byte [rcx + rax + 0xabce0]
add dx, bx
jmp 0x14005170a
movsx ecx, bx
movsx r8d, dx
lea eax, [rcx + 0x31]
cmp r8d, eax
jg 0x14005170a
lea eax, [rcx + 0x1f]
cmp r8d, eax
jle 0x1400516e5
add dx, 1
jmp 0x14005170a
movsx rcx, dx
movsx rax, bx
sub rcx, rax
lea rax, [0x140000000]
movzx eax, byte [rcx + rax + 0xabce0]
add ax, dx
mov dx, ax
jmp 0x14005170a
mov dx, bx
mov r10, qword [rsp + 0x58]
xor ecx, ecx
test r15d, r15d
mov rdi, r10
jle 0x14005173a
nop
nop
cmp qword [rdi], rbp
jne 0x14005172e
movzx eax, byte [rdi + 0x16]
xor al, r11b
jns 0x14005175f
add ecx, 1
add rdi, 0x20
cmp ecx, r15d
jl 0x140051720
cmp r15d, dword [rsp + 0x108]
jl 0x140051780
cmp dx, si
jg 0x140051838
jne 0x140051759
cmp bx, r13w
jge 0x140051838
mov eax, dword [rsp + 0x50]
jmp 0x140051787
cmp ecx, r15d
jge 0x14005173a
movzx eax, word [rdi + 0x12]
cmp ax, dx
jl 0x140051838
jne 0x140051791
cmp word [rdi + 0x10], r12w
jle 0x140051838
jmp 0x140051791
mov eax, r15d
add r15d, 1
movsxd rdi, eax
shl rdi, 5
add rdi, r10
mov rax, qword [r14 + 8]
mov rcx, qword [rsp + 0x40]
or rax, qword [rcx]
mov word [rdi + 0x14], bx
mov qword [rdi + 8], r9
mov qword [rdi], rax
movsxd rax, dword [rsp + 0x100]
mov word [rdi + 0x10], r12w
mov word [rdi + 0x12], dx
mov byte [rdi + 0x16], r11b
mov rdx, qword [rcx + 0x18]
mov rcx, qword [rdi + 0x18]
lea rbx, [rax*8]
mov r8, rbx
call sub.msvcrt.dll_memcpy
mov r11, qword [rdi + 0x18]
mov edi, dword [rsp + 0x108]
cmp r15d, edi
mov r10, qword [rsp + 0x58]
mov qword [rbx + r11], r14
jl 0x140051838
movzx esi, word [r10 + 0x12]
movzx r13d, word [r10 + 0x10]
mov edx, 1
cmp edi, edx
mov dword [rsp + 0x50], 0
jle 0x140051838
lea rax, [r10 + 0x32]
nop
movzx ecx, word [rax]
cmp cx, si
jg 0x140051821
jne 0x14005182d
cmp word [rax + 2], r13w
jle 0x14005182d
mov r13w, word [rax + 2]
mov si, cx
mov dword [rsp + 0x50], edx
add edx, 1
add rax, 0x20
cmp edx, edi
jl 0x140051810
mov rdi, qword [rsp + 0x40]
lea r12, [0x140000000]
mov r14, qword [r14 + 0x40]
test r14, r14
jne 0x140051370
mov rbp, qword [rsp + 0xf0]
mov eax, dword [rsp + 0x64]
mov edx, dword [rsp + 0x60]
add eax, 1
add rdi, 0x20
cmp eax, edx
mov dword [rsp + 0x64], eax
mov qword [rsp + 0x40], rdi
jl 0x140051360
mov ecx, dword [rsp + 0x100]
mov r9, qword [rsp + 0x80]
mov edi, dword [rsp + 0x54]
mov rax, r10
add ecx, 1
cmp ecx, edi
mov edx, r15d
mov r10, r9
mov qword [rsp + 0x58], r9
mov qword [rsp + 0x80], rax
mov dword [rsp + 0x100], ecx
mov r9, rax
mov dword [rsp + 0x60], edx
jl 0x140051340
test r15d, r15d
jne 0x140051974
mov rcx, qword [rsp + 0x90]
lea rdx, str.no_query_solution
call fcn.140034800
mov rcx, qword [rsp + 0x78]
test rcx, rcx
je 0x1400518ff
cmp qword [rcx + 0x2c0], 0
je 0x1400518ff
mov rdx, qword [rsp + 0x48]
call fcn.140011800
lea eax, [r15 + 1]
jmp 0x140051bbd
cmp dword [0x1400bf010], 0
je 0x14005195f
mov rcx, qword [0x1400c52b8]
test rcx, rcx
je 0x14005191a
call qword [0x1400bf098]
mov rbx, qword [rsp + 0x48]
mov rcx, rbx
call qword [0x1400bf050]
sub qword [0x1400c5018], 1
movsxd rcx, eax
sub qword [0x1400c4fd0], rcx
mov rcx, rbx
call qword [0x1400bf040]
mov rcx, qword [0x1400c52b8]
test rcx, rcx
je 0x14005196a
call qword [0x1400bf0a8]
mov eax, 1
jmp 0x140051bbd
mov rcx, qword [rsp + 0x48]
call qword [0x1400bf040]
mov eax, 1
jmp 0x140051bbd
mov r12w, word [rsp + 0xf8]
mov r14d, 1
movsxd rdx, edx
mov rbx, r9
cmp rdx, 1
jle 0x1400519b8
lea rcx, [r9 + 0x32]
add rdx, 0xffffffffffffffff
movzx eax, word [rcx]
cmp word [rbx + 0x12], ax
jle 0x1400519aa
movsxd rbx, r14d
shl rbx, 5
add rbx, r9
add r14d, 1
add rcx, 0x20
sub rdx, 1
jne 0x140051997
test edi, edi
jle 0x140051a04
xor r8d, r8d
lea rdx, [rbp + 0x36c]
mov r9d, edi
nop
nop
mov rax, qword [rbx + 0x18]
add rdx, 0x58
add r8, 8
mov rcx, qword [r8 + rax - 8]
mov qword [rdx - 0x3c], rcx
movzx eax, byte [rcx + 0x10]
mov byte [rdx - 0x58], al
mov rcx, rax
mov rax, qword [rbp + 8]
imul rcx, rcx, 0x70
sub r9, 1
mov ecx, dword [rcx + rax + 0x4c]
mov dword [rdx - 0x80], ecx
jne 0x1400519d0
movzx eax, word [rbp + 0x32]
bt ax, 0xa
jae 0x140051a6b
bt ax, 9
jb 0x140051a6b
cmp byte [rbp + 0x38], 0
jne 0x140051a6b
test r12w, r12w
je 0x140051a6b
mov rax, qword [rbx + 0x18]
movsxd rcx, edi
lea r8, [rsp + 0xf0]
mov rax, qword [rax + rcx*8 - 8]
mov qword [rsp + 0x30], r8
lea edx, [rdi - 1]
mov qword [rsp + 0x28], rax
mov word [rsp + 0x20], dx
mov rdx, qword [rbp + 0x18]
mov r9w, 0x200
mov r8, rbx
mov rcx, rbp
call fcn.14004d550
movsx ecx, al
mov rax, qword [rbp + 0x18]
cmp ecx, dword [rax]
jne 0x140051a6b
mov byte [rbp + 0x38], 2
mov rdx, qword [rbp + 0x10]
test rdx, rdx
je 0x140051b17
movzx ecx, word [rbp + 0x32]
bt cx, 9
jae 0x140051a91
movsx eax, byte [rbx + 0x16]
cmp eax, dword [rdx]
jne 0x140051aa8
mov byte [rbp + 0x38], 2
jmp 0x140051aa8
movzx eax, byte [rbx + 0x16]
test al, al
mov byte [rbp + 0x34], al
jns 0x140051aa0
mov byte [rbp + 0x34], 0
mov rax, qword [rbx + 8]
mov qword [rbp + 0x28], rax
bt cx, 0xb
jae 0x140051b17
movsx eax, byte [rbp + 0x34]
cmp eax, dword [rdx]
jne 0x140051b17
test edi, edi
jle 0x140051b17
mov rax, qword [rbx + 0x18]
movsxd rcx, edi
lea r8, [rsp + 0xf0]
mov rax, qword [rax + rcx*8 - 8]
mov qword [rsp + 0x30], r8
sub di, 1
mov qword [rsp + 0x28], rax
xor r9d, r9d
mov r8, rbx
mov rcx, rbp
mov qword [rsp + 0xf0], 0
mov word [rsp + 0x20], di
call fcn.14004d550
movsx ecx, al
mov rax, qword [rbp + 0x10]
cmp ecx, dword [rax]
jne 0x140051b17
mov rax, qword [rsp + 0xf0]
mov byte [rbp + 0x35], 1
mov qword [rbp + 0x28], rax
mov rcx, qword [rsp + 0x78]
movzx eax, word [rbx + 0x10]
test rcx, rcx
mov word [rbp + 0x30], ax
je 0x140051b41
cmp qword [rcx + 0x2c0], 0
je 0x140051b41
mov rdx, qword [rsp + 0x48]
call fcn.140011800
xor eax, eax
jmp 0x140051bbd
cmp dword [0x1400bf010], 0
je 0x140051b9b
mov rcx, qword [0x1400c52b8]
test rcx, rcx
je 0x140051b5c
call qword [0x1400bf098]
mov rbx, qword [rsp + 0x48]
mov rcx, rbx
call qword [0x1400bf050]
sub qword [0x1400c5018], 1
movsxd rcx, eax
sub qword [0x1400c4fd0], rcx
mov rcx, rbx
call qword [0x1400bf040]
mov rcx, qword [0x1400c52b8]
test rcx, rcx
je 0x140051ba6
call qword [0x1400bf0a8]
xor eax, eax
jmp 0x140051bbd
mov rcx, qword [rsp + 0x48]
call qword [0x1400bf040]
xor eax, eax
jmp 0x140051bbd
mov rdx, qword [rsp + 0x78]
test rdx, rdx
je 0x140051bb8
mov byte [rdx + 0x51], r14b
mov eax, 7
add rsp, 0xa8
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbp
pop rbx
ret