// File: /workspace/github_c_makefile_star2_O3/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, 0x1c463(%rip)     # 0x21300
jle 0x4ec2
leaq 0xe743(%rip), %rdi      # 0x135e9
leaq 0xd532(%rip), %rsi      # 0x123df
movl $0x760, %edx            # imm = 0x760
movq %rbx, %rcx
movq %r14, %r8
movl %ebp, %r9d
xorl %eax, %eax
callq 0xc84f
leaq 0x8(%rsp), %rdi
movl $0x18d48, %edx          # imm = 0x18D48
movq %r15, %rsi
callq 0x2260
leaq 0x5f05(%rsp), %r15
leaq 0x1317d(%rip), %rdx     # 0x18060
movl $0x1001, %esi           # imm = 0x1001
movq %r15, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2140
cmpl $0x0, 0x1c404(%rip)     # 0x21300
jle 0x4f1b
leaq 0xe729(%rip), %rdi      # 0x1362e
leaq 0xd4d3(%rip), %rsi      # 0x123df
movl $0x764, %edx            # imm = 0x764
movq %r15, %rcx
xorl %eax, %eax
callq 0xc84f
movq %rbx, %rdi
callq 0x39aa
testl %eax, %eax
je 0x4f53
cmpl $0x0, 0x1c3be(%rip)     # 0x212ec
jle 0x4f41
leaq 0xe72e(%rip), %rdi      # 0x13665
movq %rbx, %rsi
xorl %eax, %eax
callq 0xc84f
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x4fd8
movl %eax, %r12d
jmp 0x4fc5
movq %r15, %rdi
callq 0xd960
testl %eax, %eax
je 0x4fc2
leaq 0x17b98(%rsp), %r15
cmpl $0x0, 0x1c37e(%rip)     # 0x212ec
jle 0x4f81
leaq 0xe72d(%rip), %rdi      # 0x136a4
movq %rbx, %rsi
xorl %eax, %eax
callq 0xc84f
movl $0x1, %edi
callq 0xd81f
movl $0x1, (%rsp)
xorl %r12d, %r12d
xorl %edi, %edi
movq %r14, %rsi
movq %rbx, %rdx
movq %r15, %rcx
movl $0x1000, %r8d           # imm = 0x1000
movl $0x1, %r9d
callq 0xda45
movl %eax, %ebx
xorl %edi, %edi
callq 0xd81f
addl %ebx, 0x1cb5c(%rip)     # 0x21b1c
jmp 0x4fc5
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x18d50, %rsp          # imm = 0x18D50
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq