// File: /workspace/github_c_makefile_star2_O0/jflatow[P]jfdb/src/trie.h
// Function: JFT_jump_child_slot
static inline JFT_Offset *JFT_jump_child_slot(const JFT *trie,
                                              JFT_Symbol symbol,
                                              int delta) {
  JFT_TypeInfo rangeId = JFT_type_info(trie);
  JFT_Offset *offsets = (JFT_Offset *)JFT_type_data(trie);
  JFT_Range range = JumpTableRanges[rangeId];
  JFT_Symbol min = range.min, max = range.max;

  // if its NIL, handle it first
  if (symbol == JFT_SYMBOL_NIL) {
    if (delta > 0)
      goto searchForward; // range.min, range.max
    if (delta < 0)
      goto searchReverse; // range.max, range.min
    return NULL;
  }

  // otherwise, figure out if its in the range of the table and search appropriately
  if (symbol < range.min) {
    if (delta > 0)
      goto searchForward; // range.min, range.max
  } else if (symbol <= range.max) {
    if (delta == 0) {
      return offsets + symbol - range.min;
    } else if (delta < 0) {
      max = symbol - 1;
      goto searchReverse; // symbol - 1, range.min
    } else if (delta > 0) {
      min = symbol + 1;
      goto searchForward; // symbol + 1, range.max
    }
  } else {
    if (delta < 0)
      goto searchReverse; // range.max, range.min
  }
  return NULL;

 searchForward:
  offsets += min - range.min;
  for (JFT_Symbol i = min; i <= max; i++, offsets++)
    if (*offsets)
      return offsets;
  return NULL;

 searchReverse:
  offsets += max - range.min;
  for (JFT_Symbol i = max; i >= min; i--, offsets--)
    if (*offsets)
      return offsets;
  return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7950
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7970
movq %rax, -0x28(%rbp)
movl -0x20(%rbp), %eax
movl %eax, %ecx
leaq 0x1e68(%rip), %rax      # 0x93b0
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x38(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $-0x2, -0x18(%rbp)
jne 0x7598
cmpl $0x0, -0x1c(%rbp)
jle 0x7580
jmp 0x762e
cmpl $0x0, -0x1c(%rbp)
jge 0x758b
jmp 0x7691
movq $0x0, -0x8(%rbp)
jmp 0x76ef
movq -0x18(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x75af
cmpl $0x0, -0x1c(%rbp)
jle 0x75ad
jmp 0x762e
jmp 0x7621
movq -0x18(%rbp), %rax
cmpq -0x30(%rbp), %rax
ja 0x7615
cmpl $0x0, -0x1c(%rbp)
jne 0x75e4
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
xorl %ecx, %ecx
subq -0x38(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x76ef
cmpl $0x0, -0x1c(%rbp)
jge 0x75fb
movq -0x18(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x7691
cmpl $0x0, -0x1c(%rbp)
jle 0x760f
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x762e
jmp 0x7611
jmp 0x7613
jmp 0x761f
cmpl $0x0, -0x1c(%rbp)
jge 0x761d
jmp 0x7691
jmp 0x761f
jmp 0x7621
movq $0x0, -0x8(%rbp)
jmp 0x76ef
movq -0x40(%rbp), %rax
subq -0x38(%rbp), %rax
shlq $0x3, %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x48(%rbp), %rax
ja 0x7687
movq -0x28(%rbp), %rax
cmpq $0x0, (%rax)
je 0x766b
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x76ef
jmp 0x766d
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
movq -0x28(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x28(%rbp)
jmp 0x764a
movq $0x0, -0x8(%rbp)
jmp 0x76ef
movq -0x48(%rbp), %rax
subq -0x38(%rbp), %rax
shlq $0x3, %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x40(%rbp), %rax
jb 0x76e7
movq -0x28(%rbp), %rax
cmpq $0x0, (%rax)
je 0x76cb
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x76ef
jmp 0x76cd
movq -0x58(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rax
addq $-0x8, %rax
movq %rax, -0x28(%rbp)
jmp 0x76ad
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)