// File: /workspace/github_c_makefile_star2_O0/inflex[P]ripMIME/mime.c
// Function: MIME_decode_64
int MIME_decode_64( FFGET_FILE *f, char *unpackdir, struct MIMEH_header_info *hinfo )
{
    int i;
    int cr_total = 0;
    int cr_count = 0; /* the number of consecutive \n's we've read in, used to detect End of B64 enc */
    int ignore_crcount = 0; /* If we have a boundary in our emails, then ignore the CR counts */
    int stopcount = 0; /* How many stop (=) characters we've read in */
    int eom_reached = 0; /* flag to say that we've reached the End-Of-MIME encoding. */
    int status = 0; /* Overall status of decoding operation */
    int c; /* a single char as retrieved using MIME_get_char() */
    int char_count = 0; /* How many chars have been received */
    int boundary_crash = 0; /* if we crash into a boundary, set this */
    long int bytecount=0; /* The total file decoded size */
    char output[3]; /* The 4->3 byte output array */
    char input[4]; /* The 4->3 byte input array */
    char fullMIME_filename[_MIME_STRLEN_MAX]=""; /* Full Filename of output file */

    // Write Buffer routine

    unsigned char *writebuffer;
    unsigned char *wbpos;
    int wbcount = 0;
    int loop;

    int of; /* output file pointer */
    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_decode_64:DEBUG: attempting to decode '%s'", FL, hinfo->filename);

    /* generate the MIME_filename, and open it up... */
    if (glb.unique_names) MIME_test_uniquename( unpackdir, hinfo->filename, glb.rename_method );
    snprintf(fullMIME_filename,_MIME_STRLEN_MAX,"%s/%s",unpackdir,hinfo->filename);
    //of = fopen(fullMIME_filename,"wb");
    of = open(fullMIME_filename, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR);
    /* if we were unable to open the output file, then we better log an error and drop out */
    if (of < 0)
    {
        LOGGER_log("%s:%d:MIME_decode_64:ERROR: Cannot open output file %s for BASE64 decoding. (%s)",FL,fullMIME_filename, strerror(errno));
        //      exit(_EXITERR_BASE64_OUTPUT_NOT_OPEN);
        return -1;
    }

    // Allocate the write buffer.  By using the write buffer we gain an additional 10% in performance
    // due to the lack of function call (fwrite) overheads
    writebuffer = malloc( _MIME_WRITE_BUFFER_SIZE *sizeof(unsigned char));
    if (!writebuffer)
    {
        LOGGER_log("%s:%d:MIME_decode_64:ERROR: cannot allocate %dbytes of memory for the write buffer",FL, _MIME_WRITE_BUFFER_SIZE);
        return -1;
    }
    else {
        wbpos = writebuffer;
        wbcount = 0;
    }
    /* Set our ignore_crcount flag */
    if (BS_count() > 0)
    {
        //LOGGER_log("%s:%d:MIME_decode_64:DEBUG: Ignore CR set to 1",FL);
        ignore_crcount = 1;
    }
    /* collect prefixing trash (if any, such as spaces, CR's etc)*/
    //  c = MIME_getchar_start(f);
    /* and push the good char back */
    //  FFGET_ungetc(f,c);
    c = '\0';

    /* do an endless loop, as we're -breaking- out later */
    while (1)
    {
        int lastchar_was_linebreak=0;
        /* Initialise the decode buffer */
        input[0] = input[1] = input[2] = input[3] = 0; // was '0' - Stepan Kasal patch
        /* snatch 4 characters from the input */
        for (i = 0; i < 4; i++)
        {
            // Get Next char from the file input
            //
            // A lot of CPU is wasted here due to function call overheads, unfortunately
            // I cannot yet work out how to make this call (FFGET) operate effectively
            // without including a couple of dozen lines in this section.
            //
            // Times like this C++'s "inline" statement would be nice.
            //
            //----------INLINE Version of FFGET_getchar()
            //
            do {
                if ((c == '\n')||(c == '\r')) lastchar_was_linebreak = 1; else lastchar_was_linebreak = 0;
                if (f->ungetcset)
                {
                    f->ungetcset = 0;
                    c = f->c;
                }
                else
                {
                    if ((!f->startpoint)||(f->startpoint > f->endpoint))
                    {
                        FFGET_getnewblock(f);
                    }
                    if (f->startpoint <= f->endpoint)
                    {
                        c = *f->startpoint;
                        f->startpoint++;
                    }
                    else
                    {
                        c = EOF;
                    }
                }
            }
            while ( (c != EOF) && ( c < ' ' ) && ( c != '\n' ) && (c != '-') && (c != '\r') );
            //
            //-------END OF INLINE---------------------------------------------
            if ((ignore_crcount == 1)&&(c == '-'))
                //&&(lastchar_was_linebreak == 1))
            {
                int hit = 0;
                char *p;
                if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_decode_64:DEBUG: leader '-' found at %50s",FL,(f->startpoint -1));
                p = strchr((f->startpoint -1), '\n');
                if (p == NULL) {
                    /* The boundary test was failing because sometimes the full line
                     * wasn't available to test against in BM_cmp(), so if we can't
                     * see a \n (or \r even), then we should load up some more data
                     */
                    char scratch[1024];
                    FFGET_fgets(scratch,sizeof(scratch), f);
                    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_decode_64:DEBUG: Scratch = '%s'", FL, scratch);
                    hit = BS_cmp(scratch,strlen(scratch) +1);
                    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_decode_64:DEBUG: Boundary hit = %d", FL, hit);
                } else {
                    *p = '\0';
                    hit = BS_cmp((f->startpoint -1),strlen(f->startpoint) +1);
                    *p = '\n';
                }
                if (hit > 0) {
                    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_decode_64:DEBUG: Boundary detected and breaking out ",FL);
                    //      FFGET_fgets(scratch,sizeof(scratch),f);
                    //      eom_reached = 1;
                    boundary_crash = 1;
                    break;
                } else {
                    /** 20041105-22H56:PLD: Applied Stepan Kasal patch **/
                    i--;
                    continue;
                }
            }
            // If we get a CR then we need to check a few things, namely to see
            //  if the BASE64 stream has terminated ( indicated by two consecutive
            //  \n's
            //
            // This should not be affected by \r's because the \r's will just pass
            //  through and be absorbed by the detection of possible 'invalid'
            //  characters
            if ((ignore_crcount == 0)&&(c == '\n'))
            {
                cr_count++;
                cr_total++;
                // Because there are some mail-agents out there which are REALLY naughty
                //      and do things like sticking random blank lines into B64 data streams
                //      (why o why!?) we need to have a settable option here to decide if
                //      we want to test for double-CR breaking or just ignore it
                //
                // To avoid this, we relax the double-CR extention, and say "Okay, we'll let
                // you have a single blank line - but any more than that and we'll slap you
                //  hand".  Honestly, I do not like this solution, but it seems to be the only
                //  way to preserve decoding accurancy without resorting to having to use
                //  a command line switch to dictate which method to use ( NO-CR's or ignore
                // CR's ).
                if (cr_count > 2)
                {
                    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_decode_64:DEBUG: EOF Reached due to two consecutive CR's on line %d\n",FL,cr_total);
                    eom_reached++;
                    break;
                }
                else
                {
                    char_count = 0;
                    i--;
                    continue;
                } // else if it wasn't our 3rd CR
            } else {
                cr_count=0;
            }
            /* if we get an EOF char, then we know something went wrong */
            if ( c == EOF )
            {
                size_t bc;
                if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_decode_64:DEBUG: input stream broken for base64 decoding for file %s. %ld bytes of data in buffer to be written out\n",FL,hinfo->filename,wbcount);
                status = MIME_ERROR_B64_INPUT_STREAM_EOF;
                //fwrite(writebuffer, 1, wbcount, of);
                bc = write( of, writebuffer, wbcount);
                close(of);
                if (writebuffer) free(writebuffer);
                return status;
                break;
            } /* if c was the EOF */
            else if (c == '=')
            {
                // Once we've found a stop char, we can actually just "pad" in the rest
                // of the stop chars because we know we're at the end. Some MTA's dont
                // put in enough stopchars... at least it seems X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
                // doesnt.
                if (i == 2)
                {
                    input[2] = input[3] = (char)b64[c];
                }
                else if (i == 3)
                {
                    input[3] = (char)b64[c];
                }
                // NOTE------
                // Previously we relied on the fact that if we detected a stop char, that FFGET()
                // would automatically absorb the data till EOL. This is no longer the case as we
                // are now only retrieving data byte at a time.
                // So, now we -absorb- till the end of the line using FFGET_fgets()
                stopcount = 4 -i;
                FFGET_fgets(scratch,sizeof(scratch),f);
                if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_decode_64:DEBUG: Stop char detected pos=%d...StopCount = %d\n",FL,i,stopcount);
                i = 4;
                break; // out of FOR.
            }
            /*
                else if ((char_count == 0)&&(c == '-' )) {
                if (FFGET_fgetc(f) == '-')
                {
                boundary_crash++;
                eom_reached++;
                break;
                }
                }
                */
            /* test for and discard invalid chars */
            if (b64[c] == 0x80)
            {
                i--;
                continue;
            }
            // Finally, if we get this far without the character having been picked
            //  out as some special meaning character, we decode it and place the
            //  resultant byte into the input[] array.
            input[i] = (char)b64[c];
            /* assuming we've gotten this far, then we increment the char_count */
            char_count++;
        } // 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)
        {
            // If our buffer is full beyond the 'write out limit', then we write the buffered
            //  data to the file -  We use this method in order to save calling fwrite() too
            //  many times, thus avoiding function call overheads and [ possibly ] disk write
            //  interrupt costs.
            if ( wbcount > _MIME_WRITE_BUFFER_LIMIT )
            {
                size_t bc;
                bc = write ( of, writebuffer, wbcount );
                //          fwrite(writebuffer, 1, wbcount, of);
                wbpos = writebuffer;
                wbcount = 0;
            }
            // Copy our converted bytes to the write buffer
            for (loop = 0; loop < (3 -stopcount); loop++)
            {
                *wbpos = output[loop];
                wbpos++;
                wbcount++;
            }
            // tally up our total byte conversion count
            bytecount+=(3 -stopcount);
        }
        else if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_decode_64:DEBUG: could not attain 4 bytes input\n",FL);

        // if we wrote less than 3 chars, it means we were at the end of the encoded file thus we exit
        if ((eom_reached)||(stopcount > 0)||(boundary_crash)||(i!=4))
        {
            // Write out the remaining contents of our write buffer - If we don't do this
            //  we'll end up with truncated files.
            if (wbcount > 0)
            {
                size_t bc;
                //fwrite(writebuffer, 1, wbcount, of);
                bc = write( of, writebuffer, wbcount);
            }
            /* close the output file, we're done writing to it */
            close(of);
            /* if we didn't really write anything, then trash the  file */
            if (bytecount == 0)
            {
                //              unlink(fullMIME_filename);
                status = MIME_BASE64_STATUS_ZERO_FILE;
            }
            if (boundary_crash)
            {
                // Absorb to end of line
                //
                status = MIME_BASE64_STATUS_HIT_BOUNDARY; // was _BOUNDARY_CRASH
            }
            if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_decode_64:DEBUG: File size = %ld bytes, Exit Status = %d, Boundary Crash = %d\n",FL, bytecount, status, boundary_crash);
            if (writebuffer) free(writebuffer);
            return status;
        } // if End-of-MIME or Stopchars appeared
    } // while
    if (writebuffer) free(writebuffer);
    return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x8d0, %rsp            # imm = 0x8D0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x44(%rbp)
movl $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
leaq -0x460(%rbp), %rdi
xorl %esi, %esi
movl $0x3ff, %edx            # imm = 0x3FF
callq 0x2150
movl $0x0, -0x474(%rbp)
cmpl $0x1, 0x21e75(%rip)     # 0x276f0
jl 0x58a2
movq -0x20(%rbp), %rcx
addq $0x5efd, %rcx           # imm = 0x5EFD
leaq 0x148a4(%rip), %rdi     # 0x1a133
leaq 0x13c39(%rip), %rsi     # 0x194cf
movl $0x60f, %edx            # imm = 0x60F
movb $0x0, %al
callq 0x117c0
cmpl $0x0, 0x21e57(%rip)     # 0x27700
je 0x58c5
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq $0x5efd, %rsi           # imm = 0x5EFD
movl 0x21e44(%rip), %edx     # 0x27704
callq 0x41a0
leaq -0x460(%rbp), %rdi
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
addq $0x5efd, %r8            # imm = 0x5EFD
movl $0x3ff, %esi            # imm = 0x3FF
leaq 0x13c15(%rip), %rdx     # 0x194fc
movb $0x0, %al
callq 0x2130
leaq -0x460(%rbp), %rdi
movl $0x41, %esi
movl $0x180, %edx            # imm = 0x180
movb $0x0, %al
callq 0x2320
movl %eax, -0x47c(%rbp)
cmpl $0x0, -0x47c(%rbp)
jge 0x595f
leaq -0x460(%rbp), %rax
movq %rax, -0x8b0(%rbp)
callq 0x2050
movl (%rax), %edi
callq 0x23a0
movq -0x8b0(%rbp), %rcx
movq %rax, %r8
leaq 0x14829(%rip), %rdi     # 0x1a169
leaq 0x13b88(%rip), %rsi     # 0x194cf
movl $0x619, %edx            # imm = 0x619
movb $0x0, %al
callq 0x117c0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6093
movl $0x2000, %edi           # imm = 0x2000
callq 0x2290
movq %rax, -0x468(%rbp)
cmpq $0x0, -0x468(%rbp)
jne 0x59a5
leaq 0x14839(%rip), %rdi     # 0x1a1ba
leaq 0x13b47(%rip), %rsi     # 0x194cf
movl $0x623, %edx            # imm = 0x623
movl $0x2000, %ecx           # imm = 0x2000
movb $0x0, %al
callq 0x117c0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6093
movq -0x468(%rbp), %rax
movq %rax, -0x470(%rbp)
movl $0x0, -0x474(%rbp)
callq 0x12ba0
cmpl $0x0, %eax
jle 0x59ce
movl $0x1, -0x30(%rbp)
movl $0x0, -0x40(%rbp)
movl $0x0, -0x480(%rbp)
movb $0x0, -0x54(%rbp)
movb $0x0, -0x55(%rbp)
movb $0x0, -0x56(%rbp)
movb $0x0, -0x57(%rbp)
movl $0x0, -0x24(%rbp)
cmpl $0x4, -0x24(%rbp)
jge 0x5eb7
jmp 0x5a02
cmpl $0xa, -0x40(%rbp)
je 0x5a0e
cmpl $0xd, -0x40(%rbp)
jne 0x5a1a
movl $0x1, -0x480(%rbp)
jmp 0x5a24
movl $0x0, -0x480(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x2050(%rax)
je 0x5a4f
movq -0x10(%rbp), %rax
movl $0x0, 0x2050(%rax)
movq -0x10(%rbp), %rax
movsbl 0x2038(%rax), %eax
movl %eax, -0x40(%rbp)
jmp 0x5ac8
movq -0x10(%rbp), %rax
cmpq $0x0, 0x2010(%rax)
je 0x5a75
movq -0x10(%rbp), %rax
movq 0x2010(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x2018(%rcx), %rax
jbe 0x5a7e
movq -0x10(%rbp), %rdi
callq 0x94f0
movq -0x10(%rbp), %rax
movq 0x2010(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x2018(%rcx), %rax
ja 0x5abf
movq -0x10(%rbp), %rax
movq 0x2010(%rax), %rax
movsbl (%rax), %eax
movl %eax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x2010(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x2010(%rax)
jmp 0x5ac6
movl $0xffffffff, -0x40(%rbp) # imm = 0xFFFFFFFF
jmp 0x5ac8
jmp 0x5aca
xorl %eax, %eax
cmpl $-0x1, -0x40(%rbp)
movb %al, -0x8b1(%rbp)
je 0x5b0f
xorl %eax, %eax
cmpl $0x20, -0x40(%rbp)
movb %al, -0x8b1(%rbp)
jge 0x5b0f
xorl %eax, %eax
cmpl $0xa, -0x40(%rbp)
movb %al, -0x8b1(%rbp)
je 0x5b0f
xorl %eax, %eax
cmpl $0x2d, -0x40(%rbp)
movb %al, -0x8b1(%rbp)
je 0x5b0f
cmpl $0xd, -0x40(%rbp)
setne %al
movb %al, -0x8b1(%rbp)
movb -0x8b1(%rbp), %al
testb $0x1, %al
jne 0x5a02
cmpl $0x1, -0x30(%rbp)
jne 0x5ccf
cmpl $0x2d, -0x40(%rbp)
jne 0x5ccf
movl $0x0, -0x484(%rbp)
cmpl $0x1, 0x21bae(%rip)     # 0x276f0
jl 0x5b6d
movq -0x10(%rbp), %rax
movq 0x2010(%rax), %rcx
addq $-0x1, %rcx
leaq 0x146b3(%rip), %rdi     # 0x1a20d
leaq 0x1396e(%rip), %rsi     # 0x194cf
movl $0x669, %edx            # imm = 0x669
movb $0x0, %al
callq 0x117c0
movq -0x10(%rbp), %rax
movq 0x2010(%rax), %rdi
addq $-0x1, %rdi
movl $0xa, %esi
callq 0x2110
movq %rax, -0x490(%rbp)
cmpq $0x0, -0x490(%rbp)
jne 0x5c37
leaq -0x890(%rbp), %rdi
movq -0x10(%rbp), %rdx
movl $0x400, %esi            # imm = 0x400
callq 0x9ab0
cmpl $0x1, 0x21b39(%rip)     # 0x276f0
jl 0x5bda
leaq -0x890(%rbp), %rcx
leaq 0x1467b(%rip), %rdi     # 0x1a242
leaq 0x13901(%rip), %rsi     # 0x194cf
movl $0x672, %edx            # imm = 0x672
movb $0x0, %al
callq 0x117c0
leaq -0x890(%rbp), %rax
movq %rax, -0x8c0(%rbp)
leaq -0x890(%rbp), %rdi
callq 0x2100
movq -0x8c0(%rbp), %rdi
addq $0x1, %rax
movl %eax, %esi
callq 0x12d80
movl %eax, -0x484(%rbp)
cmpl $0x1, 0x21add(%rip)     # 0x276f0
jl 0x5c35
movl -0x484(%rbp), %ecx
leaq 0x1464b(%rip), %rdi     # 0x1a26d
leaq 0x138a6(%rip), %rsi     # 0x194cf
movl $0x674, %edx            # imm = 0x674
movb $0x0, %al
callq 0x117c0
jmp 0x5c89
movq -0x490(%rbp), %rax
movb $0x0, (%rax)
movq -0x10(%rbp), %rax
movq 0x2010(%rax), %rax
addq $-0x1, %rax
movq %rax, -0x8c8(%rbp)
movq -0x10(%rbp), %rax
movq 0x2010(%rax), %rdi
callq 0x2100
movq -0x8c8(%rbp), %rdi
addq $0x1, %rax
movl %eax, %esi
callq 0x12d80
movl %eax, -0x484(%rbp)
movq -0x490(%rbp), %rax
movb $0xa, (%rax)
cmpl $0x0, -0x484(%rbp)
jle 0x5cc1
cmpl $0x1, 0x21a57(%rip)     # 0x276f0
jl 0x5cb5
leaq 0x145f9(%rip), %rdi     # 0x1a29b
leaq 0x13826(%rip), %rsi     # 0x194cf
movl $0x67b, %edx            # imm = 0x67B
movb $0x0, %al
callq 0x117c0
movl $0x1, -0x48(%rbp)
jmp 0x5eb7
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x5ea9
cmpl $0x0, -0x30(%rbp)
jne 0x5d3c
cmpl $0xa, -0x40(%rbp)
jne 0x5d3c
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
cmpl $0x2, -0x2c(%rbp)
jle 0x5d27
cmpl $0x1, 0x219f6(%rip)     # 0x276f0
jl 0x5d19
movl -0x28(%rbp), %ecx
leaq 0x145d5(%rip), %rdi     # 0x1a2db
leaq 0x137c2(%rip), %rsi     # 0x194cf
movl $0x69e, %edx            # imm = 0x69E
movb $0x0, %al
callq 0x117c0
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x5eb7
movl $0x0, -0x44(%rbp)
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x5ea9
movl $0x0, -0x2c(%rbp)
cmpl $-0x1, -0x40(%rbp)
jne 0x5dd5
cmpl $0x1, 0x2199c(%rip)     # 0x276f0
jl 0x5d82
movq -0x20(%rbp), %rcx
addq $0x5efd, %rcx           # imm = 0x5EFD
movl -0x474(%rbp), %r8d
leaq 0x145bc(%rip), %rdi     # 0x1a32b
leaq 0x13759(%rip), %rsi     # 0x194cf
movl $0x6af, %edx            # imm = 0x6AF
movb $0x0, %al
callq 0x117c0
movl $0xf2, -0x3c(%rbp)
movl -0x47c(%rbp), %edi
movq -0x468(%rbp), %rsi
movslq -0x474(%rbp), %rdx
callq 0x20d0
movq %rax, -0x898(%rbp)
movl -0x47c(%rbp), %edi
callq 0x2180
cmpq $0x0, -0x468(%rbp)
je 0x5dca
movq -0x468(%rbp), %rdi
callq 0x2030
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6093
cmpl $0x3d, -0x40(%rbp)
jne 0x5e67
cmpl $0x2, -0x24(%rbp)
jne 0x5dfb
movslq -0x40(%rbp), %rcx
leaq 0x210a0(%rip), %rax     # 0x26e90
movb (%rax,%rcx), %al
movb %al, -0x54(%rbp)
movb %al, -0x55(%rbp)
jmp 0x5e14
cmpl $0x3, -0x24(%rbp)
jne 0x5e12
movslq -0x40(%rbp), %rcx
leaq 0x21084(%rip), %rax     # 0x26e90
movb (%rax,%rcx), %al
movb %al, -0x54(%rbp)
jmp 0x5e14
movl $0x4, %eax
subl -0x24(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rdx
leaq 0x24d26(%rip), %rdi     # 0x2ab50
movl $0x400, %esi            # imm = 0x400
callq 0x9ab0
cmpl $0x1, 0x218b5(%rip)     # 0x276f0
jl 0x5e5e
movl -0x24(%rbp), %ecx
movl -0x34(%rbp), %r8d
leaq 0x14560(%rip), %rdi     # 0x1a3ab
leaq 0x1367d(%rip), %rsi     # 0x194cf
movl $0x6cd, %edx            # imm = 0x6CD
movb $0x0, %al
callq 0x117c0
movl $0x4, -0x24(%rbp)
jmp 0x5eb7
jmp 0x5e69
movslq -0x40(%rbp), %rcx
leaq 0x2101c(%rip), %rax     # 0x26e90
movzbl (%rax,%rcx), %eax
cmpl $0x80, %eax
jne 0x5e8a
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x5ea9
movslq -0x40(%rbp), %rcx
leaq 0x20ffb(%rip), %rax     # 0x26e90
movb (%rax,%rcx), %cl
movslq -0x24(%rbp), %rax
movb %cl, -0x57(%rbp,%rax)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x59f6
movsbl -0x57(%rbp), %eax
shll $0x2, %eax
movsbl -0x56(%rbp), %ecx
sarl $0x4, %ecx
orl %ecx, %eax
movb %al, -0x53(%rbp)
movsbl -0x56(%rbp), %eax
shll $0x4, %eax
movsbl -0x55(%rbp), %ecx
sarl $0x2, %ecx
orl %ecx, %eax
movb %al, -0x52(%rbp)
movsbl -0x55(%rbp), %eax
shll $0x6, %eax
movsbl -0x54(%rbp), %ecx
orl %ecx, %eax
movb %al, -0x51(%rbp)
cmpl $0x4, -0x24(%rbp)
jne 0x5fb1
cmpl $0x1ffc, -0x474(%rbp)   # imm = 0x1FFC
jle 0x5f3b
movl -0x47c(%rbp), %edi
movq -0x468(%rbp), %rsi
movslq -0x474(%rbp), %rdx
callq 0x20d0
movq %rax, -0x8a0(%rbp)
movq -0x468(%rbp), %rax
movq %rax, -0x470(%rbp)
movl $0x0, -0x474(%rbp)
movl $0x0, -0x478(%rbp)
movl -0x478(%rbp), %eax
movl $0x3, %ecx
subl -0x34(%rbp), %ecx
cmpl %ecx, %eax
jge 0x5f9d
movslq -0x478(%rbp), %rax
movb -0x53(%rbp,%rax), %cl
movq -0x470(%rbp), %rax
movb %cl, (%rax)
movq -0x470(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x470(%rbp)
movl -0x474(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x474(%rbp)
movl -0x478(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x478(%rbp)
jmp 0x5f45
movl $0x3, %eax
subl -0x34(%rbp), %eax
cltq
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x5fd6
cmpl $0x1, 0x21738(%rip)     # 0x276f0
jl 0x5fd4
leaq 0x14432(%rip), %rdi     # 0x1a3f3
leaq 0x13507(%rip), %rsi     # 0x194cf
movl $0x705, %edx            # imm = 0x705
movb $0x0, %al
callq 0x117c0
jmp 0x5fd6
cmpl $0x0, -0x38(%rbp)
jne 0x5ff2
cmpl $0x0, -0x34(%rbp)
jg 0x5ff2
cmpl $0x0, -0x48(%rbp)
jne 0x5ff2
cmpl $0x4, -0x24(%rbp)
je 0x608e
cmpl $0x0, -0x474(%rbp)
jle 0x601b
movl -0x47c(%rbp), %edi
movq -0x468(%rbp), %rsi
movslq -0x474(%rbp), %rdx
callq 0x20d0
movq %rax, -0x8a8(%rbp)
movl -0x47c(%rbp), %edi
callq 0x2180
cmpq $0x0, -0x50(%rbp)
jne 0x6034
movl $0x2, -0x3c(%rbp)
cmpl $0x0, -0x48(%rbp)
je 0x6041
movl $0x1, -0x3c(%rbp)
cmpl $0x1, 0x216a8(%rip)     # 0x276f0
jl 0x6070
movq -0x50(%rbp), %rcx
movl -0x3c(%rbp), %r8d
movl -0x48(%rbp), %r9d
leaq 0x143d2(%rip), %rdi     # 0x1a42f
leaq 0x1346b(%rip), %rsi     # 0x194cf
movl $0x720, %edx            # imm = 0x720
movb $0x0, %al
callq 0x117c0
cmpq $0x0, -0x468(%rbp)
je 0x6086
movq -0x468(%rbp), %rdi
callq 0x2030
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6093
jmp 0x59d5
movl -0x4(%rbp), %eax
addq $0x8d0, %rsp            # imm = 0x8D0
popq %rbp
retq
nop