// File: /workspace/github_c_makefile_star2_O0/inflex[P]ripMIME/mime.c
// Function: MIME_unpack_single_fp
int MIME_unpack_single_fp( char *unpackdir, FILE *fi, int current_recursion_level, struct SS_object *ss )
{
    struct MIMEH_header_info h;
    int result = 0;
    int headers_save_set_here = 0;

    FFGET_FILE f;
    FILE *hf = NULL;
    // Because this MIME module gets used in both CLI and daemon modes
    //  we should check to see that we can report to stderr
    //
    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_single_fp:DEBUG: dir=%s level=%d (max = %d)\n",FL, unpackdir, current_recursion_level, glb.max_recursion_level);
    if (current_recursion_level > glb.max_recursion_level)
    {
        LOGGER_log("%s:%d:MIME_unpack_single_fp:WARNING: Current recursion level of %d is greater than permitted %d",FL, current_recursion_level, glb.max_recursion_level);
        //      return -1;
        return MIME_ERROR_RECURSION_LIMIT_REACHED; // 20040305-1302:PLD
        //return 0; // 20040208-1723:PLD
    }
    else h.current_recursion_level = current_recursion_level;
    glb.current_line = 0;
    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_single_fp:DEBUG: recursion level checked...%d\n",FL, current_recursion_level);
    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_single_fp:DEBUG: DumpHeaders = %d\n",FL, glb.save_headers);
    if ((!hf)&&(glb.save_headers)&&(MIMEH_get_headers_save()==0))
    {
        // Prepend the unpackdir path to the headers file name
        snprintf(scratch,sizeof(scratch),"%s/%s",unpackdir, glb.headersname);
        hf = fopen(scratch,"w");
        if (!hf)
        {
            glb.save_headers = 0;
            LOGGER_log("%s:%d:MIME_unpack_single_fp:ERROR: Cannot open '%s' for writing  (%s)",FL, glb.headersname,strerror(errno));
        }
        else
        {
            headers_save_set_here = 1;
            MIMEH_set_headers_save(hf);
        }
    }

    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_single_fp:DEBUG: Setting up streams to decode\n",FL);
    FFGET_setstream(&f, fi);
    /** Initialize the header record **/
    h.boundary[0] = '\0';
    h.boundary_located = 0;
    h.filename[0] = '\0';
    h.name[0]     = '\0';
    h.content_transfer_encoding = -1;
    h.content_disposition = -1;
    h.content_type = -1;
    h.x_mac = 0;
    SS_init(&(h.ss_filenames));
    SS_init(&(h.ss_names));
    if (MIME_DNORMAL) { SS_set_debug(&(h.ss_filenames), 1); SS_set_debug(&(h.ss_names), 1); }
    if (glb.verbose_defects) {
        int i;
        for (i = 0; i < _MIMEH_DEFECT_ARRAY_SIZE; i++)
        {
            h.defects[i] = 0;
        }
    }

    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_single_fp:DEBUG: preparing to decode, calling stage2...\n",FL);
    // 20040318-0001:PLD
    result = MIME_unpack_stage2(&f, unpackdir, &h, current_recursion_level +1, ss);
    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_single_fp:DEBUG: done decoding ( in stage2 ) result=%d, to %s\n",FL, result, unpackdir);
    //  fclose(fi); 20040208-1726:PLD
    if ( headers_save_set_here > 0 )
    {
        if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_single_fp:DEBUG: Closing header file.\n",FL);
        fflush(stdout);
        MIMEH_set_headers_nosave();
        fclose(hf);
    }

    if (glb.verbose_defects) MIMEH_dump_defects(&h);
    /** Flush out the string stacks **/
    SS_done(&(h.ss_filenames));
    SS_done(&(h.ss_names));
    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_unpack_single_fp:DEBUG: Done. Result=%d Recursion=%d\n",FL, result, current_recursion_level);
    return result;
    //  return status; // 20040305-1318:PLD
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1ae00, %rsp          # imm = 0x1AE00
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movl $0x0, -0x18d74(%rbp)
movl $0x0, -0x18d78(%rbp)
movq $0x0, -0x1adf0(%rbp)
cmpl $0x1, 0x1e680(%rip)     # 0x276f0
jl 0x909b
movq -0x10(%rbp), %rcx
movl -0x1c(%rbp), %r8d
movl 0x1eebf(%rip), %r9d     # 0x27f40
leaq 0x12b83(%rip), %rdi     # 0x1bc0b
leaq 0x10440(%rip), %rsi     # 0x194cf
movl $0xc6d, %edx            # imm = 0xC6D
movb $0x0, %al
callq 0x117c0
movl -0x1c(%rbp), %eax
cmpl 0x1ee9c(%rip), %eax     # 0x27f40
jle 0x90d6
movl -0x1c(%rbp), %ecx
movl 0x1ee90(%rip), %r8d     # 0x27f40
leaq 0x12b93(%rip), %rdi     # 0x1bc4a
leaq 0x10411(%rip), %rsi     # 0x194cf
movl $0xc70, %edx            # imm = 0xC70
movb $0x0, %al
callq 0x117c0
movl $0xf0, -0x4(%rbp)
jmp 0x9457
movl -0x1c(%rbp), %eax
movl %eax, -0x1dc(%rbp)
movl $0x0, 0x1ee27(%rip)     # 0x27f10
cmpl $0x1, 0x1e600(%rip)     # 0x276f0
jl 0x910f
movl -0x1c(%rbp), %ecx
leaq 0x12bae(%rip), %rdi     # 0x1bcaa
leaq 0x103cc(%rip), %rsi     # 0x194cf
movl $0xc77, %edx            # imm = 0xC77
movb $0x0, %al
callq 0x117c0
cmpl $0x1, 0x1e5da(%rip)     # 0x276f0
jl 0x9138
movl 0x1edea(%rip), %ecx     # 0x27f08
leaq 0x12bc6(%rip), %rdi     # 0x1bceb
leaq 0x103a3(%rip), %rsi     # 0x194cf
movl $0xc78, %edx            # imm = 0xC78
movb $0x0, %al
callq 0x117c0
cmpq $0x0, -0x1adf0(%rbp)
jne 0x920c
cmpl $0x0, 0x1edbb(%rip)     # 0x27f08
je 0x920c
callq 0xa5a0
cmpl $0x0, %eax
jne 0x920c
movq -0x10(%rbp), %rcx
leaq 0x219e4(%rip), %rdi     # 0x2ab50
movl $0x400, %esi            # imm = 0x400
leaq 0x10384(%rip), %rdx     # 0x194fc
leaq 0x1e151(%rip), %r8      # 0x272d0
addq $0x438, %r8             # imm = 0x438
movb $0x0, %al
callq 0x2130
leaq 0x219bc(%rip), %rdi     # 0x2ab50
leaq 0x10c30(%rip), %rsi     # 0x19dcb
callq 0x2330
movq %rax, -0x1adf0(%rbp)
cmpq $0x0, -0x1adf0(%rbp)
jne 0x91f4
movl $0x0, 0x1ed4d(%rip)     # 0x27f08
callq 0x2050
movl (%rax), %edi
callq 0x23a0
movq %rax, %r8
leaq 0x12b4f(%rip), %rdi     # 0x1bd20
leaq 0x102f7(%rip), %rsi     # 0x194cf
movl $0xc81, %edx            # imm = 0xC81
leaq 0x1e0ec(%rip), %rcx     # 0x272d0
addq $0x438, %rcx            # imm = 0x438
movb $0x0, %al
callq 0x117c0
jmp 0x920a
movl $0x1, -0x18d78(%rbp)
movq -0x1adf0(%rbp), %rdi
callq 0xa510
jmp 0x920c
cmpl $0x1, 0x1e4dd(%rip)     # 0x276f0
jl 0x922f
leaq 0x12b4a(%rip), %rdi     # 0x1bd66
leaq 0x102ac(%rip), %rsi     # 0x194cf
movl $0xc8a, %edx            # imm = 0xC8A
movb $0x0, %al
callq 0x117c0
movq -0x18(%rbp), %rsi
leaq -0x1ade8(%rbp), %rdi
callq 0x9760
movb $0x0, -0x15b72(%rbp)
movl $0x0, -0x13378(%rbp)
movb $0x0, -0x12e73(%rbp)
movb $0x0, -0x11e72(%rbp)
movl $0xffffffff, -0x2678(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x1c70(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x16578(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x44(%rbp)
leaq -0x18d70(%rbp), %rdi
addq $0x15ec8, %rdi          # imm = 0x15EC8
callq 0x3740
leaq -0x18d70(%rbp), %rdi
addq $0x162e0, %rdi          # imm = 0x162E0
callq 0x3740
cmpl $0x1, 0x1e440(%rip)     # 0x276f0
jl 0x92e2
leaq -0x18d70(%rbp), %rdi
addq $0x15ec8, %rdi          # imm = 0x15EC8
movl $0x1, %esi
callq 0x37a0
leaq -0x18d70(%rbp), %rdi
addq $0x162e0, %rdi          # imm = 0x162E0
movl $0x1, %esi
callq 0x37a0
cmpl $0x0, 0x1e3ff(%rip)     # 0x276e8
je 0x9323
movl $0x0, -0x1adf4(%rbp)
cmpl $0x64, -0x1adf4(%rbp)
jge 0x9321
movslq -0x1adf4(%rbp), %rax
movl $0x0, -0x1d8(%rbp,%rax,4)
movl -0x1adf4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1adf4(%rbp)
jmp 0x92f5
jmp 0x9323
cmpl $0x1, 0x1e3c6(%rip)     # 0x276f0
jl 0x9346
leaq 0x12a74(%rip), %rdi     # 0x1bda7
leaq 0x10195(%rip), %rsi     # 0x194cf
movl $0xca0, %edx            # imm = 0xCA0
movb $0x0, %al
callq 0x117c0
movq -0x10(%rbp), %rsi
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movq -0x28(%rbp), %r8
leaq -0x1ade8(%rbp), %rdi
leaq -0x18d70(%rbp), %rdx
callq 0x7e40
movl %eax, -0x18d74(%rbp)
cmpl $0x1, 0x1e37c(%rip)     # 0x276f0
jl 0x939a
movl -0x18d74(%rbp), %ecx
movq -0x10(%rbp), %r8
leaq 0x12a6b(%rip), %rdi     # 0x1bdf2
leaq 0x10141(%rip), %rsi     # 0x194cf
movl $0xca3, %edx            # imm = 0xCA3
movb $0x0, %al
callq 0x117c0
cmpl $0x0, -0x18d78(%rbp)
jle 0x93e6
cmpl $0x1, 0x1e346(%rip)     # 0x276f0
jl 0x93c6
leaq 0x12a90(%rip), %rdi     # 0x1be43
leaq 0x10115(%rip), %rsi     # 0x194cf
movl $0xca7, %edx            # imm = 0xCA7
movb $0x0, %al
callq 0x117c0
movq 0x1cc03(%rip), %rax     # 0x25fd0
movq (%rax), %rdi
callq 0x22b0
callq 0xa580
movq -0x1adf0(%rbp), %rdi
callq 0x20e0
cmpl $0x0, 0x1e2fb(%rip)     # 0x276e8
je 0x93fb
leaq -0x18d70(%rbp), %rdi
callq 0xed50
leaq -0x18d70(%rbp), %rdi
addq $0x15ec8, %rdi          # imm = 0x15EC8
callq 0x37c0
leaq -0x18d70(%rbp), %rdi
addq $0x162e0, %rdi          # imm = 0x162E0
callq 0x37c0
cmpl $0x1, 0x1e2c8(%rip)     # 0x276f0
jl 0x944e
movl -0x18d74(%rbp), %ecx
movl -0x1c(%rbp), %r8d
leaq 0x12a41(%rip), %rdi     # 0x1be7c
leaq 0x1008d(%rip), %rsi     # 0x194cf
movl $0xcb1, %edx            # imm = 0xCB1
movb $0x0, %al
callq 0x117c0
movl -0x18d74(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1ae00, %rsp          # imm = 0x1AE00
popq %rbp
retq
nopw %cs:(%rax,%rax)