// File: /workspace/github_cpp_makefile_star2_O1/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 0x2a17(%rip), %rsi      # 0x5014
callq 0x2210
testq %rax, %rax
je 0x287f
movq %rax, %r14
movq %rbx, -0x58(%rbp)
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x2c04(%rip), %rdx      # 0x5225
leaq -0x50(%rbp), %rdi
movq %rdx, %rsi
callq 0x3e22
leaq -0x29(%rbp), %rax
movb $0x0, (%rax)
xorl %r12d, %r12d
leaq 0x29c6(%rip), %rbx      # 0x5004
xorl %r13d, %r13d
xorl %r15d, %r15d
movq %r14, %rdi
leaq 0x29e6(%rip), %rsi      # 0x5034
leaq -0x29(%rbp), %rdx
xorl %eax, %eax
callq 0x2330
cmpl $-0x1, %eax
je 0x27de
movl %r13d, %eax
movslq (%rbx,%rax,4), %rax
addq %rbx, %rax
jmpq *%rax
movzbl -0x29(%rbp), %eax
cmpb $0x2f, %r12b
jne 0x271c
cmpl $0x2f, %eax
je 0x27b0
cmpl $0x2a, %eax
jne 0x27b8
movl $0x3, %r13d
jmp 0x27d5
movl $0x2, %r13d
cmpb $0x5c, %r12b
je 0x27d5
movzbl -0x29(%rbp), %eax
cmpl $0xd, %eax
je 0x26bb
cmpl $0xa, %eax
jne 0x27d5
movsbl %al, %esi
leaq -0x50(%rbp), %rdi
callq 0x2150
jmp 0x26e3
movl $0x3, %r13d
cmpb $0x2a, %r12b
jne 0x27d5
cmpb $0x2f, -0x29(%rbp)
jne 0x27d5
movb $0x0, -0x29(%rbp)
xorl %r13d, %r13d
jmp 0x27d5
cmpb $0x5c, %r12b
jne 0x275d
cmpl $0x1, %r15d
jne 0x2783
movsbl -0x29(%rbp), %esi
leaq -0x50(%rbp), %rdi
callq 0x2150
xorl %r13d, %r13d
cmpb $0x22, -0x29(%rbp)
setne %r13b
jmp 0x27a3
xorl %r13d, %r13d
cmpl $0x2f, %eax
je 0x27d5
movsbl %al, %esi
leaq -0x50(%rbp), %rdi
callq 0x2150
cmpb $0x22, -0x29(%rbp)
jne 0x27d5
cmpb $0x27, %r12b
je 0x27d5
movzbl %r12b, %eax
cmpl $0x5c, %eax
je 0x27d5
movl $0x1, %r13d
jmp 0x27d5
movb -0x29(%rbp), %al
movl $0x1, %r13d
cmpb $0x5c, %al
je 0x27d5
movsbl %al, %esi
leaq -0x50(%rbp), %rdi
callq 0x2150
xorl %r13d, %r13d
cmpb $0x22, -0x29(%rbp)
setne %r13b
jmp 0x27d5
movsbl %r12b, %esi
leaq -0x50(%rbp), %rdi
callq 0x2150
movl $0x1, %r13d
movsbl -0x29(%rbp), %esi
leaq -0x50(%rbp), %rdi
callq 0x2150
xorl %r15d, %r15d
cmpb $0x5c, -0x29(%rbp)
sete %r15b
jmp 0x27d5
movl $0x2, %r13d
jmp 0x27d5
movsbl %r12b, %esi
leaq -0x50(%rbp), %rdi
callq 0x2150
xorl %r13d, %r13d
movsbl -0x29(%rbp), %esi
leaq -0x50(%rbp), %rdi
callq 0x2150
movb -0x29(%rbp), %r12b
jmp 0x2644
movq %r14, %rdi
callq 0x21c0
movq -0x58(%rbp), %rax
movq (%rax), %rsi
leaq -0x258(%rbp), %rdi
movl $0x10, %edx
callq 0x21f0
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
leaq -0x258(%rbp), %rdi
callq 0x2200
leaq -0x258(%rbp), %rdi
callq 0x2240
movq 0x579b(%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 0x2140
leaq -0x160(%rbp), %rdi
callq 0x2080
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x286d
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21e0
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x5742(%rip), %r14      # 0x7fc8
leaq 0x2789(%rip), %rsi      # 0x5016
movl $0x1d, %edx
movq %r14, %rdi
callq 0x2200
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x2200
leaq 0x2974(%rip), %rsi      # 0x5224
movl $0x1, %edx
movq %rax, %rdi
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2200
jmp 0x28e1
movq %rax, %rbx
leaq -0x258(%rbp), %rdi
callq 0x2270
jmp 0x28e4
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x28fd
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21e0
movq %rbx, %rdi
callq 0x2300