// File: /workspace/github_c_makefile_star2_O0/hkshenSmart[P]ONVIF-discovery_cs/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 0x352c2
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 0x19790
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x352d6
movq $0x0, -0x8(%rbp)
jmp 0x3548f
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
cmpq $0x0, -0x18(%rbp)
jne 0x352f9
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3548f
jmp 0x352fb
cmpl $0x2, -0x24(%rbp)
jle 0x353a4
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 0x3537e
movq -0x30(%rbp), %rcx
andq $0x3f, %rcx
leaq 0x3f86(%rip), %rax      # 0x392e0
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 0x35345
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 0x352fb
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
cmpl $0x0, -0x24(%rbp)
jle 0x35487
movq $0x0, -0x30(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x353f8
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 0x353c4
jmp 0x353fa
cmpl $0x3, -0x28(%rbp)
jge 0x35417
movq -0x30(%rbp), %rax
shlq $0x8, %rax
movq %rax, -0x30(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x353fa
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jle 0x35459
movq -0x30(%rbp), %rcx
andq $0x3f, %rcx
leaq 0x3eab(%rip), %rax      # 0x392e0
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 0x35420
movl $0x3, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jle 0x3547f
movq -0x20(%rbp), %rax
movslq -0x28(%rbp), %rcx
movb $0x3d, (%rax,%rcx)
movl -0x28(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x35460
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)