Function at 0x180005170
Capabilities:
Encode data using base64 via winapi

Disassembly:
push rbx
push rbp
push rsi
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x38
mov rbx, rcx
movsxd rax, r8d
mov qword [rcx + 0x18], rax
mov qword [rcx + 0x20], rax
mov eax, 0x2000
mov qword [rcx + 8], rdx
mov qword [rcx + 0x10], rdx
mov ecx, dword [rcx + 0x38]
cmp ecx, dword [rbx + 0x48]
cmovbe ecx, dword [rbx + 0x48]
lea r13d, [rcx + rcx*2]
cmp r13d, eax
cmovl r13d, eax
movsxd r12, r13d
mov rcx, r12
call qword [sym.imp.msvcrt.dll_malloc]
mov rcx, r12
xor r14d, r14d
mov rbp, rax
call qword [sym.imp.msvcrt.dll_malloc]
mov r15, rax
mov edi, 0x3f
cmp qword [rbx + 0x20], 4
jb 0x1800056e6
mov rcx, qword [rbx + 0x10]
mov ecx, dword [rcx]
call qword [sym.imp.WS2_32.dll_ntohl]
mov rcx, qword [rbx + 0x20]
add qword [rbx + 0x10], 4
add rcx, 0xfffffffffffffffc
mov rdx, qword [rbx + 0x10]
mov qword [rbx + 0x20], rcx
cmp eax, 7
jne 0x18000526f
cmp rcx, 4
jb 0x180005249
mov ecx, dword [rdx]
call qword [sym.imp.WS2_32.dll_ntohl]
add qword [rbx + 0x20], 0xfffffffffffffffc
add qword [rbx + 0x10], 4
test eax, eax
je 0x180005249
cmp eax, 1
jne 0x1800051d4
mov r8, r12
xor edx, edx
mov rcx, rbp
call sub.msvcrt.dll_memset
mov r8d, dword [rbx + 0x48]
mov rcx, rbp
mov rdx, qword [rbx + 0x40]
call sub.msvcrt.dll_memcpy
mov r14d, dword [rbx + 0x48]
jmp 0x1800051d4
mov r8, r12
xor edx, edx
mov rcx, rbp
call sub.msvcrt.dll_memset
mov r8d, dword [rbx + 0x38]
mov rcx, rbp
mov rdx, qword [rbx + 0x30]
call sub.msvcrt.dll_memcpy
mov r14d, dword [rbx + 0x38]
jmp 0x1800051d4
cmp eax, 9
jne 0x180005326
mov rax, qword [rbx + 0x28]
mov rcx, qword [rax + 0x18]
cmp byte [rcx], 0
jne 0x180005289
xor edi, edi
jmp 0x180005299
mov rdi, 0xffffffffffffffff
inc rdi
cmp byte [rcx + rdi], 0
jne 0x180005290
test rdi, rdi
mov eax, 0x26
mov edx, 0x3f
cmove eax, edx
mov byte [rcx + rdi], al
inc rdi
mov rax, qword [rbx + 0x20]
cmp rax, 4
jae 0x1800052bd
xor ecx, ecx
jmp 0x1800052d9
mov rax, qword [rbx + 0x10]
mov ecx, dword [rax]
call qword [sym.imp.WS2_32.dll_ntohl]
add qword [rbx + 0x20], 0xfffffffffffffffc
mov ecx, eax
mov rax, qword [rbx + 0x20]
add qword [rbx + 0x10], 4
movsxd rsi, ecx
test ecx, ecx
je 0x1800052fd
cmp rsi, rax
ja 0x1800052fd
mov rdx, qword [rbx + 0x10]
sub rax, rsi
mov qword [rbx + 0x20], rax
lea rax, [rdx + rsi]
mov qword [rbx + 0x10], rax
test rdx, rdx
jne 0x1800052ff
xor edx, edx
mov rax, qword [rbx + 0x28]
mov r8, rsi
mov rcx, qword [rax + 0x18]
add rcx, rdi
call sub.msvcrt.dll_memcpy
mov rax, qword [rbx + 0x28]
mov rax, qword [rax + 0x18]
add rax, rsi
mov byte [rax + rdi], 0
jmp 0x1800051cf
cmp eax, 0xa
jne 0x1800053a1
cmp rcx, 4
jae 0x180005335
xor eax, eax
jmp 0x18000534f
mov ecx, dword [rdx]
call qword [sym.imp.WS2_32.dll_ntohl]
add qword [rbx + 0x20], 0xfffffffffffffffc
add qword [rbx + 0x10], 4
mov rdx, qword [rbx + 0x10]
mov rcx, qword [rbx + 0x20]
movsxd rsi, eax
test eax, eax
je 0x18000536f
cmp rsi, rcx
ja 0x18000536f
sub rcx, rsi
lea rax, [rdx + rsi]
mov qword [rbx + 0x20], rcx
mov qword [rbx + 0x10], rax
test rdx, rdx
jne 0x180005371
xor edx, edx
mov rax, qword [rbx + 0x28]
mov rcx, qword [rax + 0x28]
cmp byte [rcx], 0
jne 0x180005388
xor edi, edi
add rcx, rdi
jmp 0x1800056b0
mov rdi, 0xffffffffffffffff
nop
inc rdi
cmp byte [rcx + rdi], 0
jne 0x180005390
add rcx, rdi
jmp 0x1800056b0
cmp eax, 1
jne 0x180005400
cmp rcx, 4
jae 0x1800053b0
xor eax, eax
jmp 0x1800053ca
mov ecx, dword [rdx]
call qword [sym.imp.WS2_32.dll_ntohl]
add qword [rbx + 0x20], 0xfffffffffffffffc
add qword [rbx + 0x10], 4
mov rdx, qword [rbx + 0x10]
mov rcx, qword [rbx + 0x20]
movsxd rdi, eax
test eax, eax
je 0x1800053ea
cmp rdi, rcx
ja 0x1800053ea
sub rcx, rdi
lea rax, [rdx + rdi]
mov qword [rbx + 0x20], rcx
mov qword [rbx + 0x10], rax
test rdx, rdx
jne 0x1800053ec
xor edx, edx
lea rcx, [r14 + rbp]
mov r8, rdi
call sub.msvcrt.dll_memcpy
add r14, rdi
jmp 0x1800051cf
cmp eax, 2
jne 0x18000548c
cmp rcx, 4
jae 0x180005413
xor eax, eax
jmp 0x18000542d
mov ecx, dword [rdx]
call qword [sym.imp.WS2_32.dll_ntohl]
add qword [rbx + 0x20], 0xfffffffffffffffc
add qword [rbx + 0x10], 4
mov rdx, qword [rbx + 0x10]
mov rcx, qword [rbx + 0x20]
movsxd rdi, eax
test eax, eax
je 0x18000544d
cmp rdi, rcx
ja 0x18000544d
sub rcx, rdi
lea rax, [rdx + rdi]
mov qword [rbx + 0x20], rcx
mov qword [rbx + 0x10], rax
test rdx, rdx
jne 0x18000544f
xor edx, edx
mov r8, rdi
mov rcx, r15
call sub.msvcrt.dll_memcpy
lea rcx, [rdi + r15]
mov r8, r14
mov rdx, rbp
call sub.msvcrt.dll_memcpy
mov r8, r12
xor edx, edx
mov rcx, rbp
add r14, rdi
call sub.msvcrt.dll_memset
mov r8, r14
mov rdx, r15
mov rcx, rbp
call sub.msvcrt.dll_memcpy
jmp 0x1800051cf
cmp eax, 3
je 0x18000570d
cmp eax, 0xd
je 0x18000570d
cmp eax, 4
jne 0x1800054bb
mov rcx, qword [rbx + 0x28]
mov r8, r14
mov rdx, rbp
mov rcx, qword [rcx + 0x20]
call sub.msvcrt.dll_memcpy
jmp 0x1800051d4
cmp eax, 5
jne 0x180005567
mov rax, qword [rbx + 0x28]
mov rcx, qword [rax + 0x18]
cmp byte [rcx], 0
jne 0x1800054d5
xor esi, esi
jmp 0x1800054e9
mov rsi, 0xffffffffffffffff
nop dword [rax]
inc rsi
cmp byte [rcx + rsi], 0
jne 0x1800054e0
test rsi, rsi
lea rdx, [rsp + 0x88]
mov eax, 0x26
cmove eax, edi
mov byte [rcx + rsi], al
mov rcx, rbx
inc rsi
call fcn.180005b80
mov rcx, qword [rbx + 0x28]
mov rdx, rax
mov r8, qword [rsp + 0x88]
mov rcx, qword [rcx + 0x18]
add rcx, rsi
call sub.msvcrt.dll_memcpy
mov rax, qword [rbx + 0x28]
mov r8, r14
add rsi, qword [rsp + 0x88]
mov rdx, rbp
mov rcx, qword [rax + 0x18]
mov byte [rsi + rcx], 0x3d
inc rsi
mov rax, qword [rbx + 0x28]
mov rcx, qword [rax + 0x18]
add rcx, rsi
call sub.msvcrt.dll_memcpy
mov rax, qword [rbx + 0x28]
mov rax, qword [rax + 0x18]
add rax, rsi
mov byte [rax + r14], 0
jmp 0x1800051cf
cmp eax, 6
jne 0x180005615
lea rdx, [rsp + 0x98]
mov rcx, rbx
call fcn.180005b80
mov rcx, qword [rbx + 0x28]
mov rdx, qword [rcx + 0x28]
cmp byte [rdx], 0
jne 0x180005591
xor esi, esi
jmp 0x1800055a9
mov rsi, 0xffffffffffffffff
nop dword [rax + rax]
inc rsi
cmp byte [rdx + rsi], 0
jne 0x1800055a0
mov r8, qword [rsp + 0x98]
lea rcx, [rdx + rsi]
mov rdx, rax
call sub.msvcrt.dll_memcpy
mov rax, qword [rbx + 0x28]
mov r8, r14
add rsi, qword [rsp + 0x98]
mov rdx, rbp
mov rcx, qword [rax + 0x28]
mov eax, 0x203a
mov word [rsi + rcx], ax
inc rsi
mov rax, qword [rbx + 0x28]
mov rcx, qword [rax + 0x28]
add rcx, rsi
call sub.msvcrt.dll_memcpy
mov rax, qword [rbx + 0x28]
add rsi, r14
mov rcx, qword [rax + 0x28]
mov eax, 0xa0d
mov word [rsi + rcx], ax
mov rax, qword [rbx + 0x28]
mov rcx, qword [rax + 0x28]
mov byte [rcx + rsi + 2], 0
jmp 0x1800051cf
cmp eax, 0x10
jne 0x1800056de
mov rax, qword [0x181776730]
xor r9d, r9d
mov rsi, 0xffffffffffffffff
mov rcx, qword [rax + 8]
movups xmm1, xmmword [rcx + 0x360]
movd eax, xmm1
movdqa xmm0, xmm1
psrldq xmm0, 8
movq rcx, xmm0
cmp ax, 3
cmove r9, rcx
inc rsi
cmp byte [r9 + rsi], 0
jne 0x180005654
mov qword [rsp + 0x80], rsi
test rsi, rsi
jne 0x180005686
lea rdx, [rsp + 0x80]
mov rcx, rbx
call fcn.180005b80
mov rsi, qword [rsp + 0x80]
mov r9, rax
mov rcx, qword [rbx + 0x28]
mov rdx, qword [rcx + 0x28]
cmp byte [rdx], 0
jne 0x180005697
xor edi, edi
jmp 0x1800056a9
mov rdi, 0xffffffffffffffff
nop
inc rdi
cmp byte [rdx + rdi], 0
jne 0x1800056a0
lea rcx, [rdx + rdi]
mov rdx, r9
mov r8, rsi
call sub.msvcrt.dll_memcpy
mov rax, qword [rbx + 0x28]
add rdi, rsi
mov rcx, qword [rax + 0x28]
mov eax, 0xa0d
mov word [rdi + rcx], ax
mov rax, qword [rbx + 0x28]
mov rcx, qword [rax + 0x28]
mov byte [rcx + rdi + 2], 0
jmp 0x1800051cf
test eax, eax
jne 0x1800051d4
mov rcx, rbp
call qword [sym.imp.msvcrt.dll_free]
mov rcx, r15
call qword [sym.imp.msvcrt.dll_free]
mov rax, qword [rbx + 0x28]
add rsp, 0x38
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbp
pop rbx
ret
mov dword [rsp + 0x90], r13d
cmp eax, 3
je 0x180005797
cmp eax, 0xd
jne 0x1800057c3
lea rax, [rsp + 0x90]
mov r9, r15
mov r8d, 1
mov qword [rsp + 0x20], rax
mov edx, r14d
mov rcx, rbp
call qword [sym.imp.CRYPT32.dll_CryptBinaryToStringA]
test eax, eax
jne 0x180005753
call qword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x1800057c3
mov edx, dword [rsp + 0x90]
test edx, edx
je 0x18000578e
mov rax, r15
mov r8d, edx
movzx ecx, byte [rax]
cmp cl, 0x3d
jne 0x180005773
mov byte [rax], 0
dec edx
jmp 0x180005785
cmp cl, 0x2f
jne 0x18000577d
mov byte [rax], 0x5f
jmp 0x180005785
cmp cl, 0x2b
jne 0x180005785
mov byte [rax], 0x2d
inc rax
sub r8, 1
jne 0x180005764
mov dword [rsp + 0x90], edx
jmp 0x1800057c3
lea rax, [rsp + 0x90]
mov r9, r15
mov r8d, 1
mov qword [rsp + 0x20], rax
mov edx, r14d
mov rcx, rbp
call qword [sym.imp.CRYPT32.dll_CryptBinaryToStringA]
test eax, eax
jne 0x1800057c3
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov r14d, dword [rsp + 0x90]
mov r8, r12
xor edx, edx
mov rcx, rbp
call sub.msvcrt.dll_memset
mov r8d, r14d
mov rdx, r15
mov rcx, rbp
call sub.msvcrt.dll_memcpy
jmp 0x1800051d4