// File: /workspace/github_c_makefile_star2_O2/inflex[P]ripMIME/mime.c
// Function: MIME_doubleCR_decode
int MIME_doubleCR_decode( char *filename, char *unpackdir, struct MIMEH_header_info *hinfo, int current_recursion_level )
{
    int result = 0;
    struct MIMEH_header_info h;
    char *p;
    // PLD:260303-1317
    //  if ((p=strrchr(filename,'/'))) p++;
    //  else p = filename;

    p = filename;
    // * Initialise the header fields
    h.uudec_name[0] = '\0';
    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_doubleCR_decode:DEBUG: filename=%s, path=%s, recursion=%d", FL, filename, unpackdir, current_recursion_level );
    memcpy(&h, hinfo, sizeof(h));
    // Works for ripMIME    snprintf(h.filename, sizeof(h.filename), "%s/%s", unpackdir, p);
    snprintf(h.filename, sizeof(h.filename), "%s", p); /// Works for Xamime
    if (MIME_DNORMAL) LOGGER_log("%s:%d:MIME_doubleCR_decode:DEBUG: header.filename = %s", FL, h.filename );
    if (MIME_is_file_RFC822(filename))
    {
        if (MIME_VERBOSE) LOGGER_log("Attempting to decode Double-CR delimeted MIME attachment '%s'\n",filename);
        result = MIME_unpack( unpackdir, filename, current_recursion_level ); // 20040305-1303:PLD - Capture the result of the unpack and propagate up
    }
    else if (UUENCODE_is_file_uuencoded(h.filename))
    {
        if (MIME_VERBOSE) LOGGER_log("Attempting to decode UUENCODED attachment from Double-CR delimeted attachment '%s'\n",filename);
        UUENCODE_set_doubleCR_mode(1);
        result = UUENCODE_decode_uu(NULL, unpackdir, filename, h.uudec_name, _MIMEH_FILENAMELEN_MAX , 1, 1 );
        UUENCODE_set_doubleCR_mode(0);
        glb.attachment_count += result;
        result = 0;
    }
    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18d50, %rsp          # imm = 0x18D50
movl %ecx, %ebp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
cmpl $0x0, 0x1b5e0(%rip)     # 0x20300
jle 0x4d45
leaq 0xd8c0(%rip), %rdi      # 0x125e9
leaq 0xc6af(%rip), %rsi      # 0x113df
movl $0x760, %edx            # imm = 0x760
movq %rbx, %rcx
movq %r14, %r8
movl %ebp, %r9d
xorl %eax, %eax
callq 0xc2a1
leaq 0x8(%rsp), %rdi
movl $0x18d48, %edx          # imm = 0x18D48
movq %r15, %rsi
callq 0x2260
leaq 0x5f05(%rsp), %r15
leaq 0x122fa(%rip), %rdx     # 0x17060
movl $0x1001, %esi           # imm = 0x1001
movq %r15, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2140
cmpl $0x0, 0x1b581(%rip)     # 0x20300
jle 0x4d9e
leaq 0xd8a6(%rip), %rdi      # 0x1262e
leaq 0xc650(%rip), %rsi      # 0x113df
movl $0x764, %edx            # imm = 0x764
movq %r15, %rcx
xorl %eax, %eax
callq 0xc2a1
movq %rbx, %rdi
callq 0x3874
testl %eax, %eax
je 0x4dd6
cmpl $0x0, 0x1b53b(%rip)     # 0x202ec
jle 0x4dc4
leaq 0xd8ab(%rip), %rdi      # 0x12665
movq %rbx, %rsi
xorl %eax, %eax
callq 0xc2a1
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x4e58
movl %eax, %r12d
jmp 0x4e45
movq %r15, %rdi
callq 0xd320
testl %eax, %eax
je 0x4e42
leaq 0x17b98(%rsp), %r15
cmpl $0x0, 0x1b4fb(%rip)     # 0x202ec
jle 0x4e04
leaq 0xd8aa(%rip), %rdi      # 0x126a4
movq %rbx, %rsi
xorl %eax, %eax
callq 0xc2a1
pushq $0x1
popq %rbp
movl %ebp, %edi
callq 0xd1e1
movl $0x1, (%rsp)
xorl %r12d, %r12d
xorl %edi, %edi
movq %r14, %rsi
movq %rbx, %rdx
movq %r15, %rcx
movl $0x1000, %r8d           # imm = 0x1000
movl %ebp, %r9d
callq 0xd3fd
movl %eax, %ebx
xorl %edi, %edi
callq 0xd1e1
addl %ebx, 0x1bcdc(%rip)     # 0x20b1c
jmp 0x4e45
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x18d50, %rsp          # imm = 0x18D50
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq