Function at 0x140066d90
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
mov qword [rsp + 0x18], rbx
mov dword [rsp + 0x20], r9d
push rbp
push rsi
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x90
movsxd r14, dword [rsp + 0xf0]
xor r13d, r13d
mov ebp, dword [rsp + 0x100]
mov rdi, rcx
mov eax, r9d
cmp ebp, 0x10
mov r9d, dword [rsp + 0xf8]
mov r10d, r13d
sete r10b
mov esi, r8d
inc r10d
mov r15, rdx
mov ecx, r10d
imul ecx, eax
mov rax, qword [rdi]
mov r12d, dword [rax + 8]
mov r11d, ecx
imul r11d, r14d
mov eax, r12d
imul eax, r10d
mov dword [rsp + 0x40], r12d
mov dword [rsp + 0x4c], r11d
mov dword [rsp + 0xd0], eax
test r14d, r14d
js 0x140067960
test r9d, r9d
js 0x140067960
mov ebx, 0x7fffffff
je 0x140066e34
xor edx, edx
mov eax, ebx
div r9d
cmp r14d, eax
jg 0x140067960
mov r8d, r14d
imul r8d, r9d
test r8d, r8d
js 0x140067960
test ecx, ecx
js 0x140067960
je 0x140066e5c
mov eax, ebx
cdq
idiv ecx
cmp r8d, eax
jg 0x140067960
mov eax, r9d
imul eax, r11d
movsxd rcx, eax
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
mov qword [rdi + 0x18], rax
test rax, rax
je 0x140067964
test r12d, r12d
js 0x14006794b
test r14d, r14d
je 0x140066e97
xor edx, edx
mov eax, ebx
div r14d
cmp r12d, eax
jg 0x14006794b
imul r12d, r14d
test r12d, r12d
js 0x14006794b
test ebp, ebp
js 0x14006794b
je 0x140066ebd
xor edx, edx
mov eax, ebx
div ebp
cmp r12d, eax
jg 0x14006794b
mov eax, r12d
imul eax, ebp
cmp eax, 0x7ffffff8
jg 0x14006794b
mov ecx, dword [rsp + 0xf8]
imul ebp, r12d
add ebp, 7
shr ebp, 3
mov dword [rsp + 0x48], ebp
test ecx, ecx
je 0x140066ef5
xor edx, edx
mov eax, ebx
div ecx
cmp ebp, eax
jg 0x14006794b
mov eax, ebp
sub ebx, ebp
imul eax, ecx
cmp eax, ebx
jg 0x14006794b
lea eax, [rbp + 1]
imul eax, ecx
cmp esi, eax
jae 0x140066f26
mov rax, qword gs:[0x58]
mov rcx, qword [rax]
lea rax, str.not_enough_pixels
jmp 0x140067977
lea ecx, [rbp*2]
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
mov qword [rsp + 0x28], rax
mov r9, rax
test rax, rax
je 0x140067964
movsxd rsi, dword [rsp + 0x100]
mov ebx, 1
cmp esi, 8
jge 0x140066f63
mov eax, ebx
mov dword [rsp + 0xd0], ebx
mov ecx, ebp
jmp 0x140066f6d
mov eax, dword [rsp + 0xd0]
mov ecx, r14d
mov edx, r13d
mov dword [rsp + 0x44], edx
cmp dword [rsp + 0xf8], edx
jbe 0x140067938
mov r8, qword [rdi + 0x18]
mov qword [rsp + 0x60], r8
lea r8, [0x140085018]
add r8, rsi
movsxd r10, eax
imul ecx, eax
mov qword [rsp + 0x58], r14
mov r14d, r12d
mov qword [rsp + 0x80], r8
mov qword [rsp + 0x38], r10
mov ebp, r12d
movsxd rax, ecx
mov dword [rsp + 0x50], ecx
mov rcx, rax
mov qword [rsp + 0x68], rax
mov eax, edx
mov qword [rsp + 0x20], rcx
and eax, 1
mov qword [rsp + 0x78], r15
imul eax, dword [rsp + 0x48]
mov r11d, edx
not r11d
mov edi, edx
imul edi, dword [rsp + 0x4c]
and r11d, 1
imul r11d, dword [rsp + 0x48]
mov r13, r15
mov ecx, eax
mov qword [rsp + 0x30], rcx
add rdi, qword [rsp + 0x60]
lea rbx, [rax + r9]
mov qword [rsp + 0x70], rdi
movzx eax, byte [r15]
add r11, r9
inc r15
cmp eax, 4
ja 0x140067911
lea r8, [0x140000000]
test edx, edx
jne 0x140067037
mov rdx, qword [rsp + 0x68]
movzx eax, byte [rax + r8 + 0x8500c]
mov qword [rsp + 0x20], rdx
jmp 0x14006703c
mov rdx, qword [rsp + 0x20]
cmp eax, 5
ja case.default.0x140067052
cdqe
mov ecx, dword [r8 + rax*4 + 0x679a0]
add rcx, r8
jmp rcx
mov r8, rdx
mov rcx, rbx
mov rdx, r15
call sub.VCRUNTIME140.dll_memcpy
jmp 0x140067559
mov r8, r10
mov rdx, r15
mov rcx, rbx
call sub.VCRUNTIME140.dll_memcpy
mov r10, qword [rsp + 0x38]
mov r11, qword [rsp + 0x20]
cmp r10, r11
jge 0x1400670b5
mov r8, rbx
lea rcx, [r10 + 1]
sub r8, r10
mov r9, rbx
sub r8, r15
add rcx, r13
sub r9, r15
mov rdx, r11
sub rdx, r10
movzx eax, byte [r8 + rcx]
add al, byte [rcx]
mov byte [r9 + rcx], al
lea rcx, [rcx + 1]
sub rdx, 1
jne 0x1400670a0
mov rcx, qword [rsp + 0x30]
jmp 0x140067563
mov r10d, dword [rsp + 0x50]
xor eax, eax
mov edx, eax
test r10d, r10d
jle 0x140067202
cmp r10d, 8
jb 0x140067202
lea eax, [r10 - 1]
movsxd rcx, eax
lea rax, [rcx + r15]
lea r8, [rcx + rbx]
cmp rbx, rax
ja 0x1400670f8
cmp r8, r15
jae 0x140067202
lea rax, [rcx + r11]
cmp rbx, rax
ja 0x14006710a
cmp r8, r11
jae 0x140067202
cmp r10d, 0x40
jb 0x1400671af
mov ecx, r10d
and ecx, 0x8000003f
jge 0x140067126
dec ecx
or ecx, 0xffffffc0
inc ecx
mov eax, r10d
sub eax, ecx
mov rcx, r11
movsxd r9, eax
sub rcx, r15
lea rax, [r13 + 0x11]
mov r8, rbx
sub r8, r15
nop
movdqu xmm0, xmmword [rax - 0x10]
add rdx, 0x40
movdqu xmm1, xmmword [rcx + rax - 0x10]
movdqu xmm2, xmmword [rax + rcx]
lea rax, [rax + 0x40]
paddb xmm1, xmm0
movdqu xmm0, xmmword [rax - 0x40]
movdqu xmmword [r8 + rax - 0x50], xmm1
paddb xmm2, xmm0
movdqu xmm0, xmmword [rax - 0x30]
movdqu xmm1, xmmword [rcx + rax - 0x30]
movdqu xmmword [rax + r8 - 0x40], xmm2
paddb xmm1, xmm0
movdqu xmm0, xmmword [rax - 0x20]
movdqu xmm2, xmmword [rcx + rax - 0x20]
movdqu xmmword [r8 + rax - 0x30], xmm1
paddb xmm2, xmm0
movdqu xmmword [r8 + rax - 0x20], xmm2
cmp rdx, r9
jl 0x140067140
mov eax, r10d
and al, 0x3f
cmp al, 8
jb 0x140067202
jmp 0x1400671b5
mov rcx, r11
sub rcx, r15
mov r8d, r10d
and r8d, 0x80000007
jge 0x1400671cb
dec r8d
or r8d, 0xfffffff8
inc r8d
mov eax, r10d
sub eax, r8d
movsxd r9, eax
mov r8, rbx
lea rax, [r13 + 1]
add rax, rdx
sub r8, r15
movq xmm1, qword [rax + rcx]
add rdx, 8
movq xmm0, qword [rax]
lea rax, [rax + 8]
paddb xmm1, xmm0
movq qword [rax + r8 - 8], xmm1
cmp rdx, r9
jl 0x1400671e1
cmp rdx, qword [rsp + 0x20]
jge 0x140067559
mov r8, qword [rsp + 0x20]
lea rcx, [r13 + 1]
mov r9, rbx
add rcx, rdx
sub r9, r15
sub r11, r15
sub r8, rdx
nop word [rax + rax]
movzx eax, byte [rcx + r11]
add al, byte [rcx]
mov byte [rcx + r9], al
lea rcx, [rcx + 1]
sub r8, 1
jne 0x140067230
jmp 0x140067559
test r10, r10
jle 0x14006727a
mov r8, r11
mov r9, rbx
sub r8, r15
mov rcx, r15
sub r9, r15
mov rdx, r10
movzx eax, byte [rcx + r8]
lea rcx, [rcx + 1]
shr al, 1
add al, byte [rcx - 1]
mov byte [rcx + r9 - 1], al
sub rdx, 1
jne 0x140067261
mov rcx, qword [rsp + 0x20]
cmp r10, rcx
jge 0x140067559
lea rdx, [r10 + r11]
mov r9, rbx
sub r9, r10
sub r15, r11
mov r10, rbx
sub r9, r11
sub r10, r11
mov r8, rcx
sub r8, qword [rsp + 0x38]
nop word [rax + rax]
movzx ecx, byte [r9 + rdx]
movzx eax, byte [rdx]
lea rdx, [rdx + 1]
add ecx, eax
shr ecx, 1
add cl, byte [r15 + rdx - 1]
mov byte [r10 + rdx - 1], cl
sub r8, 1
jne 0x1400672b0
jmp 0x140067559
mov r9d, dword [rsp + 0xd0]
xor eax, eax
mov edx, eax
test r9d, r9d
jle 0x140067431
cmp r9d, 8
jb 0x140067431
lea eax, [r9 - 1]
movsxd rcx, eax
lea rax, [rcx + r15]
lea r8, [rcx + rbx]
cmp rbx, rax
ja 0x140067311
cmp r8, r15
jae 0x140067431
lea rax, [rcx + r11]
cmp rbx, rax
ja 0x140067323
cmp r8, r11
jae 0x140067431
cmp r9d, 0x40
jb 0x1400673d7
mov ecx, r9d
and ecx, 0x8000003f
jge 0x14006733f
dec ecx
or ecx, 0xffffffc0
inc ecx
mov eax, r9d
sub eax, ecx
mov rcx, r11
movsxd r9, eax
sub rcx, r15
lea rax, [r13 + 0x11]
mov r8, rbx
sub r8, r15
nop word [rax + rax]
movdqu xmm0, xmmword [rax - 0x10]
add rdx, 0x40
movdqu xmm1, xmmword [rcx + rax - 0x10]
movdqu xmm2, xmmword [rcx + rax]
lea rax, [rax + 0x40]
paddb xmm1, xmm0
movdqu xmm0, xmmword [rax - 0x40]
movdqu xmmword [r8 + rax - 0x50], xmm1
paddb xmm2, xmm0
movdqu xmm0, xmmword [rax - 0x30]
movdqu xmm1, xmmword [rcx + rax - 0x30]
movdqu xmmword [r8 + rax - 0x40], xmm2
paddb xmm1, xmm0
movdqu xmm0, xmmword [rax - 0x20]
movdqu xmm2, xmmword [rcx + rax - 0x20]
movdqu xmmword [r8 + rax - 0x30], xmm1
paddb xmm2, xmm0
movdqu xmmword [r8 + rax - 0x20], xmm2
cmp rdx, r9
jl 0x140067360
mov r9d, dword [rsp + 0xd0]
mov eax, r9d
and al, 0x3f
cmp al, 8
jb 0x140067431
jmp 0x1400673dd
mov rcx, r11
sub rcx, r15
mov r8d, r9d
and r8d, 0x80000007
jge 0x1400673f3
dec r8d
or r8d, 0xfffffff8
inc r8d
mov eax, r9d
sub eax, r8d
movsxd r9, eax
mov r8, rbx
lea rax, [r13 + 1]
add rax, rdx
sub r8, r15
nop dword [rax]
movq xmm1, qword [rax + rcx]
add rdx, 8
movq xmm0, qword [rax]
lea rax, [rax + 8]
paddb xmm1, xmm0
movq qword [r8 + rax - 8], xmm1
cmp rdx, r9
jl 0x140067410
cmp rdx, r10
jge 0x14006746b
mov r8, qword [rsp + 0x38]
lea rcx, [r13 + 1]
mov r9, r11
mov r10, rbx
add rcx, rdx
sub r9, r15
sub r10, r15
sub r8, rdx
movzx eax, byte [r9 + rcx]
add al, byte [rcx]
mov byte [rcx + r10], al
lea rcx, [rcx + 1]
sub r8, 1
jne 0x140067451
mov r10, qword [rsp + 0x38]
cmp r10, qword [rsp + 0x20]
jge 0x140067559
mov rax, qword [rsp + 0x38]
mov rsi, r11
mov rdi, qword [rsp + 0x38]
sub rax, rbx
sub rsi, rbx
add r13, rax
mov r10, rbx
lea r15, [rax + r11]
mov r11, qword [rsp + 0x20]
sub r11, qword [rsp + 0x38]
nop dword [rax]
movzx eax, byte [r15 + r10]
movzx r9d, byte [r10]
mov edx, eax
movzx ecx, byte [rsi + r10]
lea r10, [r10 + 1]
lea r8d, [rcx + rcx*2]
sub r8d, r9d
sub r8d, eax
cmp r9d, eax
cmovb edx, r9d
cmovb r9d, eax
cmp r9d, r8d
movzx eax, dl
cmovle ecx, eax
cmp r8d, edx
movzx ecx, cl
movzx eax, r9b
cmovle ecx, eax
add cl, byte [r10 + r13]
mov byte [r10 + rdi - 1], cl
sub r11, 1
jne 0x1400674a0
mov rdi, qword [rsp + 0x70]
mov r13, qword [rsp + 0x78]
mov esi, dword [rsp + 0x100]
jmp 0x140067559
mov r8, r10
mov rdx, r15
mov rcx, rbx
call sub.VCRUNTIME140.dll_memcpy
mov r10, qword [rsp + 0x38]
cmp r10, qword [rsp + 0x20]
jge 0x140067559
mov rdx, qword [rsp + 0x20]
lea rcx, [r10 + 1]
mov r8, rbx
mov r9, rbx
sub r8, r10
add rcx, r13
sub r8, r15
sub r9, r15
sub rdx, r10
nop dword [rax]
movzx eax, byte [r8 + rcx]
lea rcx, [rcx + 1]
shr al, 1
add al, byte [rcx - 1]
mov byte [r9 + rcx - 1], al
sub rdx, 1
jne 0x140067540
mov rcx, qword [rsp + 0x30]
mov r11, qword [rsp + 0x20]
lea r15, [r13 + 1]
add r15, r11
mov qword [rsp + 0xd8], r15
cmp esi, 8
jge 0x14006775e
cmp dword [rsp + 0x108], 0
jne 0x140067593
mov rax, qword [rsp + 0x80]
movzx r15d, byte [rax]
jmp 0x140067596
mov r15b, 1
xor r8b, r8b
mov r9, rdi
cmp esi, 4
jne 0x1400675f2
xor esi, esi
test r14d, r14d
je 0x14006768c
nop dword [rax]
mov r11d, esi
and r11d, 1
jne 0x1400675bd
movzx r8d, byte [rbx]
movzx eax, r8b
movzx ecx, r15b
shr al, 4
inc esi
movzx edx, al
lea rax, [rbx + 1]
imul edx, ecx
shl r8b, 4
mov byte [r9], dl
inc r9
test r11d, r11d
cmovne rax, rbx
mov rbx, rax
cmp esi, r14d
jb 0x1400675b0
jmp 0x14006768c
cmp esi, 2
jne 0x140067641
xor esi, esi
test r14d, r14d
je 0x14006768c
mov r11d, esi
and r11d, 3
jne 0x14006760f
movzx r8d, byte [rbx]
movzx eax, r8b
movzx ecx, r15b
shr al, 6
inc esi
movzx edx, al
lea rax, [rbx + 1]
imul edx, ecx
shl r8b, 2
mov byte [r9], dl
inc r9
test r11d, r11d
cmovne rax, rbx
mov rbx, rax
cmp esi, r14d
jb 0x140067602
jmp 0x14006768c
xor esi, esi
test r14d, r14d
je 0x14006768c
nop dword [rax + rax]
mov r11d, esi
and r11d, 7
jne 0x14006765d
movzx r8d, byte [rbx]
movzx eax, r8b
movzx ecx, r15b
shr al, 7
add r8b, r8b
movzx edx, al
inc esi
imul edx, ecx
lea rax, [rbx + 1]
mov byte [r9], dl
inc r9
test r11d, r11d
cmovne rax, rbx
mov rbx, rax
cmp esi, r14d
jb 0x140067650
mov eax, dword [rsp + 0x40]
cmp eax, dword [rsp + 0xe8]
je 0x1400676c2
mov rcx, qword [rsp + 0x58]
dec rcx
cmp eax, 1
jne 0x14006770a
test rcx, rcx
js 0x1400676c2
nop dword [rax + rax]
mov byte [rdi + rcx*2 + 1], 0xff
movzx eax, byte [rcx + rdi]
mov byte [rdi + rcx*2], al
sub rcx, 1
jns 0x1400676b0
mov r15, qword [rsp + 0xd8]
mov esi, dword [rsp + 0x100]
mov r9, qword [rsp + 0x28]
mov edx, dword [rsp + 0x44]
mov r10, qword [rsp + 0x38]
inc edx
mov rcx, qword [rsp + 0x20]
mov dword [rsp + 0x44], edx
cmp edx, dword [rsp + 0xf8]
jb 0x140066fc1
mov rcx, r9
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov eax, 1
jmp 0x140067982
test rcx, rcx
js 0x1400676c2
lea r8, [rcx*2 + 1]
add r8, rdi
lea rdx, [rcx*4 + 2]
add r8, rcx
add rdx, rdi
nop dword [rax + rax]
sub rcx, 1
mov byte [rdx + 1], 0xff
movzx eax, byte [r8 + 1]
lea r8, [r8 - 3]
mov byte [rdx], al
lea rdx, [rdx - 4]
movzx eax, byte [r8 + 3]
mov byte [rdx + 3], al
movzx eax, byte [r8 + 2]
mov byte [rdx + 2], al
jns 0x140067730
jmp 0x1400676c2
jne 0x14006780e
mov eax, dword [rsp + 0x40]
cmp eax, dword [rsp + 0xe8]
jne 0x140067784
mov r8, rbp
mov rdx, rbx
mov rcx, rdi
call sub.VCRUNTIME140.dll_memcpy
jmp 0x1400676d1
mov rcx, qword [rsp + 0x58]
dec rcx
cmp eax, 1
jne 0x1400677b7
test rcx, rcx
js 0x1400676d1
nop word [rax + rax]
mov byte [rdi + rcx*2 + 1], 0xff
movzx eax, byte [rcx + rbx]
mov byte [rdi + rcx*2], al
sub rcx, 1
jns 0x1400677a0
jmp 0x1400676d1
test rcx, rcx
js 0x1400676d1
lea r8, [rcx*2 + 1]
add r8, rbx
lea rdx, [rcx*4 + 2]
add r8, rcx
add rdx, rdi
nop dword [rax]
sub rcx, 1
mov byte [rdx + 1], 0xff
movzx eax, byte [r8 + 1]
lea r8, [r8 - 3]
mov byte [rdx], al
lea rdx, [rdx - 4]
movzx eax, byte [r8 + 3]
mov byte [rdx + 3], al
movzx eax, byte [r8 + 2]
mov byte [rdx + 2], al
jns 0x1400677e0
jmp 0x1400676d1
cmp esi, 0x10
jne 0x1400676d1
mov eax, dword [rsp + 0x40]
cmp eax, dword [rsp + 0xe8]
jne 0x140067867
mov r9, qword [rsp + 0x28]
test r12d, r12d
je 0x1400676d6
sub rcx, rdi
mov edx, r12d
lea r8, [rcx + r9]
nop dword [rax]
movzx eax, byte [rbx]
lea rbx, [rbx + 2]
movzx ecx, byte [r8 + rdi + 1]
lea rdi, [rdi + 2]
shl ax, 8
or cx, ax
mov word [rdi - 2], cx
sub rdx, 1
jne 0x140067840
jmp 0x1400676d6
cmp eax, 1
mov eax, dword [rsp + 0xf0]
jne 0x1400678ab
test eax, eax
je 0x1400676d1
mov edx, eax
nop dword [rax]
movzx ecx, byte [rbx]
lea rdi, [rdi + 4]
movzx eax, byte [rbx + 1]
lea rbx, [rbx + 2]
shl cx, 8
or cx, ax
mov word [rdi - 2], 0xffff
mov word [rdi - 4], cx
sub rdx, 1
jne 0x140067880
jmp 0x1400676ca
test eax, eax
je 0x1400676d1
add rdi, 4
mov rdx, rax
nop word [rax + rax]
movzx ecx, byte [rbx]
lea rdi, [rdi + 8]
movzx eax, byte [rbx + 1]
lea rbx, [rbx + 6]
shl cx, 8
or cx, ax
mov word [rdi - 0xc], cx
movzx ecx, byte [rbx - 4]
movzx eax, byte [rbx - 3]
shl cx, 8
or cx, ax
mov word [rdi - 0xa], cx
movzx ecx, byte [rbx - 2]
movzx eax, byte [rbx - 1]
shl cx, 8
or cx, ax
mov word [rdi - 6], 0xffff
mov word [rdi - 8], cx
sub rdx, 1
jne 0x1400678c0
jmp 0x1400676ca
mov rax, qword gs:[0x58]
mov edx, 0x28
mov rcx, qword [rax]
lea rax, str.invalid_filter
mov qword [rdx + rcx], rax
mov rcx, r9
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
jmp 0x140067980
mov rcx, r9
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
test ebx, ebx
mov rax, r13
setne al
jmp 0x140067982
mov rax, qword gs:[0x58]
mov rcx, qword [rax]
lea rax, str.too_large
jmp 0x140067977
mov qword [rdi + 0x18], r13
mov rax, qword gs:[0x58]
mov rcx, qword [rax]
lea rax, str.outofmem
mov edx, 0x28
mov qword [rdx + rcx], rax
xor eax, eax
mov rbx, qword [rsp + 0xe0]
add rsp, 0x90
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbp
ret