// File: /workspace/github_cpp_makefile_star2_O3/waltersharpWEI[P]CommentEliminator/main.cpp
// Function: removeComment(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void removeComment(string FilePath) {
    //FILE handle of the input file, read-only
    FILE * Input = fopen(FilePath.c_str(),"r");
    //If fail to open the file, show the message and leave funtion
    if (Input == NULL) {
        cout << "Can not open this file, path:"  << FilePath << "\n";
        return ;
    }
    //This Buffer is used to store the content of entire output file
    //Initialized as empty string
    string Buffer = "";
    //Previous is the last character readed
    //Now is the current character from input file
    char Previous = 0,Now = 0,PoP = 0;
    //0 for code, 1 for string, 2 for one line comment, 3 for multiline comment
    //The
    int Status = 0;
    int es = 0;
    //keep read the input stream until End of File
    //one character each time
    while (fscanf(Input, "%c",&Now) != EOF) {
        switch (Status) {
            //if cursor is in the normal code area
            case 0:{
                if (Previous == '/') {
                    if (Now == '/') {
                        Status = 2;
                    } else if (Now == '*') {
                        Status = 3;
                    } else {
                        Buffer += Previous;
                        Buffer += Now;
                    }
                } else if (Now != '/') {
                    Buffer += Now;
                    if (Previous != '\\' && Previous != '\'' && Now == '"') {
                        Status = 1;
                    }
                }
            }break;
            //if cursor is in a string
            case 1:{
                //if there is a single \ to continue the line, just put it into Buffer,
                //together with the \r or \n in Now
                if (Previous == '\\') {
                    if (es != 1) {
                        Buffer += Previous;
                        Buffer += Now;
                        es = 0;
                    } else {
                        Buffer += Now;
                        if (Now == '"') {
                            Status = 0;
                        }
                        es = 0;
                    }
                    if (Now == '\\') {
                        es = 1;
                    }
                //otherwise just add Now to Buffer
                } else if (Now != '\\') {
                    Buffer += Now;
                    if (Now == '"') {
                        Status = 0;

                    }
                }
            }break;
            //if cursor is in a single line comment
            case 2:{
                //if there is no single \ to continue the line, then stop single lien comment, add /n into Buffer
                if (Previous != '\\' && (Now == '\n' || Now == '\r')) {
                    Buffer += Now;
                    Now = 0;
                    Status = 0;
                }
            }break;
            //if cursor is in a multiple line comment
            case 3:{
                if (Previous == '*' && Now == '/') {
                    Status = 0;
                    Now = 0;
                }
            }break;
            default: {

            }break;
        }
        //update the Previous character, move forward to next character
        PoP = Previous;
        Previous = Now;
    }
    //close the input file
    fclose(Input);
    //open the input file in write mode
    ofstream fout(FilePath.c_str());
    //write the Buffer content into the file
    fout << Buffer;
    //close the file
    fout.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %rdi, %rbx
