// File: /workspace/github_c_makefile_star2_O2/inflex[P]ripMIME/mime.c
// Function: MIME_unpack_stage2
int MIME_unpack_stage2( FFGET_FILE *f, char *unpackdir, struct MIMEH_header_info *hinfo, int current_recursion_level, struct SS_object *ss )
{
    int result = 0;
    struct MIMEH_header_info *h;
    char *p;

    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Start, recursion %d\n",FL, current_recursion_level);
    if (current_recursion_level > glb.max_recursion_level)
    {
        /** Test for recursion limits **/
        if (MIME_VERBOSE) LOGGER_log("%s:%d:MIME_unpack_stage2:WARNING: Current recursion level of %d is greater than permitted %d"\
                ,FL, current_recursion_level, glb.max_recursion_level);
        return MIME_ERROR_RECURSION_LIMIT_REACHED; // 20040306-1301:PLD
    }
    h = hinfo;
    // Get our headers and determin what we have...
    //
    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Parsing headers (initial)\n",FL);
    // Parse the headers, extracting what information we need
    /** 20041216-1102:PLD: Keep attempting to read headers until we get a sane set **/
    do {
        /** Read next set of headers, repeat until a sane set of headers are found **/
        result = MIMEH_parse_headers(f,h);
        DMIME LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Parsing of headers done, sanity = %d, result = %d",FL,h->sanity, result);
    } while ((h->sanity == 0)&&(result != -1));

    DMIME LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Repeat loop of header-reading done, sanity = %d, result = %d",FL,h->sanity, result);
    glb.header_defect_count += MIMEH_get_defect_count(h);
    // Test the result output
    switch (result) {
        case -1:
            return MIME_ERROR_FFGET_EMPTY;
            break;
    }
    // Copy the subject over to our global structure if the subject is not already set.
    //      this will give us the 'main' subject of the entire email and prevent
    //      and subsequent subjects from clobbering it.
    //if (glb.subject[0] == '\0') snprintf(glb.subject, _MIME_STRLEN_MAX, "%s", h->subject );
    if ((strlen(glb.subject) < 1)&&(h->subject != NULL)&&(strlen(h->subject) > 0))
    {
        snprintf(glb.subject, sizeof(glb.subject), "%s", h->subject );
    }
    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Headers parsed, Result = %d, Boundary located = %d\n"\
            ,FL,result, hinfo->boundary_located);

    // Test to see if we encountered any DoubleCR situations while we
    //      were processing the headers.  If we did encounter a doubleCR
    //      then we need to decode that data and then reset the doubleCR
    //      flag.
    if (MIMEH_get_doubleCR() != 0)
    {
        MIME_doubleCR_decode( MIMEH_get_doubleCR_name(), unpackdir, h, current_recursion_level);
        MIMEH_set_doubleCR( 0 );
        FFGET_SDL_MODE = 0;
    }

    // If we located a boundary being specified (as apposed to existing)
    // then we push it to the BoundaryStack

    if (h->boundary_located)
    {
        char *lbc;
        char *fbc;

        if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Boundary located, pushing to stack (%s)\n",FL,h->boundary);
        BS_push(h->boundary);

        // Get the first and last character positions of the boundary
        //      so we can test these for quotes.
        fbc = h->boundary;
        lbc = h->boundary +strlen(h->boundary) -1;

        // Circumvent attempts to trick the boundary
        //      Even though we may end up pushing 3 boundaries to the stack
        //      they will be popped off if they're not needed.
        if (*fbc == '"') { BS_push((fbc +1)); MIMEH_set_defect( hinfo, MIMEH_DEFECT_UNBALANCED_BOUNDARY_QUOTE); }
        if (*lbc == '"') { *lbc = '\0'; BS_push(h->boundary); *lbc = '"'; MIMEH_set_defect( hinfo, MIMEH_DEFECT_UNBALANCED_BOUNDARY_QUOTE); }
        h->boundary_located = 0;
    } else {
        if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Decoding in BOUNDARY-LESS mode\n",FL);
        if (h->content_type == _CTYPE_RFC822)
        {
            // Pass off to the RFC822 handler
            if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Decoding with RFC822 decoder\n",FL);
            result = MIME_handle_rfc822(f,unpackdir,h,current_recursion_level,ss);
        } else if (MIMEH_is_contenttype(_CTYPE_MULTIPART, h->content_type)) {
            // Pass off to the multipart handler
            if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Decoding with Multipart decoder\n",FL);
            result = MIME_handle_multipart(f,unpackdir,h,current_recursion_level,ss);
        } else {
            if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Decoding boundaryless file (%s)...\n",FL,h->filename);
            result = MIME_handle_plain( f, unpackdir,h,current_recursion_level,ss);
        } // else-if content was RFC822 or multi-part
        return result;
    } // End of the boundary-LESS mode ( processing the mail which has no boundaries in the primary headers )

    if ((BS_top()!=NULL)&&(result == 0))
    {
        // Commence decoding WITH boundary awareness.
        if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Decoding with boundaries (filename = %s)\n",FL,h->filename);

        // Decode the data in the current MIME segment
        // based on the header information retrieved from
        // the start of this function.
        result = MIME_decode_encoding(f, unpackdir, h, ss);
        if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Done decoding, result = %d",FL,result);
        if (result == 0)
        {
            if (BS_top()!=NULL)
            {
                // As this is a multipart email, then, each section will have its
                // own headers, so, we just simply call the MIMEH_parse call again
                // and get the attachment details
                while ((result == 0)||(result == MIME_STATUS_ZERO_FILE)||(result == MIME_ERROR_RECURSION_LIMIT_REACHED))
                {
                    h->content_type = -1;
                    h->filename[0] = '\0';
                    h->name[0]     = '\0';
                    h->content_transfer_encoding = -1;
                    h->content_disposition = -1;

                    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Decoding headers...\n",FL);
                    do {
                        result = MIMEH_parse_headers(f,h);
                    } while ((h->sanity == 0)&&(result != -1));

                    glb.header_defect_count += MIMEH_get_defect_count(h);
                    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Mime header parsing result = %d\n",FL, result);
                    // 20040305-1331:PLD
                    if (result == -1)
                    {
                        result = MIME_ERROR_FFGET_EMPTY;
                        return result;
                    }

                    if (h->boundary_located)
                    {
                        if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Pushing boundary %s\n",FL, h->boundary);
                        BS_push(h->boundary);
                        h->boundary_located = 0;
                    }

                    if (result == _MIMEH_FOUND_FROM)
                    {
                        return _MIMEH_FOUND_FROM;
                    }

                    if (result == 0)
                    {
                        // If we locate a new boundary specified, it means we have a
                        // embedded message, also if we have a ctype of RFC822
                        if ( (h->boundary_located) \
                                || (h->content_type == _CTYPE_RFC822)\
                                || (MIMEH_is_contenttype(_CTYPE_MULTIPART, h->content_type))\
                            )
                        {
                            if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Multipart/RFC822 mail headers found\n",FL);
                            /* If there is no filename, then we have a "standard"
                             * embedded message, which can be just read off as a
                             * continuous stream (simply with new boundaries */
                            if (( h->content_type == _CTYPE_RFC822 ))
                            {
                                // If the content_type is set to message/RFC822
                                // then we simply read off the data to the next
                                // boundary into a seperate file, then 'reload'
                                // the file into ripMIME.  Certainly, this is not
                                // the most efficent way of dealing with nested emails
                                // however, it is a rather robust/reliable way.
                                if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Chose Content-type == RFC822 clause",FL);
                                if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Calling MIME_decode_encoding()",FL);
                                result = MIME_handle_rfc822(f,unpackdir,h,current_recursion_level,ss);
                                // First up - extract the RFC822 body out of the parent mailpack
                                // XX result = MIME_decode_encoding( f, unpackdir, h, ss );

                                // Now decode the RFC822 body.
                                /**
                                  XX
                                  if (result == 0)
                                  {
                                  snprintf(scratch,sizeof(scratch),"%s/%s",unpackdir, h->filename);
                                  snprintf(h->filename,sizeof(h->filename),"%s",scratch);
                                  if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Now calling MIME_unpack_single() on the file '%s' for our RFC822 decode operation.",FL, scratch);
                                //result = MIME_unpack_single( unpackdir, h->filename, current_recursion_level +1, ss);
                                result = MIME_unpack( unpackdir, h->filename, current_recursion_level +1  );
                                if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Unpack result = %d", FL, result);
                                result = 0;
                                } else return result; // 20040305-1312:PLD
                                */
                            } else if (( h->content_transfer_encoding != _CTRANS_ENCODING_B64)&&(h->filename[0] == '\0' )) {

                                // Decode nameless MIME segments which are not BASE64 encoded
                                //
                                // To be honest, i've forgotten what this section of test is supposed to pick out
                                // in terms of files - certainly it does pick out some, but I'm not sure what format
                                // they are.  Shame on me for not remembering, in future I must comment more.
                                if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: NON-BASE64 DECODE\n",FL);
                                h->boundary_located = 0;
                                result = MIME_unpack_stage2(f, unpackdir, h, current_recursion_level , ss);

                                // When we've exited from decoding the sub-mailpack, we need to restore the original
                                // boundary
                                p = BS_top();
                                if (p) snprintf(h->boundary,_MIME_STRLEN_MAX,"%s",p);

                                /** 20041207-0106:PLD:
                                 ** changed to test for _INLINE **/
                                //} else if (( h->content_type = _CTYPE_MULTIPART_APPLEDOUBLE )&&(h->content_disposition != _CDISPOSITION_INLINE)) {
                        } else if (( h->content_type = _CTYPE_MULTIPART_APPLEDOUBLE )&&(h->content_disposition != _CDISPOSITION_INLINE)) {

                            // AppleDouble needs to be handled explicity - as even though it's
                            //      and embedded format, it does not have the normal headers->[headers->data]
                            //      layout of other nested emails

                            if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Handle Appledouble explicitly",FL);
                            result = MIME_unpack_stage2(f, unpackdir, h, current_recursion_level , ss);

                        } else {
                            if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: RFC822 Message to be decoded...\n",FL);
                            result = MIME_decode_encoding( f, unpackdir, h, ss );
                            if (result != 0) return result; // 20040305-1313:PLD
                            else
                            {
                                if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Now running ripMIME over decoded RFC822 message...\n",FL);

                                // Because we're calling MIME_unpack_single again [ie, recursively calling it
                                // we need to now adjust the input-filename so that it correctly is prefixed
                                // with the directory we unpacked to.

                                snprintf(scratch,sizeof(scratch),"%s/%s",unpackdir, h->filename);
                                snprintf(h->filename,sizeof(h->filename),"%s",scratch);
                                //result = MIME_unpack_single( unpackdir, h->filename, current_recursion_level +1, ss);
                                result = MIME_unpack_single( unpackdir, h->filename, current_recursion_level,ss );
                            }

                        } // else-if transfer-encoding wasn't B64 and filename was blank
                        } else {
                            // If the attachment included in this MIME segment is NOT a
                            // multipart or RFC822 embedded email, we can then simply use
                            // the normal decoding function to interpret its data.
                            if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Decoding a normal attachment \n",FL);
                            result = MIME_decode_encoding( f, unpackdir, h, ss );

                            if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Decoding a normal attachment '%s' done. \n",FL, h->filename);
                            // See if we have an attachment output which is actually another
                            //      email.
                            //
                            // Added 24 Aug 2003 by PLD
                            //      Ricardo Kleemann supplied offending mailpack to display
                            //      this behavior
                            if (result != 0) return result; // 20040305-1314:PLD
                            else
                            {
                                char *mime_fname;

                                mime_fname = PLD_dprintf("%s/%s", unpackdir, h->filename);
                                if(mime_fname != NULL)
                                {
                                    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Testing '%s' for email type",FL,mime_fname);
                                    if (MIME_is_file_RFC822(mime_fname))
                                    {
                                        //MIME_unpack_single( unpackdir, mime_fname, (hinfo->current_recursion_level+1), ss);
                                        MIME_unpack_single( unpackdir, mime_fname, current_recursion_level+1,ss);
                                    }
                                    free(mime_fname);
                                }
                            }
                        } // if there was a boundary, RFC822 content or it was multi-part
                    } else {
                        // if the result is not 0
                        break;
                    } // result == 0 test
                } // While (result)

                // ???? Why do we bother to pop the stack ???
                //  The way BS is designed it will auto-pop the inner nested boundaries
                //      when a higher-up one is located.
                //if (result == 0) BS_pop(); // 20040305-2219:PLD
            } // if MIME_BS_top()
        } // if result == 0
    } // if (result)
    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_stage2:DEBUG: Exiting with result=%d recursion=%d\n",FL,result, current_recursion_level);
    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %r14
movl %ecx, %ebx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
cmpl $0x0, 0x1a129(%rip)     # 0x20300
jle 0x61f5
leaq 0xd115(%rip), %rdi      # 0x132f5
leaq 0xb1f8(%rip), %rsi      # 0x113df
movl $0xa98, %edx            # imm = 0xA98
movl %ebx, %ecx
xorl %eax, %eax
callq 0xc2a1
movl 0x1a954(%rip), %r8d     # 0x20b50
cmpl %ebx, %r8d
jge 0x622e
movl $0xf0, %r14d
cmpl $0x0, 0x1a0de(%rip)     # 0x202ec
jle 0x6a1e
leaq 0xd10f(%rip), %rdi      # 0x1332a
leaq 0xb1bd(%rip), %rsi      # 0x113df
movl $0xa9d, %edx            # imm = 0xA9D
movl %ebx, %ecx
jmp 0x64d7
movq %r12, 0x18(%rsp)
movq %r14, 0x8(%rsp)
cmpl $0x0, 0x1a0c1(%rip)     # 0x20300
jle 0x625b
leaq 0xd13f(%rip), %rdi      # 0x13387
leaq 0xb190(%rip), %rsi      # 0x113df
movl $0xaa3, %edx            # imm = 0xAA3
xorl %eax, %eax
callq 0xc2a1
leaq 0xd160(%rip), %rbp      # 0x133c2
leaq 0xb176(%rip), %r12      # 0x113df
movq %r13, %rdi
movq %r15, %rsi
callq 0xabfa
movl %eax, %r14d
cmpl $0x0, 0x1a082(%rip)     # 0x20300
jle 0x629c
movl 0x18d30(%r15), %ecx
movq %rbp, %rdi
movq %r12, %rsi
movl $0xaa9, %edx            # imm = 0xAA9
movl %r14d, %r8d
xorl %eax, %eax
callq 0xc2a1
movl 0x18d30(%r15), %ecx
testl %ecx, %ecx
jne 0x62ad
cmpl $-0x1, %r14d
jne 0x6269
cmpl $0x0, 0x1a04c(%rip)     # 0x20300
jle 0x62d3
leaq 0xd157(%rip), %rdi      # 0x13414
leaq 0xb11b(%rip), %rsi      # 0x113df
movl $0xaac, %edx            # imm = 0xAAC
movl %r14d, %r8d
xorl %eax, %eax
callq 0xc2a1
movq %r15, %rdi
callq 0xae1d
addl %eax, 0x19bff(%rip)     # 0x1fee0
cmpl $-0x1, %r14d
movq 0x18(%rsp), %rbp
je 0x6a18
cmpb $0x0, 0x1d069(%rip)     # 0x23360
jne 0x631f
leaq 0x59fc(%r15), %rcx
cmpb $0x0, (%rcx)
je 0x631f
leaq 0x1d054(%rip), %rdi     # 0x23360
leaq 0x10d4d(%rip), %rdx     # 0x17060
movl $0x3ff, %esi            # imm = 0x3FF
xorl %eax, %eax
callq 0x2140
cmpl $0x0, 0x19fda(%rip)     # 0x20300
jle 0x634c
movl 0x59f8(%r15), %r8d
leaq 0xd13b(%rip), %rdi      # 0x13471
leaq 0xb0a2(%rip), %rsi      # 0x113df
movl $0xabd, %edx            # imm = 0xABD
movl %r14d, %ecx
xorl %eax, %eax
callq 0xc2a1
callq 0x7c14
testl %eax, %eax
je 0x637b
callq 0x7c3d
movq %rax, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movl %ebx, %ecx
callq 0x4cff
xorl %edi, %edi
callq 0x7c1b
leaq 0x1d7f8(%rip), %rax     # 0x23b70
andl $0x0, (%rax)
cmpl $0x0, 0x59f8(%r15)
movl 0x19f77(%rip), %eax     # 0x20300
je 0x64e3
testl %eax, %eax
jle 0x63b4
leaq 0x31fe(%r15), %rcx
leaq 0xd124(%rip), %rdi      # 0x134c5
leaq 0xb037(%rip), %rsi      # 0x113df
movl $0xad2, %edx            # imm = 0xAD2
xorl %eax, %eax
callq 0xc2a1
leaq 0x31fe(%r15), %r12
movq %r12, %rdi
callq 0xccb7
movq %r12, (%rsp)
movq %r12, %rdi
callq 0x2110
movq %rax, %r12
cmpb $0x22, 0x31fe(%r15)
jne 0x63f3
leaq 0x31ff(%r15), %rdi
callq 0xccb7
pushq $0x6
popq %rsi
movq %r15, %rdi
callq 0x7d08
movq (%rsp), %rax
cmpb $0x22, -0x1(%rax,%r12)
jne 0x6425
movb $0x0, 0x31fd(%r15,%r12)
movq (%rsp), %rdi
callq 0xccb7
movb $0x22, 0x31fd(%r15,%r12)
pushq $0x6
popq %rsi
movq %r15, %rdi
callq 0x7d08
andl $0x0, 0x59f8(%r15)
callq 0xce57
testq %rax, %rax
setne %al
testl %r14d, %r14d
sete %cl
testb %cl, %al
je 0x64b1
cmpl $0x0, 0x19eb7(%rip)     # 0x20300
jle 0x646c
leaq 0x5efd(%r15), %rcx
leaq 0xd1b8(%rip), %rdi      # 0x13611
leaq 0xaf7f(%rip), %rsi      # 0x113df
movl $0xaf5, %edx            # imm = 0xAF5
xorl %eax, %eax
callq 0xc2a1
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq 0x8(%rsp), %rcx
callq 0x561f
movl %eax, %r14d
cmpl $0x0, 0x19e77(%rip)     # 0x20300
jle 0x64a8
leaq 0xd1c9(%rip), %rdi      # 0x1365b
leaq 0xaf46(%rip), %rsi      # 0x113df
movl $0xafb, %edx            # imm = 0xAFB
movl %r14d, %ecx
xorl %eax, %eax
callq 0xc2a1
testl %r14d, %r14d
je 0x65ae
cmpl $0x0, 0x19e48(%rip)     # 0x20300
jle 0x6a1e
leaq 0xd50f(%rip), %rdi      # 0x139d4
leaq 0xaf13(%rip), %rsi      # 0x113df
movl $0xbaa, %edx            # imm = 0xBAA
movl %r14d, %ecx
movl %ebx, %r8d
xorl %eax, %eax
callq 0xc2a1
jmp 0x6a1e
testl %eax, %eax
jle 0x6501
leaq 0xd020(%rip), %rdi      # 0x1350e
leaq 0xaeea(%rip), %rsi      # 0x113df
movl $0xae1, %edx            # imm = 0xAE1
xorl %eax, %eax
callq 0xc2a1
movl 0x27f8(%r15), %esi
cmpl $0x1f4, %esi            # imm = 0x1F4
movq 0x8(%rsp), %r14
jne 0x6559
cmpl $0x0, 0x19de4(%rip)     # 0x20300
jle 0x6538
leaq 0xd029(%rip), %rdi      # 0x1354e
leaq 0xaeb3(%rip), %rsi      # 0x113df
movl $0xae5, %edx            # imm = 0xAE5
xorl %eax, %eax
callq 0xc2a1
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movl %ebx, %ecx
movq %r14, %r8
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6a8f
pushq $0x64
popq %rdi
callq 0x7d51
movl 0x19d99(%rip), %ecx     # 0x20300
testl %eax, %eax
je 0x6a30
testl %ecx, %ecx
jle 0x658d
leaq 0xd012(%rip), %rdi      # 0x1358c
leaq 0xae5e(%rip), %rsi      # 0x113df
movl $0xae9, %edx            # imm = 0xAE9
xorl %eax, %eax
callq 0xc2a1
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movl %ebx, %ecx
movq %r14, %r8
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6020
callq 0xce57
testq %rax, %rax
je 0x6a76
leaq 0x5efd(%r15), %rax
movq %rax, 0x10(%rsp)
leal 0x1(%rbx), %eax
movl %eax, 0x24(%rsp)
xorl %r12d, %r12d
xorl %r14d, %r14d
testl %r14d, %r14d
movq 0x18(%rsp), %rbp
je 0x65f2
cmpl $0xf0, %r14d
je 0x65f2
cmpl $0x64, %r14d
jne 0x64b1
orl $-0x1, 0x27f8(%r15)
movb %r12b, 0x5efd(%r15)
movb %r12b, 0x6efe(%r15)
orl $-0x1, 0x166f8(%r15)
orl $-0x1, 0x17100(%r15)
cmpl $0x0, 0x19ce1(%rip)     # 0x20300
jle 0x663b
leaq 0xd06e(%rip), %rdi      # 0x13696
leaq 0xadb0(%rip), %rsi      # 0x113df
movl $0xb0b, %edx            # imm = 0xB0B
xorl %eax, %eax
callq 0xc2a1
movq %r13, %rdi
movq %r15, %rsi
callq 0xabfa
movl %eax, %r14d
cmpl $0x0, 0x18d30(%r15)
jne 0x6659
cmpl $-0x1, %r14d
jne 0x663b
movq %r15, %rdi
callq 0xae1d
addl %eax, 0x19879(%rip)     # 0x1fee0
cmpl $0x0, 0x19c92(%rip)     # 0x20300
jle 0x668d
leaq 0xd054(%rip), %rdi      # 0x136cb
leaq 0xad61(%rip), %rsi      # 0x113df
movl $0xb11, %edx            # imm = 0xB11
movl %r14d, %ecx
xorl %eax, %eax
callq 0xc2a1
cmpl $-0x1, %r14d
je 0x6a18
cmpl $0x0, 0x59f8(%r15)
je 0x66dd
cmpl $0x0, 0x19c58(%rip)     # 0x20300
movq (%rsp), %rdi
jle 0x66d0
leaq 0xd057(%rip), %rdi      # 0x1370c
leaq 0xad23(%rip), %rsi      # 0x113df
movl $0xb1b, %edx            # imm = 0xB1B
movq (%rsp), %rcx
xorl %eax, %eax
callq 0xc2a1
movq (%rsp), %rdi
callq 0xccb7
andl $0x0, 0x59f8(%r15)
testl %r14d, %r14d
jne 0x6a7e
movl 0x27f8(%r15), %esi
cmpl $0x1f4, %esi            # imm = 0x1F4
je 0x6705
pushq $0x64
popq %rdi
callq 0x7d51
testl %eax, %eax
je 0x688a
cmpl $0x0, 0x19bf4(%rip)     # 0x20300
movq 0x8(%rsp), %r14
jle 0x672d
leaq 0xd027(%rip), %rdi      # 0x13741
leaq 0xacbe(%rip), %rsi      # 0x113df
movl $0xb2e, %edx            # imm = 0xB2E
xorl %eax, %eax
callq 0xc2a1
cmpl $0x1f4, 0x27f8(%r15) # imm = 0x1F4
jne 0x679b
cmpl $0x0, 0x19bbf(%rip)     # 0x20300
jle 0x6780
leaq 0xd03c(%rip), %rdi      # 0x13786
leaq 0xac8e(%rip), %rsi      # 0x113df
movl $0xb3a, %edx            # imm = 0xB3A
xorl %eax, %eax
callq 0xc2a1
cmpl $0x0, 0x19b9c(%rip)     # 0x20300
jle 0x6780
leaq 0xd05d(%rip), %rdi      # 0x137ca
leaq 0xac6b(%rip), %rsi      # 0x113df
movl $0xb3b, %edx            # imm = 0xB3B
xorl %eax, %eax
callq 0xc2a1
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movl %ebx, %ecx
movq %r14, %r8
callq 0x6a8f
movl %eax, %r14d
jmp 0x65d5
cmpl $0x64, 0x166f8(%r15)
je 0x67b3
movq 0x10(%rsp), %rax
cmpb $0x0, (%rax)
je 0x69aa
movl $0x66, 0x27f8(%r15)
cmpl $0x64, 0x17100(%r15)
movl 0x19b34(%rip), %eax     # 0x20300
jne 0x6971
testl %eax, %eax
jle 0x67f0
leaq 0xd09d(%rip), %rdi      # 0x1387a
leaq 0xabfb(%rip), %rsi      # 0x113df
movl $0xb6b, %edx            # imm = 0xB6B
xorl %eax, %eax
callq 0xc2a1
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x561f
testl %eax, %eax
jne 0x6a8a
cmpl $0x0, 0x19af0(%rip)     # 0x20300
jle 0x682c
leaq 0xd0a2(%rip), %rdi      # 0x138bb
leaq 0xabbf(%rip), %rsi      # 0x113df
movl $0xb70, %edx            # imm = 0xB70
xorl %eax, %eax
callq 0xc2a1
movl $0x400, %esi            # imm = 0x400
leaq 0x1cf28(%rip), %r12     # 0x23760
movq %r12, %rdi
leaq 0xabca(%rip), %rdx      # 0x1140c
movq %rbp, %rcx
movq 0x10(%rsp), %r14
movq %r14, %r8
xorl %eax, %eax
callq 0x2140
movl $0x1001, %esi           # imm = 0x1001
movq %r14, %rdi
leaq 0x107fd(%rip), %rdx     # 0x17060
movq %r12, %rcx
xorl %eax, %eax
callq 0x2140
movq %rbp, %rdi
movq %r14, %rsi
movl %ebx, %edx
movq 0x8(%rsp), %rcx
callq 0x5d29
movl %eax, %r14d
xorl %r12d, %r12d
jmp 0x65d5
cmpl $0x0, 0x19a6f(%rip)     # 0x20300
movq 0x8(%rsp), %r14
jle 0x68b2
leaq 0xd070(%rip), %rdi      # 0x1390f
leaq 0xab39(%rip), %rsi      # 0x113df
movl $0xb81, %edx            # imm = 0xB81
xorl %eax, %eax
callq 0xc2a1
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x561f
movl %eax, %r14d
cmpl $0x0, 0x19a33(%rip)     # 0x20300
jle 0x68ee
leaq 0xd078(%rip), %rdi      # 0x1394e
leaq 0xab02(%rip), %rsi      # 0x113df
movl $0xb84, %edx            # imm = 0xB84
movq 0x10(%rsp), %rcx
xorl %eax, %eax
callq 0xc2a1
testl %r14d, %r14d
jne 0x6a1e
xorl %r14d, %r14d
leaq 0xab0b(%rip), %rdi      # 0x1140c
movq %rbp, %rsi
movq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0xbfbe
testq %rax, %rax
je 0x65d5
movq %rax, %rbp
cmpl $0x0, 0x199dd(%rip)     # 0x20300
jle 0x6942
leaq 0xd06c(%rip), %rdi      # 0x13998
leaq 0xaaac(%rip), %rsi      # 0x113df
movl $0xb93, %edx            # imm = 0xB93
movq %rbp, %rcx
xorl %eax, %eax
callq 0xc2a1
movq %rbp, %rdi
callq 0x3874
testl %eax, %eax
je 0x6964
movq 0x18(%rsp), %rdi
movq %rbp, %rsi
movl 0x24(%rsp), %edx
movq 0x8(%rsp), %rcx
callq 0x5d29
movq %rbp, %rdi
callq 0x2030
jmp 0x65d5
testl %eax, %eax
jle 0x698f
leaq 0xcec0(%rip), %rdi      # 0x1383c
leaq 0xaa5c(%rip), %rsi      # 0x113df
movl $0xb67, %edx            # imm = 0xB67
xorl %eax, %eax
callq 0xc2a1
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movl %ebx, %ecx
movq %r14, %r8
callq 0x61b4
movl %eax, %r14d
jmp 0x65d5
cmpl $0x0, 0x1994f(%rip)     # 0x20300
jle 0x69cd
leaq 0xce4f(%rip), %rdi      # 0x13809
leaq 0xaa1e(%rip), %rsi      # 0x113df
movl $0xb55, %edx            # imm = 0xB55
xorl %eax, %eax
callq 0xc2a1
andl $0x0, 0x59f8(%r15)
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movl %ebx, %ecx
movq %r14, %r8
callq 0x61b4
movl %eax, %r14d
callq 0xce57
testq %rax, %rax
je 0x65d5
movl $0x3ff, %esi            # imm = 0x3FF
movq (%rsp), %rdi
leaq 0x10657(%rip), %rdx     # 0x17060
movq %rax, %rcx
xorl %eax, %eax
callq 0x2140
jmp 0x65d5
movl $0xf1, %r14d
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %ecx, %ecx
jle 0x6a55
leaq 0x5efd(%r15), %rcx
leaq 0xcb8b(%rip), %rdi      # 0x135cd
leaq 0xa996(%rip), %rsi      # 0x113df
movl $0xaec, %edx            # imm = 0xAEC
xorl %eax, %eax
callq 0xc2a1
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movl %ebx, %ecx
movq %r14, %r8
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6ce0
xorl %r14d, %r14d
jmp 0x64b1
cmpl $0x64, %r14d
jne 0x64b1
jmp 0x6a1e
movl %eax, %r14d
jmp 0x6a1e