// File: /workspace/github_c_makefile_star2_O1/inflex[P]ripMIME/MIME_headers.c
// Function: MIMEH_parse_contenttransferencoding
int MIMEH_parse_contenttransferencoding( char *header_name, char *header_value, struct MIMEH_header_info *hinfo )
{
    char *p, *q;
    char c = '\n';

    // CONTENT TRANSFER ENCODING ---------------------
    // CONTENT TRANSFER ENCODING ---------------------
    // CONTENT TRANSFER ENCODING ---------------------


    p = strstr(header_name,"content-transfer-encoding");
    if (p)
    {
        /** 20041216-1107:PLD: Increase our sanity **/
        hinfo->sanity++;

        q = strpbrk(header_value,"\n\r;");
        if (q != NULL)
        {
            c = *q;
            *q = '\0';
        }

        p = header_value;

        PLD_strlower( p );

        if (strstr(p,"base64"))
        {
            hinfo->content_transfer_encoding = _CTRANS_ENCODING_B64;
            if (MIMEH_DNORMAL) LOGGER_log("%s:%d:MIMEH_parse_contenttransferencoding: Encoding set to BASE64", FL);
        }
        else if (strstr(p,"7bit"))
        {
            hinfo->content_transfer_encoding = _CTRANS_ENCODING_7BIT;
            if (MIMEH_DNORMAL) LOGGER_log("%s:%d:MIMEH_parse_contenttransferencoding: Encoding set to 7-BIT ", FL);
        }
        else if (strstr(p,"8bit"))
        {
            hinfo->content_transfer_encoding = _CTRANS_ENCODING_8BIT;
            if (MIMEH_DNORMAL) LOGGER_log("%s:%d:MIMEH_parse_contenttransferencoding: Encoding set to 8-BIT", FL);
        }
        else if (strstr(p,"quoted-printable"))
        {
            hinfo->content_transfer_encoding = _CTRANS_ENCODING_QP;
            if (MIMEH_DNORMAL) LOGGER_log("%s:%d:MIMEH_parse_contenttransferencoding: Encoding set to Quoted-Printable", FL);
        }
        else if (strstr(p,"binary"))
        {
            hinfo->content_transfer_encoding = _CTRANS_ENCODING_BINARY;
            if (MIMEH_DNORMAL) LOGGER_log("%s:%d:MIMEH_parse_contenttransferencoding: Encoding set to Binary", FL);
        }
        else if (
                (strstr(p,"uu"))
                ||(strstr(p,"x-u"))
                ||(strcmp(p,"u") == 0)
                )
        {
            hinfo->content_transfer_encoding = _CTRANS_ENCODING_UUENCODE;
            if (MIMEH_DNORMAL) LOGGER_log("%s:%d:MIMEH_parse_contenttransferencoding: Encoding set to UUENCODE", FL);
        }
        else hinfo->content_transfer_encoding = _CTRANS_ENCODING_RAW;


        // Copy the string to our content-transfer string storage field
        p = header_value;
        if (p != NULL)
        {
            char *cp = p;

            // Step 1 - jump over any whitespace
            while ( *cp == ' ' || *cp == '\t') cp++;

            // Step 2 - Copy the string
            PLD_strncpy( hinfo->content_transfer_encoding_string, cp, _MIMEH_CONTENT_TRANSFER_ENCODING_MAX);

            // Step 3 - clean up the string
            cp = hinfo->content_transfer_encoding_string;
            while (*cp && *cp != ' ' && *cp != '\t' && *cp != '\n' && *cp != '\r' && *cp != ';') cp++;

            // Step 4 - Terminate the string
            *cp = '\0';
        }

        // Set the character which we changed to a \0 back to its original form so that
        //      we don't cause problems from tainted data for any further parsing calls
        //      which use the data.
        if (q != NULL) *q = c;
    }

    return 0;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
leaq 0xc61d(%rip), %rsi      # 0x16839
callq 0x23d0
testq %rax, %rax
je 0xa454
incl 0x18d30(%rbx)
leaq 0xc61c(%rip), %rsi      # 0x16853
movq %r15, %rdi
callq 0x2300
movq %rax, %r14
testq %rax, %rax
je 0xa250
movb (%r14), %bpl
movb $0x0, (%r14)
jmp 0xa253
movb $0xa, %bpl
movq %r15, %rdi
callq 0xbf91
leaq 0x7faf(%rip), %rsi      # 0x12211
movq %r15, %rdi
callq 0x23d0
testq %rax, %rax
je 0xa29e
movl $0x64, 0x166f8(%rbx)
cmpl $0x0, 0x2210c(%rip)     # 0x2c38c
jle 0xa3fc
leaq 0xc5ca(%rip), %rdi      # 0x16857
leaq 0xb01a(%rip), %rsi      # 0x152ae
movl $0x903, %edx            # imm = 0x903
jmp 0xa3f5
leaq 0xc5f4(%rip), %rsi      # 0x16899
movq %r15, %rdi
callq 0x23d0
testq %rax, %rax
je 0xa2e1
movl $0x65, 0x166f8(%rbx)
cmpl $0x0, 0x220c9(%rip)     # 0x2c38c
jle 0xa3fc
leaq 0xc5ce(%rip), %rdi      # 0x1689e
leaq 0xafd7(%rip), %rsi      # 0x152ae
movl $0x908, %edx            # imm = 0x908
jmp 0xa3f5
leaq 0xc5f8(%rip), %rsi      # 0x168e0
movq %r15, %rdi
callq 0x23d0
testq %rax, %rax
je 0xa324
movl $0x66, 0x166f8(%rbx)
cmpl $0x0, 0x22086(%rip)     # 0x2c38c
jle 0xa3fc
leaq 0xc5d2(%rip), %rdi      # 0x168e5
leaq 0xaf94(%rip), %rsi      # 0x152ae
movl $0x90d, %edx            # imm = 0x90D
jmp 0xa3f5
leaq 0xc5fb(%rip), %rsi      # 0x16926
movq %r15, %rdi
callq 0x23d0
testq %rax, %rax
je 0xa367
movl $0x67, 0x166f8(%rbx)
cmpl $0x0, 0x22043(%rip)     # 0x2c38c
jle 0xa3fc
leaq 0xc5e1(%rip), %rdi      # 0x16937
leaq 0xaf51(%rip), %rsi      # 0x152ae
movl $0x912, %edx            # imm = 0x912
jmp 0xa3f5
leaq 0xc615(%rip), %rsi      # 0x16983
movq %r15, %rdi
callq 0x23d0
testq %rax, %rax
je 0xa3a3
movl $0x69, 0x166f8(%rbx)
cmpl $0x0, 0x22000(%rip)     # 0x2c38c
jle 0xa3fc
leaq 0xc5f5(%rip), %rdi      # 0x1698a
leaq 0xaf12(%rip), %rsi      # 0x152ae
movl $0x917, %edx            # imm = 0x917
jmp 0xa3f5
leaq 0xc622(%rip), %rsi      # 0x169cc
movq %r15, %rdi
callq 0x23d0
testq %rax, %rax
jne 0xa3cf
leaq 0xc611(%rip), %rsi      # 0x169cf
movq %r15, %rdi
callq 0x23d0
testq %rax, %rax
je 0xa461
movl $0x6a, 0x166f8(%rbx)
cmpl $0x0, 0x21fac(%rip)     # 0x2c38c
jle 0xa3fc
leaq 0xc5ea(%rip), %rdi      # 0x169d3
leaq 0xaebe(%rip), %rsi      # 0x152ae
movl $0x920, %edx            # imm = 0x920
xorl %eax, %eax
callq 0xc960
testq %r15, %r15
je 0xa44c
movzbl (%r15), %eax
cmpl $0x20, %eax
je 0xa40f
cmpl $0x9, %eax
jne 0xa414
incq %r15
jmp 0xa401
addq $0x166fc, %rbx          # imm = 0x166FC
movl $0xa00, %edx            # imm = 0xA00
movq %rbx, %rdi
movq %r15, %rsi
callq 0xbfb6
movabsq $0x800000100002601, %rax # imm = 0x800000100002601
movzbl (%rbx), %ecx
cmpq $0x3b, %rcx
ja 0xa444
btq %rcx, %rax
jb 0xa449
incq %rbx
jmp 0xa435
movb $0x0, (%rbx)
testq %r14, %r14
je 0xa454
movb %bpl, (%r14)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc569(%rip), %rsi      # 0x169d1
movq %r15, %rdi
callq 0x2200
testl %eax, %eax
je 0xa3cf
movl $0x68, 0x166f8(%rbx)
jmp 0xa3fc