movq (%rdi), %rdi
leaq 0x2a27(%rip), %rsi      # 0x5014
callq 0x2200
testq %rax, %rax
je 0x2873
movq %rax, %r14
movq %rbx, -0x58(%rbp)
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x2c11(%rip), %rdx      # 0x5222
leaq -0x50(%rbp), %rdi
movq %rdx, %rsi
callq 0x3e0a
leaq -0x29(%rbp), %rax
movb $0x0, (%rax)
xorl %r12d, %r12d
leaq 0x29d6(%rip), %rbx      # 0x5004
xorl %r13d, %r13d
xorl %r15d, %r15d
movq %r14, %rdi
leaq 0x29f6(%rip), %rsi      # 0x5034
leaq -0x29(%rbp), %rdx
xorl %eax, %eax
callq 0x2320
cmpl $-0x1, %eax
je 0x27d2
movl %r13d, %eax
movslq (%rbx,%rax,4), %rax
addq %rbx, %rax
jmpq *%rax
movzbl -0x29(%rbp), %eax
cmpb $0x2f, %r12b
jne 0x270d
cmpl $0x2f, %eax
je 0x27a3
cmpl $0x2a, %eax
jne 0x27ab
movl $0x3, %r13d
jmp 0x27c9
movl $0x2, %r13d
cmpb $0x5c, %r12b
je 0x27c9
movzbl -0x29(%rbp), %eax
cmpl $0xd, %eax
je 0x26ab
cmpl $0xa, %eax
jne 0x27c9
movsbl %al, %esi
leaq -0x50(%rbp), %rdi
callq 0x2140
jmp 0x26d3
movl $0x3, %r13d
cmpb $0x2a, %r12b
jne 0x27c9
cmpb $0x2f, -0x29(%rbp)
jne 0x27c9
movb $0x0, -0x29(%rbp)
xorl %r13d, %r13d
jmp 0x27c9
cmpb $0x5c, %r12b
jne 0x274e
cmpl $0x1, %r15d
jne 0x2774
movsbl -0x29(%rbp), %esi
leaq -0x50(%rbp), %rdi
callq 0x2140
movb -0x29(%rbp), %al
xorl %r13d, %r13d
cmpb $0x22, %al
setne %r13b
jmp 0x2798
xorl %r13d, %r13d
cmpl $0x2f, %eax
je 0x27c9
movsbl %al, %esi
leaq -0x50(%rbp), %rdi
callq 0x2140
cmpb $0x22, -0x29(%rbp)
jne 0x27c9
cmpb $0x27, %r12b
je 0x27c9
movzbl %r12b, %eax
cmpl $0x5c, %eax
je 0x27c9
movl $0x1, %r13d
jmp 0x27c9
movb -0x29(%rbp), %al
movl $0x1, %r13d
cmpb $0x5c, %al
je 0x27c9
movsbl %al, %esi
leaq -0x50(%rbp), %rdi
callq 0x2140
xorl %r13d, %r13d
cmpb $0x22, -0x29(%rbp)
setne %r13b
jmp 0x27c9
leaq -0x50(%rbp), %rdi
movl $0x5c, %esi
callq 0x2140
movsbl -0x29(%rbp), %esi
leaq -0x50(%rbp), %rdi
callq 0x2140
movl $0x1, %r13d
movb -0x29(%rbp), %al
xorl %r15d, %r15d
cmpb $0x5c, %al
sete %r15b
jmp 0x27c9
movl $0x2, %r13d
jmp 0x27c9
leaq -0x50(%rbp), %rdi
movl $0x2f, %esi
callq 0x2140
xorl %r13d, %r13d
movsbl -0x29(%rbp), %esi
leaq -0x50(%rbp), %rdi
callq 0x2140
movb -0x29(%rbp), %r12b
jmp 0x2634
movq %r14, %rdi
callq 0x21b0
movq -0x58(%rbp), %rax
movq (%rax), %rsi
leaq -0x258(%rbp), %rdi
movl $0x10, %edx
callq 0x21e0
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
leaq -0x258(%rbp), %rdi
callq 0x21f0
leaq -0x258(%rbp), %rdi
callq 0x2230
movq 0x57a7(%rip), %rax      # 0x7fc0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x250(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x258(%rbp,%rcx)
callq 0x2130
leaq -0x160(%rbp), %rdi
callq 0x2080
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x2861
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21d0
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x574e(%rip), %r14      # 0x7fc8
leaq 0x2795(%rip), %rsi      # 0x5016
movl $0x1d, %edx
movq %r14, %rdi
callq 0x21f0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x21f0
leaq 0x297d(%rip), %rsi      # 0x5221
movl $0x1, %edx
movq %rax, %rdi
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x21f0
jmp 0x28d5
movq %rax, %rbx
leaq -0x258(%rbp), %rdi
callq 0x2260
jmp 0x28d8
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x28f1
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21d0
movq %rbx, %rdi
callq 0x22f0