// File: /workspace/github_c_makefile_star2_O0/liuhaotian[P]xmppsh/libstrophe/src/sasl.c
// Function: base64_decode
unsigned char *base64_decode(xmpp_ctx_t *ctx,
			     const char * const buffer, const unsigned len)
{
    int dlen;
    unsigned char *dbuf, *d;
    uint32_t word, hextet;
    int i;

    /* len must be a multiple of 4 */
    if (len & 0x03) return NULL;

    dlen = base64_decoded_len(ctx, buffer, len);
    dbuf = xmpp_alloc(ctx, dlen + 1);
    if (dbuf != NULL) {
	d = dbuf;
	/* loop over each set of 4 characters, decoding 3 bytes */
	for (i = 0; i < len - 3; i += 4) {
	    hextet = _base64_invcharmap[(int)buffer[i]];
	    if (hextet & 0xC0) break;
	    word = hextet << 18;
	    hextet = _base64_invcharmap[(int)buffer[i+1]];
	    if (hextet & 0xC0) break;
	    word |= hextet << 12;
	    hextet = _base64_invcharmap[(int)buffer[i+2]];
	    if (hextet & 0xC0) break;
	    word |= hextet << 6;
	    hextet = _base64_invcharmap[(int)buffer[i+3]];
	    if (hextet & 0xC0) break;
	    word |= hextet;
	    *d++ = (word & 0x00FF0000) >> 16;
	    *d++ = (word & 0x0000FF00) >> 8;
	    *d++ = (word & 0x000000FF);
	}
	if (hextet > 64) goto _base64_decode_error;
	/* handle the remainder */
	switch (dlen % 3) {
	    case 0:
		/* nothing to do */
		break;
	    case 1:
		/* redo the last quartet, checking for correctness */
		hextet = _base64_invcharmap[(int)buffer[len-4]];
		if (hextet & 0xC0) goto _base64_decode_error;
		word = hextet << 2;
		hextet = _base64_invcharmap[(int)buffer[len-3]];
		if (hextet & 0xC0) goto _base64_decode_error;
		word |= hextet >> 4;
		*d++ = word & 0xFF;
		hextet = _base64_invcharmap[(int)buffer[len-2]];
		if (hextet != 64) goto _base64_decode_error;
		hextet = _base64_invcharmap[(int)buffer[len-1]];
		if (hextet != 64) goto _base64_decode_error;
		break;
	    case 2:
		/* redo the last quartet, checking for correctness */
		hextet = _base64_invcharmap[(int)buffer[len-4]];
		if (hextet & 0xC0) goto _base64_decode_error;
		word = hextet << 10;		
		hextet = _base64_invcharmap[(int)buffer[len-3]];
		if (hextet & 0xC0) goto _base64_decode_error;
		word |= hextet << 4;		
		hextet = _base64_invcharmap[(int)buffer[len-2]];
		if (hextet & 0xC0) goto _base64_decode_error;
		word |= hextet >> 2;
		*d++ = (word & 0xFF00) >> 8;
		*d++ = (word & 0x00FF);		
		hextet = _base64_invcharmap[(int)buffer[len-1]];
		if (hextet != 64) goto _base64_decode_error;
		break;
	}
    }
    *d = '\0';
    return dbuf;

_base64_decode_error:	
    /* invalid character; abort decoding! */
    xmpp_free(ctx, dbuf);
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0xbd8b
movq $0x0, -0x8(%rbp)
jmp 0xc1c2
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0xbc80
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x6680
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0xc19c
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl -0x1c(%rbp), %ecx
subl $0x3, %ecx
cmpl %ecx, %eax
jae 0xbf36
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movslq %eax, %rcx
leaq 0x90db(%rip), %rax      # 0x14ed0
movsbl (%rax,%rcx), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
andl $0xc0, %eax
cmpl $0x0, %eax
je 0xbe0e
jmp 0xbf36
movl -0x38(%rbp), %eax
shll $0x12, %eax
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rax
movl -0x3c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
movslq %eax, %rcx
leaq 0x909e(%rip), %rax      # 0x14ed0
movsbl (%rax,%rcx), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
andl $0xc0, %eax
cmpl $0x0, %eax
je 0xbe4b
jmp 0xbf36
movl -0x38(%rbp), %eax
shll $0xc, %eax
orl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rax
movl -0x3c(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
movslq %eax, %rcx
leaq 0x905e(%rip), %rax      # 0x14ed0
movsbl (%rax,%rcx), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
andl $0xc0, %eax
cmpl $0x0, %eax
je 0xbe8b
jmp 0xbf36
movl -0x38(%rbp), %eax
shll $0x6, %eax
orl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rax
movl -0x3c(%rbp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
movslq %eax, %rcx
leaq 0x901e(%rip), %rax      # 0x14ed0
movsbl (%rax,%rcx), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
andl $0xc0, %eax
cmpl $0x0, %eax
je 0xbec8
jmp 0xbf36
movl -0x38(%rbp), %eax
orl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
andl $0xff0000, %eax         # imm = 0xFF0000
shrl $0x10, %eax
movb %al, %cl
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb %cl, (%rax)
movl -0x34(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
shrl $0x8, %eax
movb %al, %cl
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb %cl, (%rax)
movl -0x34(%rbp), %eax
andl $0xff, %eax
movb %al, %cl
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb %cl, (%rax)
movl -0x3c(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x3c(%rbp)
jmp 0xbdce
cmpl $0x40, -0x38(%rbp)
jbe 0xbf41
jmp 0xc1ad
movslq -0x20(%rbp), %rcx
movl %ecx, %eax
imulq $0x55555556, %rcx, %rdx # imm = 0x55555556
movq %rdx, %rcx
shrq $0x3f, %rcx
shrq $0x20, %rdx
addl %ecx, %edx
movl %edx, %ecx
leal (%rcx,%rcx,2), %ecx
subl %ecx, %eax
movl %eax, -0x40(%rbp)
je 0xbf84
jmp 0xbf69
movl -0x40(%rbp), %eax
subl $0x1, %eax
je 0xbf89
jmp 0xbf73
movl -0x40(%rbp), %eax
subl $0x2, %eax
je 0xc07c
jmp 0xc19a
jmp 0xc19a
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x4, %ecx
movl %ecx, %ecx
movsbl (%rax,%rcx), %eax
movslq %eax, %rcx
leaq 0x8f2d(%rip), %rax      # 0x14ed0
movsbl (%rax,%rcx), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
andl $0xc0, %eax
cmpl $0x0, %eax
je 0xbfbc
jmp 0xc1ad
movl -0x38(%rbp), %eax
shll $0x2, %eax
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x3, %ecx
movl %ecx, %ecx
movsbl (%rax,%rcx), %eax
movslq %eax, %rcx
leaq 0x8ef1(%rip), %rax      # 0x14ed0
movsbl (%rax,%rcx), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
andl $0xc0, %eax
cmpl $0x0, %eax
je 0xbff8
jmp 0xc1ad
movl -0x38(%rbp), %eax
shrl $0x4, %eax
orl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
andl $0xff, %eax
movb %al, %cl
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb %cl, (%rax)
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x2, %ecx
movl %ecx, %ecx
movsbl (%rax,%rcx), %eax
movslq %eax, %rcx
leaq 0x8e97(%rip), %rax      # 0x14ed0
movsbl (%rax,%rcx), %eax
movl %eax, -0x38(%rbp)
cmpl $0x40, -0x38(%rbp)
je 0xc04b
jmp 0xc1ad
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movsbl (%rax,%rcx), %eax
movslq %eax, %rcx
leaq 0x8e6b(%rip), %rax      # 0x14ed0
movsbl (%rax,%rcx), %eax
movl %eax, -0x38(%rbp)
cmpl $0x40, -0x38(%rbp)
je 0xc077
jmp 0xc1ad
jmp 0xc19a
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x4, %ecx
movl %ecx, %ecx
movsbl (%rax,%rcx), %eax
movslq %eax, %rcx
leaq 0x8e3a(%rip), %rax      # 0x14ed0
movsbl (%rax,%rcx), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
andl $0xc0, %eax
cmpl $0x0, %eax
je 0xc0af
jmp 0xc1ad
movl -0x38(%rbp), %eax
shll $0xa, %eax
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x3, %ecx
movl %ecx, %ecx
movsbl (%rax,%rcx), %eax
movslq %eax, %rcx
leaq 0x8dfe(%rip), %rax      # 0x14ed0
movsbl (%rax,%rcx), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
andl $0xc0, %eax
cmpl $0x0, %eax
je 0xc0eb
jmp 0xc1ad
movl -0x38(%rbp), %eax
shll $0x4, %eax
orl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x2, %ecx
movl %ecx, %ecx
movsbl (%rax,%rcx), %eax
movslq %eax, %rcx
leaq 0x8dbf(%rip), %rax      # 0x14ed0
movsbl (%rax,%rcx), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
andl $0xc0, %eax
cmpl $0x0, %eax
je 0xc12a
jmp 0xc1ad
movl -0x38(%rbp), %eax
shrl $0x2, %eax
orl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
shrl $0x8, %eax
movb %al, %cl
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb %cl, (%rax)
movl -0x34(%rbp), %eax
andl $0xff, %eax
movb %al, %cl
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb %cl, (%rax)
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movsbl (%rax,%rcx), %eax
movslq %eax, %rcx
leaq 0x8d47(%rip), %rax      # 0x14ed0
movsbl (%rax,%rcx), %eax
movl %eax, -0x38(%rbp)
cmpl $0x40, -0x38(%rbp)
je 0xc198
jmp 0xc1ad
jmp 0xc19a
jmp 0xc19c
movq -0x30(%rbp), %rax
movb $0x0, (%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xc1c2
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x66c0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)