// File: /workspace/github_c_makefile_star2_O0/inflex[P]ripMIME/mime.c
// Function: MIME_unpack
int MIME_unpack( char *unpackdir, char *mpname, int current_recursion_level )
{
    int result = 0;
    struct SS_object ss; // Stores the filenames that are created in the unpack operation

    if (current_recursion_level > glb.max_recursion_level) return MIME_ERROR_RECURSION_LIMIT_REACHED;
    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack: Unpacking %s to %s, recursion level is %d",FL,mpname,unpackdir,current_recursion_level);
    MIMEH_set_outputdir(unpackdir);
    if (MIME_DNORMAL) SS_set_debug(&ss,1);
    SS_init(&ss);
    if (glb.mailbox_format > 0)
    {
        if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack: Unpacking using mailbox format",FL);
        result = MIME_unpack_mailbox( unpackdir, mpname, (current_recursion_level), &ss );
    }
    else
    {
        if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack: Unpacking standard mailpack",FL,mpname,unpackdir,current_recursion_level);
        result = MIME_unpack_single( unpackdir, mpname, (current_recursion_level +1), &ss );
    }

    if (glb.no_nameless)
    {
        MIME_postdecode_cleanup( unpackdir, &ss );
    }

    if (MIME_DNORMAL)
    {
        LOGGER_log("%s:%d:MIME_unpack: Files unpacked from '%s' (recursion=%d);",FL,mpname,current_recursion_level);
        SS_dump(&ss);
    }

    SS_done(&ss);
    if (MIME_DNORMAL) SS_set_debug(&ss,1);
    // If the result is a non-critical one (ie, just running out of data from the
    //      file we attempted to decode - then don't propergate it, on the other
    switch (result) {
        case 1:
            result = 0;
            break;
        case MIME_STATUS_ZERO_FILE:
            result = 0;
            break;
        case MIME_ERROR_FFGET_EMPTY:
        case MIME_ERROR_RECURSION_LIMIT_REACHED:
            result = 0;
            break;
        default:
            break;
    }

    if (current_recursion_level == 0)
    {
        //LOGGER_log("%s:%d:MIME_unpack:DEBUG: Clearing boundary stack",FL);
        BS_clear();
    }
    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack: Unpacking of %s is done.",FL,mpname);
    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack: -----------------------------------",FL);
    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x440, %rsp            # imm = 0x440
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x1c(%rbp), %eax
cmpl 0x21c3a(%rip), %eax     # 0x27f40
jle 0x6314
movl $0xf0, -0x4(%rbp)
jmp 0x6523
cmpl $0x1, 0x213d5(%rip)     # 0x276f0
jl 0x6343
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %r8
movl -0x1c(%rbp), %r9d
leaq 0x15b8d(%rip), %rdi     # 0x1bebd
leaq 0x13198(%rip), %rsi     # 0x194cf
movl $0xcc4, %edx            # imm = 0xCC4
movb $0x0, %al
callq 0x117c0
movq -0x10(%rbp), %rdi
callq 0xa440
cmpl $0x1, 0x2139d(%rip)     # 0x276f0
jl 0x6366
leaq -0x438(%rbp), %rdi
movl $0x1, %esi
callq 0x37a0
leaq -0x438(%rbp), %rdi
callq 0x3740
cmpl $0x0, 0x21ba3(%rip)     # 0x27f1c
jle 0x63ba
cmpl $0x1, 0x2136e(%rip)     # 0x276f0
jl 0x639e
leaq 0x15b6f(%rip), %rdi     # 0x1befa
leaq 0x1313d(%rip), %rsi     # 0x194cf
movl $0xcca, %edx            # imm = 0xCCA
movb $0x0, %al
callq 0x117c0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
leaq -0x438(%rbp), %rcx
callq 0x8c80
movl %eax, -0x20(%rbp)
jmp 0x6406
cmpl $0x1, 0x2132f(%rip)     # 0x276f0
jl 0x63e9
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %r8
movl -0x1c(%rbp), %r9d
leaq 0x15b56(%rip), %rdi     # 0x1bf2c
leaq 0x130f2(%rip), %rsi     # 0x194cf
movl $0xccf, %edx            # imm = 0xCCF
movb $0x0, %al
callq 0x117c0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
addl $0x1, %edx
leaq -0x438(%rbp), %rcx
callq 0x78b0
movl %eax, -0x20(%rbp)
cmpl $0x0, 0x21b07(%rip)     # 0x27f14
je 0x641f
movq -0x10(%rbp), %rdi
leaq -0x438(%rbp), %rsi
callq 0x7ae0
cmpl $0x1, 0x212ca(%rip)     # 0x276f0
jl 0x6456
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %r8d
leaq 0x15b24(%rip), %rdi     # 0x1bf5b
leaq 0x13091(%rip), %rsi     # 0x194cf
movl $0xcda, %edx            # imm = 0xCDA
movb $0x0, %al
callq 0x117c0
leaq -0x438(%rbp), %rdi
callq 0x3890
leaq -0x438(%rbp), %rdi
callq 0x37c0
cmpl $0x1, 0x21287(%rip)     # 0x276f0
jl 0x647c
leaq -0x438(%rbp), %rdi
movl $0x1, %esi
callq 0x37a0
movl -0x20(%rbp), %eax
movl %eax, -0x43c(%rbp)
subl $0x1, %eax
je 0x64ab
jmp 0x648c
movl -0x43c(%rbp), %eax
subl $0x64, %eax
je 0x64b4
jmp 0x6499
movl -0x43c(%rbp), %eax
addl $0xffffff10, %eax       # imm = 0xFFFFFF10
subl $0x2, %eax
jb 0x64bd
jmp 0x64c6
movl $0x0, -0x20(%rbp)
jmp 0x64c8
movl $0x0, -0x20(%rbp)
jmp 0x64c8
movl $0x0, -0x20(%rbp)
jmp 0x64c8
jmp 0x64c8
cmpl $0x0, -0x1c(%rbp)
jne 0x64d3
callq 0x12800
cmpl $0x1, 0x21216(%rip)     # 0x276f0
jl 0x64fa
movq -0x18(%rbp), %rcx
leaq 0x15ab0(%rip), %rdi     # 0x1bf97
leaq 0x12fe1(%rip), %rsi     # 0x194cf
movl $0xcf6, %edx            # imm = 0xCF6
movb $0x0, %al
callq 0x117c0
cmpl $0x1, 0x211ef(%rip)     # 0x276f0
jl 0x651d
leaq 0x15ab9(%rip), %rdi     # 0x1bfc3
leaq 0x12fbe(%rip), %rsi     # 0x194cf
movl $0xcf7, %edx            # imm = 0xCF7
movb $0x0, %al
callq 0x117c0
movl -0x20(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x440, %rsp            # imm = 0x440
popq %rbp
retq
nop