// File: /workspace/github_c_makefile_star2_O0/otrtool[P]otrtool/src/main.c
// Function: base64Decode
void * base64Decode(char *text, int *outlen) {
  static const unsigned char b64dec[] = {
   0,  0,  0,  0,  0,  0,  0,  0,   0,  0,  0,  0,  0,  0,  0,  0, //00
   0,  0,  0,  0,  0,  0,  0,  0,   0,  0,  0,  0,  0,  0,  0,  0, //10
   0,  0,  0,  0,  0,  0,  0,  0,   0,  0,  0, 62,  0,  0,  0, 63, //20
  52, 53, 54, 55, 56, 57, 58, 59,  60, 61,  0,  0,  0,  0,  0,  0, //30
   0,  0,  1,  2,  3,  4,  5,  6,   7,  8,  9, 10, 11, 12, 13, 14, //40
  15, 16, 17, 18, 19, 20, 21, 22,  23, 24, 25,  0,  0,  0,  0,  0, //50
   0, 26, 27, 28, 29, 30, 31, 32,  33, 34, 35, 36, 37, 38, 39, 40, //60
  41, 42, 43, 44, 45, 46, 47, 48,  49, 50, 51,  0,  0,  0,  0,  0, //70
   0,  0,  0,  0,  0,  0,  0,  0,   0,  0,  0,  0,  0,  0,  0,  0, //80
   0,  0,  0,  0,  0,  0,  0,  0,   0,  0,  0,  0,  0,  0,  0,  0, //90
   0,  0,  0,  0,  0,  0,  0,  0,   0,  0,  0,  0,  0,  0,  0,  0, //a0
   0,  0,  0,  0,  0,  0,  0,  0,   0,  0,  0,  0,  0,  0,  0,  0, //b0
   0,  0,  0,  0,  0,  0,  0,  0,   0,  0,  0,  0,  0,  0,  0,  0, //c0
   0,  0,  0,  0,  0,  0,  0,  0,   0,  0,  0,  0,  0,  0,  0,  0, //d0
   0,  0,  0,  0,  0,  0,  0,  0,   0,  0,  0,  0,  0,  0,  0,  0, //e0
   0,  0,  0,  0,  0,  0,  0,  0,   0,  0,  0,  0,  0,  0,  0,  0  //f0
  };
  // this functions treats invalid characters as 'A'. deal with it :-P
  int inlen = (strlen(text) >> 2) << 2;
  int blocks = inlen >> 2;
  *outlen = blocks * 3 - (text[inlen-2] == '='
      ? 2 : (text[inlen-1] == '=' ? 1 : 0));
  char *result = malloc(blocks * 3);
  char *resptr = result;
  uint8_t *text_ = (uint8_t*)text;
  int i;
  
  for (i = 0 ; i < blocks ; i++) {
    resptr[0] = b64dec[text_[0]] << 2 | b64dec[text_[1]] >> 4;
    resptr[1] = b64dec[text_[1]] << 4 | b64dec[text_[2]] >> 2;
    resptr[2] = b64dec[text_[2]] << 6 | b64dec[text_[3]];
    
    text_ += 4;
    resptr += 3;
  }
  
  return (void*)result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x20c0
shrq $0x2, %rax
shlq $0x2, %rax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
sarl $0x2, %eax
movl %eax, -0x18(%rbp)
imull $0x3, -0x18(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movl -0x14(%rbp), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x3d, %eax
jne 0x4844
movl $0x2, %eax
movl %eax, -0x3c(%rbp)
jmp 0x4865
movq -0x8(%rbp), %rax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x3d, %edx
cmovel %ecx, %eax
movl %eax, -0x3c(%rbp)
movl -0x38(%rbp), %ecx
movl -0x3c(%rbp), %eax
subl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
imull $0x3, -0x18(%rbp), %eax
movslq %eax, %rdi
callq 0x2300
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x4978
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x589a(%rip), %rax      # 0xa150
movzbl (%rax,%rcx), %eax
shll $0x2, %eax
movq -0x30(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
movl %ecx, %edx
leaq 0x5882(%rip), %rcx      # 0xa150
movzbl (%rcx,%rdx), %ecx
sarl $0x4, %ecx
orl %ecx, %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, (%rax)
movq -0x30(%rbp), %rax
movzbl 0x1(%rax), %eax
movl %eax, %ecx
leaq 0x5860(%rip), %rax      # 0xa150
movzbl (%rax,%rcx), %eax
shll $0x4, %eax
movq -0x30(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
movl %ecx, %edx
leaq 0x5848(%rip), %rcx      # 0xa150
movzbl (%rcx,%rdx), %ecx
sarl $0x2, %ecx
orl %ecx, %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x30(%rbp), %rax
movzbl 0x2(%rax), %eax
movl %eax, %ecx
leaq 0x5825(%rip), %rax      # 0xa150
movzbl (%rax,%rcx), %eax
shll $0x6, %eax
movq -0x30(%rbp), %rcx
movzbl 0x3(%rcx), %ecx
movl %ecx, %edx
leaq 0x580d(%rip), %rcx      # 0xa150
movzbl (%rcx,%rdx), %ecx
orl %ecx, %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0x2(%rax)
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x28(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x489a
movq -0x20(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)