// File: /workspace/github_c_makefile_star2_O3/jflatow[P]jfdb/src/trie.c
// Function: make_jump_table
static inline JFT_Offset make_jump_table(JFT_Buffer *buf,
                                         JFT_Offset parentPos,
                                         const JFT_Stem *stem,
                                         JFT_TypeInfo rangeId) {
  // just create an offset for each symbol in the range
  int rangeSize = JumpTableRanges[rangeId].max - JumpTableRanges[rangeId].min + 1;
  JFT_Offset size = JFT_jump_size(stem->size, rangeSize);
  if (!JFT_buffer_ample(buf, size))
    return 0;

  JFT_Offset parentOffset = offset_parent(buf, parentPos, stem);
  write_node(buf, JumpTable, stem, rangeId, parentOffset);

  for (int i = 0; i < rangeSize; i++)
    JFT_buffer_equal(buf, JFT_Offset, 0);

  return size;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
movl %ecx, 0x4(%rsp)
movl %ecx, %eax
shlq $0x4, %rax
leaq 0x9af(%rip), %rbp       # 0x63e0
movq (%rax,%rbp), %rcx
movq 0x8(%rax,%rbp), %r13
movq %r13, %r14
movq %rcx, 0x10(%rsp)
subq %rcx, %r14
movzwl 0x8(%rdx), %eax
leaq 0x8(,%r14,8), %rcx
movabsq $0x7fffffff8, %rdx      # imm = 0x7FFFFFFF8
andq %rcx, %rdx
leaq (%rax,%rdx), %rsi
addq $0x8, %rsi
movq %rsi, 0x8(%rsp)
callq *0x20(%rdi)
movl %eax, %ecx
xorl %eax, %eax
testq %rbx, %rbx
je 0x5c7f
testl %ecx, %ecx
jne 0x5c7f
movq 0x18(%rbx), %rax
leaq (%rax,%r12), %rdi
movq (%r15), %rdx
movq %rdx, %rsi
testq %rdx, %rdx
jne 0x5a9d
movq 0x10(%r15), %rcx
movzbl (%rcx), %esi
movq 0x10(%rbx), %rcx
subq %r12, %rcx
movq (%rdi), %r8
movq %r8, %r9
shrq $0x3e, %r9
leaq 0x91b(%rip), %r10       # 0x63d0
movslq (%r10,%r9,4), %r9
addq %r10, %r9
jmpq *%r9
cmpq $-0x2, %rsi
je 0x5b73
movq %r8, %r9
shrq $0x28, %r9
movzbl %r9b, %r10d
shll $0x4, %r10d
movq (%r10,%rbp), %r9
cmpq %rsi, %r9
ja 0x5b73
cmpq %rsi, 0x8(%r10,%rbp)
jb 0x5b73
shrq $0x30, %r8
andl $0xfff, %r8d            # imm = 0xFFF
addq %r8, %rdi
leaq (%rdi,%rsi,8), %rdx
shlq $0x3, %r9
subq %r9, %rdx
addq $0x8, %rdx
movq %rcx, (%rdx)
movq (%r15), %rdx
jmp 0x5b73
cmpq $-0x2, %rsi
je 0x5b73
movq %r8, %r9
shrq $0x28, %r9
movzbl %r9b, %r9d
testq %r9, %r9
je 0x5b73
shrq $0x30, %r8
andl $0xfff, %r8d            # imm = 0xFFF
leaq (%rdi,%r8), %r10
addq %rdi, %r8
addq $0x8, %r8
leaq (%r9,%r10), %rdi
addq $0x8, %rdi
xorl %r10d, %r10d
leaq (%r10,%r9), %r11
shrq %r11
movzbl (%r8,%r11), %r12d
cmpq %r12, %rsi
jbe 0x5b65
incq %r11
movq %r11, %r10
jmp 0x5b6e
jae 0x5c8e
movq %r11, %r9
cmpq %r9, %r10
jb 0x5b4c
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
movabsq $0xffffffffff, %rdi     # imm = 0xFFFFFFFFFF
movzwl 0x8(%r15), %r12d
testq %rdx, %rdx
je 0x5bf9
xorl %r8d, %r8d
testl %edx, %edx
setne %r8b
shlq $0x3d, %r8
andl $0xfff, %r12d           # imm = 0xFFF
shlq $0x30, %r12
orq %r8, %r12
movzbl 0x4(%rsp), %edx
shlq $0x28, %rdx
orq %r12, %rdx
andq %rdi, %rcx
orq %rdx, %rcx
orq %rsi, %rcx
movq 0x10(%rbx), %rdx
movq %rcx, (%rax,%rdx)
movq 0x10(%rbx), %rcx
leaq 0x8(%rcx), %rdx
movq %rdx, 0x10(%rbx)
movb (%r15), %dl
movb %dl, 0x8(%rax,%rcx)
movq 0x10(%rbx), %rdi
incq %rdi
movq %rdi, 0x10(%rbx)
movq 0x10(%r15), %rsi
movzwl 0x8(%r15), %r12d
decq %r12
addq 0x18(%rbx), %rdi
jmp 0x5c3c
movl %r12d, %edx
andl $0xfff, %edx            # imm = 0xFFF
shlq $0x30, %rdx
movzbl 0x4(%rsp), %r8d
shlq $0x28, %r8
orq %rdx, %r8
andq %rdi, %rcx
orq %r8, %rcx
orq %rsi, %rcx
movq 0x10(%rbx), %rdx
movq %rcx, (%rax,%rdx)
movq 0x10(%rbx), %rcx
leaq 0x8(%rcx), %rdx
movq %rdx, 0x10(%rbx)
movq 0x10(%r15), %rsi
leaq (%rax,%rcx), %rdi
addq $0x8, %rdi
movq %r12, %rdx
callq 0x1140
addq 0x10(%rbx), %r12
movq %r12, 0x10(%rbx)
cmpl $0x7ffffffe, %r14d      # imm = 0x7FFFFFFE
ja 0x5c7a
movq 0x18(%rbx), %rax
subl 0x10(%rsp), %r13d
incl %r13d
movq $0x0, (%rax,%r12)
movq 0x10(%rbx), %r12
addq $0x8, %r12
movq %r12, 0x10(%rbx)
decl %r13d
jne 0x5c61
movq 0x8(%rsp), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq (%rdi,%r11,8), %rdx
jmp 0x5b0d