Function at 0x51fbd0
Capabilities:
Encode data using base64

Disassembly:
sub esp, 0x4c
push ebx
push ebp
mov ebp, dword [esp + 0x5c]
push esi
push edi
mov ecx, 0x10
mov esi, str.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_
lea edi, [esp + 0x18]
rep movsd dword es:[edi], dword [esi]
lea ecx, [ebp + 2]
mov eax, 0x55555556
imul ecx
mov eax, edx
or ecx, 0xffffffff
shr eax, 0x1f
movsb byte es:[edi], byte [esi]
add edx, eax
mov edi, 0x71471c
xor eax, eax
shl edx, 2
repne scasb al, byte es:[edi]
not ecx
mov esi, edx
dec ecx
imul ecx, esi
mov eax, 0xaf286bcb
mul ecx
sub ecx, edx
shr ecx, 1
add ecx, edx
shr ecx, 6
lea ecx, [esi + ecx + 3]
push ecx
call fcn.00581c40
mov esi, eax
mov eax, 0x55555556
imul ebp
mov ebx, dword [esp + 0x64]
mov eax, edx
shr eax, 0x1f
xor ecx, ecx
add edx, eax
add esp, 4
xor edi, edi
cmp edx, ecx
mov dword [esp + 0x10], ecx
jle 0x51fd0f
mov dword [esp + 0x14], edx
jmp 0x51fc5f
mov ebx, dword [esp + 0x60]
xor eax, eax
xor edx, edx
mov al, byte [edi + ebx]
mov dl, byte [edi + ebx + 1]
inc edi
mov ebp, edx
inc edi
xor edx, edx
mov dl, byte [edi + ebx]
mov ebx, eax
sar ebx, 2
and ebx, 0x3f
and eax, 3
shl eax, 4
mov bl, byte [esp + ebx + 0x18]
inc edi
mov byte [ecx + esi], bl
mov ebx, ebp
sar ebx, 4
and ebx, 0xf
inc ecx
or ebx, eax
and ebp, 0xf
shl ebp, 2
mov al, byte [esp + ebx + 0x18]
mov byte [ecx + esi], al
mov eax, edx
sar eax, 6
and eax, 3
inc ecx
or eax, ebp
and edx, 0x3f
inc ecx
mov al, byte [esp + eax + 0x18]
mov dl, byte [esp + edx + 0x18]
mov byte [ecx + esi - 1], al
mov eax, dword [esp + 0x6c]
mov byte [ecx + esi], dl
mov edx, dword [esp + 0x10]
inc ecx
add edx, 4
test eax, eax
mov dword [esp + 0x10], edx
je 0x51fcf8
mov eax, edx
cmp eax, 0x49
jl 0x51fcf8
mov al, byte [0x71471c]
mov byte [ecx + esi], al
mov al, byte [0x71471d]
inc ecx
test al, al
je 0x51fcf0
mov byte [ecx + esi], al
inc ecx
mov dword [esp + 0x10], 0
mov eax, dword [esp + 0x14]
dec eax
mov dword [esp + 0x14], eax
jne 0x51fc5b
mov ebp, dword [esp + 0x64]
mov ebx, dword [esp + 0x60]
mov eax, ebp
mov ebp, 3
cdq
idiv ebp
sub edx, 0
je 0x51fdb7
dec edx
je 0x51fd6c
dec edx
jne 0x51fdd5
xor edx, edx
xor eax, eax
mov dl, byte [edi + ebx]
mov al, byte [edi + ebx + 1]
mov ebp, edx
sar edx, 2
and edx, 0x3f
and ebp, 3
shl ebp, 4
mov dl, byte [esp + edx + 0x18]
mov byte [ecx + esi], dl
mov edx, eax
sar edx, 4
and edx, 0xf
inc ecx
or edx, ebp
inc ecx
and eax, 0xf
mov dl, byte [esp + edx + 0x18]
mov al, byte [esp + eax*4 + 0x18]
mov byte [ecx + esi - 1], dl
mov byte [ecx + esi], al
jmp 0x51fd94
xor eax, eax
mov al, byte [edi + ebx]
mov edx, eax
and eax, 3
sar edx, 2
and edx, 0x3f
inc ecx
shl eax, 4
mov dl, byte [esp + edx + 0x18]
mov al, byte [esp + eax + 0x18]
mov byte [ecx + esi - 1], dl
mov byte [ecx + esi], al
inc ecx
mov byte [ecx + esi], 0x3d
mov eax, dword [esp + 0x6c]
inc ecx
mov byte [ecx + esi], 0x3d
inc ecx
test eax, eax
je 0x51fdd5
mov dl, byte [0x71471c]
mov byte [ecx + esi], dl
mov al, byte [0x71471d]
inc ecx
test al, al
je 0x51fdd5
jmp 0x51fdd1
mov eax, dword [esp + 0x6c]
test eax, eax
je 0x51fdd5
mov al, byte [0x71471c]
mov byte [ecx + esi], al
mov al, byte [0x71471d]
inc ecx
test al, al
je 0x51fdd5
mov byte [ecx + esi], al
inc ecx
mov edx, dword [esp + 0x68]
mov byte [ecx + esi], 0
mov eax, esi
pop edi
pop esi
pop ebp
mov dword [edx], ecx
pop ebx
add esp, 0x4c
ret