// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movb $0xa, -0x29(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x101f6(%rip), %rsi     # 0x1d9f9
callq 0x23b0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xdb7d
movq -0x18(%rbp), %rax
movl 0x18d30(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x18d30(%rax)
movq -0x10(%rbp), %rdi
leaq 0x101de(%rip), %rsi     # 0x1da13
callq 0x22e0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0xd855
movq -0x28(%rbp), %rax
movb (%rax), %al
movb %al, -0x29(%rbp)
movq -0x28(%rbp), %rax
movb $0x0, (%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x105f0
movq -0x20(%rbp), %rdi
leaq 0xba90(%rip), %rsi      # 0x19301
callq 0x23b0
cmpq $0x0, %rax
je 0xd8b2
movq -0x18(%rbp), %rax
movl $0x64, 0x166f8(%rax)
cmpl $0x1, 0x24eeb(%rip)     # 0x3277c
jl 0xd8ad
leaq 0x1017d(%rip), %rdi     # 0x1da17
leaq 0xebcd(%rip), %rsi      # 0x1c46e
movl $0x903, %edx            # imm = 0x903
movb $0x0, %al
callq 0x117c0
jmp 0xda6e
movq -0x20(%rbp), %rdi
leaq 0x1019c(%rip), %rsi     # 0x1da59
callq 0x23b0
cmpq $0x0, %rax
je 0xd8fe
movq -0x18(%rbp), %rax
movl $0x65, 0x166f8(%rax)
cmpl $0x1, 0x24e9f(%rip)     # 0x3277c
jl 0xd8f9
leaq 0x10178(%rip), %rdi     # 0x1da5e
leaq 0xeb81(%rip), %rsi      # 0x1c46e
movl $0x908, %edx            # imm = 0x908
movb $0x0, %al
callq 0x117c0
jmp 0xda6c
movq -0x20(%rbp), %rdi
leaq 0x10197(%rip), %rsi     # 0x1daa0
callq 0x23b0
cmpq $0x0, %rax
je 0xd94a
movq -0x18(%rbp), %rax
movl $0x66, 0x166f8(%rax)
cmpl $0x1, 0x24e53(%rip)     # 0x3277c
jl 0xd945
leaq 0x10173(%rip), %rdi     # 0x1daa5
leaq 0xeb35(%rip), %rsi      # 0x1c46e
movl $0x90d, %edx            # imm = 0x90D
movb $0x0, %al
callq 0x117c0
jmp 0xda6a
movq -0x20(%rbp), %rdi
leaq 0x10191(%rip), %rsi     # 0x1dae6
callq 0x23b0
cmpq $0x0, %rax
je 0xd996
movq -0x18(%rbp), %rax
movl $0x67, 0x166f8(%rax)
cmpl $0x1, 0x24e07(%rip)     # 0x3277c
jl 0xd991
leaq 0x10179(%rip), %rdi     # 0x1daf7
leaq 0xeae9(%rip), %rsi      # 0x1c46e
movl $0x912, %edx            # imm = 0x912
movb $0x0, %al
callq 0x117c0
jmp 0xda68
movq -0x20(%rbp), %rdi
leaq 0x101a2(%rip), %rsi     # 0x1db43
callq 0x23b0
cmpq $0x0, %rax
je 0xd9e2
movq -0x18(%rbp), %rax
movl $0x69, 0x166f8(%rax)
cmpl $0x1, 0x24dbb(%rip)     # 0x3277c
jl 0xd9dd
leaq 0x10180(%rip), %rdi     # 0x1db4a
leaq 0xea9d(%rip), %rsi      # 0x1c46e
movl $0x917, %edx            # imm = 0x917
movb $0x0, %al
callq 0x117c0
jmp 0xda66
movq -0x20(%rbp), %rdi
leaq 0x1019f(%rip), %rsi     # 0x1db8c
callq 0x23b0
cmpq $0x0, %rax
jne 0xda23
movq -0x20(%rbp), %rdi
leaq 0x1018c(%rip), %rsi     # 0x1db8f
callq 0x23b0
cmpq $0x0, %rax
jne 0xda23
movq -0x20(%rbp), %rdi
leaq 0x10178(%rip), %rsi     # 0x1db91
callq 0x21e0
cmpl $0x0, %eax
jne 0xda56
movq -0x18(%rbp), %rax
movl $0x6a, 0x166f8(%rax)
cmpl $0x1, 0x24d44(%rip)     # 0x3277c
jl 0xda54
leaq 0x10152(%rip), %rdi     # 0x1db93
leaq 0xea26(%rip), %rsi      # 0x1c46e
movl $0x920, %edx            # imm = 0x920
movb $0x0, %al
callq 0x117c0
jmp 0xda64
movq -0x18(%rbp), %rax
movl $0x68, 0x166f8(%rax)
jmp 0xda66
jmp 0xda68
jmp 0xda6a
jmp 0xda6c
jmp 0xda6e
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xdb6b
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x20, %ecx
movb %al, -0x39(%rbp)
je 0xdaaa
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x9, %eax
sete %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0xdab3
jmp 0xdac1
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0xda89
movq -0x18(%rbp), %rdi
addq $0x166fc, %rdi          # imm = 0x166FC
movq -0x38(%rbp), %rsi
movl $0xa00, %edx            # imm = 0xA00
callq 0x10640
movq -0x18(%rbp), %rax
addq $0x166fc, %rax          # imm = 0x166FC
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x3a(%rbp)
je 0xdb4d
movq -0x38(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x20, %ecx
movb %al, -0x3a(%rbp)
je 0xdb4d
movq -0x38(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x9, %ecx
movb %al, -0x3a(%rbp)
je 0xdb4d
movq -0x38(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0xa, %ecx
movb %al, -0x3a(%rbp)
je 0xdb4d
movq -0x38(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0xd, %ecx
movb %al, -0x3a(%rbp)
je 0xdb4d
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3b, %eax
setne %al
movb %al, -0x3a(%rbp)
movb -0x3a(%rbp), %al
testb $0x1, %al
jne 0xdb56
jmp 0xdb64
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0xdae8
movq -0x38(%rbp), %rax
movb $0x0, (%rax)
cmpq $0x0, -0x28(%rbp)
je 0xdb7b
movb -0x29(%rbp), %cl
movq -0x28(%rbp), %rax
movb %cl, (%rax)
jmp 0xdb7d
xorl %eax, %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)