// File: /workspace/github_cpp_makefile_star2_O1/IHorvalds[P]RomAna/./processing/InflexEngineUtil.cpp
// Function: InflexEngine::consumeInflexions(char const*, char const*)
void InflexEngine::consumeInflexions(const char* filename, const char* latinFilename) {
  std::ifstream infile(filename);
  std::ifstream latinInfile(latinFilename);
   
  // Read both variants
  unsigned latinTotalCountOfRoots, totalCountOfRoots;
  infile >> totalCountOfRoots;
  latinInfile >> latinTotalCountOfRoots;
  
  // Compare for equality of count of words
  assert(latinTotalCountOfRoots == totalCountOfRoots);
  
  // Function to extract the inflexions from each line
  auto extractInflexionsFromLine = [&](std::string& line) -> std::vector<std::string> {
    const std::string delimiter = ",";
    std::vector<std::string> inflexions;
    size_t pos = 0;
    while ((pos = line.find(delimiter)) != std::string::npos) {
      inflexions.push_back(line.substr(0, pos));
      line.erase(0, pos + delimiter.length());
    }
    // If the root-word is alone in the list
    if (inflexions.empty())
      inflexions.push_back(line);
    return inflexions;
  };
   
  // Personal getline
  auto __getline = [&](std::ifstream& file, std::string& result) {
    result.clear();
    char c;
    while ((file.get(c)) && (c != '\n'))
      result += c;
  };
  
  // Jump over the newline character
  std::string line, latinLine;
  __getline(infile, line);
  __getline(latinInfile, latinLine);
  
  // Read both files
  while (totalCountOfRoots--) {
    __getline(infile, line);
    __getline(latinInfile, latinLine);
    
    // Extract the inflexions from each line
    std::vector<std::string> inflexions = extractInflexionsFromLine(line), latinInflexions = extractInflexionsFromLine(latinLine);
    assert(inflexions.size() == latinInflexions.size());
    
    std::string root = specialChars::cleanUpWord(inflexions.front()), latinRoot = specialChars::cleanUpWord(latinInflexions.front());
    
    // Check if the root is indeed a romanian one
    bool isInLanguage = romanian::isRomanian(root);
    addRoot(isInLanguage ? root : latinRoot);
    
    // Iterate over the inflexions
    for (unsigned index = 1, limit = inflexions.size(); index < limit; ++index) {
      std::string inflexion = specialChars::cleanUpWord(inflexions[index]), latinInflexion = specialChars::cleanUpWord(latinInflexions[index]);
      
      // Does the root-word have characters outside the language?
      if (!isInLanguage) {
        // It could be the case that some of the inflexions do have all their characters in the language
        if (romanian::isRomanian(inflexion)) {
          addDerivated(latinRoot, inflexion);
        } else {
          addDerivated(latinRoot, latinInflexion);
        }
      } else {
        // This means, the root-word contains only characters from the language. Thus we are sure that the inflexion also does.
        addDerivated(root, inflexion);
      }
    }
  }
  infile.close();
  latinInfile.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x6b8, %rsp            # imm = 0x6B8
movq %rdx, %r14
movq %rdi, 0x28(%rsp)
leaq 0x4b0(%rsp), %rdi
movl $0x8, %edx
callq 0x34d0
leaq 0x2a8(%rsp), %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0x34d0
leaq 0x4b0(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x34a0
leaq 0x2a8(%rsp), %rdi
leaq 0x34(%rsp), %rsi
callq 0x34a0
movl 0x34(%rsp), %eax
cmpl 0x4(%rsp), %eax
jne 0x52f5
leaq 0xa8(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x48(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x4b0(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3380
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
sete %cl
movb 0x8(%rsp), %al
cmpb $0xa, %al
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x4ad1
leaq 0x98(%rsp), %r14
leaq 0x4b0(%rsp), %r15
leaq 0x8(%rsp), %r12
movsbl %al, %esi
movq %r14, %rdi
callq 0x3230
movq %r15, %rdi
movq %r12, %rsi
callq 0x3380
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4ad1
movb 0x8(%rsp), %al
cmpb $0xa, %al
jne 0x4aa5
movq $0x0, 0x40(%rsp)
movq 0x38(%rsp), %rax
movb $0x0, (%rax)
leaq 0x2a8(%rsp), %rdi
leaq 0x8(%rsp), %rbx
movq %rbx, %rsi
callq 0x3380
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
sete %cl
movb 0x8(%rsp), %al
cmpb $0xa, %al
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x4b54
leaq 0x38(%rsp), %r15
leaq 0x2a8(%rsp), %r12
leaq 0x8(%rsp), %r13
movsbl %al, %esi
movq %r15, %rdi
callq 0x3230
movq %r12, %rdi
movq %r13, %rsi
callq 0x3380
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4b54
movb 0x8(%rsp), %al
cmpb $0xa, %al
jne 0x4b28
subl $0x1, 0x4(%rsp)
jb 0x524f
leaq 0x218(%rsp), %r14
leaq 0x248(%rsp), %r15
leaq 0x228(%rsp), %r13
movq $0x0, 0xa0(%rsp)
movq 0x98(%rsp), %rax
movb $0x0, (%rax)
leaq 0x4b0(%rsp), %rdi
movq %rbx, %rsi
callq 0x3380
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
sete %cl
movb 0x8(%rsp), %al
cmpb $0xa, %al
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x4bf3
movsbl %al, %esi
leaq 0x98(%rsp), %rdi
callq 0x3230
leaq 0x4b0(%rsp), %rdi
movq %rbx, %rsi
callq 0x3380
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4bf3
movb 0x8(%rsp), %al
cmpb $0xa, %al
jne 0x4bbd
movq $0x0, 0x40(%rsp)
movq 0x38(%rsp), %rax
movb $0x0, (%rax)
leaq 0x2a8(%rsp), %rdi
movq %rbx, %rsi
callq 0x3380
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
sete %cl
movb 0x8(%rsp), %al
cmpb $0xa, %al
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x4c66
movsbl %al, %esi
leaq 0x38(%rsp), %rdi
callq 0x3230
leaq 0x2a8(%rsp), %rdi
movq %rbx, %rsi
callq 0x3380
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4c66
movb 0x8(%rsp), %al
cmpb $0xa, %al
jne 0x4c33
leaq 0xb8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x5822
leaq 0x110(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x5822
movq 0xb8(%rsp), %rax
movq 0xc0(%rsp), %rcx
subq %rax, %rcx
movq 0x118(%rsp), %rdx
subq 0x110(%rsp), %rdx
cmpq %rdx, %rcx
jne 0x52d6
leaq 0x298(%rsp), %r12
movq %r12, 0x288(%rsp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x288(%rsp), %rbp
movq %rbp, %rdi
callq 0xb0ae
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x5959
movq 0x288(%rsp), %rdi
cmpq %r12, %rdi
je 0x4d0b
movq 0x298(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x110(%rsp), %rax
leaq 0x278(%rsp), %r12
movq %r12, 0x268(%rsp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x268(%rsp), %rbp
movq %rbp, %rdi
callq 0xb0ae
leaq 0x78(%rsp), %rdi
movq %rbp, %rsi
callq 0x5959
movq 0x268(%rsp), %rdi
cmpq %r12, %rdi
je 0x4d67
movq 0x278(%rsp), %rsi
incq %rsi
callq 0x3290
movq %r14, 0x208(%rsp)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
leaq 0x208(%rsp), %rdi
callq 0xb0ae
leaq 0x208(%rsp), %rdi
xorl %esi, %esi
callq 0x407c
movl %eax, %ebp
movq 0x208(%rsp), %rdi
cmpq %r14, %rdi
je 0x4db7
movq 0x218(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x100(%rsp), %rax
movq %rax, 0xf0(%rsp)
testb %bpl, %bpl
leaq 0x78(%rsp), %rax
cmovneq %rbx, %rax
movq (%rax), %rsi
leaq 0x80(%rsp), %rax
leaq 0x10(%rsp), %rcx
cmovneq %rcx, %rax
movq (%rax), %rdx
addq %rsi, %rdx
leaq 0xf0(%rsp), %rdi
callq 0xb0ae
movq 0x28(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x5684
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x4e31
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0xc0(%rsp), %rax
subq 0xb8(%rsp), %rax
movabsq $0x1fffffffc0, %rcx     # imm = 0x1FFFFFFFC0
testq %rcx, %rax
je 0x51df
shrq $0x5, %rax
movl %eax, %r14d
decq %r14
movl $0x28, %ebx
movq 0xb8(%rsp), %rax
leaq 0x258(%rsp), %r12
movq %r12, 0x248(%rsp)
movq -0x8(%rax,%rbx), %rsi
movq (%rax,%rbx), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0xb0ae
leaq 0x58(%rsp), %rdi
movq %r15, %rsi
callq 0x5959
movq 0x248(%rsp), %rdi
cmpq %r12, %rdi
je 0x4eb9
movq 0x258(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x110(%rsp), %rax
leaq 0x238(%rsp), %r12
movq %r12, 0x228(%rsp)
movq -0x8(%rax,%rbx), %rsi
movq (%rax,%rbx), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0xb0ae
leaq 0x1e8(%rsp), %rdi
movq %r13, %rsi
callq 0x5959
movq 0x228(%rsp), %rdi
cmpq %r12, %rdi
je 0x4f12
movq 0x238(%rsp), %rsi
incq %rsi
callq 0x3290
testb %bpl, %bpl
je 0x4fc1
leaq 0x158(%rsp), %rax
movq %rax, 0x148(%rsp)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
leaq 0x148(%rsp), %rdi
callq 0xb0ae
leaq 0x138(%rsp), %rax
movq %rax, 0x128(%rsp)
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
addq %rsi, %rdx
leaq 0x128(%rsp), %r12
movq %r12, %rdi
callq 0xb0ae
movq 0x28(%rsp), %rdi
leaq 0x148(%rsp), %rsi
movq %r12, %rdx
callq 0x5710
movq 0x128(%rsp), %rdi
leaq 0x138(%rsp), %rax
cmpq %rax, %rdi
je 0x4fac
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x148(%rsp), %rdi
leaq 0x158(%rsp), %rcx
jmp 0x517e
leaq 0xe0(%rsp), %rax
movq %rax, 0xd0(%rsp)
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
addq %rsi, %rdx
leaq 0xd0(%rsp), %rdi
callq 0xb0ae
leaq 0xd0(%rsp), %rdi
xorl %esi, %esi
callq 0x407c
movl %eax, %r12d
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
je 0x5022
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x3290
testb %r12b, %r12b
je 0x50d4
leaq 0x1d8(%rsp), %rax
movq %rax, 0x1c8(%rsp)
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rdx
addq %rsi, %rdx
leaq 0x1c8(%rsp), %rdi
callq 0xb0ae
leaq 0x1b8(%rsp), %rax
movq %rax, 0x1a8(%rsp)
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
addq %rsi, %rdx
leaq 0x1a8(%rsp), %r12
movq %r12, %rdi
callq 0xb0ae
movq 0x28(%rsp), %rdi
leaq 0x1c8(%rsp), %rsi
movq %r12, %rdx
callq 0x5710
movq 0x1a8(%rsp), %rdi
leaq 0x1b8(%rsp), %rax
cmpq %rax, %rdi
je 0x50bf
movq 0x1b8(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x1c8(%rsp), %rdi
leaq 0x1d8(%rsp), %rcx
jmp 0x517e
leaq 0x198(%rsp), %rax
movq %rax, 0x188(%rsp)
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rdx
addq %rsi, %rdx
leaq 0x188(%rsp), %rdi
callq 0xb0ae
leaq 0x178(%rsp), %rax
movq %rax, 0x168(%rsp)
movq 0x1e8(%rsp), %rsi
movq 0x1f0(%rsp), %rdx
addq %rsi, %rdx
leaq 0x168(%rsp), %r12
movq %r12, %rdi
callq 0xb0ae
movq 0x28(%rsp), %rdi
leaq 0x188(%rsp), %rsi
movq %r12, %rdx
callq 0x5710
movq 0x168(%rsp), %rdi
leaq 0x178(%rsp), %rax
cmpq %rax, %rdi
je 0x516e
movq 0x178(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x188(%rsp), %rdi
leaq 0x198(%rsp), %rcx
movq %rcx, %rax
cmpq %rcx, %rdi
je 0x5191
movq (%rax), %rsi
incq %rsi
callq 0x3290
movq 0x1e8(%rsp), %rdi
leaq 0x1f8(%rsp), %rax
cmpq %rax, %rdi
je 0x51b6
movq 0x1f8(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x51d2
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x3290
addq $0x20, %rbx
decq %r14
jne 0x4e63
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x5201
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
leaq 0x8(%rsp), %rbx
leaq 0x218(%rsp), %r14
je 0x522a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x110(%rsp), %rdi
callq 0x820a
leaq 0xb8(%rsp), %rdi
callq 0x820a
subl $0x1, 0x4(%rsp)
jae 0x4b77
leaq 0x4b0(%rsp), %rdi
callq 0x30a0
leaq 0x2a8(%rsp), %rdi
callq 0x30a0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x5285
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x52aa
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x2a8(%rsp), %rdi
callq 0x30c0
leaq 0x4b0(%rsp), %rdi
callq 0x30c0
addq $0x6b8, %rsp            # imm = 0x6B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6e4d(%rip), %rdi      # 0xc12a
leaq 0x6d8c(%rip), %rsi      # 0xc070
leaq 0x6dfe(%rip), %rcx      # 0xc0e9
movl $0x96, %edx
callq 0x3190
leaq 0x6dc1(%rip), %rdi      # 0xc0bd
leaq 0x6d6d(%rip), %rsi      # 0xc070
leaq 0x6ddf(%rip), %rcx      # 0xc0e9
movl $0x71, %edx
callq 0x3190
movq %rax, %rbx
jmp 0x55b8
movq %rax, %rbx
jmp 0x55ab
jmp 0x5567
jmp 0x5567
movq %rax, %rbx
jmp 0x5556
movq %rax, %rbx
jmp 0x5549
movq %rax, %rbx
jmp 0x552d
movq %rax, %rbx
movq 0x208(%rsp), %rdi
cmpq %r14, %rdi
je 0x550b
movq 0x218(%rsp), %rsi
jmp 0x5503
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x550b
movq 0x100(%rsp), %rsi
jmp 0x5503
jmp 0x54c2
jmp 0x5567
jmp 0x5567
jmp 0x5567
movq %rax, %rbx
movq 0x168(%rsp), %rdi
leaq 0x178(%rsp), %rax
cmpq %rax, %rdi
je 0x53d1
movq 0x178(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x53d1
movq %rax, %rbx
movq 0x188(%rsp), %rdi
leaq 0x198(%rsp), %rax
cmpq %rax, %rdi
je 0x54ca
movq 0x198(%rsp), %rsi
jmp 0x54b3
movq %rax, %rbx
movq 0x1a8(%rsp), %rdi
leaq 0x1b8(%rsp), %rax
cmpq %rax, %rdi
je 0x5424
movq 0x1b8(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x5424
movq %rax, %rbx
movq 0x1c8(%rsp), %rdi
leaq 0x1d8(%rsp), %rax
cmpq %rax, %rdi
je 0x54ca
movq 0x1d8(%rsp), %rsi
jmp 0x54b3
movq %rax, %rbx
jmp 0x5496
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
je 0x54ca
movq 0xe0(%rsp), %rsi
jmp 0x54b3
movq %rax, %rbx
movq 0x128(%rsp), %rdi
leaq 0x138(%rsp), %rax
cmpq %rax, %rdi
je 0x5496
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x148(%rsp), %rdi
leaq 0x158(%rsp), %rax
cmpq %rax, %rdi
je 0x54ca
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x54ca
movq %rax, %rbx
jmp 0x54ef
movq %rax, %rbx
jmp 0x550b
movq %rax, %rbx
movq 0x1e8(%rsp), %rdi
leaq 0x1f8(%rsp), %rax
cmpq %rax, %rdi
je 0x54ef
movq 0x1f8(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x550b
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x552d
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5549
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x110(%rsp), %rdi
callq 0x820a
leaq 0xb8(%rsp), %rdi
callq 0x820a
jmp 0x556a
jmp 0x5567
movq %rax, %rbx
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x5586
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x3290
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x55ab
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x2a8(%rsp), %rdi
callq 0x30c0
leaq 0x4b0(%rsp), %rdi
callq 0x30c0
movq %rbx, %rdi
callq 0x34b0
nop