Function at 0x2bbf77e20
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x108
mov eax, dword [rsp + 0x170]
mov esi, dword [rsp + 0x190]
mov edi, dword [r8 + 0xc]
mov ebp, dword [rsp + 0x180]
mov r15d, dword [rsp + 0x188]
mov r14d, dword [rsp + 0x198]
mov r12d, dword [rsp + 0x1a0]
mov dword [rsp + 0x68], eax
mov eax, dword [rsp + 0x178]
mov rbx, rdx
mov qword [rsp + 0x50], rcx
mov dword [rsp + 0x6c], eax
mov eax, dword [rsp + 0x1a8]
mov dword [rsp + 0x64], r9d
mov dword [rsp + 0x90], esi
test edi, edi
je 0x2bbf784c7
mov edx, dword [r8 + 8]
mov dword [rsp + 0x48], edx
test edx, edx
je 0x2bbf784c7
cmp r15d, 1
jne 0x2bbf784dd
cmp esi, 1
jne 0x2bbf784dd
cmp r14d, 1
jne 0x2bbf77ec9
cmp r12d, 1
je 0x2bbf78594
mov esi, eax
and eax, 0xefffffff
mov r9d, eax
mov eax, dword [rbx + 0x24]
and esi, 0x10000000
mov dword [rsp + 0x70], esi
test eax, eax
je 0x2bbf77eff
mov r10d, dword [rsp + 0x6c]
mov esi, dword [rsp + 0x64]
mov edx, eax
lea ecx, [rsi + r10]
sub edx, esi
cmp eax, ecx
cmovge edx, r10d
mov dword [rsp + 0x6c], edx
mov eax, dword [rbx + 0x28]
test eax, eax
je 0x2bbf77f16
mov esi, dword [rsp + 0x68]
mov edx, eax
lea ecx, [rsi + rbp]
sub edx, esi
cmp eax, ecx
cmovl ebp, edx
mov r13d, dword [rsp + 0x6c]
test r13d, r13d
setle dl
test ebp, ebp
setle al
or dl, al
mov byte [rsp + 0x97], dl
jne 0x2bbf784c7
mov eax, dword [r8 + 0x18]
mov esi, dword [r8 + 0x10]
mov qword [rsp + 0xa0], r8
mov r13d, dword [r8 + 0x14]
mov r10, qword [r8]
mov ecx, dword [rbx + 0x1c]
mov r11d, dword [rbx + 0x20]
mov dword [rsp + 0x58], eax
mov eax, dword [r8 + 0x1c]
mov dword [rsp + 0x5c], esi
mov dword [rsp + 0x4c], r13d
mov dword [rsp + 0x80], eax
mov eax, dword [r8 + 0x20]
mov dword [rsp + 0x78], eax
mov eax, dword [r8 + 0x24]
mov dword [rsp + 0x60], eax
mov rax, qword [rbx + 0x60]
test rax, rax
je 0x2bbf77fa1
cmp r10, rax
jb 0x2bbf77fa1
mov edx, ecx
imul edx, r11d
shl edx, 2
movsxd rdx, edx
add rax, rdx
cmp r10, rax
jb 0x2bbf78815
mov qword [rsp + 0x88], 0
mov esi, dword [rsp + 0x64]
mov eax, dword [rsp + 0x6c]
add eax, esi
mov esi, dword [rsp + 0x68]
lea r8d, [rbp + rsi]
cmp eax, ecx
jg 0x2bbf77fc9
cmp r8d, r11d
jle 0x2bbf7800b
cmp eax, ecx
mov edx, ecx
mov rcx, rbx
mov dword [rsp + 0xa0], r9d
cmovge edx, eax
cmp r8d, r11d
mov qword [rsp + 0x98], r10
cmovl r8d, r11d
call sym.ImgPhotoSetSize
cmp eax, 1
je 0x2bbf78797
mov ecx, dword [rbx + 0x1c]
mov r10, qword [rsp + 0x98]
mov r9d, dword [rsp + 0xa0]
mov eax, dword [rsp + 0x68]
cmp dword [rbx + 0x6c], eax
jg 0x2bbf7801f
jne 0x2bbf7802d
mov eax, dword [rsp + 0x64]
cmp dword [rbx + 0x68], eax
jle 0x2bbf7802d
mov eax, dword [rsp + 0x64]
mov dword [rbx + 0x68], eax
mov eax, dword [rsp + 0x68]
mov dword [rbx + 0x6c], eax
mov esi, dword [rsp + 0x58]
mov eax, dword [rsp + 0x80]
mov edx, dword [rsp + 0x4c]
sub eax, esi
mov dword [rsp + 0xa8], eax
mov eax, dword [rsp + 0x78]
sub eax, esi
mov dword [rsp + 0xac], eax
mov eax, dword [rsp + 0x60]
cmp eax, edx
jge 0x2bbf78062
test eax, eax
jns 0x2bbf7876a
mov dword [rsp + 0x60], 0
mov eax, dword [rsp + 0xa8]
or eax, dword [rsp + 0xac]
je 0x2bbf7807e
or dword [rbx + 0x18], 1
mov eax, dword [rsp + 0x5c]
mov r11d, dword [rsp + 0x4c]
imul eax, r12d
imul r11d, r14d
mov dword [rsp + 0xb0], eax
test r14d, r14d
jle 0x2bbf784f2
mov eax, dword [rsp + 0x48]
lea eax, [rax + r14 - 1]
cdq
idiv r14d
imul eax, r15d
mov dword [rsp + 0x98], eax
movsxd rax, dword [rsp + 0x58]
mov esi, dword [rsp + 0x64]
lea r8, [r10 + rax]
mov eax, dword [rsp + 0x68]
imul eax, ecx
add eax, esi
shl eax, 2
cdqe
add rax, qword [rbx + 0x60]
mov qword [rsp + 0xa0], rax
test r12d, r12d
jg 0x2bbf78750
mov r13d, ebp
jne 0x2bbf78709
lea eax, [rcx*4]
movsxd r14, r11d
mov edi, ebp
mov rcx, rbx
mov dword [rsp + 0xb4], eax
mov rax, r14
mov r10d, 0x80808081
mov r14d, r13d
mov r13d, r9d
mov r9, rax
cmp r14d, edi
mov edx, edi
cmovle edx, r14d
sub edi, edx
test edx, edx
jle 0x2bbf783e8
movsxd rbx, dword [rsp + 0xa8]
movsxd rsi, dword [rsp + 0xb4]
mov qword [rsp + 0xb8], r8
mov dword [rsp + 0xc8], edi
mov r11d, dword [rsp + 0x90]
mov qword [rsp + 0x70], rbx
movsxd rbx, dword [rsp + 0xac]
mov r12, qword [rsp + 0xa0]
mov eax, dword [rsp + 0x98]
mov dword [rsp + 0xc0], edx
mov qword [rsp + 0x78], rbx
mov rbx, r8
mov dword [rsp + 0xc4], edx
mov rdx, rsi
mov dword [rsp + 0xcc], r14d
mov r14, r9
movsxd rdi, dword [rsp + 0x60]
mov dword [rsp + 0xe8], r11d
mov r8, r12
mov qword [rsp + 0xd0], r12
mov r9d, dword [rsp + 0x6c]
mov qword [rsp + 0x80], rdi
mov qword [rsp + 0xd8], rdx
mov qword [rsp + 0xe0], rcx
mov dword [rsp + 0xec], ebp
nop
cmp r9d, eax
mov ecx, eax
cmovle ecx, r9d
sub r9d, ecx
test ecx, ecx
jle 0x2bbf78360
mov rdi, qword [rsp + 0x70]
mov rsi, qword [rsp + 0x78]
mov dword [rsp + 0x58], eax
mov r11d, dword [rsp + 0x60]
mov qword [rsp + 0x50], rbx
lea rbp, [rbx + rdi]
mov dword [rsp + 0x5c], r9d
lea rdi, [rbx + rsi]
mov rsi, qword [rsp + 0x80]
test r11d, r11d
sete r12b
lea r11, [rbx + rsi]
mov rsi, rbx
nop
cmp r15d, ecx
mov edx, ecx
mov rax, r8
mov dword [rsp + 0x48], ecx
cmovle rdx, r15
mov dword [rsp + 0x4c], r15d
lea r8, [r8 + rdx*4]
jmp 0x2bbf782ee
movzx r9d, byte [rax - 1]
test r9b, r9b
je 0x2bbf78317
test ecx, ecx
je 0x2bbf782e9
mov ebx, 0xff
movzx r15d, byte [rax - 4]
sub ebx, ecx
imul ebx, r9d
movzx r9d, byte [rsi]
imul r9d, ecx
imul rbx, r10
imul r9, r10
shr rbx, 0x27
imul r15d, ebx
add edx, ebx
shr r9, 0x27
imul r15, r10
shr r15, 0x27
add r9d, r15d
movzx r15d, byte [rax - 3]
mov byte [rax - 4], r9b
movzx r9d, byte [rbp]
imul r15d, ebx
imul r9d, ecx
imul r15, r10
imul r9, r10
shr r15, 0x27
shr r9, 0x27
add r9d, r15d
mov byte [rax - 3], r9b
movzx r9d, byte [rdi]
mov byte [rax - 1], dl
imul r9d, ecx
mov ecx, r9d
movzx r9d, byte [rax - 2]
imul rcx, r10
imul r9d, ebx
shr rcx, 0x27
imul r9, r10
shr r9, 0x27
add ecx, r9d
mov byte [rax - 2], cl
cmp rax, r8
je 0x2bbf78332
movzx ecx, byte [r11]
add rax, 4
mov edx, ecx
cmp ecx, 0xff
je 0x2bbf78578
test r12b, r12b
jne 0x2bbf78578
cmp r13d, 1
jne 0x2bbf78240
movzx ecx, byte [rsi]
mov byte [rax - 4], cl
movzx ecx, byte [rbp]
mov byte [rax - 3], cl
movzx ecx, byte [rdi]
mov byte [rax - 1], dl
mov byte [rax - 2], cl
cmp rax, r8
jne 0x2bbf782ee
mov ecx, dword [rsp + 0x48]
mov r15d, dword [rsp + 0x4c]
add rsi, r14
add rbp, r14
add rdi, r14
add r11, r14
sub ecx, r15d
test ecx, ecx
jg 0x2bbf78220
mov eax, dword [rsp + 0x58]
mov rbx, qword [rsp + 0x50]
mov r9d, dword [rsp + 0x5c]
test r9d, r9d
jg 0x2bbf781d0
mov r12, qword [rsp + 0xd0]
mov rdx, qword [rsp + 0xd8]
mov r11d, dword [rsp + 0xe8]
mov rcx, qword [rsp + 0xe0]
mov ebp, dword [rsp + 0xec]
add r12, rdx
sub r11d, 1
jne 0x2bbf783ac
movsxd r8, dword [rsp + 0xb0]
mov r11d, dword [rsp + 0x90]
add rbx, r8
sub dword [rsp + 0xc0], 1
jne 0x2bbf78192
movsxd rax, dword [rsp + 0xc4]
mov r9, r14
mov r8, qword [rsp + 0xb8]
mov edi, dword [rsp + 0xc8]
mov r14d, dword [rsp + 0xcc]
imul rax, rdx
add qword [rsp + 0xa0], rax
test edi, edi
jg 0x2bbf78118
mov edx, dword [rsp + 0x60]
mov rbx, rcx
test edx, edx
je 0x2bbf7867c
test r13d, r13d
jne 0x2bbf78611
mov eax, dword [rbx + 0x1c]
mov r8d, dword [rsp + 0x68]
mov edi, dword [rsp + 0x64]
mov rcx, qword [rbx + 0x70]
mov dword [rsp + 0x30], 4
lea edx, [rax*4]
mov r9d, dword [rsp + 0x6c]
imul eax, r8d
mov dword [rsp + 0x38], edx
mov rdx, qword [rbx + 0x60]
mov dword [rsp + 0x20], ebp
add eax, edi
shl eax, 2
cdqe
lea rax, [rdx + rax + 3]
mov edx, edi
mov qword [rsp + 0x28], rax
call sym.TkpBuildRegionFromAlphaData
cmp byte [rsp + 0x97], 0
jne 0x2bbf785d3
mov rcx, rbx
call sym.ToggleComplexAlphaIfNeeded.isra.0
mov r14d, dword [rsp + 0x6c]
mov esi, dword [rsp + 0x68]
mov dword [rsp + 0x20], ebp
mov rcx, rbx
mov edi, dword [rsp + 0x64]
mov r9d, r14d
mov r8d, esi
mov edx, edi
call sym.tcl9tk90.dll_Tk_DitherPhoto
mov eax, dword [rbx + 0x20]
mov rcx, qword [rbx]
mov r9d, r14d
mov r8d, esi
mov edx, edi
mov dword [rsp + 0x30], eax
mov eax, dword [rbx + 0x1c]
mov dword [rsp + 0x20], ebp
mov dword [rsp + 0x28], eax
call sym.tcl9tk90.dll_Tk_ImageChanged
mov rcx, qword [rsp + 0x88]
test rcx, rcx
je 0x2bbf784c7
mov rax, qword [0x2bc041fd0]
mov rax, qword [rax]
call qword [rax + 0x30]
xor eax, eax
add rsp, 0x108
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret
test r15d, r15d
jle 0x2bbf784c7
mov edx, dword [rsp + 0x90]
test edx, edx
jle 0x2bbf784c7
jmp 0x2bbf77ec9
je 0x2bbf786dc
mov esi, dword [rsp + 0x48]
mov r8d, r14d
neg r8d
mov eax, esi
sub eax, r14d
sub eax, 1
cdq
idiv r8d
mov edx, dword [rsp + 0x64]
imul eax, r15d
mov dword [rsp + 0x98], eax
movsxd rax, dword [rsp + 0x58]
lea r8, [r10 + rax]
mov eax, dword [rsp + 0x68]
imul eax, ecx
add eax, edx
shl eax, 2
cdqe
add rax, qword [rbx + 0x60]
mov qword [rsp + 0xa0], rax
test r12d, r12d
jle 0x2bbf786ec
lea eax, [rdi + r12 - 1]
mov r13d, dword [rsp + 0x90]
mov edi, dword [rsp + 0x4c]
cdq
idiv r12d
imul r13d, eax
mov eax, esi
sub eax, 1
imul eax, edi
cdqe
add r8, rax
jmp 0x2bbf780f0
movzx edx, byte [rsi]
mov byte [rax - 4], dl
movzx edx, byte [rbp]
mov byte [rax - 3], dl
movzx edx, byte [rdi]
mov byte [rax - 1], 0xff
mov byte [rax - 2], dl
jmp 0x2bbf782e9
mov dword [rsp + 0x188], eax
mov eax, dword [rsp + 0x6c]
mov rdx, rbx
mov dword [rsp + 0x180], ebp
mov dword [rsp + 0x178], eax
mov eax, dword [rsp + 0x68]
mov dword [rsp + 0x170], eax
add rsp, 0x108
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
jmp sym.tcl9tk90.dll_Tk_PhotoPutBlock
mov edx, dword [rbx + 0x18]
test dl, 4
jne 0x2bbf7846a
mov eax, dword [rsp + 0x68]
imul eax, dword [rbx + 0x1c]
mov edi, dword [rsp + 0x64]
mov rcx, qword [rbx + 0x60]
add eax, edi
shl eax, 2
cdqe
movzx eax, byte [rcx + rax + 3]
sub eax, 1
cmp al, 0xfd
ja 0x2bbf7846a
or edx, 4
mov dword [rbx + 0x18], edx
jmp 0x2bbf7846a
call sym.tcl9tk90.dll_XCreateRegion
lea rcx, [rsp + 0xf8]
mov r12, rax
movzx eax, word [rsp + 0x64]
mov r8, r12
mov rdx, r12
mov word [rsp + 0xf8], ax
movzx eax, word [rsp + 0x68]
mov word [rsp + 0xfa], ax
movzx eax, word [rsp + 0x6c]
mov word [rsp + 0xfc], ax
mov eax, 1
mov word [rsp + 0xfe], ax
call sym.tcl9tk90.dll_XUnionRectWithRegion
mov rcx, qword [rbx + 0x70]
mov rdx, r12
mov r8, rcx
call sym.tcl9tk90.dll_XSubtractRegion
mov rcx, r12
call sym.tcl9tk90.dll_XDestroyRegion
jmp 0x2bbf78408
movzx eax, word [rsp + 0x64]
mov rdx, qword [rcx + 0x70]
lea rcx, [rsp + 0xf8]
mov word [rsp + 0xfe], bp
mov word [rsp + 0xf8], ax
movzx eax, word [rsp + 0x68]
mov r8, rdx
mov word [rsp + 0xfa], ax
movzx eax, word [rsp + 0x6c]
mov word [rsp + 0xfc], ax
call sym.tcl9tk90.dll_XUnionRectWithRegion
cmp byte [rsp + 0x97], 0
jne 0x2bbf785d3
test byte [rbx + 0x18], 4
jne 0x2bbf78462
jmp 0x2bbf7846a
mov eax, dword [rsp + 0x6c]
mov dword [rsp + 0x98], eax
jmp 0x2bbf780b7
jne 0x2bbf78709
mov eax, dword [rsp + 0x48]
mov edi, dword [rsp + 0x4c]
mov r13d, ebp
sub eax, 1
imul eax, edi
cdqe
add r8, rax
jmp 0x2bbf780f0
mov eax, edi
mov r13d, dword [rsp + 0x90]
sub eax, r12d
neg r12d
sub eax, 1
cdq
idiv r12d
imul r13d, eax
test r14d, r14d
jns 0x2bbf7873c
mov eax, dword [rsp + 0x48]
mov esi, dword [rsp + 0x4c]
sub eax, 1
imul eax, esi
cdqe
add r8, rax
lea eax, [rdi - 1]
mov edi, dword [rsp + 0x5c]
imul eax, edi
cdqe
add r8, rax
jmp 0x2bbf780f0
lea eax, [rdi + r12 - 1]
mov r13d, dword [rsp + 0x90]
cdq
idiv r12d
imul r13d, eax
jmp 0x2bbf780f0
sub eax, esi
mov esi, dword [rsp + 0x70]
mov dword [rsp + 0x60], eax
test esi, esi
sete al
cmp dword [rsp + 0x6c], 1
sete dl
and eax, edx
cmp ebp, 1
sete dl
and eax, edx
mov byte [rsp + 0x97], al
jmp 0x2bbf7806a
mov rdi, qword [rsp + 0x50]
test rdi, rdi
je 0x2bbf787eb
mov rbx, qword [0x2bc041fd0]
mov rdx, 0xffffffffffffffff
lea rcx, str.not_enough_free_memory_for_image_buffer
mov rax, qword [rbx]
mov rsi, qword [rax + 0x768]
call qword [rax + 0x1d0]
mov rcx, rdi
mov rdx, rax
call rsi
mov rax, qword [rbx]
xor r9d, r9d
lea r8, str.MALLOC
lea rdx, [0x2bc01db45]
mov rcx, rdi
call qword [rax + 0x730]
cmp qword [rsp + 0x88], 0
je 0x2bbf7880b
mov rax, qword [0x2bc041fd0]
mov rcx, qword [rsp + 0x88]
mov rax, qword [rax]
call qword [rax + 0x30]
mov eax, 1
jmp 0x2bbf784c9
mov edx, dword [rsp + 0x48]
lea eax, [rdi - 1]
mov r11, qword [0x2bc041fd0]
mov dword [rsp + 0x98], r9d
imul eax, esi
imul edx, r13d
lea esi, [rax + rdx]
mov rax, qword [r11]
mov rcx, rsi
call qword [rax + 0xd70]
mov r11, qword [0x2bc041fd0]
mov r9d, dword [rsp + 0x98]
test rax, rax
mov qword [rsp + 0x88], rax
mov r8, qword [rsp + 0xa0]
je 0x2bbf7889a
mov rdx, qword [r8]
mov r8, rsi
mov rsi, qword [rsp + 0x88]
mov dword [rsp + 0x98], r9d
mov rcx, rsi
call sym.memcpy
mov ecx, dword [rbx + 0x1c]
mov r11d, dword [rbx + 0x20]
mov r10, rsi
mov r9d, dword [rsp + 0x98]
jmp 0x2bbf77fad
mov rdi, qword [rsp + 0x50]
test rdi, rdi
je 0x2bbf7880b
mov rax, qword [r11]
mov rdx, 0xffffffffffffffff
lea rcx, str.not_enough_free_memory_for_image_buffer
mov rbx, qword [rax + 0x768]
call qword [rax + 0x1d0]
mov rcx, rdi
mov rdx, rax
call rbx
mov r11, qword [0x2bc041fd0]
xor r9d, r9d
mov rcx, rdi
lea r8, str.MALLOC
lea rdx, [0x2bc01db45]
mov rax, qword [r11]
call qword [rax + 0x730]
jmp 0x2bbf7880b