// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x858, %rsp            # imm = 0x858
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x50(%rsp), %rdi
movl $0x3ff, %edx            # imm = 0x3FF
xorl %esi, %esi
callq 0x2170
cmpl $0x0, 0x1ca97(%rip)     # 0x21300
jle 0x488d
leaq 0x5efd(%r12), %rcx
leaq 0xe9e9(%rip), %rdi      # 0x13263
leaq 0xdb5e(%rip), %rsi      # 0x123df
movl $0x60f, %edx            # imm = 0x60F
xorl %eax, %eax
callq 0xc960
cmpl $0x0, 0x1ca7c(%rip)     # 0x21310
je 0x48ac
leaq 0x5efd(%r12), %rsi
movl 0x1ca70(%rip), %edx     # 0x21314
movq %rbx, %rdi
callq 0x3738
addq $0x5efd, %r12           # imm = 0x5EFD
leaq 0xdb52(%rip), %rdx      # 0x1240c
leaq 0x50(%rsp), %r15
movl $0x3ff, %esi            # imm = 0x3FF
movq %r15, %rdi
movq %rbx, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x2140
movq %r15, %rdi
movl $0x41, %esi
movl $0x180, %edx            # imm = 0x180
xorl %eax, %eax
callq 0x2340
testl %eax, %eax
js 0x4e28
movl %eax, 0x1c(%rsp)
movl $0x2000, %edi           # imm = 0x2000
callq 0x22b0
testq %rax, %rax
je 0x4e58
movq %rax, %rbx
movq %r12, 0x48(%rsp)
callq 0xd626
movl %eax, %r13d
movl $0x4801, %r12d          # imm = 0x4801
movl $0x0, 0x24(%rsp)
movl $0x0, 0xc(%rsp)
xorl %ebp, %ebp
xorl %r15d, %r15d
movl $0x0, 0x20(%rsp)
movq %rbx, 0x38(%rsp)
movq %rbx, 0x28(%rsp)
movl $0x0, 0x10(%rsp)
xorl %ebx, %ebx
movl $0x0, 0x34(%rsp)
movl %ebp, 0x18(%rsp)
movq %r15, 0x40(%rsp)
movl $0x0, 0x8(%rsp)
xorl %ebp, %ebp
movl %ebx, %r15d
cmpl $0x0, 0x2050(%r14)
je 0x498b
movl $0x0, 0x2050(%r14)
movsbl 0x2038(%r14), %eax
jmp 0x49ca
movq 0x2010(%r14), %rax
testq %rax, %rax
je 0x49a0
cmpq 0x2018(%r14), %rax
jbe 0x49a8
movq %r14, %rdi
callq 0x76ff
movq 0x2010(%r14), %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq 0x2018(%r14), %rcx
ja 0x49ca
movsbl (%rcx), %eax
incq %rcx
movq %rcx, 0x2010(%r14)
cmpl $0x1f, %eax
jg 0x49dd
leal 0x1(%rax), %ecx
cmpl $0xe, %ecx
ja 0x496c
btl %ecx, %r12d
jae 0x496c
testl %r13d, %r13d
jle 0x4a68
cmpl $0x2d, %eax
jne 0x4a68
movl %r13d, %r12d
cmpl $0x0, 0x1c90b(%rip)     # 0x21300
jle 0x4a1b
movq 0x2010(%r14), %rcx
decq %rcx
leaq 0xe935(%rip), %rdi      # 0x1333d
leaq 0xd9d0(%rip), %rsi      # 0x123df
movl $0x669, %edx            # imm = 0x669
xorl %eax, %eax
callq 0xc960
movq 0x2010(%r14), %rdi
decq %rdi
movl $0xa, %esi
callq 0x2120
testq %rax, %rax
je 0x4abb
movq %rax, %r13
movb $0x0, (%rax)
movq 0x2010(%r14), %rdi
leaq -0x1(%rdi), %rbx
callq 0x2110
leal 0x1(%rax), %esi
movq %rbx, %rdi
callq 0xd799
movl %eax, %ebx
movb $0xa, (%r13)
movl %r12d, %r13d
jmp 0x4b36
testl %r13d, %r13d
jg 0x4a8e
cmpl $0xa, %eax
jne 0x4a8e
leal 0x1(%r15), %ebx
incl 0x34(%rsp)
cmpl $0x2, %r15d
jge 0x4d07
decl %ebp
movl %ebx, %r15d
jmp 0x4b7f
cmpl $0x3d, %eax
je 0x4d37
cmpl $-0x1, %eax
je 0x4d57
cltq
leaq 0xdbb7(%rip), %rcx      # 0x12660
movb (%rax,%rcx), %al
cmpb $-0x80, %al
jne 0x4b75
decl %ebp
jmp 0x4b7c
leaq 0x450(%rsp), %rbx
movq %rbx, %rdi
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdx
callq 0x7a09
cmpl $0x0, 0x1c826(%rip)     # 0x21300
jle 0x4af9
leaq 0xe88f(%rip), %rdi      # 0x13372
leaq 0xd8f5(%rip), %rsi      # 0x123df
movl $0x672, %edx            # imm = 0x672
movq %rbx, %rcx
xorl %eax, %eax
callq 0xc960
movq %rbx, %rdi
callq 0x2110
leal 0x1(%rax), %esi
movq %rbx, %rdi
callq 0xd799
movl %eax, %ebx
cmpl $0x0, 0x1c7eb(%rip)     # 0x21300
movl %r12d, %r13d
jle 0x4b36
leaq 0xe87c(%rip), %rdi      # 0x1339d
leaq 0xd8b7(%rip), %rsi      # 0x123df
movl $0x674, %edx            # imm = 0x674
movl %ebx, %ecx
xorl %eax, %eax
callq 0xc960
movl $0x4801, %r12d          # imm = 0x4801
testl %ebx, %ebx
jle 0x4b6d
movl $0x1, 0x18(%rsp)
cmpl $0x0, 0x1c7b1(%rip)     # 0x21300
jle 0x4b6f
leaq 0xe873(%rip), %rdi      # 0x133cb
leaq 0xd880(%rip), %rsi      # 0x123df
movl $0x67b, %edx            # imm = 0x67B
xorl %eax, %eax
callq 0xc960
jmp 0x4b6f
decl %ebp
testl %ebx, %ebx
jle 0x4b7f
jmp 0x4b8d
movslq %ebp, %rcx
movb %al, 0x8(%rsp,%rcx)
xorl %r15d, %r15d
movl %ebp, %eax
leal 0x1(%rax), %ebp
cmpl $0x3, %eax
jl 0x496c
movl %r15d, %ebx
movq 0x28(%rsp), %r15
movb 0x8(%rsp), %al
movb 0x9(%rsp), %cl
shlb $0x2, %al
movl %ecx, %edx
sarb $0x4, %dl
orb %al, %dl
movb %dl, 0x15(%rsp)
shlb $0x4, %cl
movb 0xa(%rsp), %al
movl %eax, %edx
sarb $0x2, %dl
orb %cl, %dl
movb %dl, 0x16(%rsp)
shlb $0x6, %al
orb 0xb(%rsp), %al
movb %al, 0x17(%rsp)
cmpl $0x4, %ebp
jne 0x4c31
movl 0x10(%rsp), %eax
cmpl $0x1ffd, %eax           # imm = 0x1FFD
jl 0x4bf3
movl %eax, %edx
movl 0x1c(%rsp), %edi
movq 0x38(%rsp), %r15
movq %r15, %rsi
callq 0x20e0
movl $0x0, 0x10(%rsp)
movl $0x3, %eax
movl 0x20(%rsp), %ecx
subl %ecx, %eax
cmpl $0x2, %ecx
jg 0x4c28
cmpl $0x2, %eax
movl $0x1, %ecx
cmovgel %eax, %ecx
xorl %edx, %edx
movb 0x15(%rsp,%rdx), %sil
movb %sil, (%r15,%rdx)
incq %rdx
cmpq %rdx, %rcx
jne 0x4c10
addl %ecx, 0x10(%rsp)
addq %rdx, %r15
cltq
addq %rax, 0x40(%rsp)
jmp 0x4c54
cmpl $0x0, 0x1c6c8(%rip)     # 0x21300
jle 0x4c54
leaq 0xe8e2(%rip), %rdi      # 0x13523
leaq 0xd797(%rip), %rsi      # 0x123df
movl $0x705, %edx            # imm = 0x705
xorl %eax, %eax
callq 0xc960
cmpl $0x0, 0x24(%rsp)
movl 0x20(%rsp), %eax
movq %r15, 0x28(%rsp)
jne 0x4c8a
testl %eax, %eax
jg 0x4c8a
cmpl $0x0, 0x18(%rsp)
jne 0x4c8a
cmpl $0x4, %ebp
jne 0x4c8a
movl $0x0, 0x24(%rsp)
movb $0x1, %al
xorl %ebp, %ebp
movq 0x40(%rsp), %r15
jmp 0x4dbf
movl 0x10(%rsp), %eax
testl %eax, %eax
movl 0x1c(%rsp), %ebp
jle 0x4ca4
movl %eax, %edx
movl %ebp, %edi
movq 0x38(%rsp), %rsi
callq 0x20e0
movl %ebp, %edi
callq 0x21a0
movq 0x40(%rsp), %r15
testq %r15, %r15
movl $0x2, %eax
movl 0xc(%rsp), %r8d
cmovel %eax, %r8d
movl 0x18(%rsp), %ebp
testl %ebp, %ebp
movl $0x1, %eax
cmovnel %eax, %r8d
cmpl $0x0, 0x1c629(%rip)     # 0x21300
movl %r8d, 0xc(%rsp)
jle 0x4db3
leaq 0xe876(%rip), %rdi      # 0x1355f
leaq 0xd6ef(%rip), %rsi      # 0x123df
movl $0x720, %edx            # imm = 0x720
movq %r15, %rcx
movl %ebp, %r9d
xorl %eax, %eax
callq 0xc960
jmp 0x4db3
cmpl $0x0, 0x1c5f2(%rip)     # 0x21300
jle 0x4d2e
leaq 0xe6f4(%rip), %rdi      # 0x1340b
leaq 0xd6c1(%rip), %rsi      # 0x123df
movl $0x69e, %edx            # imm = 0x69E
movl 0x34(%rsp), %ecx
xorl %eax, %eax
callq 0xc960
incl 0x24(%rsp)
jmp 0x4b90
cmpl $0x3, %ebp
movq 0x28(%rsp), %r15
je 0x4dcc
cmpl $0x2, %ebp
jne 0x4dd1
movw $0x0, 0xa(%rsp)
jmp 0x4dd1
cmpl $0x0, 0x1c5a2(%rip)     # 0x21300
movl 0x10(%rsp), %ebx
jle 0x4d86
leaq 0xe6f0(%rip), %rdi      # 0x1345b
leaq 0xd66d(%rip), %rsi      # 0x123df
movl $0x6af, %edx            # imm = 0x6AF
movq 0x48(%rsp), %rcx
movl %ebx, %r8d
xorl %eax, %eax
callq 0xc960
movslq %ebx, %rdx
movl 0x1c(%rsp), %ebx
movl %ebx, %edi
movq 0x38(%rsp), %rsi
callq 0x20e0
movl %ebx, %edi
callq 0x21a0
xorl %ebx, %ebx
movl $0xf2, 0xc(%rsp)
movq 0x40(%rsp), %r15
movl 0x18(%rsp), %ebp
movq 0x38(%rsp), %rdi
callq 0x2030
xorl %eax, %eax
testb %al, %al
jne 0x4956
jmp 0x4e7f
movb $0x0, 0xb(%rsp)
movl $0x4, %ebx
subl %ebp, %ebx
leaq 0x1f981(%rip), %rdi     # 0x24760
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdx
callq 0x7a09
cmpl $0x0, 0x1c50d(%rip)     # 0x21300
movl %ebx, 0x20(%rsp)
jle 0x4e1c
movl %ebx, %r8d
xorl %ebx, %ebx
leaq 0xe6d6(%rip), %rdi      # 0x134db
leaq 0xd5d3(%rip), %rsi      # 0x123df
movl $0x6cd, %edx            # imm = 0x6CD
movl %ebp, %ecx
xorl %eax, %eax
callq 0xc960
jmp 0x4e1e
xorl %ebx, %ebx
movl $0x4, %ebp
jmp 0x4b95
callq 0x2060
movl (%rax), %edi
callq 0x23c0
leaq 0xe45e(%rip), %rdi      # 0x13299
leaq 0xd59d(%rip), %rsi      # 0x123df
leaq 0x50(%rsp), %rcx
movl $0x619, %edx            # imm = 0x619
movq %rax, %r8
xorl %eax, %eax
callq 0xc960
jmp 0x4e77
leaq 0xe48b(%rip), %rdi      # 0x132ea
leaq 0xd579(%rip), %rsi      # 0x123df
movl $0x623, %edx            # imm = 0x623
movl $0x2000, %ecx           # imm = 0x2000
xorl %eax, %eax
callq 0xc960
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
movl 0xc(%rsp), %eax
addq $0x858, %rsp            # imm = 0x858
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq