// File: /workspace/github_c_makefile_star2_O0/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_s2base64
SOAP_FMAC1
char*
SOAP_FMAC2
soap_s2base64(struct soap *soap, const unsigned char *s, char *t, int n)
{ register int i;
  register unsigned long m;
  register char *p;
  if (!t)
    t = (char*)soap_malloc(soap, (n + 2) / 3 * 4 + 1);
  if (!t)
    return NULL;
  p = t;
  t[0] = '\0';
  if (!s)
    return p;
  for (; n > 2; n -= 3, s += 3)
  { m = s[0];
    m = (m << 8) | s[1];
    m = (m << 8) | s[2];
    for (i = 4; i > 0; m >>= 6)
      t[--i] = soap_base64o[m & 0x3F];
    t += 4;
  }
  t[0] = '\0';
  if (n > 0)
  { m = 0;
    for (i = 0; i < n; i++)
      m = (m << 8) | *s++;
    for (; i < 3; i++)
      m <<= 8;
    for (i++; i > 0; m >>= 6)
      t[--i] = soap_base64o[m & 0x3F];
    for (i = 3; i > n; i--)
      t[i] = '=';
    t[4] = '\0';
  }
  return p;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x6bf22
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %eax
addl $0x2, %eax
movl $0x3, %ecx
cltd
idivl %ecx
shll $0x2, %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x518f0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x6bf36
movq $0x0, -0x8(%rbp)
jmp 0x6c0ef
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
cmpq $0x0, -0x18(%rbp)
jne 0x6bf59
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6c0ef
jmp 0x6bf5b
cmpl $0x2, -0x24(%rbp)
jle 0x6c004
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
shlq $0x8, %rax
movq -0x18(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
orq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
shlq $0x8, %rax
movq -0x18(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
orq %rcx, %rax
movq %rax, -0x30(%rbp)
movl $0x4, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jle 0x6bfde
movq -0x30(%rbp), %rcx
andq $0x3f, %rcx
leaq 0xe426(%rip), %rax      # 0x7a3e0
movb (%rax,%rcx), %dl
movq -0x20(%rbp), %rax
movl -0x28(%rbp), %ecx
addl $-0x1, %ecx
movl %ecx, -0x28(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x30(%rbp), %rax
shrq $0x6, %rax
movq %rax, -0x30(%rbp)
jmp 0x6bfa5
movq -0x20(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x20(%rbp)
movl -0x24(%rbp), %eax
subl $0x3, %eax
movl %eax, -0x24(%rbp)
movq -0x18(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x18(%rbp)
jmp 0x6bf5b
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
cmpl $0x0, -0x24(%rbp)
jle 0x6c0e7
movq $0x0, -0x30(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x6c058
movq -0x30(%rbp), %rax
shlq $0x8, %rax
movq -0x18(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x18(%rbp)
movzbl (%rcx), %ecx
orq %rcx, %rax
movq %rax, -0x30(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x6c024
jmp 0x6c05a
cmpl $0x3, -0x28(%rbp)
jge 0x6c077
movq -0x30(%rbp), %rax
shlq $0x8, %rax
movq %rax, -0x30(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x6c05a
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jle 0x6c0b9
movq -0x30(%rbp), %rcx
andq $0x3f, %rcx
leaq 0xe34b(%rip), %rax      # 0x7a3e0
movb (%rax,%rcx), %dl
movq -0x20(%rbp), %rax
movl -0x28(%rbp), %ecx
addl $-0x1, %ecx
movl %ecx, -0x28(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x30(%rbp), %rax
shrq $0x6, %rax
movq %rax, -0x30(%rbp)
jmp 0x6c080
movl $0x3, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jle 0x6c0df
movq -0x20(%rbp), %rax
movslq -0x28(%rbp), %rcx
movb $0x3d, (%rax,%rcx)
movl -0x28(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x6c0c0
movq -0x20(%rbp), %rax
movb $0x0, 0x4(%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)