// File: /workspace/github_c_makefile_star2_O1/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 0x1bb5d(%rip), %r8d     # 0x21b50
cmpl %edx, %r8d
jge 0x601e
leaq 0xeaf1(%rip), %rdi      # 0x14af0
leaq 0xc3d9(%rip), %rsi      # 0x123df
movl $0xc34, %edx            # imm = 0xC34
movl %ebp, %ecx
xorl %eax, %eax
callq 0xc960
movl $0xf0, %ebx
jmp 0x61a6
movq %rcx, %r14
movq %rsi, %rbx
movq %rdi, %r15
cmpl $0x0, 0x1b2d2(%rip)     # 0x21300
jle 0x6057
movl %r8d, (%rsp)
leaq 0xeb12(%rip), %rdi      # 0x14b4d
leaq 0xc39d(%rip), %rsi      # 0x123df
movl $0xc38, %edx            # imm = 0xC38
movq %r15, %rcx
movq %rbx, %r8
movl %ebp, %r9d
xorl %eax, %eax
callq 0xc960
cmpb $0x2d, (%rbx)
jne 0x6062
cmpb $0x0, 0x1(%rbx)
je 0x60c3
leaq 0x1046b(%rip), %rsi     # 0x164d4
movq %rbx, %rdi
callq 0x2350
testq %rax, %rax
je 0x60a1
movq %rax, %r12
cmpl $0x0, 0x1b280(%rip)     # 0x21300
jle 0x60f0
leaq 0xeb81(%rip), %rdi      # 0x14c0a
leaq 0xc34f(%rip), %rsi      # 0x123df
movl $0xc47, %edx            # imm = 0xC47
movq %rbx, %rcx
xorl %eax, %eax
callq 0xc960
jmp 0x60f0
leaq 0xeb1e(%rip), %rdi      # 0x14bc6
leaq 0xc330(%rip), %rsi      # 0x123df
movl $0xc44, %edx            # imm = 0xC44
movq %rbx, %rcx
xorl %eax, %eax
callq 0xc960
jmp 0x61a1
cmpl $0x0, 0x1b236(%rip)     # 0x21300
jle 0x60e6
leaq 0xeac2(%rip), %rdi      # 0x14b95
leaq 0xc305(%rip), %rsi      # 0x123df
movl $0xc3c, %edx            # imm = 0xC3C
xorl %eax, %eax
callq 0xc960
movq 0x19eeb(%rip), %rax     # 0x1ffd8
movq (%rax), %r12
cmpl $0x0, 0x1b209(%rip)     # 0x21300
jle 0x6113
leaq 0xeb45(%rip), %rdi      # 0x14c45
leaq 0xc2d8(%rip), %rsi      # 0x123df
movl $0xc49, %edx            # imm = 0xC49
xorl %eax, %eax
callq 0xc960
testq %r12, %r12
je 0x6175
movq %r15, %rdi
movq %r12, %rsi
movl %ebp, %edx
movq %r14, %rcx
callq 0x7338
movl %eax, %r14d
cmpl $0x0, 0x1b1ce(%rip)     # 0x21300
jle 0x6157
leaq 0xeb8c(%rip), %rdi      # 0x14cc7
leaq 0xc29d(%rip), %rsi      # 0x123df
movl $0xc52, %edx            # imm = 0xC52
movl %r14d, %ecx
movl %ebp, %r8d
movq %rbx, %r9
xorl %eax, %eax
callq 0xc960
xorl %ebx, %ebx
cmpl $0xf1, %r14d
cmovnel %r14d, %ebx
cmpl $0x2, %ebp
cmovll %r14d, %ebx
movq %r12, %rdi
callq 0x20f0
jmp 0x61a6
callq 0x2060
movl (%rax), %edi
callq 0x23c0
leaq 0xeaf8(%rip), %rdi      # 0x14c80
leaq 0xc250(%rip), %rsi      # 0x123df
movl $0xc4d, %edx            # imm = 0xC4D
movq %rbx, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0xc960
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq