// File: /workspace/github_c_makefile_star2_O3/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 0x1bc21(%rip), %r8d     # 0x21b50
cmpl %edx, %r8d
jge 0x5f5a
leaq 0xebe5(%rip), %rdi      # 0x14b20
leaq 0xc49d(%rip), %rsi      # 0x123df
movl $0xc34, %edx            # imm = 0xC34
movl %ebp, %ecx
xorl %eax, %eax
callq 0xc84f
movl $0xf0, %ebx
jmp 0x60e6
movq %rcx, %r14
movq %rsi, %rbx
movq %rdi, %r15
cmpl $0x0, 0x1b396(%rip)     # 0x21300
jle 0x5f93
movl %r8d, (%rsp)
leaq 0xec06(%rip), %rdi      # 0x14b7d
leaq 0xc461(%rip), %rsi      # 0x123df
movl $0xc38, %edx            # imm = 0xC38
movq %r15, %rcx
movq %rbx, %r8
movl %ebp, %r9d
xorl %eax, %eax
callq 0xc84f
cmpb $0x2d, (%rbx)
jne 0x5f9e
cmpb $0x0, 0x1(%rbx)
je 0x6003
leaq 0x1055f(%rip), %rsi     # 0x16504
movq %rbx, %rdi
callq 0x2340
testq %rax, %rax
je 0x5fe1
movq %rax, %r12
cmpl $0x0, 0x1b344(%rip)     # 0x21300
jle 0x6058
leaq 0xec71(%rip), %rdi      # 0x14c3a
leaq 0xc40f(%rip), %rsi      # 0x123df
movl $0xc47, %edx            # imm = 0xC47
movq %rbx, %rcx
xorl %eax, %eax
callq 0xc84f
jmp 0x6030
leaq 0xec0e(%rip), %rdi      # 0x14bf6
leaq 0xc3f0(%rip), %rsi      # 0x123df
movl $0xc44, %edx            # imm = 0xC44
movq %rbx, %rcx
xorl %eax, %eax
callq 0xc84f
jmp 0x60e1
cmpl $0x0, 0x1b2f6(%rip)     # 0x21300
jle 0x6026
leaq 0xebb2(%rip), %rdi      # 0x14bc5
leaq 0xc3c5(%rip), %rsi      # 0x123df
movl $0xc3c, %edx            # imm = 0xC3C
xorl %eax, %eax
callq 0xc84f
movq 0x19fab(%rip), %rax     # 0x1ffd8
movq (%rax), %r12
cmpl $0x0, 0x1b2c9(%rip)     # 0x21300
jle 0x6053
leaq 0xec35(%rip), %rdi      # 0x14c75
leaq 0xc398(%rip), %rsi      # 0x123df
movl $0xc49, %edx            # imm = 0xC49
xorl %eax, %eax
callq 0xc84f
testq %r12, %r12
je 0x60b5
movq %r15, %rdi
movq %r12, %rsi
movl %ebp, %edx
movq %r14, %rcx
callq 0x727a
movl %eax, %r14d
cmpl $0x0, 0x1b28e(%rip)     # 0x21300
jle 0x6097
leaq 0xec7c(%rip), %rdi      # 0x14cf7
leaq 0xc35d(%rip), %rsi      # 0x123df
movl $0xc52, %edx            # imm = 0xC52
movl %r14d, %ecx
movl %ebp, %r8d
movq %rbx, %r9
xorl %eax, %eax
callq 0xc84f
xorl %ebx, %ebx
cmpl $0xf1, %r14d
cmovnel %r14d, %ebx
cmpl $0x2, %ebp
cmovll %r14d, %ebx
movq %r12, %rdi
callq 0x20f0
jmp 0x60e6
callq 0x2060
movl (%rax), %edi
callq 0x23b0
leaq 0xebe8(%rip), %rdi      # 0x14cb0
leaq 0xc310(%rip), %rsi      # 0x123df
movl $0xc4d, %edx            # imm = 0xC4D
movq %rbx, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0xc84f
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq