// File: /workspace/github_cpp_makefile_star2_O1/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 0x1024f(%rip), %r12     # 0x16021
movq %r14, %rdi
movq %r15, %rsi
callq 0x33a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x5eec
movq -0x40(%rbp), %rax
testq %rax, %rax
je 0x5e10
movq -0x48(%rbp), %rcx
xorl %edx, %edx
cmpb $0x2d, (%rcx,%rdx)
jne 0x5e08
movb $0x20, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x5dfe
movq -0x40(%rbp), %rax
testq %rax, %rax
je 0x5e31
movq -0x48(%rbp), %rcx
xorl %edx, %edx
cmpb $0x3b, (%rcx,%rdx)
jne 0x5e29
movb $0x20, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x5e1f
movq -0x40(%rbp), %rax
testq %rax, %rax
je 0x5e52
movq -0x48(%rbp), %rcx
xorl %edx, %edx
cmpb $0x2e, (%rcx,%rdx)
jne 0x5e4a
movb $0x20, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x5e40
movq -0x40(%rbp), %rax
testq %rax, %rax
je 0x5e73
movq -0x48(%rbp), %rcx
xorl %edx, %edx
cmpb $0x3a, (%rcx,%rdx)
jne 0x5e6b
movb $0x20, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x5e61
movq -0x40(%rbp), %rax
testq %rax, %rax
je 0x5e94
movq -0x48(%rbp), %rcx
xorl %edx, %edx
cmpb $0x21, (%rcx,%rdx)
jne 0x5e8c
movb $0x20, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x5e82
movq -0x40(%rbp), %rax
testq %rax, %rax
je 0x5eb5
movq -0x48(%rbp), %rcx
xorl %edx, %edx
cmpb $0x29, (%rcx,%rdx)
jne 0x5ead
movb $0x20, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x5ea3
movq -0x40(%rbp), %rax
testq %rax, %rax
je 0x5ed6
movq -0x48(%rbp), %rcx
xorl %edx, %edx
cmpb $0x2c, (%rcx,%rdx)
jne 0x5ece
movb $0x20, (%rcx,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x5ec4
movq %r15, %rdi
movq %r12, %rsi
callq 0x30b0
cmpl $0x1, %eax
sbbl $-0x1, %ebx
jmp 0x5dd2
leaq -0x250(%rbp), %rdi
callq 0x3080
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x5f06
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 0x5f2e
movq %rax, %rbx
leaq -0x250(%rbp), %rdi
callq 0x3080
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x5f3c
callq 0x32f0
movq %rbx, %rdi
callq 0x3560