// File: /workspace/github_c_makefile_star2_O0/inflex[P]ripMIME/libmime-decoders.c
// Function: MDECODE_decode_short64
int MDECODE_decode_short64( char *short64 )
{
    int i;
    int realm_size = strlen( short64 );
    int stopcount = 0; /* How many stop (=) characters we've read in */
    int c; /* a single char as retrieved using MDECODE_get_char() */
    int char_count = 0; /* How many chars have been received */
    char output[3]; /* The 4->3 byte output array */
    char input[4]; /* The 4->3 byte input array */
    char *outstring = short64;

    char_count = 0;
    while (char_count < realm_size)
    {
        /* Initialise the decode buffer */
        input[0] = input[1] = input[2] = input[3] = 0;

        /* snatch 4 characters from the input */
        for (i = 0; i < 4; i++) {
            /* get a char from the filestream */
            c = *short64;
            short64++;
            /* assuming we've gotten this far, then we increment the char_count */
            char_count++;
            /* if we detect the "stopchar" then we better increment the STOP counter */
            if (c == '=') {
                stopcount++;
            }
            /* test for and discard invalid chars */
            if (b64[c] == 0x80) {
                i--;
                continue;
            }
            /* do the conversion from encoded -> decoded */
            input[i] = (char)b64[c];

        } /* for */

        /* now that our 4-char buffer is full, we can do some fancy bit-shifting and get the required 3-chars of 8-bit data */
        output[0] = (input[0] << 2) | (input[1] >> 4);
        output[1] = (input[1] << 4) | (input[2] >> 2);
        output[2] = (input[2] << 6) | input[3];

        /* determine how many chars to write write and check for errors if our input char count was 4 then we did receive a propper 4:3 Base64 block, hence write it */
        if (i == 4) {
            for (i = 0; i < (3 -stopcount); i++){
                *outstring = output[i];
                outstring++;
            } /* copy our data across */
        } /* if 4 chars were inputted */
    } /* while more chars to proccess */

    *outstring = '\0';  // Set the last char to NULL
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2100
movl %eax, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x11c6c
movb $0x0, -0x20(%rbp)
movb $0x0, -0x21(%rbp)
movb $0x0, -0x22(%rbp)
movb $0x0, -0x23(%rbp)
movl $0x0, -0xc(%rbp)
cmpl $0x4, -0xc(%rbp)
jge 0x11bee
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x3d, -0x18(%rbp)
jne 0x11bac
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movslq -0x18(%rbp), %rcx
leaq 0x153f9(%rip), %rax     # 0x26fb0
movzbl (%rax,%rcx), %eax
cmpl $0x80, %eax
jne 0x11bcd
movl -0xc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x11be3
movslq -0x18(%rbp), %rcx
leaq 0x153d8(%rip), %rax     # 0x26fb0
movb (%rax,%rcx), %cl
movslq -0xc(%rbp), %rax
movb %cl, -0x23(%rbp,%rax)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x11b78
movsbl -0x23(%rbp), %eax
shll $0x2, %eax
movsbl -0x22(%rbp), %ecx
sarl $0x4, %ecx
orl %ecx, %eax
movb %al, -0x1f(%rbp)
movsbl -0x22(%rbp), %eax
shll $0x4, %eax
movsbl -0x21(%rbp), %ecx
sarl $0x2, %ecx
orl %ecx, %eax
movb %al, -0x1e(%rbp)
movsbl -0x21(%rbp), %eax
shll $0x6, %eax
movsbl -0x20(%rbp), %ecx
orl %ecx, %eax
movb %al, -0x1d(%rbp)
cmpl $0x4, -0xc(%rbp)
jne 0x11c67
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movl $0x3, %ecx
subl -0x14(%rbp), %ecx
cmpl %ecx, %eax
jge 0x11c65
movslq -0xc(%rbp), %rax
movb -0x1f(%rbp,%rax), %cl
movq -0x30(%rbp), %rax
movb %cl, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x11c31
jmp 0x11c67
jmp 0x11b55
movq -0x30(%rbp), %rax
movb $0x0, (%rax)
xorl %eax, %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)