// File: /workspace/github_c_makefile_star2_O0/jflatow[P]jfdb/src/trie.h
// Function: JFT_keys_next_until
static inline JFT_Stem *JFT_keys_next_until(JFT_Keys *keys, const JFT_Symbol *stop) {
  // after the first pass, wind back to the last fork before pushing on
  // if we hit a wall, or go out of the range of the prefix, stop
 next:
  if (keys->nth++) {
    while (JFT_cursor_next(keys->cursor, keys->direction) >= JFT_SYMBOL_NIL)
      if (!keys->stem->size-- || JFT_cursor_back(keys->cursor, keys->direction) >= JFT_SYMBOL_TOP)
        return NULL;
    if (keys->stem->size <= keys->zero)
      return NULL;
    JFT_set_symbol_at_point(keys->stem, keys->stem->size - 1, keys->cursor->symbol);
  }
  // append each symbol to the stem until we hit a stopping condition
  // in a 'degenerate' trie we might step off a cliff, in which case we must search for siblings
  // NB: its not *really* degenerate, its possible for branches to have all their children deleted
  //     eventually the branch should be removed too, but it can and does occur
  while (1) {
    if (stop && keys->cursor->symbol == *stop)
      return keys->stem;
    if (JFT_cursor_at_terminal(keys->cursor))
      return keys->stem;
    if (JFT_cursor_step(keys->cursor, keys->direction) >= JFT_SYMBOL_NIL) {
      if (JFT_cursor_back(keys->cursor, keys->direction) >= JFT_SYMBOL_TOP)
        return NULL;
      else
        goto next;
    }
    JFT_set_symbol_at_point(keys->stem, keys->stem->size++, keys->cursor->symbol);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x18(%rcx)
cmpq $0x0, %rax
je 0x484c
jmp 0x479f
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x14(%rax), %esi
callq 0x4fd0
cmpq $-0x2, %rax
jb 0x47fd
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movw 0x8(%rcx), %ax
movw %ax, %dx
addw $-0x1, %dx
movw %dx, 0x8(%rcx)
cmpw $0x0, %ax
je 0x47ee
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x14(%rax), %esi
callq 0x4df0
cmpq $-0x3, %rax
jb 0x47fb
movq $0x0, -0x8(%rbp)
jmp 0x4913
jmp 0x479f
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movzwl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
movzwl 0x10(%rcx), %ecx
cmpl %ecx, %eax
jg 0x4822
movq $0x0, -0x8(%rbp)
jmp 0x4913
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movzwl 0x8(%rax), %eax
subl $0x1, %eax
movslq %eax, %rsi
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %rdx
callq 0x4920
jmp 0x484e
cmpq $0x0, -0x18(%rbp)
je 0x487a
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %rax
movq -0x18(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x487a
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x4913
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x49c0
cmpl $0x0, %eax
je 0x4899
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x4913
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x14(%rax), %esi
callq 0x4eb0
cmpq $-0x2, %rax
jb 0x48da
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x14(%rax), %esi
callq 0x4df0
cmpq $-0x3, %rax
jb 0x48d5
movq $0x0, -0x8(%rbp)
jmp 0x4913
jmp 0x4780
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movw 0x8(%rcx), %ax
movw %ax, %dx
addw $0x1, %dx
movw %dx, 0x8(%rcx)
movzwl %ax, %eax
movl %eax, %esi
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %rdx
callq 0x4920
jmp 0x484e
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)