// File: /workspace/github_cpp_makefile_star2_O3/IlyaSamoylov45[P]MapReduce-Project/main.cpp
// Function: count_words(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int count_words(std::string file){
  int count = 0;
  std::string word;
  std::ifstream infile(file.c_str());
  while(infile >> word) {
    std::replace( word.begin(), word.end(), '-', ' ');
    std::replace( word.begin(), word.end(), ';', ' ');
    std::replace( word.begin(), word.end(), '.', ' ');
    std::replace( word.begin(), word.end(), ':', ' ');
    std::replace( word.begin(), word.end(), '!', ' ');
    std::replace( word.begin(), word.end(), ')', ' ');
    std::replace( word.begin(), word.end(), ',', ' ');
    //std::replace( word.begin(), word.end(), ';', ' ');
    //word.erase(std::remove_if(word.begin(), word.end(), remove_char), word.end());
    if(word != ""){
      count++;
    }

    //std::cout << "word is: " << word << " " << count << "\n";
  }
  return count;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
leaq -0x38(%rbp), %r13
movq %r13, -0x10(%r13)
movq $0x0, -0x8(%r13)
movb $0x0, (%r13)
movq (%rdi), %rsi
leaq -0x250(%rbp), %rdi
movl $0x8, %edx
callq 0x35a0
xorl %ebx, %ebx
leaq -0x250(%rbp), %r14
leaq -0x48(%rbp), %r15
leaq 0xf24d(%rip), %r12      # 0x15021
movq %r14, %rdi
movq %r15, %rsi
callq 0x33a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x5efa
movq -0x40(%rbp), %rax
testq %rax, %rax
je 0x5ee4
movq -0x48(%rbp), %rcx
xorl %edx, %edx
cmpb $0x2d, (%rcx,%rdx)
jne 0x5e0e
movb $0x20, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x5e04
movq -0x40(%rbp), %rax
testq %rax, %rax
je 0x5ee4
movq -0x48(%rbp), %rcx
xorl %edx, %edx
cmpb $0x3b, (%rcx,%rdx)
jne 0x5e33
movb $0x20, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x5e29
movq -0x40(%rbp), %rax
testq %rax, %rax
je 0x5ee4
movq -0x48(%rbp), %rcx
xorl %edx, %edx
cmpb $0x2e, (%rcx,%rdx)
jne 0x5e58
movb $0x20, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x5e4e
movq -0x40(%rbp), %rax
testq %rax, %rax
je 0x5ee4
movq -0x48(%rbp), %rcx
xorl %edx, %edx
cmpb $0x3a, (%rcx,%rdx)
jne 0x5e79
movb $0x20, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x5e6f
movq -0x40(%rbp), %rax
testq %rax, %rax
je 0x5ee4
movq -0x48(%rbp), %rcx
xorl %edx, %edx
cmpb $0x21, (%rcx,%rdx)
jne 0x5e9a
movb $0x20, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x5e90
movq -0x40(%rbp), %rax
testq %rax, %rax
je 0x5ee4
movq -0x48(%rbp), %rcx
xorl %edx, %edx
cmpb $0x29, (%rcx,%rdx)
jne 0x5ebb
movb $0x20, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x5eb1
movq -0x40(%rbp), %rax
testq %rax, %rax
je 0x5ee4
movq -0x48(%rbp), %rcx
xorl %edx, %edx
cmpb $0x2c, (%rcx,%rdx)
jne 0x5edc
movb $0x20, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x5ed2
movq %r15, %rdi
movq %r12, %rsi
callq 0x30b0
cmpl $0x1, %eax
sbbl $-0x1, %ebx
jmp 0x5dd4
leaq -0x250(%rbp), %rdi
callq 0x3080
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x5f14
callq 0x32f0
movl %ebx, %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x5f3c
movq %rax, %rbx
leaq -0x250(%rbp), %rdi
callq 0x3080
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x5f4a
callq 0x32f0
movq %rbx, %rdi
callq 0x3560