// File: /workspace/github_cpp_makefile_star2_O2/wx-csy[P]librmq/prep.cpp
// Function: main
int main() {
    work();
    decision_tree_node *node = new decision_tree_node(instances, 0);
    puts("#include <cstdint>");
    puts("#include \"librmq/hardcode.h\"");
    puts("namespace librmq {");
    puts("static const decision_tree_node _nodes[] = {");
    node->serialize();
    delete node;
    puts("};\n");
    fprintf(stderr, "# of nodes in decision tree: %d\n", next_node_id);
    puts("decision_tree_node const * const decision_tree_nodes = _nodes;");

    puts("const std::int8_t lookup_table[][SEGLEN][SEGLEN] = {");
    for (const auto& tr : trees) print_lookup(tree_sample[tr]);
    puts("};\n");
    
    puts("const std::int8_t lookup_pref[][SEGLEN] = {");
    for (const auto& tr : trees) print_lookup_pref(tree_sample[tr]);
    puts("};\n");
    
    puts("const std::int8_t lookup_suf[][SEGLEN] = {");
    for (const auto& tr : trees) print_lookup_suf(tree_sample[tr]);
    puts("};\n");
    
    puts("}");
    fprintf(stderr, "# of different Cartesian trees: %d\n", (int)trees.size());
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
callq 0x1673
pushq $0x20
popq %rdi
callq 0x10e0
movq %rax, %rbx
leaq 0x49e8(%rip), %rsi      # 0x6170
movq %rax, %rdi
xorl %edx, %edx
callq 0x19ca
leaq 0x1894(%rip), %rdi      # 0x302d
callq 0x1150
leaq 0x189b(%rip), %rdi      # 0x3040
callq 0x1150
leaq 0x18ac(%rip), %rdi      # 0x305d
callq 0x1150
leaq 0x18b3(%rip), %rdi      # 0x3070
callq 0x1150
movq %rbx, %rdi
callq 0x1af8
movq %rbx, %rdi
callq 0x1b58
pushq $0x20
popq %rsi
movq %rbx, %rdi
callq 0x10f0
leaq 0x18b9(%rip), %rdi      # 0x309d
callq 0x1150
movq 0x47e8(%rip), %r15      # 0x5fd8
movq (%r15), %rdi
movl 0x496f(%rip), %edx      # 0x6168
leaq 0x18a1(%rip), %rsi      # 0x30a1
xorl %eax, %eax
callq 0x1120
leaq 0x18b4(%rip), %rdi      # 0x30c2
callq 0x1150
leaq 0x18e7(%rip), %rdi      # 0x3101
callq 0x1150
movq 0x48ca(%rip), %rbx      # 0x60f0
movq 0x48cb(%rip), %r12      # 0x60f8
leaq 0x4904(%rip), %r14      # 0x6138
cmpq %r12, %rbx
je 0x1852
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1b9e
movq (%rax), %rdi
callq 0x14cc
addq $0x8, %rbx
jmp 0x1834
leaq 0x1844(%rip), %rdi      # 0x309d
callq 0x1150
leaq 0x18d1(%rip), %rdi      # 0x3136
callq 0x1150
movq 0x487f(%rip), %rbx      # 0x60f0
movq 0x4880(%rip), %r12      # 0x60f8
leaq 0x48b9(%rip), %r14      # 0x6138
cmpq %r12, %rbx
je 0x189d
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1b9e
movq (%rax), %rdi
callq 0x15ac
addq $0x8, %rbx
jmp 0x187f
leaq 0x17f9(%rip), %rdi      # 0x309d
callq 0x1150
leaq 0x18b2(%rip), %rdi      # 0x3162
callq 0x1150
movq 0x4834(%rip), %rbx      # 0x60f0
movq 0x4835(%rip), %r12      # 0x60f8
leaq 0x486e(%rip), %r14      # 0x6138
cmpq %r12, %rbx
je 0x18e8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1b9e
movq (%rax), %rdi
callq 0x160f
addq $0x8, %rbx
jmp 0x18ca
leaq 0x17ae(%rip), %rdi      # 0x309d
callq 0x1150
leaq 0x1892(%rip), %rdi      # 0x318d
callq 0x1150
movq (%r15), %rdi
movq 0x47ee(%rip), %rdx      # 0x60f8
subq 0x47df(%rip), %rdx      # 0x60f0
shrq $0x3, %rdx
leaq 0x1873(%rip), %rsi      # 0x318f
xorl %eax, %eax
callq 0x1120
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
pushq $0x20
popq %rsi
movq %rbx, %rdi
callq 0x10f0
movq %r14, %rdi
callq 0x1180
nop