// File: /workspace/github_c_makefile_star2_O1/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
movb $0x0, 0x17b98(%rsp)
cmpl $0x0, 0x1c3ee(%rip)     # 0x21300
jle 0x4f37
leaq 0xe69e(%rip), %rdi      # 0x135b9
leaq 0xd4bd(%rip), %rsi      # 0x123df
movl $0x760, %edx            # imm = 0x760
movq %rbx, %rcx
movq %r14, %r8
movl %ebp, %r9d
xorl %eax, %eax
callq 0xc960
leaq 0x8(%rsp), %rdi
movl $0x18d48, %edx          # imm = 0x18D48
movq %r15, %rsi
callq 0x2270
leaq 0x5f05(%rsp), %r15
leaq 0x13135(%rip), %rdx     # 0x1808d
movl $0x1001, %esi           # imm = 0x1001
movq %r15, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2140
cmpl $0x0, 0x1c38f(%rip)     # 0x21300
jle 0x4f90
leaq 0xe684(%rip), %rdi      # 0x135fe
leaq 0xd45e(%rip), %rsi      # 0x123df
movl $0x764, %edx            # imm = 0x764
movq %r15, %rcx
xorl %eax, %eax
callq 0xc960
movq %rbx, %rdi
callq 0x39e8
testl %eax, %eax
je 0x4fc8
cmpl $0x0, 0x1c349(%rip)     # 0x212ec
jle 0x4fb6
leaq 0xe689(%rip), %rdi      # 0x13635
movq %rbx, %rsi
xorl %eax, %eax
callq 0xc960
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x504d
movl %eax, %r12d
jmp 0x503a
movq %r15, %rdi
callq 0xdb03
testl %eax, %eax
je 0x5037
leaq 0x17b98(%rsp), %r15
cmpl $0x0, 0x1c309(%rip)     # 0x212ec
jle 0x4ff6
leaq 0xe688(%rip), %rdi      # 0x13674
movq %rbx, %rsi
xorl %eax, %eax
callq 0xc960
movl $0x1, %edi
callq 0xd9bb
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 0xdbe8
movl %eax, %ebx
xorl %edi, %edi
callq 0xd9bb
addl %ebx, 0x1cae7(%rip)     # 0x21b1c
jmp 0x503a
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x18d50, %rsp          # imm = 0x18D50
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq