// File: /workspace/github_c_makefile_star2_O2/inflex[P]ripMIME/mime.c
// Function: MIME_unpack_single
int MIME_unpack_single( char *unpackdir, char *mpname, int current_recursion_level, struct SS_object *ss )
{
    FILE *fi;           /* Pointer for the MIME file we're going to be going through */
    int result = 0;

    if (current_recursion_level > glb.max_recursion_level)
    {
        LOGGER_log("%s:%d:MIME_unpack_single: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;
    }

    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_single:DEBUG: dir=%s packname=%s level=%d (max = %d)\n",FL, unpackdir, mpname, current_recursion_level, glb.max_recursion_level);
    /* if we're reading in from STDIN */
    if( mpname[0] == '-' && mpname[1] == '\0' )
    {
        if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_single:DEBUG: STDIN opened...\n",FL);
        fi = stdin;
    }
    else
    {
        fi = fopen(mpname,"r");
        if (!fi)
        {
            LOGGER_log("%s:%d:MIME_unpack_single:ERROR: Cannot open file '%s' for reading.\n",FL, mpname);
            return -1;
        }
        if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_single:DEBUG: Input file (%s) opened...\n",FL, mpname);
    }
    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_single:DEBUG: Checking input streams...\n",FL);
    /* check to see if we had problems opening the file */
    if (fi == NULL)
    {
        LOGGER_log("%s:%d:MIME_unpack_single:ERROR: Could not open mailpack file '%s' (%s)",FL, mpname, strerror(errno));
        return -1;
    }
    // 20040317-2359:PLD
    result = MIME_unpack_single_fp(unpackdir,fi,current_recursion_level , ss);
    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_single:DEBUG: result = %d, recursion = %d, filename = '%s'", FL, result, current_recursion_level, mpname );
    if ((current_recursion_level > 1)&&(result == 241)) result = 0;
    fclose(fi);
    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebp
movl 0x1ae12(%rip), %r8d     # 0x20b50
cmpl %edx, %r8d
jge 0x5d69
leaq 0xddd6(%rip), %rdi      # 0x13b20
leaq 0xb68e(%rip), %rsi      # 0x113df
movl $0xc34, %edx            # imm = 0xC34
movl %ebp, %ecx
xorl %eax, %eax
callq 0xc2a1
movl $0xf0, %ebx
jmp 0x5ef3
movq %rcx, %r14
movq %rsi, %rbx
movq %rdi, %r15
cmpl $0x0, 0x1a587(%rip)     # 0x20300
jle 0x5da2
movl %r8d, (%rsp)
leaq 0xddf7(%rip), %rdi      # 0x13b7d
leaq 0xb652(%rip), %rsi      # 0x113df
movl $0xc38, %edx            # imm = 0xC38
movq %r15, %rcx
movq %rbx, %r8
movl %ebp, %r9d
xorl %eax, %eax
callq 0xc2a1
cmpb $0x2d, (%rbx)
jne 0x5dad
cmpb $0x0, 0x1(%rbx)
je 0x5e12
leaq 0xf750(%rip), %rsi      # 0x15504
movq %rbx, %rdi
callq 0x2350
testq %rax, %rax
je 0x5df0
movq %rax, %r12
cmpl $0x0, 0x1a535(%rip)     # 0x20300
jle 0x5e67
leaq 0xde62(%rip), %rdi      # 0x13c3a
leaq 0xb600(%rip), %rsi      # 0x113df
movl $0xc47, %edx            # imm = 0xC47
movq %rbx, %rcx
xorl %eax, %eax
callq 0xc2a1
jmp 0x5e3f
leaq 0xddff(%rip), %rdi      # 0x13bf6
leaq 0xb5e1(%rip), %rsi      # 0x113df
movl $0xc44, %edx            # imm = 0xC44
movq %rbx, %rcx
xorl %eax, %eax
callq 0xc2a1
jmp 0x5ef0
cmpl $0x0, 0x1a4e7(%rip)     # 0x20300
jle 0x5e35
leaq 0xdda3(%rip), %rdi      # 0x13bc5
leaq 0xb5b6(%rip), %rsi      # 0x113df
movl $0xc3c, %edx            # imm = 0xC3C
xorl %eax, %eax
callq 0xc2a1
movq 0x1919c(%rip), %rax     # 0x1efd8
movq (%rax), %r12
cmpl $0x0, 0x1a4ba(%rip)     # 0x20300
jle 0x5e62
leaq 0xde26(%rip), %rdi      # 0x13c75
leaq 0xb589(%rip), %rsi      # 0x113df
movl $0xc49, %edx            # imm = 0xC49
xorl %eax, %eax
callq 0xc2a1
testq %r12, %r12
je 0x5ec4
movq %r15, %rdi
movq %r12, %rsi
movl %ebp, %edx
movq %r14, %rcx
callq 0x7043
movl %eax, %r14d
cmpl $0x0, 0x1a47f(%rip)     # 0x20300
jle 0x5ea6
leaq 0xde6d(%rip), %rdi      # 0x13cf7
leaq 0xb54e(%rip), %rsi      # 0x113df
movl $0xc52, %edx            # imm = 0xC52
movl %r14d, %ecx
movl %ebp, %r8d
movq %rbx, %r9
xorl %eax, %eax
callq 0xc2a1
xorl %ebx, %ebx
cmpl $0xf1, %r14d
cmovnel %r14d, %ebx
cmpl $0x2, %ebp
cmovll %r14d, %ebx
movq %r12, %rdi
callq 0x20f0
jmp 0x5ef3
callq 0x2060
movl (%rax), %edi
callq 0x23c0
leaq 0xddd9(%rip), %rdi      # 0x13cb0
leaq 0xb501(%rip), %rsi      # 0x113df
movl $0xc4d, %edx            # imm = 0xC4D
movq %rbx, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0xc2a1
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq