Function at 0x518050
Capabilities:
Encode data using xor

Disassembly:
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x58
mov rdi, qword [rsp + 0xc0]
mov r11d, dword [rdi + 4]
mov r10d, dword [rdi]
mov rsi, rdx
mov eax, r8d
bswap r11d
mov edx, dword [rsp + 0xc8]
sub eax, 8
bswap r10d
mov rbp, r9
mov qword [rsp + 0xa0], rcx
mov dword [rsp + 0xb0], r8d
mov r13d, r11d
mov r14d, r10d
mov dword [rsp + 0x30], eax
test edx, edx
je 0x5181c0
test eax, eax
js 0x518468
shr eax, 3
mov r15, rcx
lea rbx, [rsp + 0x48]
mov edx, r11d
mov ecx, eax
mov dword [rsp + 0x34], eax
lea rax, [rcx*8 + 8]
mov qword [rsp + 0x28], rax
lea r12, [rsi + rax]
mov eax, r10d
nop word [rax + rax]
mov ecx, dword [r15 + 4]
mov r8d, dword [r15]
add rsi, 8
add r15, 8
bswap ecx
xor edx, ecx
bswap r8d
mov rcx, rbx
xor eax, r8d
mov dword [rsp + 0x4c], edx
mov rdx, rbp
mov dword [rsp + 0x48], eax
call sym.CAST_encrypt
mov eax, dword [rsp + 0x48]
mov edx, dword [rsp + 0x4c]
mov ecx, eax
mov byte [rsi - 6], ah
shr ecx, 0x18
mov byte [rsi - 5], al
mov byte [rsi - 8], cl
mov ecx, eax
shr ecx, 0x10
mov byte [rsi - 2], dh
mov byte [rsi - 7], cl
mov ecx, edx
shr ecx, 0x18
mov byte [rsi - 4], cl
mov ecx, edx
shr ecx, 0x10
mov byte [rsi - 3], cl
mov byte [rsi - 1], dl
cmp rsi, r12
jne 0x5180e0
mov r14d, eax
mov rax, qword [rsp + 0x28]
mov ebx, dword [rsp + 0xb0]
mov r13d, edx
add qword [rsp + 0xa0], rax
mov eax, dword [rsp + 0x34]
neg eax
shl eax, 3
lea ecx, [rbx + rax - 0x10]
add eax, dword [rsp + 0x30]
mov dword [rsp + 0xb0], eax
cmp ecx, 0xfffffff8
je 0x518480
mov rax, qword [rsp + 0xa0]
movsxd rcx, ecx
cmp dword [rsp + 0xb0], 7
lea rcx, [rax + rcx + 8]
ja case.0x5181b3.0
mov eax, dword [rsp + 0xb0]
lea r9, [0x005f7d20]
movsxd r8, dword [r9 + rax*4]
add r8, r9
jmp r8
test eax, eax
js 0x518470
shr eax, 3
mov r12, rcx
lea rbx, [rsp + 0x48]
mov qword [rsp + 0xc0], rdi
mov ecx, eax
mov dword [rsp + 0x34], eax
mov rdi, r12
mov r12, rbx
lea rax, [rcx*8 + 8]
mov ebx, r11d
mov qword [rsp + 0x38], rax
add rax, rsi
mov qword [rsp + 0x28], rax
nop
mov r8d, dword [rdi + 4]
mov r13d, r14d
mov r14d, dword [rdi]
mov r15d, ebx
mov rdx, rbp
mov rcx, r12
add rsi, 8
add rdi, 8
mov ebx, r8d
bswap r14d
mov dword [rsp + 0x48], r14d
bswap ebx
mov dword [rsp + 0x4c], ebx
call sym.CAST_decrypt
mov edx, dword [rsp + 0x48]
mov eax, dword [rsp + 0x4c]
xor edx, r13d
xor eax, r15d
mov ecx, edx
mov byte [rsi - 6], dh
shr ecx, 0x18
mov byte [rsi - 5], dl
mov byte [rsi - 8], cl
mov ecx, edx
mov edx, eax
shr edx, 0x18
mov byte [rsi - 2], ah
shr ecx, 0x10
mov byte [rsi - 4], dl
mov edx, eax
mov byte [rsi - 7], cl
shr edx, 0x10
mov byte [rsi - 3], dl
mov byte [rsi - 1], al
cmp rsi, qword [rsp + 0x28]
jne 0x518200
mov ecx, dword [rsp + 0x34]
mov rax, qword [rsp + 0x38]
mov r13d, ebx
add qword [rsp + 0xa0], rax
mov eax, dword [rsp + 0xb0]
neg ecx
mov rdi, qword [rsp + 0xc0]
shl ecx, 3
lea ebx, [rax + rcx - 0x10]
add ecx, dword [rsp + 0x30]
mov dword [rsp + 0xb0], ecx
cmp ebx, 0xfffffff8
je 0x518369
mov rax, qword [rsp + 0xa0]
lea rcx, [rsp + 0x48]
mov rdx, rbp
movsxd rbx, ebx
mov r12d, dword [rax]
mov eax, dword [rax + 4]
bswap r12d
bswap eax
mov dword [rsp + 0x48], r12d
mov r15d, eax
mov dword [rsp + 0x4c], eax
call sym.CAST_decrypt
xor r14d, dword [rsp + 0x48]
xor r13d, dword [rsp + 0x4c]
lea rax, [rsi + rbx + 8]
cmp dword [rsp + 0xb0], 7
ja case.0x518313.0
mov esi, dword [rsp + 0xb0]
lea rcx, [0x005f7d40]
movsxd rdx, dword [rcx + rsi*4]
add rdx, rcx
jmp rdx
mov ebx, r13d
sub rax, 1
mov byte [rax], bh
mov edx, r13d
sub rax, 1
shr edx, 0x10
mov byte [rax], dl
mov r11d, r13d
lea rdx, [rax - 1]
shr r11d, 0x18
mov byte [rax - 1], r11b
mov byte [rdx - 1], r14b
lea rax, [rdx - 1]
mov ebx, r14d
lea rdx, [rax - 1]
mov byte [rax - 1], bh
mov ecx, r14d
lea rax, [rdx - 1]
shr ecx, 0x10
mov byte [rdx - 1], cl
mov r10d, r14d
mov r13d, r15d
mov r14d, r12d
shr r10d, 0x18
mov byte [rax - 1], r10b
mov r10d, r14d
mov r11d, r13d
bswap r10d
bswap r11d
mov dword [rdi], r10d
mov dword [rdi + 4], r11d
add rsp, 0x58
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret
xor r9d, r9d
movzx r8d, byte [rcx - 1]
sub rcx, 1
shl r8d, 0x10
or r8d, r9d
lea r9, [rcx - 1]
movzx ecx, byte [rcx - 1]
shl ecx, 0x18
or ecx, r8d
xor r13d, ecx
lea rcx, [r9 - 1]
movzx r9d, byte [r9 - 1]
movzx r8d, byte [rcx - 1]
lea rbx, [rcx - 1]
shl r8d, 8
or r9d, r8d
movzx r8d, byte [rbx - 1]
lea rcx, [rbx - 1]
shl r8d, 0x10
or r8d, r9d
movzx ecx, byte [rcx - 1]
shl ecx, 0x18
or ecx, r8d
xor r14d, ecx
mov rdx, rbp
lea rcx, [rsp + 0x48]
mov dword [rsp + 0x48], r14d
mov dword [rsp + 0x4c], r13d
call sym.CAST_encrypt
mov ecx, dword [rsp + 0x48]
mov edx, dword [rsp + 0x4c]
mov eax, ecx
mov r11d, edx
mov r9d, ecx
mov r8d, ecx
shr eax, 0x18
bswap r11d
mov dword [rsi + 4], r11d
movzx ebx, ch
mov r15d, eax
mov eax, edx
mov r10d, ecx
mov ecx, edx
shr eax, 0x18
bswap r9d
shr r8d, 0x10
mov dword [rsi], r9d
mov ebp, eax
movzx eax, dh
shr ecx, 0x10
mov r9d, eax
mov byte [rdi], r15b
mov byte [rdi + 1], r8b
mov byte [rdi + 2], bl
mov byte [rdi + 3], r10b
mov byte [rdi + 4], bpl
mov byte [rdi + 5], cl
mov byte [rdi + 6], r9b
mov byte [rdi + 7], dl
jmp 0x51837c
mov ecx, eax
jmp 0x518177
mov ebx, eax
jmp 0x5182a9
mov eax, r14d
mov edx, r13d
mov r8d, r14d
mov ebx, r14d
shr eax, 0x18
mov ecx, r13d
shr r8d, 0x10
movzx ebx, bh
mov r15d, eax
mov eax, r13d
mov r10d, r14d
shr ecx, 0x10
shr eax, 0x18
mov ebp, eax
movzx eax, dh
mov r9d, eax
jmp 0x518443
xor r8d, r8d
jmp 0x5183dd
mov rbx, rcx
xor r9d, r9d
jmp 0x5183cd
xor r9d, r9d
jmp 0x5183bd
mov r9, rcx
jmp 0x5183b4
xor r8d, r8d
jmp 0x5183a3
movzx r8d, byte [rcx - 1]
sub rcx, 1
mov r9d, r8d
shl r9d, 8
jmp 0x518393
mov rdx, rax
jmp 0x518339
mov rdx, rax
jmp 0x51834b
mov r13d, r15d
mov r14d, r12d
jmp 0x518369