// File: solaldunckel[P]webserv/srcs/Utils/Base64.cpp
// Function: ft::b64decode[abi:cxx11](void const*, unsigned long const&)
const std::string b64decode(const void *data, const size_t &len) {
    if (len == 0) return "";

    unsigned char *p = (unsigned char*)data;
    size_t j = 0,
      pad1 = len % 4 || p[len - 1] == '=',
      pad2 = pad1 && (len % 4 > 2 || p[len - 2] != '=');
    const size_t last = (len - pad1) / 4 << 2;
    std::string result(last / 4 * 3 + pad1 + pad2, '\0');
    unsigned char *str = (unsigned char*) &result[0];

    for (size_t i = 0; i < last; i += 4) {
      int n = ft::B64index[p[i]] << 18 | ft::B64index[p[i + 1]] << 12 | ft::B64index[p[i + 2]] << 6 | ft::B64index[p[i + 3]];
      str[j++] = n >> 16;
      str[j++] = n >> 8 & 0xFF;
      str[j++] = n & 0xFF;
    }
    if (pad1) {
      int n = ft::B64index[p[last]] << 18 | ft::B64index[p[last + 1]] << 12;
      str[j++] = n >> 16;
      if (pad2) {
        n |= ft::B64index[p[last + 2]] << 6;
        str[j++] = n >> 8 & 0xFF;
      }
    }
    return result;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x88(%rbp)
movq %rdi, %rax
movq %rax, -0x80(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x352a3
leaq -0x19(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0x5960
movq -0x88(%rbp), %rdi
movq -0x90(%rbp), %rdx
leaq 0xe7e0(%rip), %rsi      # 0x43a54
callq 0x6be0
jmp 0x3527b
leaq -0x19(%rbp), %rdi
callq 0x55e0
jmp 0x355f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x19(%rbp), %rdi
callq 0x55e0
jmp 0x355fd
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rcx
andq $0x3, %rcx
movb $0x1, %al
cmpq $0x0, %rcx
movb %al, -0x91(%rbp)
jne 0x352eb
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
subq $0x1, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x3d, %eax
sete %al
movb %al, -0x91(%rbp)
movb -0x91(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movq %rax, -0x48(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x48(%rbp)
movb %al, -0x92(%rbp)
je 0x3534d
movq -0x18(%rbp), %rax
movq (%rax), %rcx
andq $0x3, %rcx
movb $0x1, %al
cmpq $0x2, %rcx
movb %al, -0x93(%rbp)
ja 0x35341
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
subq $0x2, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x3d, %eax
setne %al
movb %al, -0x93(%rbp)
movb -0x93(%rbp), %al
movb %al, -0x92(%rbp)
movb -0x92(%rbp), %al
movzbl %al, %eax
andl $0x1, %eax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x48(%rbp), %rcx
subq %rcx, %rax
andq $-0x4, %rax
movq %rax, -0x58(%rbp)
movb $0x0, -0x59(%rbp)
movq -0x58(%rbp), %rax
shrq $0x2, %rax
leaq (%rax,%rax,2), %rax
movq -0x48(%rbp), %rcx
addq %rcx, %rax
movq -0x50(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0xa8(%rbp)
leaq -0x5a(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0x5960
movq -0x88(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq -0xa0(%rbp), %rcx
xorl %edx, %edx
callq 0x35660
jmp 0x353c6
leaq -0x5a(%rbp), %rdi
callq 0x55e0
movq -0x88(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5a80
movq %rax, -0xb0(%rbp)
jmp 0x353e8
movq -0xb0(%rbp), %rax
movq %rax, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0x35525
movq -0x38(%rbp), %rax
movq -0x70(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
leaq 0xe642(%rip), %rax      # 0x43a60
movl (%rax,%rcx,4), %eax
shll $0x12, %eax
movq -0x38(%rbp), %rcx
movq -0x70(%rbp), %rdx
movzbl 0x1(%rcx,%rdx), %ecx
movl %ecx, %edx
leaq 0xe626(%rip), %rcx      # 0x43a60
movl (%rcx,%rdx,4), %ecx
shll $0xc, %ecx
orl %ecx, %eax
movq -0x38(%rbp), %rcx
movq -0x70(%rbp), %rdx
movzbl 0x2(%rcx,%rdx), %ecx
movl %ecx, %edx
leaq 0xe608(%rip), %rcx      # 0x43a60
movl (%rcx,%rdx,4), %ecx
shll $0x6, %ecx
orl %ecx, %eax
movq -0x38(%rbp), %rcx
movq -0x70(%rbp), %rdx
movzbl 0x3(%rcx,%rdx), %ecx
movl %ecx, %edx
leaq 0xe5ea(%rip), %rcx      # 0x43a60
orl (%rcx,%rdx,4), %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %eax
sarl $0x10, %eax
movb %al, %dl
movq -0x68(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x40(%rbp)
movb %dl, (%rax,%rcx)
movl -0x74(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %dl
movq -0x68(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x40(%rbp)
movb %dl, (%rax,%rcx)
movl -0x74(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
movq -0x68(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x40(%rbp)
movb %dl, (%rax,%rcx)
movq -0x70(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x70(%rbp)
jmp 0x353fb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x5a(%rbp), %rdi
callq 0x55e0
jmp 0x355fd
movq -0x88(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
callq 0x5aa8
jmp 0x355fd
cmpq $0x0, -0x48(%rbp)
je 0x355d8
movq -0x38(%rbp), %rax
movq -0x58(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
leaq 0xe51b(%rip), %rax      # 0x43a60
movl (%rax,%rcx,4), %eax
shll $0x12, %eax
movq -0x38(%rbp), %rcx
movq -0x58(%rbp), %rdx
movzbl 0x1(%rcx,%rdx), %ecx
movl %ecx, %edx
leaq 0xe4ff(%rip), %rcx      # 0x43a60
movl (%rcx,%rdx,4), %ecx
shll $0xc, %ecx
orl %ecx, %eax
movl %eax, -0x78(%rbp)
movl -0x78(%rbp), %eax
sarl $0x10, %eax
movb %al, %dl
movq -0x68(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x40(%rbp)
movb %dl, (%rax,%rcx)
cmpq $0x0, -0x50(%rbp)
je 0x355d6
movq -0x38(%rbp), %rax
movq -0x58(%rbp), %rcx
movzbl 0x2(%rax,%rcx), %eax
movl %eax, %ecx
leaq 0xe4b9(%rip), %rax      # 0x43a60
movl (%rax,%rcx,4), %eax
shll $0x6, %eax
orl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0x78(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %dl
movq -0x68(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x40(%rbp)
movb %dl, (%rax,%rcx)
jmp 0x355d8
movb $0x1, -0x59(%rbp)
testb $0x1, -0x59(%rbp)
jne 0x355ee
movq -0x88(%rbp), %rdi
callq 0x5aa8
jmp 0x355f0
movq -0x80(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x5950
nopw %cs:(%rax,%rax)