Function at 0x180147590
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push rbp
push rbx
push rsi
push rdi
push r12
push r13
push r14
push r15
lea rbp, [rsp - 0x68]
sub rsp, 0x168
mov rax, qword [0x1802240e0]
xor rax, rsp
mov qword [rbp + 0x50], rax
mov r15d, dword [rbp + 0xd0]
xor edi, edi
mov rax, qword [rcx]
mov rbx, rcx
mov qword [rsp + 0x60], r9
mov qword [rsp + 0x58], r8
mov qword [rsp + 0x50], rdx
mov dword [rax + 8], edi
mov dword [rsp + 0x30], r15d
cmp r15d, 4
ja 0x180147c1b
call fcn.18014b0c8
test eax, eax
je 0x180147c11
mov rcx, qword [rbx]
lea esi, [rdi + 1]
lea r8d, [rdi + 3]
mov eax, dword [rcx + 8]
test r15d, r15d
jne 0x180147615
cmp eax, r8d
mov r15d, esi
cmovge r15d, r8d
mov dword [rsp + 0x30], r15d
cmp eax, r8d
jne 0x18014763c
cmp dword [rbx + 0x4850], r8d
je 0x180147633
cmp dword [rbx + 0x484c], edi
jne 0x18014763c
cmp dword [rbx + 0x4848], edi
jne 0x18014763c
mov edx, esi
mov qword [rsp + 0x38], rsi
jmp 0x180147648
mov qword [rsp + 0x38], rdi
mov edx, edi
cmp eax, r8d
jne 0x180147655
cmp r15d, r8d
jge 0x180147655
test edx, edx
jne 0x180147655
mov eax, esi
jmp 0x18014765d
test eax, eax
jle 0x180147c11
movsxd r13, eax
xorps xmm0, xmm0
mov qword [rsp + 0x40], r13
xorps xmm1, xmm1
movdqu xmmword [rsp + 0x68], xmm0
movdqu xmmword [rsp + 0x78], xmm1
test eax, eax
jle 0x180147765
mov r12, rdi
lea r14, [rbx + 0x46a4]
lea rdi, [rbp - 0x58]
mov rax, qword [rbx]
mov ecx, dword [rax]
add ecx, r8d
call sub.api_ms_win_crt_heap_l1_1_0.dll_malloc
mov qword [r14 + 0x44], rax
test rax, rax
je 0x180147786
mov eax, dword [rbx + 0x4688]
and dword [rdi + 0x10], 0
cdq
idiv dword [r14]
mov r8d, eax
mov dword [rdi], eax
mov eax, dword [rbx + 0x468c]
cdq
idiv dword [r14 + 4]
xor edx, edx
mov ecx, eax
mov dword [rdi + 4], eax
sar ecx, 1
mov r9d, eax
mov dword [rdi + 0xc], ecx
mov rcx, qword [rbx]
mov eax, dword [rcx]
mov rcx, qword [r14 + 0x2c]
dec eax
add eax, r8d
mov qword [rdi - 8], rcx
div r8d
mov qword [rdi - 0x10], rcx
mov dword [rdi + 8], eax
cmp r8d, esi
jne 0x180147715
cmp r9d, esi
jne 0x180147703
lea rax, [0x180147c4c]
jmp 0x180147744
mov r8d, esi
cmp r9d, 2
jne 0x180147729
lea rax, [0x180153328]
jmp 0x180147744
cmp r8d, 2
jne 0x18014773d
cmp r9d, esi
jne 0x180147729
lea rax, [0x180152fc8]
jmp 0x180147744
cmp r8d, 2
jne 0x18014773d
cmp r9d, r8d
jne 0x18014773d
mov rax, qword [rbx + 0x4880]
jmp 0x180147744
lea rax, [0x180152f90]
mov qword [rdi - 0x18], rax
add r12, rsi
add rdi, 0x30
add r14, 0x60
mov r8d, 3
cmp r12, r13
jl 0x18014768d
mov rcx, qword [rbx]
mov r8d, dword [rcx + 4]
mov r9d, esi
mov edx, dword [rcx]
mov ecx, r15d
call fcn.18014f1e8
xor r8d, r8d
mov qword [rsp + 0x48], rax
mov r12, rax
test rax, rax
jne 0x18014779a
mov rcx, rbx
call fcn.1801492ac
lea rcx, str.outofmem
jmp 0x180147c22
mov rcx, qword [rbx]
mov edx, r8d
mov dword [rsp + 0x34], edx
cmp dword [rcx + 4], r8d
jbe 0x180147bd1
mov r14, qword [rsp + 0x68]
mov r13, qword [rsp + 0x78]
mov r11, qword [rsp + 0x70]
jmp 0x1801477c2
xor r8d, r8d
mov edi, dword [rcx]
imul edi, edx
imul edi, r15d
add rdi, r12
mov r12, r8
cmp qword [rsp + 0x40], r8
jle 0x180147882
mov r15, qword [rsp + 0x40]
lea r13, [rbx + 0x46c0]
lea r14, [rbp - 0x4c]
mov eax, dword [r14 - 8]
sar eax, 1
cmp dword [r14], eax
jl 0x1801477fd
mov r8, qword [r14 - 0x1c]
jmp 0x180147801
mov r8, qword [r14 - 0x14]
jl 0x180147809
mov rdx, qword [r14 - 0x14]
jmp 0x18014780d
mov rdx, qword [r14 - 0x1c]
mov eax, dword [r14 - 0xc]
mov r9d, dword [r14 - 4]
mov rcx, qword [r13 + 0x28]
mov dword [rsp + 0x20], eax
call qword [r14 - 0x24]
mov qword [rsp + r12*8 + 0x68], rax
xor r8d, r8d
mov eax, dword [r14]
inc eax
mov dword [r14], eax
cmp eax, dword [r14 - 8]
jl 0x18014785b
add dword [r14 + 4], esi
mov eax, dword [r14 + 4]
mov rcx, qword [r14 - 0x14]
mov dword [r14], r8d
mov qword [r14 - 0x1c], rcx
cmp eax, dword [r13]
jge 0x18014785b
movsxd rax, dword [r13 + 4]
add rax, rcx
mov qword [r14 - 0x14], rax
add r12, rsi
add r14, 0x30
add r13, 0x60
cmp r12, r15
jl 0x1801477ec
mov rcx, qword [rbx]
mov r14, qword [rsp + 0x68]
mov r15d, dword [rsp + 0x30]
mov r13, qword [rsp + 0x78]
mov r11, qword [rsp + 0x70]
mov eax, 3
cmp r15d, eax
jl 0x180147a29
cmp dword [rcx + 8], eax
jne 0x180147905
cmp qword [rsp + 0x38], r8
je 0x1801478d9
cmp dword [rcx], 0
jbe 0x1801478fd
movsxd r10, r15d
mov r9d, r8d
xor edx, edx
mov al, byte [r9 + r14]
mov byte [rdi], al
mov rax, qword [rsp + rdx*8 + 0x70]
mov cl, byte [r9 + rax]
mov byte [rdi + rdx + 1], cl
add rdx, rsi
cmp rdx, 2
jl 0x1801478af
mov byte [rdi + 3], 0xff
add r8d, esi
mov rax, qword [rbx]
add rdi, r10
cmp r8d, dword [rax]
jb 0x1801478a4
jmp 0x1801478fd
mov eax, dword [rcx]
mov r9, r13
mov r8, qword [rsp + 0x70]
mov rcx, rdi
mov dword [rsp + 0x28], r15d
mov rdx, r14
mov dword [rsp + 0x20], eax
call qword [rbx + 0x4878]
mov r11, qword [rsp + 0x70]
mov rcx, qword [rbx]
jmp 0x180147bb9
cmp dword [rcx + 8], 4
jne 0x1801479f7
mov eax, dword [rbx + 0x484c]
test eax, eax
jne 0x180147970
mov r10d, r8d
cmp dword [rcx], r8d
jbe 0x1801478fd
movsxd r11, r15d
mov r15, qword [rsp + 0x70]
mov rax, qword [rbp - 0x80]
mov r9d, r10d
mov dl, byte [r9 + rax]
mov cl, byte [r9 + r14]
call fcn.180147fc4
mov byte [rdi], al
mov cl, byte [r9 + r15]
call fcn.180147fc4
mov byte [rdi + 1], al
mov cl, byte [r9 + r13]
call fcn.180147fc4
mov byte [rdi + 2], al
add r10d, esi
mov byte [rdi + 3], 0xff
add rdi, r11
mov rax, qword [rbx]
cmp r10d, dword [rax]
jb 0x180147929
mov r15d, dword [rsp + 0x30]
jmp 0x1801478f8
mov edx, dword [rcx]
mov r9, r13
mov r10, qword [rbx + 0x4878]
mov rcx, rdi
mov r8, qword [rsp + 0x70]
mov dword [rsp + 0x28], r15d
mov dword [rsp + 0x20], edx
mov rdx, r14
cmp eax, 2
jne 0x1801479ef
call r10
mov rax, qword [rbx]
xor r9d, r9d
cmp dword [rax], r9d
jbe 0x1801478f8
mov r13, qword [rbp - 0x80]
movsxd r10, r15d
mov cl, byte [rdi]
mov dl, byte [r9 + r13]
not cl
call fcn.180147fc4
mov cl, byte [rdi + 1]
not cl
mov byte [rdi], al
call fcn.180147fc4
mov cl, byte [rdi + 2]
not cl
mov byte [rdi + 1], al
call fcn.180147fc4
mov byte [rdi + 2], al
add r9d, esi
mov rax, qword [rbx]
add rdi, r10
cmp r9d, dword [rax]
jb 0x1801479ae
mov r13, qword [rsp + 0x78]
jmp 0x1801478f8
call r10
jmp 0x1801478f8
mov edx, r8d
cmp dword [rcx], r8d
jbe 0x1801478fd
movsxd r8, r15d
mov eax, edx
add edx, esi
mov cl, byte [rax + r14]
mov byte [rdi + 2], cl
mov byte [rdi + 1], cl
mov byte [rdi], cl
mov byte [rdi + 3], 0xff
add rdi, r8
mov rax, qword [rbx]
cmp edx, dword [rax]
jb 0x180147a06
jmp 0x1801478fd
cmp qword [rsp + 0x38], r8
je 0x180147aa7
mov eax, dword [rcx]
mov r9d, r8d
cmp r15d, esi
jne 0x180147a6e
test eax, eax
je 0x180147bb9
mov eax, r9d
movzx r8d, byte [rax + r13]
movzx edx, byte [rax + r11]
movzx ecx, byte [rax + r14]
call fcn.180149690
mov byte [rdi], al
add r9d, esi
mov rcx, qword [rbx]
add rdi, rsi
cmp r9d, dword [rcx]
jb 0x180147a42
jmp 0x180147bb9
test eax, eax
je 0x180147bb9
mov eax, r9d
movzx r8d, byte [rax + r13]
movzx edx, byte [rax + r11]
movzx ecx, byte [rax + r14]
call fcn.180149690
mov byte [rdi], al
add r9d, esi
mov byte [rdi + 1], 0xff
lea rdi, [rdi + 2]
mov rcx, qword [rbx]
cmp r9d, dword [rcx]
jb 0x180147a76
jmp 0x180147bb9
cmp dword [rcx + 8], 4
jne 0x180147b79
mov eax, dword [rbx + 0x484c]
test eax, eax
jne 0x180147b38
mov r12d, r8d
cmp dword [rcx], r8d
jbe 0x180147bb9
movsxd r13, r15d
mov r15, qword [rsp + 0x78]
mov rax, qword [rbp - 0x80]
mov r11d, r12d
mov dl, byte [r11 + rax]
mov cl, byte [r11 + r15]
call fcn.180147fc4
movzx r10d, al
mov rax, qword [rsp + 0x70]
mov cl, byte [r11 + rax]
call fcn.180147fc4
mov cl, byte [r11 + r14]
movzx r9d, al
call fcn.180147fc4
movzx ecx, al
mov r8d, r10d
mov edx, r9d
call fcn.180149690
mov byte [rdi], al
add r12d, esi
mov byte [rdi + 1], 0xff
add rdi, r13
mov rcx, qword [rbx]
cmp r12d, dword [rcx]
jb 0x180147acf
mov r15d, dword [rsp + 0x30]
mov r13, qword [rsp + 0x78]
mov r11, qword [rsp + 0x70]
jmp 0x180147bb9
cmp eax, 2
jne 0x180147b79
mov r9d, r8d
cmp dword [rcx], r8d
jbe 0x180147bb9
mov r13, qword [rbp - 0x80]
movsxd r10, r15d
mov eax, r9d
mov cl, byte [rax + r14]
mov dl, byte [rax + r13]
not cl
call fcn.180147fc4
mov byte [rdi], al
add r9d, esi
mov byte [rdi + 1], 0xff
add rdi, r10
mov rcx, qword [rbx]
cmp r9d, dword [rcx]
jb 0x180147b4c
mov r13, qword [rsp + 0x78]
jmp 0x180147bb9
mov eax, dword [rcx]
mov edx, r8d
cmp r15d, esi
jne 0x180147b9b
test eax, eax
je 0x180147bb9
mov ecx, edx
add edx, esi
mov al, byte [rcx + r14]
mov byte [rcx + rdi], al
mov rcx, qword [rbx]
cmp edx, dword [rcx]
jb 0x180147b87
jmp 0x180147bb9
test eax, eax
je 0x180147bb9
mov eax, edx
add edx, esi
mov cl, byte [rax + r14]
mov byte [rdi], cl
add rdi, rsi
mov byte [rdi], 0xff
add rdi, rsi
mov rcx, qword [rbx]
cmp edx, dword [rcx]
jb 0x180147b9f
mov edx, dword [rsp + 0x34]
mov r12, qword [rsp + 0x48]
add edx, esi
mov dword [rsp + 0x34], edx
cmp edx, dword [rcx + 4]
jb 0x1801477bf
mov rcx, rbx
call fcn.1801492ac
mov rax, qword [rbx]
mov ecx, dword [rax]
mov rax, qword [rsp + 0x50]
mov dword [rax], ecx
mov rax, qword [rbx]
mov ecx, dword [rax + 4]
mov rax, qword [rsp + 0x58]
mov dword [rax], ecx
mov rcx, qword [rsp + 0x60]
test rcx, rcx
je 0x180147c0c
mov rax, qword [rbx]
mov edx, 3
cmp dword [rax + 8], edx
cmovge esi, edx
mov dword [rcx], esi
mov rax, r12
jmp 0x180147c29
mov rcx, rbx
call fcn.1801492ac
jmp 0x180147c27
lea rcx, str.bad_req_comp
call fcn.18014b3cc
xor eax, eax
mov rcx, qword [rbp + 0x50]
xor rcx, rsp
call fcn.18017dee0
add rsp, 0x168
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbx
pop rbp
ret