// File: /workspace/github_c_makefile_star2_O0/inflex[P]ripMIME/MIME_headers.c
// Function: MIMEH_strip_comments
int MIMEH_strip_comments( char *input )
{
    char *p,*p_org;
    int in_quote=0;

    if (input == NULL) return 0;

    p = p_org = input;

    do {
        char *q = NULL;

        // Locate (if any) the first occurance of the (
        while ((p_org != NULL)&&((*p_org != '(')||(in_quote==1)))
        {
            switch (*p_org) {
                case '"':
                    in_quote ^= 1;
                    break;
                case '\n':
                case '\r':
                    in_quote = 0;
                    break;
                case '\0':
                    p_org = NULL;
                    break;
            }

            if (p_org) p_org++;
        }

        p = p_org;

        if ((p != NULL)&&(in_quote == 0))
        {
            int stop_searching = 0;

            DMIMEH LOGGER_log("%s:%d:MIMEH_strip_comments:DEBUG: Located open ( at %s",FL,p);
            // If we did locate an opening parenthesis, look for the closing one
            //      NOTE - we cannot have a breaking \n or \r inbetween
            //      q = strpbrk(p, ")\n\r");
            q = p;
            while ( (q != NULL) && (stop_searching == 0) )
            {
                switch (*q) {
                    case '\0':
                        stop_searching = 1;
                        q = NULL;
                        break;

                    case '\n':
                    case '\r':
                        stop_searching = 1;
                        in_quote = 0;
                        break;

                    case '"':
                        in_quote ^= 1;
                        break;

                    case ')':
                        DMIMEH LOGGER_log("%s:%d:MIMEH_strip_comments:DEBUG: Located closing ) at %s",FL,q);
                        if (in_quote == 0) stop_searching = 1;
                        break;
                }
                if ((q != NULL)&&(stop_searching == 0)) q++;
            }

            // If we've got both opening and closing, then we need to remove
            //      the contents of the comment, including the parenthesis
            if (q != NULL)
            {
                if (*q != ')')
                {
                    // if we found a \n or \r between the two (), then jump out
                    // and move p to the next position.
                    p_org++;
                    continue;
                } else {
                    // Move q to the first char after the closing parenthesis
                    q++;

                    DMIMEH LOGGER_log("%s:%d:MIMEH_strip_comments:DEBUG: located closing ) at %s ",FL, q);
                    // While there's more chars in string, copy them to where
                    //      the opening parenthesis is
                    while (*q != '\0')
                    {
                        *p = *q;
                        p++;
                        q++;
                    } // While q != '\0'
                    DMIMEH LOGGER_log("%s:%d:MIMEH_strip_comments:DEBUG: char copy done",FL);

                    // Terminate the string
                    *p = '\0';
                } // if q !=/= ')'

            } else break; // if q == NULL
        } // if p == NULL
    } while ((p != NULL)&&(p_org != NULL)); // do-while more comments to remove

    DMIMEH LOGGER_log("%s:%d:MIMEH_strip_comments:DEBUG: Final string = '%s'",FL,input);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x24(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xab96
movl $0x0, -0x4(%rbp)
jmp 0xae66
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq %rax, -0x18(%rbp)
movq $0x0, -0x30(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x20(%rbp)
movb %al, -0x35(%rbp)
je 0xabd7
movq -0x20(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x28, %ecx
movb %al, -0x36(%rbp)
jne 0xabd1
cmpl $0x1, -0x24(%rbp)
sete %al
movb %al, -0x36(%rbp)
movb -0x36(%rbp), %al
movb %al, -0x35(%rbp)
movb -0x35(%rbp), %al
testb $0x1, %al
jne 0xabe0
jmp 0xac3a
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
movl %eax, %ecx
movq %rcx, -0x40(%rbp)
subl $0x22, %eax
ja 0xac22
movq -0x40(%rbp), %rax
leaq 0x1170b(%rip), %rcx     # 0x1c308
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x24(%rbp), %eax
xorl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xac22
movl $0x0, -0x24(%rbp)
jmp 0xac22
movq $0x0, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xac35
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0xabaa
movq -0x20(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xae14
cmpl $0x0, -0x24(%rbp)
jne 0xae14
movl $0x0, -0x34(%rbp)
cmpl $0x1, 0x27b17(%rip)     # 0x3277c
jl 0xac85
movq -0x18(%rbp), %rcx
leaq 0x11988(%rip), %rdi     # 0x1c5fa
leaq 0x117f5(%rip), %rsi     # 0x1c46e
movl $0x35b, %edx            # imm = 0x35B
movb $0x0, %al
callq 0x117c0
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x30(%rbp)
movb %al, -0x41(%rbp)
je 0xaca3
cmpl $0x0, -0x34(%rbp)
sete %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0xacaf
jmp 0xad55
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
movl %eax, %ecx
movq %rcx, -0x50(%rbp)
subl $0x29, %eax
ja 0xad37
movq -0x50(%rbp), %rax
leaq 0x11594(%rip), %rcx     # 0x1c260
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1, -0x34(%rbp)
movq $0x0, -0x30(%rbp)
jmp 0xad37
movl $0x1, -0x34(%rbp)
movl $0x0, -0x24(%rbp)
jmp 0xad37
movl -0x24(%rbp), %eax
xorl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xad37
cmpl $0x1, 0x27a74(%rip)     # 0x3277c
jl 0xad28
movq -0x30(%rbp), %rcx
leaq 0x1191c(%rip), %rdi     # 0x1c631
leaq 0x11752(%rip), %rsi     # 0x1c46e
movl $0x373, %edx            # imm = 0x373
movb $0x0, %al
callq 0x117c0
cmpl $0x0, -0x24(%rbp)
jne 0xad35
movl $0x1, -0x34(%rbp)
jmp 0xad37
cmpq $0x0, -0x30(%rbp)
je 0xad50
cmpl $0x0, -0x34(%rbp)
jne 0xad50
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xac8d
cmpq $0x0, -0x30(%rbp)
je 0xae10
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x29, %eax
je 0xad7d
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0xae16
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
cmpl $0x1, 0x279ec(%rip)     # 0x3277c
jl 0xadb0
movq -0x30(%rbp), %rcx
leaq 0x118ce(%rip), %rdi     # 0x1c66b
leaq 0x116ca(%rip), %rsi     # 0x1c46e
movl $0x388, %edx            # imm = 0x388
movb $0x0, %al
callq 0x117c0
jmp 0xadb2
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0xade4
movq -0x30(%rbp), %rax
movb (%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, (%rax)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xadb2
cmpl $0x1, 0x27991(%rip)     # 0x3277c
jl 0xae07
leaq 0x118b2(%rip), %rdi     # 0x1c6a6
leaq 0x11673(%rip), %rsi     # 0x1c46e
movl $0x391, %edx            # imm = 0x391
movb $0x0, %al
callq 0x117c0
movq -0x18(%rbp), %rax
movb $0x0, (%rax)
jmp 0xae12
jmp 0xae38
jmp 0xae14
jmp 0xae16
xorl %eax, %eax
cmpq $0x0, -0x18(%rbp)
movb %al, -0x51(%rbp)
je 0xae2d
cmpq $0x0, -0x20(%rbp)
setne %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0xaba2
cmpl $0x1, 0x2793d(%rip)     # 0x3277c
jl 0xae5f
movq -0x10(%rbp), %rcx
leaq 0x1188b(%rip), %rdi     # 0x1c6d7
leaq 0x1161b(%rip), %rsi     # 0x1c46e
movl $0x39b, %edx            # imm = 0x39B
movb $0x0, %al
callq 0x117c0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nop