// File: /workspace/github_c_makefile_star2_O0/jflatow[P]jfdb/src/trie.c
// Function: move_into_frame
static JFT_MergeFrame *move_into_frame(JFT_Cursor *cursors,
                                       JFT_CursorFun advance,
                                       JFT_Mask relevant,
                                       JFT_MergeFrame *frame,
                                       JFT_Direction direction) {
  // compute the new active set and bound from the relevant cursors
  // advance the active cursors (assumed to be a subset of relevant)
  JFT_Symbol bound = JFT_SYMBOL_NIL, symbol;
  JFT_Mask definite = 0, possible = 0, preclude = 0;
  for (JFT_Amount b = ffsll(relevant); b; b = ffsll(relevant &= relevant - 1)) {
    JFT_Amount i = b - 1;
    JFT_Mask m = 1LLU << i;
    if (frame->active & m)
      advance(&cursors[i], direction);
    symbol = cursors[i].symbol;
    if (symbol == JFT_SYMBOL_NIL) {
      // the symbol is NIL: not active and has no more siblings
      preclude |= m;
    } else if (symbol == JFT_SYMBOL_ANY) {
      // the symbol is ANY: definitely active, but does not tighten the bound
      definite |= m;
    } else if (symbol == bound) {
      // the symbol matches the bound: potentially include it in active set
      possible |= m;
    } else if ((direction == Forward && symbol < bound) ||
               (direction == Reverse && symbol > bound) ||
               (bound == JFT_SYMBOL_NIL)) {
      // the symbol beats the bound: replace the potential active set
      bound = symbol;
      possible = m;
    }
  }
  frame->bound = bound;
  frame->active = possible | definite;
  frame->done = preclude;
  return frame;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq $-0x2, -0x30(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x18(%rbp), %rdx
tzcntq %rdx, %rax
addq $0x1, %rax
xorl %ecx, %ecx
cmpq $0x0, %rdx
cmoveq %rcx, %rax
cltq
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
je 0x576a
movq -0x58(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rcx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, -0x68(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
andq -0x68(%rbp), %rax
cmpq $0x0, %rax
je 0x56a7
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rdi
imulq $0x38, -0x60(%rbp), %rcx
addq %rcx, %rdi
movl -0x24(%rbp), %esi
callq *%rax
movq -0x8(%rbp), %rax
imulq $0x38, -0x60(%rbp), %rcx
addq %rcx, %rax
movq 0x30(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $-0x2, -0x38(%rbp)
jne 0x56d0
movq -0x68(%rbp), %rax
orq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x573a
cmpq $-0x1, -0x38(%rbp)
jne 0x56e5
movq -0x68(%rbp), %rax
orq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0x5738
movq -0x38(%rbp), %rax
cmpq -0x30(%rbp), %rax
jne 0x56fd
movq -0x68(%rbp), %rax
orq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x5736
cmpl $0x1, -0x24(%rbp)
jne 0x570d
movq -0x38(%rbp), %rax
cmpq -0x30(%rbp), %rax
jb 0x5724
cmpl $-0x1, -0x24(%rbp)
jne 0x571d
movq -0x38(%rbp), %rax
cmpq -0x30(%rbp), %rax
ja 0x5724
cmpq $-0x2, -0x30(%rbp)
jne 0x5734
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x5736
jmp 0x5738
jmp 0x573a
jmp 0x573c
movq -0x18(%rbp), %rdx
subq $0x1, %rdx
andq -0x18(%rbp), %rdx
movq %rdx, -0x18(%rbp)
tzcntq %rdx, %rax
addq $0x1, %rax
xorl %ecx, %ecx
cmpq $0x0, %rdx
cmoveq %rcx, %rax
cltq
movq %rax, -0x58(%rbp)
jmp 0x5659
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x48(%rbp), %rcx
orq -0x40(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x50(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)