Function at 0x140147540
Capabilities:
Encrypt data using salsa20 or chacha

Disassembly:
mov qword [rsp + 8], rbx
mov qword [rsp + 0x10], rbp
mov qword [rsp + 0x18], rsi
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x50
cmp byte [r9 + 8], 9
mov r12, r9
mov r13d, dword [rsp + 0xa0]
mov rbx, r8
mov rdi, rdx
mov rsi, rcx
mov ebp, 0xffffff53
jne 0x14014785b
test rcx, rcx
je 0x14014759d
cmp qword [rcx + 0x178], 0
jne 0x14014759d
lea rax, [rcx + 0x180]
mov qword [rcx + 0x178], rax
test rdi, rdi
je 0x1401475ba
cmp qword [rdx + 0x178], 0
jne 0x1401475ba
lea rax, [rdx + 0x180]
mov qword [rdx + 0x178], rax
cmp r13d, 1
jne 0x140147708
test rsi, rsi
je 0x1401476be
mov r14, qword [rcx + 0x178]
lea rdx, [r8 + 0x80]
movzx r15d, word [r9]
test r14, r14
je 0x140147698
test rdx, rdx
je 0x140147698
lea eax, [r15 - 0x10]
mov ecx, 0xffef
test cx, ax
jne 0x140147698
test dl, 3
je 0x14014761a
mov r8d, r15d
lea rcx, [rsp + 0x30]
call fcn.14014cbf0
lea rdx, [rsp + 0x30]
mov eax, dword [rdx]
lea rcx, [rdx + 0x10]
mov dword [r14 + 0x10], eax
lea r8, str.expand_32_byte_kexpand_16_byte_k
mov eax, dword [rdx + 4]
cmp r15d, 0x20
mov dword [r14 + 0x14], eax
mov eax, dword [rdx + 8]
cmovne rcx, rdx
mov dword [r14 + 0x18], eax
mov eax, dword [rdx + 0xc]
mov dword [r14 + 0x1c], eax
lea rax, [0x1401d5020]
cmovne r8, rax
mov eax, dword [rcx]
mov dword [r14 + 0x20], eax
mov eax, dword [rcx + 4]
mov dword [r14 + 0x24], eax
mov eax, dword [rcx + 8]
mov dword [r14 + 0x28], eax
mov eax, dword [rcx + 0xc]
mov dword [r14 + 0x2c], eax
mov eax, dword [r8]
mov dword [r14], eax
mov eax, dword [r8 + 4]
mov dword [r14 + 4], eax
mov eax, dword [r8 + 8]
mov dword [r14 + 8], eax
mov eax, dword [r8 + 0xc]
mov dword [r14 + 0xc], eax
xor eax, eax
mov dword [r14 + 0x40], 0
jmp 0x14014769a
mov eax, ebp
movsd xmm0, qword [rbx + 0xc0]
mov ecx, dword [rbx + 0xc8]
movsd qword [rbx + 0xe8], xmm0
mov dword [rbx + 0xf0], ecx
test eax, eax
jne 0x1401480e4
test rdi, rdi
je 0x140147843
movzx r8d, word [r12]
lea rdx, [rbx + 0xa0]
mov rcx, qword [rdi + 0x178]
call fcn.140146160
movsd xmm0, qword [rbx + 0xd0]
mov ecx, dword [rbx + 0xd8]
movsd qword [rbx + 0xf4], xmm0
mov dword [rbx + 0xfc], ecx
test eax, eax
je 0x140147843
jmp 0x1401480e4
test rsi, rsi
je 0x140147802
mov r14, qword [rcx + 0x178]
lea rdx, [r8 + 0xa0]
movzx r15d, word [r9]
test r14, r14
je 0x1401477dc
test rdx, rdx
je 0x1401477dc
lea eax, [r15 - 0x10]
mov ecx, 0xffef
test cx, ax
jne 0x1401477dc
test dl, 3
je 0x14014775e
mov r8d, r15d
lea rcx, [rsp + 0x30]
call fcn.14014cbf0
lea rdx, [rsp + 0x30]
mov eax, dword [rdx]
lea rcx, [rdx + 0x10]
mov dword [r14 + 0x10], eax
lea r8, str.expand_32_byte_kexpand_16_byte_k
mov eax, dword [rdx + 4]
cmp r15d, 0x20
mov dword [r14 + 0x14], eax
mov eax, dword [rdx + 8]
cmovne rcx, rdx
mov dword [r14 + 0x18], eax
mov eax, dword [rdx + 0xc]
mov dword [r14 + 0x1c], eax
lea rax, [0x1401d5020]
cmovne r8, rax
mov eax, dword [rcx]
mov dword [r14 + 0x20], eax
mov eax, dword [rcx + 4]
mov dword [r14 + 0x24], eax
mov eax, dword [rcx + 8]
mov dword [r14 + 0x28], eax
mov eax, dword [rcx + 0xc]
mov dword [r14 + 0x2c], eax
mov eax, dword [r8]
mov dword [r14], eax
mov eax, dword [r8 + 4]
mov dword [r14 + 4], eax
mov eax, dword [r8 + 8]
mov dword [r14 + 8], eax
mov eax, dword [r8 + 0xc]
mov dword [r14 + 0xc], eax
xor eax, eax
mov dword [r14 + 0x40], 0
jmp 0x1401477de
mov eax, ebp
movsd xmm0, qword [rbx + 0xd0]
mov ecx, dword [rbx + 0xd8]
movsd qword [rbx + 0xe8], xmm0
mov dword [rbx + 0xf0], ecx
test eax, eax
jne 0x1401480e4
test rdi, rdi
je 0x140147843
movzx r8d, word [r12]
lea rdx, [rbx + 0x80]
mov rcx, qword [rdi + 0x178]
call fcn.140146160
movsd xmm0, qword [rbx + 0xc0]
mov ecx, dword [rbx + 0xc8]
movsd qword [rbx + 0xf4], xmm0
mov dword [rbx + 0xfc], ecx
test eax, eax
jne 0x1401480e4
test rsi, rsi
je 0x14014784f
mov byte [rsi + 0x1c5], 1
test rdi, rdi
je 0x14014785b
mov byte [rdi + 0x1c5], 1
cmp byte [r12 + 8], 4
jne 0x140147bcd
test rsi, rsi
je 0x1401478a6
mov rax, qword [rsi]
test rax, rax
jne 0x140147896
mov rax, qword [0x143e6a4b0]
mov ecx, 0x198
test rax, rax
je 0x140147889
call rax
jmp 0x14014788e
call fcn.14003fa18
mov qword [rsi], rax
test rax, rax
je 0x1401478d5
xor edx, edx
mov r8d, 0x198
mov rcx, rax
call fcn.14014d290
test rdi, rdi
je 0x1401478ef
mov rax, qword [rdi]
test rax, rax
jne 0x1401478df
mov rax, qword [0x143e6a4b0]
mov ecx, 0x198
test rax, rax
je 0x1401478c8
call rax
jmp 0x1401478cd
call fcn.14003fa18
mov qword [rdi], rax
test rax, rax
jne 0x1401478df
mov eax, 0xffffff83
jmp 0x1401480e4
xor edx, edx
mov r8d, 0x198
mov rcx, rax
call fcn.14014d290
test rsi, rsi
je 0x140147911
mov rax, qword [rsi]
test rax, rax
je 0x140147fbc
mov rcx, qword [rsp + 0xa8]
mov qword [rax + 0x190], rcx
jmp 0x140147919
mov rcx, qword [rsp + 0xa8]
test rdi, rdi
je 0x140147931
mov rax, qword [rdi]
test rax, rax
je 0x140147fbc
mov qword [rax + 0x190], rcx
cmp r13d, 1
jne 0x140147ad0
test rsi, rsi
je 0x1401479ff
mov r14, qword [rsi]
lea r13, [rbx + 0xc0]
lea r15, [rbx + 0x80]
test r14, r14
je 0x140147ac9
test r15, r15
je 0x140147ac9
xorps xmm0, xmm0
xor eax, eax
movups xmmword [r14], xmm0
mov r8, r14
xor edx, edx
movups xmmword [r14 + 0x10], xmm0
mov rcx, r15
movups xmmword [r14 + 0x20], xmm0
movups xmmword [r14 + 0x30], xmm0
movups xmmword [r14 + 0x40], xmm0
movups xmmword [r14 + 0x50], xmm0
movups xmmword [r14 + 0x60], xmm0
movups xmmword [r14 + 0x70], xmm0
mov dword [r14 + 0x180], eax
mov dword [r14 + 0x188], eax
call fcn.140141b70
test eax, eax
jne 0x1401480e4
lea r8, [r14 + 0x80]
lea rcx, [r15 + 8]
lea edx, [rax + 1]
call fcn.140141b70
test eax, eax
jne 0x1401480e4
lea r8, [r14 + 0x100]
xor edx, edx
lea rcx, [r15 + 0x10]
call fcn.140141b70
test eax, eax
jne 0x1401480e4
test r13, r13
je 0x140147ac2
mov rax, qword [r13]
mov qword [r14 + 0x180], rax
test rdi, rdi
je 0x140147bad
lea r13, [rbx + 0xd0]
lea r15, [rbx + 0xa0]
mov r14, qword [rdi]
test r14, r14
je 0x140147ac9
test r15, r15
je 0x140147ac9
xorps xmm0, xmm0
lea rcx, [r15 + 0x10]
movups xmmword [r14], xmm0
xor eax, eax
mov r8, r14
movups xmmword [r14 + 0x10], xmm0
movups xmmword [r14 + 0x20], xmm0
lea edx, [rax + 1]
movups xmmword [r14 + 0x30], xmm0
movups xmmword [r14 + 0x40], xmm0
movups xmmword [r14 + 0x50], xmm0
movups xmmword [r14 + 0x60], xmm0
movups xmmword [r14 + 0x70], xmm0
mov dword [r14 + 0x180], eax
mov dword [r14 + 0x188], eax
call fcn.140141b70
test eax, eax
jne 0x1401480e4
lea r8, [r14 + 0x80]
xor edx, edx
lea rcx, [r15 + 8]
call fcn.140141b70
test eax, eax
jne 0x1401480e4
lea r8, [r14 + 0x100]
mov rcx, r15
lea edx, [rax + 1]
call fcn.140141b70
test eax, eax
jne 0x1401480e4
test r13, r13
je 0x140147ba4
mov rax, qword [r13]
jmp 0x140147ba6
xor eax, eax
jmp 0x1401479f8
mov eax, ebp
jmp 0x1401480e4
test rsi, rsi
je 0x140147b8c
mov r14, qword [rsi]
lea r13, [rbx + 0xd0]
lea r15, [rbx + 0xa0]
test r14, r14
je 0x140147ac9
test r15, r15
je 0x140147ac9
xorps xmm0, xmm0
xor eax, eax
movups xmmword [r14], xmm0
mov r8, r14
xor edx, edx
movups xmmword [r14 + 0x10], xmm0
mov rcx, r15
movups xmmword [r14 + 0x20], xmm0
movups xmmword [r14 + 0x30], xmm0
movups xmmword [r14 + 0x40], xmm0
movups xmmword [r14 + 0x50], xmm0
movups xmmword [r14 + 0x60], xmm0
movups xmmword [r14 + 0x70], xmm0
mov dword [r14 + 0x180], eax
mov dword [r14 + 0x188], eax
call fcn.140141b70
test eax, eax
jne 0x1401480e4
lea r8, [r14 + 0x80]
lea rcx, [r15 + 8]
lea edx, [rax + 1]
call fcn.140141b70
test eax, eax
jne 0x1401480e4
lea r8, [r14 + 0x100]
xor edx, edx
lea rcx, [r15 + 0x10]
call fcn.140141b70
test eax, eax
jne 0x1401480e4
test r13, r13
je 0x140147b83
mov rax, qword [r13]
jmp 0x140147b85
xor eax, eax
mov qword [r14 + 0x180], rax
test rdi, rdi
je 0x140147bad
lea r13, [rbx + 0xc0]
lea r15, [rbx + 0x80]
jmp 0x140147a16
xor eax, eax
mov qword [r14 + 0x180], rax
test rsi, rsi
je 0x140147bb9
mov byte [rsi + 0x1c5], 1
mov r13d, dword [rsp + 0xa0]
test rdi, rdi
je 0x140147bcd
mov byte [rdi + 0x1c5], 1
cmp byte [r12 + 8], 6
jne 0x140147e03
lea r14, [rsi + 8]
test rsi, rsi
je 0x140147bfe
mov rcx, qword [r14]
test rcx, rcx
jne 0x140147bf1
lea rcx, [rsi + 0x10]
mov qword [r14], rcx
xor edx, edx
mov r8d, 0x150
call fcn.14014d290
lea r15, [rdi + 8]
test rdi, rdi
je 0x140147c29
mov rcx, qword [r15]
test rcx, rcx
jne 0x140147c16
lea rcx, [rdi + 0x10]
mov qword [r15], rcx
xor edx, edx
mov r8d, 0x150
call fcn.14014d290
lea rcx, [rsi + 8]
jmp 0x140147c2c
mov rcx, r14
mov rax, r15
test rsi, rsi
je 0x140147c69
mov rax, qword [r14]
test rax, rax
je 0x140147fbc
mov rdx, qword [rsp + 0xa8]
xorps xmm0, xmm0
mov qword [rax + 0x148], rdx
xor r10d, r10d
movups xmmword [rax + 0x134], xmm0
mov dword [rax + 0x144], r10d
lea rax, [rdi + 8]
jmp 0x140147c74
mov rdx, qword [rsp + 0xa8]
xor r10d, r10d
test rdi, rdi
je 0x140147ca1
mov rcx, qword [r15]
test rcx, rcx
je 0x140147fbc
mov qword [rcx + 0x148], rdx
xorps xmm0, xmm0
movups xmmword [rcx + 0x134], xmm0
mov dword [rcx + 0x144], r10d
lea rcx, [rsi + 8]
cmp r13d, 1
jne 0x140147d4e
test rsi, rsi
je 0x140147cf7
mov rcx, qword [rcx]
test rcx, rcx
je 0x140147ac9
movzx r8d, word [r12]
cmp r8d, 0xf0
ja 0x140147ac9
lea r9, [rbx + 0xc0]
mov dword [rsp + 0x28], r13d
lea rdx, [rbx + 0x80]
mov dword [rsp + 0x20], r10d
call fcn.14013c9d0
test eax, eax
jne 0x1401480e4
lea rax, [rdi + 8]
test rdi, rdi
je 0x140147deb
mov rcx, qword [rax]
test rcx, rcx
je 0x140147ac9
movzx r8d, word [r12]
cmp r8d, 0xf0
ja 0x140147ac9
lea r9, [rbx + 0xd0]
mov dword [rsp + 0x28], 1
lea rdx, [rbx + 0xa0]
mov dword [rsp + 0x20], 1
call fcn.14013c9d0
test eax, eax
je 0x140147deb
jmp 0x1401480e4
test rsi, rsi
je 0x140147d9d
mov rcx, qword [rcx]
test rcx, rcx
je 0x140147ac9
movzx r8d, word [r12]
cmp r8d, 0xf0
ja 0x140147ac9
lea r9, [rbx + 0xd0]
mov dword [rsp + 0x28], 1
lea rdx, [rbx + 0xa0]
mov dword [rsp + 0x20], r10d
call fcn.14013c9d0
test eax, eax
jne 0x1401480e4
lea rax, [rdi + 8]
test rdi, rdi
je 0x140147deb
mov rcx, qword [rax]
test rcx, rcx
je 0x140147ac9
movzx r8d, word [r12]
cmp r8d, 0xf0
ja 0x140147ac9
lea r9, [rbx + 0xc0]
mov dword [rsp + 0x28], 1
lea rdx, [rbx + 0x80]
mov dword [rsp + 0x20], 1
call fcn.14013c9d0
test eax, eax
jne 0x1401480e4
test rsi, rsi
je 0x140147df7
mov byte [rsi + 0x1c5], 1
test rdi, rdi
je 0x140147e03
mov byte [rdi + 0x1c5], 1
cmp byte [r12 + 8], 7
jne 0x1401480c4
lea r15, [rsi + 8]
test rsi, rsi
je 0x140147e34
mov rcx, qword [r15]
test rcx, rcx
jne 0x140147e27
lea rcx, [rsi + 0x10]
mov qword [r15], rcx
xor edx, edx
mov r8d, 0x150
call fcn.14014d290
test rdi, rdi
je 0x140147e5d
mov rcx, qword [rdi + 8]
test rcx, rcx
jne 0x140147e4a
lea rcx, [rdi + 0x10]
mov qword [rdi + 8], rcx
xor edx, edx
mov r8d, 0x150
call fcn.14014d290
lea r14, [rsi + 8]
jmp 0x140147e60
mov r14, r15
test rsi, rsi
je 0x140147e96
mov rax, qword [r15]
test rax, rax
je 0x140147fbc
mov rcx, qword [rsp + 0xa8]
xorps xmm0, xmm0
mov qword [rax + 0x148], rcx
xor r15d, r15d
movups xmmword [rax + 0x134], xmm0
mov dword [rax + 0x144], r15d
jmp 0x140147ea1
mov rcx, qword [rsp + 0xa8]
xor r15d, r15d
test rdi, rdi
je 0x140147ecf
mov rax, qword [rdi + 8]
test rax, rax
je 0x140147fbc
xorps xmm0, xmm0
mov qword [rax + 0x148], rcx
movups xmmword [rax + 0x134], xmm0
mov dword [rax + 0x144], r15d
lea r14, [rsi + 8]
cmp r13d, 1
jne 0x140147fc6
test rsi, rsi
je 0x140147f83
movzx r8d, word [r12]
lea rdx, [rbx + 0x80]
mov rcx, qword [r14]
call fcn.140140410
test eax, eax
jne 0x1401480e4
cmp dword [rsp + 0xc0], 0
lea rdx, [rbx + 0xc0]
movsd xmm0, qword [rdx]
mov eax, dword [rdx + 8]
movsd qword [rbx + 0xe8], xmm0
mov dword [rbx + 0xf0], eax
jne 0x140147f83
mov r14, qword [r14]
test r14, r14
je 0x140147ac9
mov rcx, qword [rsp + 0xb8]
test rcx, rcx
je 0x140147ac9
test rdx, rdx
je 0x140147ac9
mov eax, dword [rdx]
lea r8d, [r13 + 7]
lea rdx, [r14 + 0xfc]
mov dword [r14 + 0xf8], eax
call fcn.140145350
mov ebp, eax
test eax, eax
jne 0x140147ac9
mov qword [r14 + 0x118], 0
mov dword [r14 + 0x120], shutdown
test rdi, rdi
je 0x1401480ac
movzx r8d, word [r12]
lea rdx, [rbx + 0xa0]
mov rcx, qword [rdi + 8]
call fcn.140140410
test eax, eax
jne 0x1401480e4
movsd xmm0, qword [rbx + 0xd0]
mov eax, dword [rbx + 0xd8]
jmp 0x14014809e
mov eax, 0xffffff4a
jmp 0x1401480e4
test rsi, rsi
je 0x140148072
movzx r8d, word [r12]
lea rdx, [rbx + 0xa0]
mov rcx, qword [r14]
call fcn.140140410
test eax, eax
jne 0x1401480e4
cmp dword [rsp + 0xc0], 0
lea rdx, [rbx + 0xd0]
movsd xmm0, qword [rdx]
mov eax, dword [rdx + 8]
movsd qword [rbx + 0xe8], xmm0
mov dword [rbx + 0xf0], eax
jne 0x140148072
mov r14, qword [r14]
test r14, r14
je 0x140147ac9
mov rcx, qword [rsp + 0xb8]
test rcx, rcx
je 0x140147ac9
test rdx, rdx
je 0x140147ac9
mov eax, dword [rdx]
mov r8d, 8
lea rdx, [r14 + 0xfc]
mov dword [r14 + 0xf8], eax
call fcn.140145350
mov ebp, eax
test eax, eax
jne 0x140147ac9
mov qword [r14 + 0x118], 0
mov dword [r14 + 0x120], shutdown
test rdi, rdi
je 0x1401480ac
movzx r8d, word [r12]
lea rdx, [rbx + 0x80]
mov rcx, qword [rdi + 8]
call fcn.140140410
test eax, eax
jne 0x1401480e4
movsd xmm0, qword [rbx + 0xc0]
mov eax, dword [rbx + 0xc8]
movsd qword [rbx + 0xf4], xmm0
mov dword [rbx + 0xfc], eax
test rsi, rsi
je 0x1401480b8
mov byte [rsi + 0x1c5], 1
test rdi, rdi
je 0x1401480c4
mov byte [rdi + 0x1c5], 1
test rsi, rsi
je 0x1401480d2
xor eax, eax
mov qword [rbx + 0x108], rax
test rdi, rdi
je 0x1401480e2
mov qword [rbx + 0x100], 0
xor eax, eax
lea r11, [rsp + 0x50]
mov rbx, qword [r11 + 0x30]
mov rbp, qword [r11 + 0x38]
mov rsi, qword [r11 + 0x40]
mov rsp, r11
pop r15
pop r14
pop r13
pop r12
pop rdi
ret