// File: /workspace/github_c_makefile_star2_O0/otrtool[P]otrtool/src/main.c
// Function: base64Encode
char * base64Encode(void *data_, int len) {
  unsigned char *data = data_;
  static const char *b64 = "\
ABCDEFGHIJKLMNOPQRSTUVWXYZ\
abcdefghijklmnopqrstuvwxyz\
0123456789+/";
  int blocks = (len + 2) / 3;
  int newlen = blocks * 4 + 1;
  char *result = malloc(newlen);
  char *resptr = result;
  int i;
  
  for (i = len / 3 ; i > 0 ; i--) {
    resptr[0] = b64[  data[0]             >> 2 ];
    resptr[1] = b64[ (data[0] &     B_11) << 4
                    | data[1]             >> 4 ];
    resptr[2] = b64[ (data[1] &   B_1111) << 2
                    | data[2]             >> 6 ];
    resptr[3] = b64[  data[2] & B_111111       ];
    resptr += 4;
    data += 3;
  }
  
  if (len < blocks * 3 - 1) {
    resptr[0] = b64[  data[0]             >> 2 ];
    resptr[1] = b64[ (data[0] &     B_11) << 4 ];
    resptr[2] = '=';
    resptr[3] = '=';
    resptr += 4;
  } else if (len < blocks * 3) {
    resptr[0] = b64[  data[0]             >> 2 ];
    resptr[1] = b64[ (data[0] &     B_11) << 4
                    | data[1]             >> 4 ];
    resptr[2] = b64[ (data[1] &   B_1111) << 2 ];
    resptr[3] = '=';
    resptr += 4;
  }
  
  *resptr = 0;
  return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movl -0xc(%rbp), %eax
addl $0x2, %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
shll $0x2, %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movslq -0x20(%rbp), %rdi
callq 0x2300
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movl -0xc(%rbp), %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jle 0x46e0
movq 0x8c28(%rip), %rax      # 0xd250
movq -0x18(%rbp), %rcx
movzbl (%rcx), %ecx
sarl $0x2, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %cl
movq -0x30(%rbp), %rax
movb %cl, (%rax)
movq 0x8c0b(%rip), %rax      # 0xd250
movq -0x18(%rbp), %rcx
movzbl (%rcx), %ecx
andl $0x3, %ecx
shll $0x4, %ecx
movq -0x18(%rbp), %rdx
movzbl 0x1(%rdx), %edx
sarl $0x4, %edx
orl %edx, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %cl
movq -0x30(%rbp), %rax
movb %cl, 0x1(%rax)
movq 0x8bdd(%rip), %rax      # 0xd250
movq -0x18(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
andl $0xf, %ecx
shll $0x2, %ecx
movq -0x18(%rbp), %rdx
movzbl 0x2(%rdx), %edx
sarl $0x6, %edx
orl %edx, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %cl
movq -0x30(%rbp), %rax
movb %cl, 0x2(%rax)
movq 0x8bae(%rip), %rax      # 0xd250
movq -0x18(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
andl $0x3f, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %cl
movq -0x30(%rbp), %rax
movb %cl, 0x3(%rax)
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x18(%rbp)
movl -0x34(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x4617
movl -0xc(%rbp), %eax
imull $0x3, -0x1c(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x474d
movq 0x8b5b(%rip), %rax      # 0xd250
movq -0x18(%rbp), %rcx
movzbl (%rcx), %ecx
sarl $0x2, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %cl
movq -0x30(%rbp), %rax
movb %cl, (%rax)
movq 0x8b3e(%rip), %rax      # 0xd250
movq -0x18(%rbp), %rcx
movzbl (%rcx), %ecx
andl $0x3, %ecx
shll $0x4, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %cl
movq -0x30(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x30(%rbp), %rax
movb $0x3d, 0x2(%rax)
movq -0x30(%rbp), %rax
movb $0x3d, 0x3(%rax)
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
jmp 0x47df
movl -0xc(%rbp), %eax
imull $0x3, -0x1c(%rbp), %ecx
cmpl %ecx, %eax
jge 0x47dd
movq 0x8aed(%rip), %rax      # 0xd250
movq -0x18(%rbp), %rcx
movzbl (%rcx), %ecx
sarl $0x2, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %cl
movq -0x30(%rbp), %rax
movb %cl, (%rax)
movq 0x8ad0(%rip), %rax      # 0xd250
movq -0x18(%rbp), %rcx
movzbl (%rcx), %ecx
andl $0x3, %ecx
shll $0x4, %ecx
movq -0x18(%rbp), %rdx
movzbl 0x1(%rdx), %edx
sarl $0x4, %edx
orl %edx, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %cl
movq -0x30(%rbp), %rax
movb %cl, 0x1(%rax)
movq 0x8aa2(%rip), %rax      # 0xd250
movq -0x18(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
andl $0xf, %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %cl
movq -0x30(%rbp), %rax
movb %cl, 0x2(%rax)
movq -0x30(%rbp), %rax
movb $0x3d, 0x3(%rax)
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
jmp 0x47df
movq -0x30(%rbp), %rax
movb $0x0, (%rax)
movq -0x28(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq