// File: /workspace/github_c_makefile_star2_O3/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, 0x1af33(%rip)     # 0x21300
jle 0x63eb
leaq 0xdf1f(%rip), %rdi      # 0x142f5
leaq 0xc002(%rip), %rsi      # 0x123df
movl $0xa98, %edx            # imm = 0xA98
movl %ebx, %ecx
xorl %eax, %eax
callq 0xc84f
movl 0x1b75e(%rip), %r8d     # 0x21b50
cmpl %ebx, %r8d
jge 0x6424
movl $0xf0, %r14d
cmpl $0x0, 0x1aee8(%rip)     # 0x212ec
jle 0x6c2d
leaq 0xdf19(%rip), %rdi      # 0x1432a
leaq 0xbfc7(%rip), %rsi      # 0x123df
movl $0xa9d, %edx            # imm = 0xA9D
movl %ebx, %ecx
jmp 0x66d7
movq %r12, 0x18(%rsp)
movq %r14, 0x8(%rsp)
cmpl $0x0, 0x1aecb(%rip)     # 0x21300
jle 0x6451
leaq 0xdf49(%rip), %rdi      # 0x14387
leaq 0xbf9a(%rip), %rsi      # 0x123df
movl $0xaa3, %edx            # imm = 0xAA3
xorl %eax, %eax
callq 0xc84f
leaq 0xdf6a(%rip), %rbp      # 0x143c2
leaq 0xbf80(%rip), %r12      # 0x123df
movq %r13, %rdi
movq %r15, %rsi
callq 0xafd7
movl %eax, %r14d
cmpl $0x0, 0x1ae8c(%rip)     # 0x21300
jle 0x6492
movl 0x18d30(%r15), %ecx
movq %rbp, %rdi
movq %r12, %rsi
movl $0xaa9, %edx            # imm = 0xAA9
movl %r14d, %r8d
xorl %eax, %eax
callq 0xc84f
movl 0x18d30(%r15), %ecx
testl %ecx, %ecx
jne 0x64a3
cmpl $-0x1, %r14d
jne 0x645f
cmpl $0x0, 0x1ae56(%rip)     # 0x21300
jle 0x64c9
leaq 0xdf61(%rip), %rdi      # 0x14414
leaq 0xbf25(%rip), %rsi      # 0x123df
movl $0xaac, %edx            # imm = 0xAAC
movl %r14d, %r8d
xorl %eax, %eax
callq 0xc84f
movq %r15, %rdi
callq 0xb1fd
addl %eax, 0x1aa09(%rip)     # 0x20ee0
cmpl $-0x1, %r14d
movq 0x18(%rsp), %rbp
je 0x6c27
cmpb $0x0, 0x1de73(%rip)     # 0x24360
jne 0x6515
leaq 0x59fc(%r15), %rcx
cmpb $0x0, (%rcx)
je 0x6515
leaq 0x1de5e(%rip), %rdi     # 0x24360
leaq 0x11b57(%rip), %rdx     # 0x18060
movl $0x3ff, %esi            # imm = 0x3FF
xorl %eax, %eax
callq 0x2140
cmpl $0x0, 0x1ade4(%rip)     # 0x21300
jle 0x6542
movl 0x59f8(%r15), %r8d
leaq 0xdf45(%rip), %rdi      # 0x14471
leaq 0xbeac(%rip), %rsi      # 0x123df
movl $0xabd, %edx            # imm = 0xABD
movl %r14d, %ecx
xorl %eax, %eax
callq 0xc84f
callq 0x7e7d
testl %eax, %eax
je 0x6574
callq 0x7ea6
movq %rax, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movl %ebx, %ecx
callq 0x4e7c
xorl %edi, %edi
callq 0x7e84
leaq 0x1e602(%rip), %rax     # 0x24b70
movl $0x0, (%rax)
cmpl $0x0, 0x59f8(%r15)
movl 0x1ad7e(%rip), %eax     # 0x21300
je 0x66e3
testl %eax, %eax
jle 0x65ad
leaq 0x31fe(%r15), %rcx
leaq 0xdf2b(%rip), %rdi      # 0x144c5
leaq 0xbe3e(%rip), %rsi      # 0x123df
movl $0xad2, %edx            # imm = 0xAD2
xorl %eax, %eax
callq 0xc84f
leaq 0x31fe(%r15), %r12
movq %r12, %rdi
callq 0xd2e1
movq %r12, (%rsp)
movq %r12, %rdi
callq 0x2110
movq %rax, %r12
cmpb $0x22, 0x31fe(%r15)
jne 0x65ee
leaq 0x31ff(%r15), %rdi
callq 0xd2e1
movq %r15, %rdi
movl $0x6, %esi
callq 0x7f77
movq (%rsp), %rax
cmpb $0x22, -0x1(%rax,%r12)
jne 0x6622
movb $0x0, 0x31fd(%r15,%r12)
movq (%rsp), %rdi
callq 0xd2e1
movb $0x22, 0x31fd(%r15,%r12)
movq %r15, %rdi
movl $0x6, %esi
callq 0x7f77
movl $0x0, 0x59f8(%r15)
callq 0xd483
testq %rax, %rax
setne %al
testl %r14d, %r14d
sete %cl
testb %cl, %al
je 0x66b1
cmpl $0x0, 0x1acb7(%rip)     # 0x21300
jle 0x666c
leaq 0x5efd(%r15), %rcx
leaq 0xdfb8(%rip), %rdi      # 0x14611
leaq 0xbd7f(%rip), %rsi      # 0x123df
movl $0xaf5, %edx            # imm = 0xAF5
xorl %eax, %eax
callq 0xc84f
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq 0x8(%rsp), %rcx
callq 0x580c
movl %eax, %r14d
cmpl $0x0, 0x1ac77(%rip)     # 0x21300
jle 0x66a8
leaq 0xdfc9(%rip), %rdi      # 0x1465b
leaq 0xbd46(%rip), %rsi      # 0x123df
movl $0xafb, %edx            # imm = 0xAFB
movl %r14d, %ecx
xorl %eax, %eax
callq 0xc84f
testl %r14d, %r14d
je 0x67b0
cmpl $0x0, 0x1ac48(%rip)     # 0x21300
jle 0x6c2d
leaq 0xe30f(%rip), %rdi      # 0x149d4
leaq 0xbd13(%rip), %rsi      # 0x123df
movl $0xbaa, %edx            # imm = 0xBAA
movl %r14d, %ecx
movl %ebx, %r8d
xorl %eax, %eax
callq 0xc84f
jmp 0x6c2d
testl %eax, %eax
jle 0x6701
leaq 0xde20(%rip), %rdi      # 0x1450e
leaq 0xbcea(%rip), %rsi      # 0x123df
movl $0xae1, %edx            # imm = 0xAE1
xorl %eax, %eax
callq 0xc84f
movl 0x27f8(%r15), %esi
cmpl $0x1f4, %esi            # imm = 0x1F4
movq 0x8(%rsp), %r14
jne 0x6759
cmpl $0x0, 0x1abe4(%rip)     # 0x21300
jle 0x6738
leaq 0xde29(%rip), %rdi      # 0x1454e
leaq 0xbcb3(%rip), %rsi      # 0x123df
movl $0xae5, %edx            # imm = 0xAE5
xorl %eax, %eax
callq 0xc84f
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 0x6c9e
movl $0x64, %edi
callq 0x7fc0
movl 0x1ab97(%rip), %ecx     # 0x21300
testl %eax, %eax
je 0x6c3f
testl %ecx, %ecx
jle 0x678f
leaq 0xde10(%rip), %rdi      # 0x1458c
leaq 0xbc5c(%rip), %rsi      # 0x123df
movl $0xae9, %edx            # imm = 0xAE9
xorl %eax, %eax
callq 0xc84f
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 0x6213
callq 0xd483
testq %rax, %rax
je 0x6c85
leaq 0x5efd(%r15), %rax
movq %rax, 0x10(%rsp)
leal 0x1(%rbx), %eax
movl %eax, 0x24(%rsp)
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
xorl %r14d, %r14d
testl %r14d, %r14d
movq 0x18(%rsp), %rbp
je 0x67f7
cmpl $0xf0, %r14d
je 0x67f7
cmpl $0x64, %r14d
jne 0x66b1
movl %r12d, 0x27f8(%r15)
xorl %eax, %eax
movb %al, 0x5efd(%r15)
movb %al, 0x6efe(%r15)
movl %r12d, 0x166f8(%r15)
movl %r12d, 0x17100(%r15)
cmpl $0x0, 0x1aadd(%rip)     # 0x21300
jle 0x683f
leaq 0xde6a(%rip), %rdi      # 0x14696
leaq 0xbbac(%rip), %rsi      # 0x123df
movl $0xb0b, %edx            # imm = 0xB0B
xorl %eax, %eax
callq 0xc84f
movq %r13, %rdi
movq %r15, %rsi
callq 0xafd7
movl %eax, %r14d
cmpl $0x0, 0x18d30(%r15)
jne 0x685d
cmpl $-0x1, %r14d
jne 0x683f
movq %r15, %rdi
callq 0xb1fd
addl %eax, 0x1a675(%rip)     # 0x20ee0
cmpl $0x0, 0x1aa8e(%rip)     # 0x21300
jle 0x6891
leaq 0xde50(%rip), %rdi      # 0x146cb
leaq 0xbb5d(%rip), %rsi      # 0x123df
movl $0xb11, %edx            # imm = 0xB11
movl %r14d, %ecx
xorl %eax, %eax
callq 0xc84f
cmpl $-0x1, %r14d
je 0x6c27
cmpl $0x0, 0x59f8(%r15)
je 0x68e4
cmpl $0x0, 0x1aa54(%rip)     # 0x21300
movq (%rsp), %rdi
jle 0x68d4
leaq 0xde53(%rip), %rdi      # 0x1470c
leaq 0xbb1f(%rip), %rsi      # 0x123df
movl $0xb1b, %edx            # imm = 0xB1B
movq (%rsp), %rcx
xorl %eax, %eax
callq 0xc84f
movq (%rsp), %rdi
callq 0xd2e1
movl $0x0, 0x59f8(%r15)
testl %r14d, %r14d
jne 0x6c8d
movl 0x27f8(%r15), %esi
cmpl $0x1f4, %esi            # imm = 0x1F4
je 0x690e
movl $0x64, %edi
callq 0x7fc0
testl %eax, %eax
je 0x6a96
cmpl $0x0, 0x1a9eb(%rip)     # 0x21300
movq 0x8(%rsp), %r14
jle 0x6936
leaq 0xde1e(%rip), %rdi      # 0x14741
leaq 0xbab5(%rip), %rsi      # 0x123df
movl $0xb2e, %edx            # imm = 0xB2E
xorl %eax, %eax
callq 0xc84f
cmpl $0x1f4, 0x27f8(%r15) # imm = 0x1F4
jne 0x69a4
cmpl $0x0, 0x1a9b6(%rip)     # 0x21300
jle 0x6989
leaq 0xde33(%rip), %rdi      # 0x14786
leaq 0xba85(%rip), %rsi      # 0x123df
movl $0xb3a, %edx            # imm = 0xB3A
xorl %eax, %eax
callq 0xc84f
cmpl $0x0, 0x1a993(%rip)     # 0x21300
jle 0x6989
leaq 0xde54(%rip), %rdi      # 0x147ca
leaq 0xba62(%rip), %rsi      # 0x123df
movl $0xb3b, %edx            # imm = 0xB3B
xorl %eax, %eax
callq 0xc84f
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movl %ebx, %ecx
movq %r14, %r8
callq 0x6c9e
movl %eax, %r14d
jmp 0x67da
cmpl $0x64, 0x166f8(%r15)
je 0x69bc
movq 0x10(%rsp), %rax
cmpb $0x0, (%rax)
je 0x6bb6
movl $0x66, 0x27f8(%r15)
cmpl $0x64, 0x17100(%r15)
movl 0x1a92b(%rip), %eax     # 0x21300
jne 0x6b7d
testl %eax, %eax
jle 0x69f9
leaq 0xde94(%rip), %rdi      # 0x1487a
leaq 0xb9f2(%rip), %rsi      # 0x123df
movl $0xb6b, %edx            # imm = 0xB6B
xorl %eax, %eax
callq 0xc84f
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x580c
testl %eax, %eax
jne 0x6c99
cmpl $0x0, 0x1a8e7(%rip)     # 0x21300
jle 0x6a35
leaq 0xde99(%rip), %rdi      # 0x148bb
leaq 0xb9b6(%rip), %rsi      # 0x123df
movl $0xb70, %edx            # imm = 0xB70
xorl %eax, %eax
callq 0xc84f
movl $0x400, %esi            # imm = 0x400
leaq 0x1dd1f(%rip), %r12     # 0x24760
movq %r12, %rdi
leaq 0xb9c1(%rip), %rdx      # 0x1240c
movq %rbp, %rcx
movq 0x10(%rsp), %r14
movq %r14, %r8
xorl %eax, %eax
callq 0x2140
movl $0x1001, %esi           # imm = 0x1001
movq %r14, %rdi
leaq 0x115f4(%rip), %rdx     # 0x18060
movq %r12, %rcx
xorl %eax, %eax
callq 0x2140
movq %rbp, %rdi
movq %r14, %rsi
movl %ebx, %edx
movq 0x8(%rsp), %rcx
callq 0x5f1a
movl %eax, %r14d
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jmp 0x67da
cmpl $0x0, 0x1a863(%rip)     # 0x21300
movq 0x8(%rsp), %r14
jle 0x6abe
leaq 0xde64(%rip), %rdi      # 0x1490f
leaq 0xb92d(%rip), %rsi      # 0x123df
movl $0xb81, %edx            # imm = 0xB81
xorl %eax, %eax
callq 0xc84f
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x580c
movl %eax, %r14d
cmpl $0x0, 0x1a827(%rip)     # 0x21300
jle 0x6afa
leaq 0xde6c(%rip), %rdi      # 0x1494e
leaq 0xb8f6(%rip), %rsi      # 0x123df
movl $0xb84, %edx            # imm = 0xB84
movq 0x10(%rsp), %rcx
xorl %eax, %eax
callq 0xc84f
testl %r14d, %r14d
jne 0x6c2d
xorl %r14d, %r14d
leaq 0xb8ff(%rip), %rdi      # 0x1240c
movq %rbp, %rsi
movq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0xc566
testq %rax, %rax
je 0x67da
movq %rax, %rbp
cmpl $0x0, 0x1a7d1(%rip)     # 0x21300
jle 0x6b4e
leaq 0xde60(%rip), %rdi      # 0x14998
leaq 0xb8a0(%rip), %rsi      # 0x123df
movl $0xb93, %edx            # imm = 0xB93
movq %rbp, %rcx
xorl %eax, %eax
callq 0xc84f
movq %rbp, %rdi
callq 0x39aa
testl %eax, %eax
je 0x6b70
movq 0x18(%rsp), %rdi
movq %rbp, %rsi
movl 0x24(%rsp), %edx
movq 0x8(%rsp), %rcx
callq 0x5f1a
movq %rbp, %rdi
callq 0x2030
jmp 0x67da
testl %eax, %eax
jle 0x6b9b
leaq 0xdcb4(%rip), %rdi      # 0x1483c
leaq 0xb850(%rip), %rsi      # 0x123df
movl $0xb67, %edx            # imm = 0xB67
xorl %eax, %eax
callq 0xc84f
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movl %ebx, %ecx
movq %r14, %r8
callq 0x63aa
movl %eax, %r14d
jmp 0x67da
cmpl $0x0, 0x1a743(%rip)     # 0x21300
jle 0x6bd9
leaq 0xdc43(%rip), %rdi      # 0x14809
leaq 0xb812(%rip), %rsi      # 0x123df
movl $0xb55, %edx            # imm = 0xB55
xorl %eax, %eax
callq 0xc84f
movl $0x0, 0x59f8(%r15)
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
movl %ebx, %ecx
movq %r14, %r8
callq 0x63aa
movl %eax, %r14d
callq 0xd483
testq %rax, %rax
je 0x67da
movl $0x3ff, %esi            # imm = 0x3FF
movq (%rsp), %rdi
leaq 0x11448(%rip), %rdx     # 0x18060
movq %rax, %rcx
xorl %eax, %eax
callq 0x2140
jmp 0x67da
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 0x6c64
leaq 0x5efd(%r15), %rcx
leaq 0xd97c(%rip), %rdi      # 0x145cd
leaq 0xb787(%rip), %rsi      # 0x123df
movl $0xaec, %edx            # imm = 0xAEC
xorl %eax, %eax
callq 0xc84f
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 0x6ef2
xorl %r14d, %r14d
jmp 0x66b1
cmpl $0x64, %r14d
jne 0x66b1
jmp 0x6c2d
movl %eax, %r14d
jmp 0x6c2d