Function at 0x140051720
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
mov qword [rsp + 0x20], r9
mov qword [rsp + 0x18], r8
mov qword [rsp + 0x10], rdx
push rbx
push rsi
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x90
mov rax, qword [rcx + 0xc0]
mov rbx, rcx
cmp rax, qword [rcx + 0xc8]
jae 0x140051764
movzx r10d, byte [rax]
inc rax
mov qword [rcx + 0xc0], rax
jmp 0x140051789
cmp dword [rcx + 0x30], 0
je 0x140051786
call fcn.140046160
mov rax, qword [rbx + 0xc0]
movzx r10d, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140051789
xor r10b, r10b
mov ecx, Ordinal_50
mov rdx, rbx
mov qword [rsp + 0x88], rbp
movzx r13d, r10b
lea rsi, [rcx + rbx]
mov qword [rsp + 0x70], rsi
cmp rax, qword [rbx + 0xc8]
jae 0x1400517be
movzx ebp, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x1400517e4
cmp dword [rsi], 0
je 0x1400517e1
mov rcx, rbx
call fcn.140046160
mov rax, qword [rbx + 0xc0]
movzx ebp, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x1400517e4
xor bpl, bpl
mov byte [rsp + 0xf0], bpl
cmp rax, qword [rbx + 0xc8]
jae 0x140051804
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140051829
cmp dword [rsi], 0
je 0x140051827
mov rcx, rbx
call fcn.140046160
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140051829
xor cl, cl
movzx eax, cl
mov rcx, rbx
mov dword [rsp + 0x34], eax
call fcn.140046370
mov rcx, rbx
movsxd r15, eax
call fcn.140046370
mov rcx, qword [rbx + 0xc0]
mov dword [rsp + 0x48], eax
cmp rcx, qword [rbx + 0xc8]
jae 0x140051866
movzx edx, byte [rcx]
inc rcx
mov qword [rbx + 0xc0], rcx
jmp 0x14005188b
cmp dword [rsi], 0
je 0x140051889
mov rcx, rbx
call fcn.140046160
mov rax, qword [rbx + 0xc0]
movzx edx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x14005188b
xor dl, dl
mov rcx, rbx
movzx edi, dl
call fcn.140046370
mov rcx, rbx
call fcn.140046370
mov rcx, rbx
call fcn.140046370
mov rcx, rbx
mov dword [rsp + 0xf8], eax
call fcn.140046370
mov dword [rsp + 0x38], eax
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x1400518d8
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x1400518fd
cmp dword [rsi], 0
je 0x1400518fb
mov rcx, rbx
call fcn.140046160
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x1400518fd
xor cl, cl
movzx r10d, cl
mov dword [rsp + 0x54], r10d
cmp rax, qword [rbx + 0xc8]
jae 0x14005191e
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140051948
cmp dword [rsi], 0
je 0x140051946
mov rcx, rbx
call fcn.140046160
mov rax, qword [rbx + 0xc0]
mov r10d, dword [rsp + 0x54]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140051948
xor cl, cl
mov r8d, dword [rsp + 0x38]
xor r14d, r14d
movzx eax, cl
mov qword [rsp + 0x60], r14
mov dword [rsp + 0x30], r14d
mov dword [rsp + 0x3c], r14d
lea r12d, [r14 + 1]
mov dword [rsp + 0x50], r14d
cmp r8d, 0x1000000
jg 0x1400521ae
mov r9d, dword [rsp + 0xf8]
cmp r9d, 0x1000000
jg 0x1400521ae
mov ecx, dword [rsp + 0x34]
cmp ecx, 8
lea edx, [rcx - 8]
cmovb edx, ecx
shr eax, 5
and eax, r12d
mov ecx, r12d
sub ecx, eax
test bpl, bpl
mov dword [rsp + 0x58], ecx
mov ebp, r14d
je 0x1400519d3
mov ecx, edi
sub ecx, 8
je 0x1400519ce
sub ecx, 7
je 0x140051a21
sub ecx, r12d
je 0x140051a21
sub ecx, 8
je 0x1400519f2
cmp ecx, 8
jne 0x1400519fb
jmp 0x1400519f2
mov edi, r12d
jmp 0x1400519f5
mov ecx, r10d
sub ecx, 8
je 0x140051a2d
sub ecx, 7
je 0x140051a21
sub ecx, r12d
je 0x140051a13
sub ecx, 8
je 0x1400519ef
cmp ecx, 8
jne 0x1400519fb
mov edi, r10d
shr edi, 3
mov esi, edi
test edi, edi
jne 0x140051a33
mov rax, qword gs:[0x58]
mov rcx, qword [rax]
lea rax, str.bad_format
jmp 0x1400521c1
cmp edx, 3
jne 0x140051a21
mov edi, 2
mov esi, edi
jmp 0x140051a33
mov edi, 3
mov ebp, r12d
mov esi, edi
jmp 0x140051a33
mov edi, r12d
mov esi, r12d
mov rax, qword [rsp + 0xd8]
mov dword [rax], r9d
mov rax, qword [rsp + 0xe0]
mov dword [rax], r8d
mov rax, qword [rsp + 0xe8]
test rax, rax
je 0x140051a58
mov dword [rax], edi
test r9d, r9d
js 0x1400521ae
test r8d, r8d
js 0x1400521ae
je 0x140051a86
mov eax, 0x7fffffff
mov ecx, r14d
cdq
idiv r8d
cmp r9d, eax
setle cl
test ecx, ecx
je 0x1400521ae
mov ecx, r8d
imul ecx, r9d
test ecx, ecx
js 0x1400521ae
xor edx, edx
mov eax, 0x7fffffff
div edi
cmp ecx, eax
jg 0x1400521ae
test r8d, r8d
je 0x140051ac5
mov eax, 0x7fffffff
mov ecx, r14d
cdq
idiv r8d
cmp r9d, eax
setle cl
test ecx, ecx
je 0x140052199
mov eax, r8d
imul eax, edi
imul eax, r9d
movsxd rcx, eax
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
mov qword [rsp + 0x40], rax
mov rdx, rax
test rax, rax
je 0x140052199
test r13d, r13d
je 0x140051b2e
cmp qword [rbx + 0x10], r14
je 0x140051b27
mov ecx, dword [rbx + 0xc8]
sub ecx, dword [rbx + 0xc0]
cmp ecx, r13d
jge 0x140051b27
mov rax, qword [rbx + 0xc8]
sub r13d, ecx
mov rcx, qword [rbx + 0x28]
mov edx, r13d
mov qword [rbx + 0xc0], rax
call qword [rbx + Ordinal_26]
mov rdx, qword [rsp + 0x40]
jmp 0x140051b2e
add qword [rbx + 0xc0], r13
cmp byte [rsp + 0xf0], r14b
jne 0x140051c01
mov ecx, dword [rsp + 0x34]
mov r13d, edi
mov dword [rsp + 0xd0], ebp
cmp ecx, 8
jae 0x140051d86
mov dword [rsp + 0xd0], ebp
test ebp, ebp
jne 0x140051d86
mov ecx, dword [rsp + 0x38]
mov dword [rsp + 0xd0], ebp
test ecx, ecx
jle 0x140051be7
mov r15d, edi
mov dword [rsp + 0xd0], ebp
imul r15d, dword [rsp + 0xf8]
cmp dword [rsp + 0x58], r14d
mov r14d, ecx
je 0x140051bc9
mov eax, r15d
neg eax
movsxd r12, eax
lea eax, [rcx - 1]
imul eax, edi
imul eax, dword [rsp + 0xf8]
movsxd rsi, eax
add rsi, rdx
nop word [rax + rax]
mov r8d, r15d
mov rdx, rsi
mov rcx, rbx
call fcn.1400461e0
add rsi, r12
sub r14, 1
jne 0x140051bb0
jmp 0x140051be7
movsxd r12, r15d
mov rsi, rdx
nop
mov r8d, r15d
mov rdx, rsi
mov rcx, rbx
call fcn.1400461e0
add rsi, r12
sub r14, 1
jne 0x140051bd0
mov edi, dword [rsp + 0x38]
mov r15d, edi
mov edx, dword [rsp + 0xf8]
imul r15d, edx
mov esi, r13d
jmp 0x140052123
mov r13d, dword [rsp + 0x48]
test r13d, r13d
jne 0x140051c2c
mov rcx, rdx
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov rax, qword gs:[0x58]
mov rcx, qword [rax]
lea rax, str.bad_palette
jmp 0x1400521c1
test r15d, r15d
je 0x140051c7e
jns 0x140051c43
mov rax, qword [rbx + 0xc8]
mov qword [rbx + 0xc0], rax
jmp 0x140051c7e
cmp qword [rbx + 0x10], r14
je 0x140051c77
mov ecx, dword [rbx + 0xc8]
sub ecx, dword [rbx + 0xc0]
cmp ecx, r15d
jge 0x140051c77
mov rax, qword [rbx + 0xc8]
sub r15d, ecx
mov rcx, qword [rbx + 0x28]
mov edx, r15d
mov qword [rbx + 0xc0], rax
call qword [rbx + Ordinal_26]
jmp 0x140051c7e
add qword [rbx + 0xc0], r15
test r13d, r13d
js 0x14005218e
xor edx, edx
mov eax, 0x7fffffff
div edi
mov ecx, r14d
cmp r13d, eax
setle cl
imul esi, r13d
test ecx, ecx
je 0x14005218e
movsxd rcx, esi
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
mov qword [rsp + 0x60], rax
mov r15, rax
test rax, rax
je 0x14005218e
test ebp, ebp
je 0x140051e01
mov rsi, rax
cmp edi, 3
je 0x140051ce9
mov r8d, 0x1745
lea rdx, str.C:UsersjuliaOneDriveDesktopScriptsV2zKeyauthmenuimgui_masterexamplesexample_win32_directx11_stb_image.h
lea rcx, str.tga_comp__STBI_rgb
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__wassert]
mov dword [rsp + 0xd0], ebp
test r13d, r13d
jle 0x140051d7f
mov r15d, dword [rsp + 0x48]
mov r13d, edi
mov rcx, rbx
call fcn.140046370
movzx r8d, ax
mov eax, r8d
shr eax, 0xa
and eax, 0x1f
imul ecx, eax, 0xff
mov eax, 0x84210843
imul ecx
add edx, ecx
sar edx, 4
mov eax, edx
shr eax, 0x1f
add edx, eax
mov eax, r8d
shr eax, 5
and r8d, 0x1f
and eax, 0x1f
mov byte [rsi], dl
imul ecx, eax, 0xff
mov eax, 0x84210843
imul ecx
add edx, ecx
imul ecx, r8d, 0xff
sar edx, 4
mov eax, edx
shr eax, 0x1f
add edx, eax
mov eax, 0x84210843
mov byte [rsi + 1], dl
imul ecx
add edx, ecx
sar edx, 4
mov eax, edx
shr eax, 0x1f
add edx, eax
mov byte [rsi + 2], dl
add rsi, r13
sub r15, r12
jne 0x140051d01
mov r13d, edi
mov ecx, dword [rsp + 0x34]
mov edi, dword [rsp + 0x38]
mov r15d, edi
mov eax, dword [rsp + 0xf8]
imul r15d, eax
mov esi, r13d
mov dword [rsp + 0x4c], r15d
test r15d, r15d
je 0x140052094
mov rbp, qword [rsp + 0x40]
lea rax, [rsp + 0x30]
mov r9d, r15d
sub rbp, rax
mov r15, qword [rsp + 0x70]
mov r8d, r14d
mov qword [rsp + 0x68], r9
movsxd r10, r13d
nop dword [rax]
cmp ecx, 8
jb 0x140051e84
test r8d, r8d
jne 0x140051e74
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x140051e34
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140051e59
mov r8d, esi
mov dword [rsp + 0xd0], ebp
mov rdx, r15
mov rcx, rbx
mov r13d, edi
call fcn.1400461e0
test eax, eax
jne 0x140051d82
mov rcx, qword [rsp + 0x40]
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov rcx, r15
jmp 0x140051c0e
cmp dword [r15], r14d
je 0x140051e57
mov rcx, rbx
call fcn.140046160
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140051e59
xor cl, cl
movzx eax, cl
mov r8d, eax
and r8d, 0x7f
inc r8d
shr eax, 7
mov dword [rsp + 0x50], eax
mov dword [rsp + 0x3c], r8d
jmp 0x140051e84
cmp dword [rsp + 0x50], r14d
je 0x140051e84
test r12d, r12d
je 0x140052040
cmp byte [rsp + 0xf0], r14b
je 0x140051f1f
cmp dword [rsp + 0x54], 8
jne 0x140051ee8
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x140051ebb
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
movzx eax, cl
jmp 0x140051ef0
cmp dword [r15], r14d
je 0x140051ee1
mov rcx, rbx
call fcn.140046160
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
movzx eax, cl
jmp 0x140051ef0
xor cl, cl
movzx eax, cl
jmp 0x140051ef0
mov rcx, rbx
call fcn.140046370
cmp eax, dword [rsp + 0x48]
cmovge eax, r14d
test r13d, r13d
je 0x140052030
imul eax, r13d
lea rcx, [rsp + 0x30]
mov r8, rsi
movsxd rdx, eax
add rdx, qword [rsp + 0x60]
call sub.VCRUNTIME140.dll_memcpy
jmp 0x140052030
cmp dword [rsp + 0xd0], r14d
je 0x140051fc9
cmp r13d, 3
je 0x140051f4d
mov r8d, 0x1776
lea rdx, str.C:UsersjuliaOneDriveDesktopScriptsV2zKeyauthmenuimgui_masterexamplesexample_win32_directx11_stb_image.h
lea rcx, str.tga_comp__STBI_rgb
call qword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__wassert]
mov rcx, rbx
call fcn.140046370
movzx r8d, ax
mov eax, r8d
shr eax, 0xa
and eax, 0x1f
imul ecx, eax, 0xff
mov eax, 0x84210843
imul ecx
add edx, ecx
sar edx, 4
mov eax, edx
shr eax, 0x1f
add edx, eax
mov eax, r8d
shr eax, 5
and r8d, 0x1f
and eax, 0x1f
mov byte [rsp + 0x30], dl
imul ecx, eax, 0xff
mov eax, 0x84210843
imul ecx
add edx, ecx
imul ecx, r8d, 0xff
sar edx, 4
mov eax, edx
shr eax, 0x1f
add edx, eax
mov eax, 0x84210843
mov byte [rsp + 0x31], dl
imul ecx
add edx, ecx
sar edx, 4
mov eax, edx
shr eax, 0x1f
add edx, eax
mov byte [rsp + 0x32], dl
jmp 0x140052030
mov rdi, r14
test r13d, r13d
je 0x140052030
nop dword [rax]
nop word [rax + rax]
mov rax, qword [rbx + 0xc0]
cmp rax, qword [rbx + 0xc8]
jae 0x140051fff
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140052024
cmp dword [r15], r14d
je 0x140052022
mov rcx, rbx
call fcn.140046160
mov rax, qword [rbx + 0xc0]
movzx ecx, byte [rax]
inc rax
mov qword [rbx + 0xc0], rax
jmp 0x140052024
xor cl, cl
mov byte [rsp + rdi + 0x30], cl
inc rdi
cmp rdi, rsi
jl 0x140051fe0
mov r8d, dword [rsp + 0x3c]
mov r12d, r14d
mov r9, qword [rsp + 0x68]
movsxd r10, r13d
mov rdx, r14
test r13d, r13d
je 0x140052066
nop dword [rax + rax]
lea rcx, [rsp + 0x30]
add rcx, rdx
inc rdx
movzx eax, byte [rcx]
mov byte [rcx + rbp], al
cmp rdx, rsi
jl 0x140052050
mov ecx, dword [rsp + 0x34]
dec r8d
add rbp, r10
mov dword [rsp + 0x3c], r8d
sub r9, 1
mov qword [rsp + 0x68], r9
jne 0x140051dd0
mov edi, dword [rsp + 0x38]
mov r15d, dword [rsp + 0x4c]
mov eax, dword [rsp + 0xf8]
cmp dword [rsp + 0x58], r14d
je 0x140052109
test edi, edi
jle 0x140052109
mov rbp, qword [rsp + 0x40]
lea r10d, [rdi - 1]
imul r10d, r13d
mov r11d, r13d
imul r11d, eax
mov ebx, r14d
imul r10d, eax
nop word [rax + rax]
mov r8d, r11d
test r11d, r11d
jle 0x1400520fa
movsxd rax, ebx
movsxd r9, r10d
sub r9, rax
lea rdx, [rax + rbp]
nop word [rax + rax]
movzx eax, byte [r9 + rdx]
dec r8d
movzx ecx, byte [rdx]
mov byte [rdx], al
mov byte [r9 + rdx], cl
lea rdx, [rdx + 1]
test r8d, r8d
jg 0x1400520e0
add ebx, r11d
sub r10d, r11d
add r14d, 2
cmp r14d, edi
jl 0x1400520c0
mov rax, qword [rsp + 0x60]
test rax, rax
je 0x14005211c
mov rcx, rax
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov edx, dword [rsp + 0xf8]
mov rax, qword [rsp + 0x40]
cmp r13d, 3
jb 0x14005216e
cmp dword [rsp + 0xd0], 0
jne 0x14005216e
mov r8, rax
test r15d, r15d
je 0x14005216e
mov r9d, r15d
nop dword [rax]
nop word [rax + rax]
movzx ecx, byte [r8]
movzx eax, byte [r8 + 2]
mov byte [r8], al
mov byte [r8 + 2], cl
add r8, rsi
sub r9, 1
jne 0x140052150
mov rax, qword [rsp + 0x40]
cmp r13d, 4
je 0x1400521cc
mov r9d, edx
mov dword [rsp + 0x20], edi
mov edx, r13d
mov r8d, 4
mov rcx, rax
call fcn.140046430
jmp 0x1400521cc
mov rcx, qword [rsp + 0x40]
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov rax, qword gs:[0x58]
mov rcx, qword [rax]
lea rax, str.outofmem
jmp 0x1400521c1
mov rax, qword gs:[0x58]
mov rcx, qword [rax]
lea rax, str.too_large
mov edx, Ordinal_41
mov qword [rdx + rcx], rax
xor eax, eax
mov rbp, qword [rsp + 0x88]
add rsp, 0x90
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbx
ret