// File: /workspace/github_c_makefile_star2_O3/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 0xc71b(%rip), %rsi      # 0x16869
callq 0x23c0
testq %rax, %rax
je 0xa39b
incl 0x18d30(%rbx)
leaq 0xc71a(%rip), %rsi      # 0x16883
movq %r15, %rdi
callq 0x22f0
movq %rax, %r14
testq %rax, %rax
je 0xa182
movb (%r14), %bpl
movb $0x0, (%r14)
jmp 0xa185
movb $0xa, %bpl
movq %r15, %rdi
callq 0xbeb9
leaq 0x807d(%rip), %rsi      # 0x12211
movq %r15, %rdi
callq 0x23c0
testq %rax, %rax
je 0xa1d0
movl $0x64, 0x166f8(%rbx)
cmpl $0x0, 0x221da(%rip)     # 0x2c38c
jle 0xa32a
leaq 0xc6c8(%rip), %rdi      # 0x16887
leaq 0xb118(%rip), %rsi      # 0x152de
movl $0x903, %edx            # imm = 0x903
jmp 0xa323
leaq 0xc6f2(%rip), %rsi      # 0x168c9
movq %r15, %rdi
callq 0x23c0
testq %rax, %rax
je 0xa213
movl $0x65, 0x166f8(%rbx)
cmpl $0x0, 0x22197(%rip)     # 0x2c38c
jle 0xa32a
leaq 0xc6cc(%rip), %rdi      # 0x168ce
leaq 0xb0d5(%rip), %rsi      # 0x152de
movl $0x908, %edx            # imm = 0x908
jmp 0xa323
leaq 0xc6f6(%rip), %rsi      # 0x16910
movq %r15, %rdi
callq 0x23c0
testq %rax, %rax
je 0xa256
movl $0x66, 0x166f8(%rbx)
cmpl $0x0, 0x22154(%rip)     # 0x2c38c
jle 0xa32a
leaq 0xc6d0(%rip), %rdi      # 0x16915
leaq 0xb092(%rip), %rsi      # 0x152de
movl $0x90d, %edx            # imm = 0x90D
jmp 0xa323
leaq 0xc6f9(%rip), %rsi      # 0x16956
movq %r15, %rdi
callq 0x23c0
testq %rax, %rax
je 0xa299
movl $0x67, 0x166f8(%rbx)
cmpl $0x0, 0x22111(%rip)     # 0x2c38c
jle 0xa32a
leaq 0xc6df(%rip), %rdi      # 0x16967
leaq 0xb04f(%rip), %rsi      # 0x152de
movl $0x912, %edx            # imm = 0x912
jmp 0xa323
leaq 0xc713(%rip), %rsi      # 0x169b3
movq %r15, %rdi
callq 0x23c0
testq %rax, %rax
je 0xa2d5
movl $0x69, 0x166f8(%rbx)
cmpl $0x0, 0x220ce(%rip)     # 0x2c38c
jle 0xa32a
leaq 0xc6f3(%rip), %rdi      # 0x169ba
leaq 0xb010(%rip), %rsi      # 0x152de
movl $0x917, %edx            # imm = 0x917
jmp 0xa323
leaq 0xc720(%rip), %rsi      # 0x169fc
movq %r15, %rdi
callq 0x23c0
testq %rax, %rax
jne 0xa2fd
leaq 0xc70f(%rip), %rsi      # 0x169ff
movq %r15, %rdi
callq 0x23c0
testq %rax, %rax
je 0xa331
movl $0x6a, 0x166f8(%rbx)
cmpl $0x0, 0x2207e(%rip)     # 0x2c38c
jle 0xa32a
leaq 0xc6ec(%rip), %rdi      # 0x16a03
leaq 0xafc0(%rip), %rsi      # 0x152de
movl $0x920, %edx            # imm = 0x920
xorl %eax, %eax
callq 0xc84f
testq %r15, %r15
jne 0xa34d
jmp 0xa393
cmpb $0x75, (%r15)
jne 0xa33e
cmpb $0x0, 0x1(%r15)
je 0xa2fd
movl $0x68, 0x166f8(%rbx)
jmp 0xa34d
incq %r15
movzbl (%r15), %eax
cmpl $0x20, %eax
je 0xa34a
cmpl $0x9, %eax
je 0xa34a
addq $0x166fc, %rbx          # imm = 0x166FC
movl $0xa00, %edx            # imm = 0xA00
movq %rbx, %rdi
movq %r15, %rsi
callq 0xbede
movabsq $0x800000100002601, %rax # imm = 0x800000100002601
movzbl (%rbx), %ecx
cmpq $0x3b, %rcx
ja 0xa38b
btq %rcx, %rax
jb 0xa390
incq %rbx
jmp 0xa37c
movb $0x0, (%rbx)
testq %r14, %r14
je 0xa39b
movb %bpl, (%r14)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq