// File: /workspace/github_cpp_makefile_star2_O2/alfanick[P]rest-cpp/src/rest/utils.cpp
// Function: REST::Utils::base64_decode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
std::string base64_decode(std::string const& encoded_string) {
  int in_len = encoded_string.size();
  int i = 0;
  int j = 0;
  int in_ = 0;
  unsigned char char_array_4[4], char_array_3[3];
  std::string ret;

  while (in_len-- && ( encoded_string[in_] != '=') && is_base64(encoded_string[in_])) {
    char_array_4[i++] = encoded_string[in_]; in_++;
    if (i ==4) {
      for (i = 0; i <4; i++)
        char_array_4[i] = base64_chars.find(char_array_4[i]);

      char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
      char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
      char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];

      for (i = 0; (i < 3); i++)
        ret += char_array_3[i];
      i = 0;
    }
  }

  if (i) {
    for (j = i; j <4; j++)
      char_array_4[j] = 0;

    for (j = 0; j <4; j++)
      char_array_4[j] = base64_chars.find(char_array_4[j]);

    char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
    char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
    char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];

    for (j = 0; (j < i - 1); j++) ret += char_array_3[j];
  }

  return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x10(%rdi), %rax
movl 0x8(%rsi), %ebp
movq %rdi, %rbx
movq %rsi, 0x10(%rsp)
xorl %r14d, %r14d
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
xorl %eax, %eax
movb $0x0, 0x10(%rdi)
subl $0x1, %ebp
movslq %eax, %r13
movl %eax, %r12d
jb 0x45190
movq 0x10(%rsp), %rax
movl %ebp, %r15d
movq (%rax), %rax
movzbl (%rax,%r14), %ebp
cmpl $0x3d, %ebp
je 0x45190
movl %ebp, %edi
callq 0x31e60
movl %ebp, %ecx
andb $-0x5, %cl
cmpb $0x2b, %cl
je 0x450ec
testl %eax, %eax
je 0x45190
leal 0x1(%r13), %eax
incq %r14
movb %bpl, 0x9(%rsp,%r13)
movl %r15d, %ebp
cmpl $0x4, %eax
jne 0x450ab
leaq 0x1a149(%rip), %r15     # 0x5f250
movq %r14, %r13
xorl %r14d, %r14d
cmpq $0x4, %r14
je 0x4512d
movsbl 0x9(%rsp,%r14), %esi
movq %r15, %rdi
xorl %edx, %edx
callq 0x32580
movb %al, 0x9(%rsp,%r14)
incq %r14
jmp 0x4510d
movb 0xa(%rsp), %cl
movb 0x9(%rsp), %al
movb 0xb(%rsp), %sil
xorl %r14d, %r14d
movl %ecx, %edx
shlb $0x2, %al
shlb $0x4, %cl
shrb $0x4, %dl
andb $0x3, %dl
orb %al, %dl
movb %dl, 0xd(%rsp)
movl %esi, %edx
shlb $0x6, %sil
addb 0xc(%rsp), %sil
shrb $0x2, %dl
andb $0xf, %dl
orb %cl, %dl
movb %dl, 0xe(%rsp)
movb %sil, 0xf(%rsp)
cmpq $0x3, %r14
je 0x45186
movsbl 0xd(%rsp,%r14), %esi
movq %rbx, %rdi
callq 0x31800
incq %r14
jmp 0x4516d
xorl %eax, %eax
movq %r13, %r14
jmp 0x450ab
testl %r12d, %r12d
je 0x4523d
movl %r12d, %ebp
cmpq $0x4, %r13
jge 0x451ad
movb $0x0, 0x9(%rsp,%r13)
incq %r13
jmp 0x4519c
leaq 0x1a09c(%rip), %r15     # 0x5f250
xorl %r12d, %r12d
cmpq $0x4, %r12
je 0x451d7
movsbl 0x9(%rsp,%r12), %esi
movq %r15, %rdi
xorl %edx, %edx
callq 0x32580
movb %al, 0x9(%rsp,%r12)
incq %r12
jmp 0x451b7
movb 0xa(%rsp), %cl
movb 0x9(%rsp), %al
movb 0xb(%rsp), %sil
movl %ecx, %edx
shlb $0x2, %al
shlb $0x4, %cl
shrb $0x4, %dl
andb $0x3, %dl
orb %al, %dl
movb %dl, 0xd(%rsp)
movl %esi, %edx
shlb $0x6, %sil
addb 0xc(%rsp), %sil
shrb $0x2, %dl
andb $0xf, %dl
orb %cl, %dl
cmpl $0x2, %ebp
movb %dl, 0xe(%rsp)
movb %sil, 0xf(%rsp)
pushq $0x1
popq %r15
cmovgel %ebp, %r15d
xorl %r14d, %r14d
decl %r15d
cmpq %r14, %r15
je 0x4523d
movsbl 0xd(%rsp,%r14), %esi
movq %rbx, %rdi
callq 0x31800
incq %r14
jmp 0x45225
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x45251
movq %rbx, %rdi
movq %rax, %r14
callq 0x33b38
movq %r14, %rdi
callq 0x33510