// File: /workspace/github_c_makefile_star2_O0/inflex[P]ripMIME/mime.c
// Function: MIME_handle_multipart
int MIME_handle_multipart( FFGET_FILE *f, char *unpackdir, struct MIMEH_header_info *h, int current_recursion_level, struct SS_object *ss )
{
    int result = 0;
    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_handle_multipart:DEBUG: Decoding multipart/embedded \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_transfer_encoding != _CTRANS_ENCODING_B64)&&( h->filename[0] == '\0' ))
    {
        char *p;

        // If this is a simple 'wrapped' RFC822 email which has no encoding applied to it
        //      (ie, it's just the existing email with a new set of headers around it
        //      then rather than saving it to a file, we'll just peel off these outter
        //      layer of headers and get into the core of the message.  This is why we
        //      call unpack_stage2() because this function just reads the next set of
        //      headers and decodes.
        if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_handle_multipart:DEBUG: Non base64 encoding AND no filename, embedded message\n",FL);
        h->boundary_located = 0;
        result = MIME_unpack_stage2(f, unpackdir, h, current_recursion_level , ss);
        p = BS_top();
        if (p) PLD_strncpy(h->boundary, p,sizeof(h->boundary));
    } else {
        if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_handle_multipart:DEBUG: Embedded message has a filename, decoding to file %s",FL,h->filename);
        result = MIME_decode_encoding( f, unpackdir, h, ss );
        if (result == 0)
        {
            // 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 != B64 && filename was empty
    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_handle_multipart:DEBUG: done handling '%s' result = %d",FL,h->filename, result);
    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
cmpl $0x1, 0x1fa67(%rip)     # 0x276f0
jl 0x7ca5
leaq 0x131d7(%rip), %rdi     # 0x1ae69
leaq 0x11836(%rip), %rsi     # 0x194cf
movl $0x9f3, %edx            # imm = 0x9F3
movb $0x0, %al
callq 0x117c0
movq -0x18(%rbp), %rax
cmpl $0x64, 0x166f8(%rax)
je 0x7d40
movq -0x18(%rbp), %rax
movsbl 0x5efd(%rax), %eax
cmpl $0x0, %eax
jne 0x7d40
cmpl $0x1, 0x1fa23(%rip)     # 0x276f0
jl 0x7ce9
leaq 0x131d4(%rip), %rdi     # 0x1aeaa
leaq 0x117f2(%rip), %rsi     # 0x194cf
movl $0xa02, %edx            # imm = 0xA02
movb $0x0, %al
callq 0x117c0
movq -0x18(%rbp), %rax
movl $0x0, 0x59f8(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x1c(%rbp), %ecx
movq -0x28(%rbp), %r8
callq 0x7e40
movl %eax, -0x2c(%rbp)
callq 0x12b70
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x7d3b
movq -0x18(%rbp), %rdi
addq $0x31fe, %rdi           # imm = 0x31FE
movq -0x38(%rbp), %rsi
movl $0x27f7, %edx           # imm = 0x27F7
callq 0x10640
jmp 0x7dfa
cmpl $0x1, 0x1f9a9(%rip)     # 0x276f0
jl 0x7d6e
movq -0x18(%rbp), %rcx
addq $0x5efd, %rcx           # imm = 0x5EFD
leaq 0x131a9(%rip), %rdi     # 0x1af04
leaq 0x1176d(%rip), %rsi     # 0x194cf
movl $0xa08, %edx            # imm = 0xA08
movb $0x0, %al
callq 0x117c0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x6e60
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jne 0x7df8
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %r8
addq $0x5efd, %r8            # imm = 0x5EFD
leaq 0x22dae(%rip), %rdi     # 0x2ab50
movl $0x400, %esi            # imm = 0x400
leaq 0x1174e(%rip), %rdx     # 0x194fc
movb $0x0, %al
callq 0x2130
movq -0x18(%rbp), %rdi
addq $0x5efd, %rdi           # imm = 0x5EFD
movl $0x1001, %esi           # imm = 0x1001
leaq 0x171de(%rip), %rdx     # 0x1efaa
leaq 0x22d7d(%rip), %rcx     # 0x2ab50
movb $0x0, %al
callq 0x2130
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x5efd, %rsi           # imm = 0x5EFD
movl -0x1c(%rbp), %edx
movq -0x28(%rbp), %rcx
callq 0x78b0
movl %eax, -0x2c(%rbp)
jmp 0x7dfa
cmpl $0x1, 0x1f8ef(%rip)     # 0x276f0
jl 0x7e2c
movq -0x18(%rbp), %rcx
addq $0x5efd, %rcx           # imm = 0x5EFD
movl -0x2c(%rbp), %r8d
leaq 0x13143(%rip), %rdi     # 0x1af5c
leaq 0x116af(%rip), %rsi     # 0x194cf
movl $0xa18, %edx            # imm = 0xA18
movb $0x0, %al
callq 0x117c0
movl -0x2c(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)