// File: /workspace/github_cpp_makefile_star2_O1/tismith[P]tmp-play/list.cpp
// Function: main
int main() {

    /* The best example */
    std::cout << "The list is: ";
    ListPrinter<myList>::print(); // this one generates tons of classes

    std::cout << "The sorted list is: ";
    ListPrinter<SORT<ORD, myList>::TYPE>::print();

    /* basic list operations */
    std::cout << "head = " << myList::HEAD << std::endl;
    std::cout << "length = " << myList::LENGTH << std::endl;
    std::cout << "sum = " << SUM< myList >::RESULT << std::endl;
    std::cout << "minimum = " << myList::MINIMUM << std::endl;

    /* map-reduce or fold */
    std::cout << "sum of squares with map_reduce = " << MAP_REDUCE< myList, SQUARE, ADDITION, 0 >::RESULT << std::endl;
    std::cout << "minimum with map_reduce = " << MAP_REDUCE< myList, ID, MIN, INT_MAX >::RESULT << std::endl;
    std::cout << "sum done with map_reduce = " << MAP_REDUCE< myList, ID, ADDITION, 0 >::RESULT << std::endl;
    std::cout << "mapping square over the list = ";
    ListPrinter<MAP<myList, SQUARE>::TYPE>::print();
    std::cout << "mapping increment over the list = ";
    ListPrinter<MAP<myList, INCREMENT >::TYPE>::print();

    /* other list operations */
    std::cout << "prepending '3' = ";
    ListPrinter<PREPEND<3,myList>::TYPE>::print();
    std::cout << "tail function = ";
    ListPrinter<TAIL<myList>::TYPE>::print();
    std::cout << "tail member function = ";
    ListPrinter<myList::TAIL>::print();

    /* internal routines used for the merge sort */
    std::cout << "merge (1,6,8) (6,9) = ";
    ListPrinter<MERGE<ORD, LIST3<1,6,8>::TYPE, LIST2<6,9>::TYPE>::TYPE>::print();
    std::cout << "fst . split (1,6,8,6,9) = ";
    ListPrinter<SPLIT<LIST5<1,6,8,6,9>::TYPE>::TYPE::FST>::print();
    std::cout << "snd . split (1,6,8,6,9) = ";
    ListPrinter<SPLIT<LIST5<1,6,8,6,9>::TYPE>::TYPE::SND>::print();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0x2e00(%rip), %rbx      # 0x3fd8
leaq 0xe25(%rip), %rsi       # 0x2004
movl $0xd, %edx
movq %rbx, %rdi
callq 0x1070
movq %rbx, %rdi
movl $0xa, %esi
callq 0x1090
leaq 0xf6f(%rip), %r14       # 0x216f
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x17, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x4, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x9, %esi
callq 0x1090
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x1060
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1040
leaq 0xd70(%rip), %rsi       # 0x2012
movl $0x14, %edx
movq %rbx, %rdi
callq 0x1070
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x4, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x9, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0xa, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x17, %esi
callq 0x1090
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x1060
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1040
leaq 0xcc9(%rip), %rsi       # 0x2027
movl $0x7, %edx
movq %rbx, %rdi
callq 0x1070
movq %rbx, %rdi
movl $0xa, %esi
callq 0x1090
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x1060
movsbl %al, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1040
leaq 0xc86(%rip), %rsi       # 0x202f
movl $0x9, %edx
movq %rbx, %rdi
callq 0x1070
movq %rbx, %rdi
movl $0x5, %esi
callq 0x1090
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x1060
movsbl %al, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1040
leaq 0xc45(%rip), %rsi       # 0x2039
movl $0x6, %edx
movq %rbx, %rdi
callq 0x1070
movq %rbx, %rdi
movl $0x30, %esi
callq 0x1090
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x1060
movsbl %al, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1040
leaq 0xc01(%rip), %rsi       # 0x2040
movl $0xa, %edx
movq %rbx, %rdi
callq 0x1070
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1090
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x1060
movsbl %al, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1040
leaq 0xbc1(%rip), %rsi       # 0x204b
movl $0x21, %edx
movq %rbx, %rdi
callq 0x1070
movq %rbx, %rdi
movl $0x2da, %esi            # imm = 0x2DA
callq 0x1090
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x1060
movsbl %al, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1040
leaq 0xb98(%rip), %rsi       # 0x206d
movl $0x1a, %edx
movq %rbx, %rdi
callq 0x1070
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1090
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x1060
movsbl %al, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1040
leaq 0xb68(%rip), %rsi       # 0x2088
movl $0x1b, %edx
movq %rbx, %rdi
callq 0x1070
movq %rbx, %rdi
movl $0x30, %esi
callq 0x1090
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x1060
movsbl %al, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1040
leaq 0xb39(%rip), %rsi       # 0x20a4
movl $0x1f, %edx
movq %rbx, %rdi
callq 0x1070
movq %rbx, %rdi
movl $0x64, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x211, %esi            # imm = 0x211
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x10, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x4, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x51, %esi
callq 0x1090
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x1060
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1040
leaq 0xa9d(%rip), %rsi       # 0x20c4
movl $0x22, %edx
movq %rbx, %rdi
callq 0x1070
movq %rbx, %rdi
movl $0xb, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x18, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x5, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x3, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0xa, %esi
callq 0x1090
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x1060
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1040
leaq 0xa04(%rip), %rsi       # 0x20e7
movl $0x11, %edx
movq %rbx, %rdi
callq 0x1070
callq 0x19de
leaq 0x9fd(%rip), %rsi       # 0x20f9
movl $0x10, %edx
movq %rbx, %rdi
callq 0x1070
movq %rbx, %rdi
movl $0x17, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x4, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x9, %esi
callq 0x1090
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x1060
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1040
leaq 0x96f(%rip), %rsi       # 0x210a
movl $0x17, %edx
movq %rbx, %rdi
callq 0x1070
movq %rbx, %rdi
movl $0x17, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x4, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x9, %esi
callq 0x1090
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x1060
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1040
leaq 0x8e8(%rip), %rsi       # 0x2122
movl $0x16, %edx
movq %rbx, %rdi
callq 0x1070
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x6, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x6, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x8, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x9, %esi
callq 0x1090
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x1060
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1040
leaq 0x843(%rip), %rsi       # 0x2139
movl $0x1a, %edx
movq %rbx, %rdi
callq 0x1070
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x8, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x9, %esi
callq 0x1090
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x1060
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1040
leaq 0x7dc(%rip), %rsi       # 0x2154
movl $0x1a, %edx
movq %rbx, %rdi
callq 0x1070
movq %rbx, %rdi
movl $0x6, %esi
callq 0x1090
movl $0x2, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
movl $0x6, %esi
callq 0x1090
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x1060
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1040
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq