// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/misc/encoding/base64.cpp
// Function: smooth::Encoding::Base64::Decode(smooth::String const&)
S::Int S::Encoding::Base64::Decode(const String &string)
{
	Int	 bytes	= 0;
	Int	 length = string.Length();

	buffer.Resize(length / 4 * 3 + 1);

	for (Int i = 0; i < length; i += 4)
	{
		Int	 val[4] = { 64, 64, 64, 64 };

		for (Int j = 0; j < 4; j++)
		{
			wchar_t	 value = string[i + j];

			if	(value >= 'A' && value <= 'Z')	val[j] = value - 'A' +  0;
			else if (value >= 'a' && value <= 'z')	val[j] = value - 'a' + 26;
			else if (value >= '0' && value <= '9')	val[j] = value - '0' + 52;
			else if (value == '+')			val[j] = 62;
			else if (value == '/')			val[j] = 63;
		}

		if (val[0] == 64) break;

		if (val[1] != 64) buffer[bytes++] = ( val[0]       << 2) | (val[1] >> 4);
		if (val[2] != 64) buffer[bytes++] = ((val[1] & 15) << 4) | (val[2] >> 2);
		if (val[3] != 64) buffer[bytes++] = ((val[2] &  3) << 6) | (val[3]);

		buffer[bytes] = 0;
	}

	return bytes;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5b800
movl %eax, %ecx
movq -0x40(%rbp), %rax
movl %ecx, -0x18(%rbp)
movq (%rax), %rdi
movl -0x18(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
imull $0x3, %eax, %esi
addl $0x1, %esi
callq 0x72e00
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0xfd0f6
movq 0xa8b8c(%rip), %rax     # 0x1a5af0
movq %rax, -0x30(%rbp)
movq 0xa8b89(%rip), %rax     # 0x1a5af8
movq %rax, -0x28(%rbp)
movl $0x0, -0x34(%rbp)
cmpl $0x4, -0x34(%rbp)
jge 0xfd031
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
addl -0x34(%rbp), %esi
callq 0x5c900
movl %eax, -0x38(%rbp)
cmpl $0x41, -0x38(%rbp)
jl 0xfcfb5
cmpl $0x5a, -0x38(%rbp)
jg 0xfcfb5
movl -0x38(%rbp), %ecx
subl $0x41, %ecx
addl $0x0, %ecx
movslq -0x34(%rbp), %rax
movl %ecx, -0x30(%rbp,%rax,4)
jmp 0xfd021
cmpl $0x61, -0x38(%rbp)
jl 0xfcfd4
cmpl $0x7a, -0x38(%rbp)
jg 0xfcfd4
movl -0x38(%rbp), %ecx
subl $0x61, %ecx
addl $0x1a, %ecx
movslq -0x34(%rbp), %rax
movl %ecx, -0x30(%rbp,%rax,4)
jmp 0xfd01f
cmpl $0x30, -0x38(%rbp)
jl 0xfcff3
cmpl $0x39, -0x38(%rbp)
jg 0xfcff3
movl -0x38(%rbp), %ecx
subl $0x30, %ecx
addl $0x34, %ecx
movslq -0x34(%rbp), %rax
movl %ecx, -0x30(%rbp,%rax,4)
jmp 0xfd01d
cmpl $0x2b, -0x38(%rbp)
jne 0xfd007
movslq -0x34(%rbp), %rax
movl $0x3e, -0x30(%rbp,%rax,4)
jmp 0xfd01b
cmpl $0x2f, -0x38(%rbp)
jne 0xfd019
movslq -0x34(%rbp), %rax
movl $0x3f, -0x30(%rbp,%rax,4)
jmp 0xfd01b
jmp 0xfd01d
jmp 0xfd01f
jmp 0xfd021
jmp 0xfd023
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xfcf7a
cmpl $0x40, -0x30(%rbp)
jne 0xfd03c
jmp 0xfd0f6
cmpl $0x40, -0x2c(%rbp)
je 0xfd06f
movq -0x40(%rbp), %rax
movl -0x30(%rbp), %ecx
shll $0x2, %ecx
movl -0x2c(%rbp), %edx
sarl $0x4, %edx
orl %edx, %ecx
movb %cl, -0x41(%rbp)
movq (%rax), %rdi
movl -0x14(%rbp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
callq 0x717e0
movb -0x41(%rbp), %cl
movb %cl, (%rax)
cmpl $0x40, -0x28(%rbp)
je 0xfd0a5
movq -0x40(%rbp), %rax
movl -0x2c(%rbp), %ecx
andl $0xf, %ecx
shll $0x4, %ecx
movl -0x28(%rbp), %edx
sarl $0x2, %edx
orl %edx, %ecx
movb %cl, -0x42(%rbp)
movq (%rax), %rdi
movl -0x14(%rbp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
callq 0x717e0
movb -0x42(%rbp), %cl
movb %cl, (%rax)
cmpl $0x40, -0x24(%rbp)
je 0xfd0d6
movq -0x40(%rbp), %rax
movl -0x28(%rbp), %ecx
andl $0x3, %ecx
shll $0x6, %ecx
orl -0x24(%rbp), %ecx
movb %cl, -0x43(%rbp)
movq (%rax), %rdi
movl -0x14(%rbp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
callq 0x717e0
movb -0x43(%rbp), %cl
movb %cl, (%rax)
movq -0x40(%rbp), %rax
movq (%rax), %rdi
movl -0x14(%rbp), %esi
callq 0x717e0
movb $0x0, (%rax)
movl -0x1c(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x1c(%rbp)
jmp 0xfcf51
movl -0x14(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nop