// File: /workspace/github_c_makefile_star2_O0/NedFreed[P]msglint/msglint.c
// Function: decode64
int decode64(base64ctx *bctx, const char *in, int inlen,
	     char *out, int outmax)
{
    int infill, outfill, j;
    unsigned in0, in1, in2, in3;
    unsigned char *iptr, *end;
    unsigned char inbuf[4], outbuf[3];

    /* set up results */
    bctx->outlen = 0;
    bctx->badc = 0;
    
    /* check for invalid params, insufficient data */
    if (bctx->tmplen > 3) return (-3);
    if (inlen == 0 && (bctx->tmplen == 2 || bctx->tmplen == 3)) {
	while (bctx->tmplen < 4) {
	    bctx->tmpbuf[bctx->tmplen] = '=';
	    ++bctx->tmplen;
	}
    } else if (inlen + bctx->tmplen < 4) {
	memcpy(bctx->tmpbuf + bctx->tmplen, in, inlen);
	iptr = (unsigned char *) bctx->tmpbuf;
	end = iptr + bctx->tmplen + inlen;
	while (iptr < end) {
	    if (*iptr != '=' && CHAR64(*iptr) == XX) {
		bctx->badc = *iptr;
		return (-1);
	    }
	    ++iptr;
	}
	bctx->tmplen += inlen;
	return (1);
    }

    /* fill up initial input data buffer */
    infill = 4;
    if (bctx->tmplen > 0) {
	infill -= bctx->tmplen;
	memcpy(inbuf, bctx->tmpbuf, bctx->tmplen);
	bctx->tmplen = 0;
    }
    memcpy(inbuf + (4 - infill), in, infill);
    in += infill;
    inlen -= infill;

    for (;;) {
	/* check for end */
	if (bctx->sawend) return (-4);

	/* do decode/validation */
	if ((in0 = CHAR64(inbuf[0])) == XX) {
	    bctx->badc = inbuf[0];
	    return (-1);
	}
	if ((in1 = CHAR64(inbuf[1])) == XX) {
	    bctx->badc = inbuf[1];
	    bctx->tmpbuf[0] = inbuf[0];
	    bctx->tmplen = 1;
	    return (-1);
	}
	outbuf[0] = (in0 << 2) + (in1 >> 4);
	outfill = 3;
	if (inbuf[2] == '=' && inbuf[3] == '=') {
	    outbuf[1] = outbuf[2] = 0;
	    outfill = 1;
	    bctx->sawend = 1;
	} else if ((in2 = CHAR64(inbuf[2])) == XX) {
	    bctx->badc = inbuf[2];
	    bctx->tmpbuf[0] = inbuf[0];
	    bctx->tmpbuf[1] = inbuf[1];
	    bctx->tmplen = 2;
	    return (-1);
	} else {
	    outbuf[1] = (in1 << 4) | (in2 >> 2);
	    if (inbuf[3] == '=') {
		outbuf[2] = 0;
		outfill = 2;
		bctx->sawend = 1;
	    } else if ((in3 = CHAR64(inbuf[3])) == XX) {
		bctx->badc = inbuf[3];
		bctx->tmpbuf[0] = inbuf[0];
		bctx->tmpbuf[1] = inbuf[1];
		bctx->tmpbuf[2] = inbuf[2];
		bctx->tmplen = 3;
		return (-1);
	    } else {
		outbuf[2] = (in2 << 6) | in3;
	    }
	}

	/* process output buffer */
	if (out != NULL) {
	    if (outmax < outfill) return (-2);
	    memcpy(out, outbuf, outfill);
	    out += outfill;
	    outmax -= outfill;
	}
	bctx->outlen += outfill;

	/* fill input buffer */
	if (inlen < 4) break;
	memcpy(inbuf, in, 4);
	in += 4;
	inlen -= 4;
    }

    /* save remaining input buffer */
    if (inlen > 0) {
	memcpy(bctx->tmpbuf, in, inlen);
	bctx->tmplen = inlen;

	return (1);
    }

    return (0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x10(%rbp), %rax
movb $0x0, 0x10(%rax)
movq -0x10(%rbp), %rax
cmpl $0x3, 0x8(%rax)
jle 0x2324
movl $0xfffffffd, -0x4(%rbp) # imm = 0xFFFFFFFD
jmp 0x2725
cmpl $0x0, -0x1c(%rbp)
jne 0x236f
movq -0x10(%rbp), %rax
cmpl $0x2, 0x8(%rax)
je 0x233e
movq -0x10(%rbp), %rax
cmpl $0x3, 0x8(%rax)
jne 0x236f
jmp 0x2340
movq -0x10(%rbp), %rax
cmpl $0x4, 0x8(%rax)
jge 0x236a
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq 0x8(%rcx), %rcx
movb $0x3d, 0xc(%rax,%rcx)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
jmp 0x2340
jmp 0x2439
movl -0x1c(%rbp), %eax
movq -0x10(%rbp), %rcx
addl 0x8(%rcx), %eax
cmpl $0x4, %eax
jge 0x2437
movq -0x10(%rbp), %rdi
addq $0xc, %rdi
movq -0x10(%rbp), %rax
movslq 0x8(%rax), %rax
addq %rax, %rdi
movq -0x18(%rbp), %rsi
movslq -0x1c(%rbp), %rdx
callq 0x2110
movq -0x10(%rbp), %rax
addq $0xc, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq 0x8(%rcx), %rcx
addq %rcx, %rax
movslq -0x1c(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0x241e
movq -0x50(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x3d, %eax
je 0x2410
movq -0x50(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0xce22(%rip), %rax      # 0xf210
movsbl (%rax,%rcx), %eax
cmpl $0x7f, %eax
jne 0x2410
movq -0x50(%rbp), %rax
movb (%rax), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x10(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2725
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x23c8
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
addl 0x8(%rax), %ecx
movl %ecx, 0x8(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x2725
jmp 0x2439
movl $0x4, -0x30(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jle 0x247d
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
movl -0x30(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x30(%rbp)
leaq -0x5c(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0xc, %rsi
movq -0x10(%rbp), %rax
movslq 0x8(%rax), %rdx
callq 0x2110
movq -0x10(%rbp), %rax
movl $0x0, 0x8(%rax)
leaq -0x5c(%rbp), %rdi
movl $0x4, %eax
subl -0x30(%rbp), %eax
cltq
addq %rax, %rdi
movq -0x18(%rbp), %rsi
movslq -0x30(%rbp), %rdx
callq 0x2110
movl -0x30(%rbp), %ecx
movq -0x18(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movl -0x30(%rbp), %ecx
movl -0x1c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x24cc
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0x2725
movzbl -0x5c(%rbp), %eax
movl %eax, %ecx
leaq 0xcd37(%rip), %rax      # 0xf210
movsbl (%rax,%rcx), %eax
movl %eax, -0x3c(%rbp)
cmpl $0x7f, %eax
jne 0x24fb
movb -0x5c(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x10(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2725
movzbl -0x5b(%rbp), %eax
movl %eax, %ecx
leaq 0xcd08(%rip), %rax      # 0xf210
movsbl (%rax,%rcx), %eax
movl %eax, -0x40(%rbp)
cmpl $0x7f, %eax
jne 0x253f
movb -0x5b(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x10(%rax)
movb -0x5c(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0xc(%rax)
movq -0x10(%rbp), %rax
movl $0x1, 0x8(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2725
movl -0x3c(%rbp), %eax
shll $0x2, %eax
movl -0x40(%rbp), %ecx
shrl $0x4, %ecx
addl %ecx, %eax
movb %al, -0x5f(%rbp)
movl $0x3, -0x34(%rbp)
movzbl -0x5a(%rbp), %eax
cmpl $0x3d, %eax
jne 0x2587
movzbl -0x59(%rbp), %eax
cmpl $0x3d, %eax
jne 0x2587
movb $0x0, -0x5d(%rbp)
movb $0x0, -0x5e(%rbp)
movl $0x1, -0x34(%rbp)
movq -0x10(%rbp), %rax
movl $0x1, (%rax)
jmp 0x2670
movzbl -0x5a(%rbp), %eax
movl %eax, %ecx
leaq 0xcc7c(%rip), %rax      # 0xf210
movsbl (%rax,%rcx), %eax
movl %eax, -0x44(%rbp)
cmpl $0x7f, %eax
jne 0x25d5
movb -0x5a(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x10(%rax)
movb -0x5c(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0xc(%rax)
movb -0x5b(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0xd(%rax)
movq -0x10(%rbp), %rax
movl $0x2, 0x8(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2725
movl -0x40(%rbp), %eax
shll $0x4, %eax
movl -0x44(%rbp), %ecx
shrl $0x2, %ecx
orl %ecx, %eax
movb %al, -0x5e(%rbp)
movzbl -0x59(%rbp), %eax
cmpl $0x3d, %eax
jne 0x2606
movb $0x0, -0x5d(%rbp)
movl $0x2, -0x34(%rbp)
movq -0x10(%rbp), %rax
movl $0x1, (%rax)
jmp 0x266c
movzbl -0x59(%rbp), %eax
movl %eax, %ecx
leaq 0xcbfd(%rip), %rax      # 0xf210
movsbl (%rax,%rcx), %eax
movl %eax, -0x48(%rbp)
cmpl $0x7f, %eax
jne 0x265e
movb -0x59(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x10(%rax)
movb -0x5c(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0xc(%rax)
movb -0x5b(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0xd(%rax)
movb -0x5a(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0xe(%rax)
movq -0x10(%rbp), %rax
movl $0x3, 0x8(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2725
movl -0x44(%rbp), %eax
shll $0x6, %eax
orl -0x48(%rbp), %eax
movb %al, -0x5d(%rbp)
jmp 0x266c
jmp 0x266e
jmp 0x2670
cmpq $0x0, -0x28(%rbp)
je 0x26b8
movl -0x2c(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x268b
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x2725
movq -0x28(%rbp), %rdi
leaq -0x5f(%rbp), %rsi
movslq -0x34(%rbp), %rdx
callq 0x2110
movl -0x34(%rbp), %ecx
movq -0x28(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movl -0x34(%rbp), %ecx
movl -0x2c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x2c(%rbp)
movl -0x34(%rbp), %ecx
movq -0x10(%rbp), %rax
addl 0x4(%rax), %ecx
movl %ecx, 0x4(%rax)
cmpl $0x4, -0x1c(%rbp)
jge 0x26cd
jmp 0x26f0
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x5c(%rbp)
movq -0x18(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x18(%rbp)
movl -0x1c(%rbp), %eax
subl $0x4, %eax
movl %eax, -0x1c(%rbp)
jmp 0x24b7
cmpl $0x0, -0x1c(%rbp)
jle 0x271e
movq -0x10(%rbp), %rdi
addq $0xc, %rdi
movq -0x18(%rbp), %rsi
movslq -0x1c(%rbp), %rdx
callq 0x2110
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x2725
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nop