// File: /workspace/github_cpp_makefile_star2_O1/IHorvalds[P]RomAna/./processing/InflexEngineCore.cpp
// Function: InflexEngine::updateMihailsJmenuri(int, unsigned int, int)
void InflexEngine::updateMihailsJmenuri(int32_t ptr, uint32_t pos, int32_t goesTo) {
// Enlarge the vector of sons - the edge of "pos" points now to "goesTo" 
// The idea is to fully alloc the vector of sons
  // Get the number of sons
  size_t countOfSons = bitOp::countOfBits(staticTrieAccess(ptr)->configuration);
  
  // Create temporary copy of the sons
  uint32_t* temp = new uint32_t[countOfSons]();
  for (unsigned index = 0; index < countOfSons; index++)
    temp[index] = staticTrieAccess(ptr)->sons[index];
  delete[] staticTrieAccess(ptr)->sons;
  
  // Alloc a new vector of sons
  staticTrieAccess(ptr)->sons = new uint32_t[sigma]();
  
  // Re-establish the sons. 
  for (unsigned index = 0; index < sigma; index++) {
    if (bitOp::getBit(staticTrieAccess(ptr)->configuration, index))
      staticTrieAccess(ptr)->sons[index] = temp[bitOp::orderOfBit(staticTrieAccess(ptr)->configuration, index)];
    else
      staticTrieAccess(ptr)->sons[index] = 0;
  }
  
  // Update the configuration
  staticTrieAccess(ptr)->configuration = fullBits;
  
  // Let the edge "pos" point to "goesTo"
  staticTrieAccess(ptr)->sons[pos] = goesTo;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, 0x4(%rsp)
movl %edx, (%rsp)
movl %esi, %r14d
movq %rdi, %r15
callq 0x384c
movl 0x8(%rax), %ebp
movl %ebp, %eax
shrl %eax
andl $0x55555555, %eax       # imm = 0x55555555
movl %ebp, %ecx
subl %eax, %ecx
movl $0x33333333, %eax       # imm = 0x33333333
movl %ecx, %edx
andl %eax, %edx
shrl $0x2, %ecx
andl %eax, %ecx
addl %edx, %ecx
movl %ecx, %eax
shrl $0x4, %eax
addl %ecx, %eax
andl $0xf0f0f0f, %eax        # imm = 0xF0F0F0F
imull $0x1010101, %eax, %ebx  # imm = 0x1010101
shrl $0x18, %ebx
leal (,%rbx,4), %r13d
movq %r13, %rdi
callq 0x3030
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x3170
testl %ebp, %ebp
je 0x41f6
cmpl $0x1, %ebx
adcl $0x0, %ebx
xorl %r13d, %r13d
movq %r15, %rdi
movl %r14d, %esi
callq 0x384c
movq 0xc(%rax), %rax
movl (%rax,%r13,4), %eax
movl %eax, (%r12,%r13,4)
incq %r13
cmpq %r13, %rbx
jne 0x41d7
movq %r15, %rdi
movl %r14d, %esi
callq 0x384c
movq 0xc(%rax), %rdi
testq %rdi, %rdi
je 0x420f
callq 0x3350
movl 0x20(%r15), %r13d
shlq $0x2, %r13
movq %r13, %rdi
callq 0x3030
movq %rax, %rbx
movq %rax, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x3170
movq %r15, %rdi
movl %r14d, %esi
callq 0x384c
movq %rbx, 0xc(%rax)
cmpl $0x0, 0x20(%r15)
je 0x429b
xorl %r13d, %r13d
movq %r15, %rdi
movl %r14d, %esi
callq 0x384c
movl 0x8(%rax), %ebx
movq %r15, %rdi
movl %r14d, %esi
callq 0x384c
btl %r13d, %ebx
jae 0x4285
movl 0x8(%rax), %edi
movl %r13d, %esi
callq 0x42d5
movl %eax, %eax
movl (%r12,%rax,4), %ebx
movq %r15, %rdi
movl %r14d, %esi
callq 0x384c
jmp 0x4287
xorl %ebx, %ebx
movq 0xc(%rax), %rax
movl %ebx, (%rax,%r13,4)
incq %r13
movl 0x20(%r15), %eax
cmpq %rax, %r13
jb 0x4248
movl 0x24(%r15), %ebx
movq %r15, %rdi
movl %r14d, %esi
callq 0x384c
movl %ebx, 0x8(%rax)
movq %r15, %rdi
movl %r14d, %esi
callq 0x384c
movq 0xc(%rax), %rax
movl (%rsp), %ecx
movl 0x4(%rsp), %edx
movl %edx, (%rax,%rcx,4)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq