// File: /workspace/github_cpp_makefile_star2_O2/IDEmbedder[P]IDembedder/./IDdemo.cpp
// Function: main
int main(int argc, char *argv[]) {
    std::vector<Pair> vector_id;
    
    std::vector<double> vector_to_embed1 = {1.3, 1.4, -1.8};
    std::vector<double> vector_to_embed2 = {2.2, -1.4, 8.7};
    
    //dimensions
    std::vector<double> dim1 = {0, 2, 4, 6, 10};
    std::vector<double> dim2 = {-3, 0, 3};
    std::vector<double> dim3 = {-6.4, -1.3, 0.1, 13, 17.3};
    
    //discrete points of dimensions
    std::vector<std::vector<double> > discrete_points = {dim1, dim2, dim3};
    
    //grid wrapper for discrete points
    Grid grid(discrete_points);
    
    //groups indices - in the following example combinations of two dimensions
    std::vector<std::vector<size_t> > groups = {{0, 1}, {0, 2}, {1, 2}};
    
    //grids of groups makes grid for each group
    GridsOfGroups grids_of_groups(discrete_points, groups);
    
    //interpolated discretization
    ID id(grid);
    
    //embedder
    vector_id = id(vector_to_embed1);
    
    std::cout << "-----------------------ID-----------------------" << std::endl;
    for (const auto& pair : vector_id) {
        std::cout << pair << std::endl;
    }
    std::cout << "\n\n";
    
    
    //interpolated discretization of pairs
    IDpair id_pair(grid);
    
    //embedder
    vector_id = id_pair(vector_to_embed1, vector_to_embed2);
    
    std::cout << "--------------------ID  PAIR--------------------" << std::endl;
    for (const auto& pair : vector_id) {
        std::cout << pair << std::endl;
    }
    std::cout << "\n\n";
    
    
    //interpolated discretization for all ID groups
    IDgroups id_groups(grids_of_groups, groups);
    
    //embedder
    vector_id = id_groups(vector_to_embed1);
    
    std::cout << "-------------------ID  GROUPS-------------------" << std::endl;
    for (const auto& pair : vector_id) {
        std::cout << pair << std::endl;
    }
    
    
    //interpolated discretization for all IDpair groups
    IDgroupsPair id_groups_pair(grids_of_groups, groups);
    
    //embedder
    vector_id = id_groups_pair(vector_to_embed1, vector_to_embed2);
    
    std::cout << "-----------------ID GROUPS PAIR-----------------" << std::endl;
    for (const auto& pair : vector_id) {
        std::cout << pair << std::endl;
    }

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x2a0, %rsp            # imm = 0x2A0
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movups 0x3d9b(%rip), %xmm0     # 0x5028
leaq 0x90(%rsp), %rsi
movaps %xmm0, (%rsi)
movabsq $-0x4003333333333333, %rax # imm = 0xBFFCCCCCCCCCCCCD
movq %rax, 0x10(%rsi)
leaq 0x30(%rsp), %rdi
pushq $0x3
popq %rdx
leaq 0x160(%rsp), %rcx
callq 0x19a8
movups 0x3d7e(%rip), %xmm0     # 0x5040
leaq 0x90(%rsp), %rsi
movaps %xmm0, (%rsi)
movabsq $0x4021666666666666, %rax # imm = 0x4021666666666666
movq %rax, 0x10(%rsi)
leaq 0x78(%rsp), %rdi
pushq $0x3
popq %rdx
leaq 0x160(%rsp), %rcx
callq 0x19a8
movups 0x3d71(%rip), %xmm0     # 0x5068
leaq 0x90(%rsp), %rsi
movaps %xmm0, 0x10(%rsi)
movups 0x3d4e(%rip), %xmm0     # 0x5058
movaps %xmm0, (%rsi)
movabsq $0x4024000000000000, %rax # imm = 0x4024000000000000
movq %rax, 0x20(%rsi)
leaq 0x148(%rsp), %rdi
pushq $0x5
popq %rdx
leaq 0x160(%rsp), %rcx
callq 0x19a8
movups 0x3d46(%rip), %xmm0     # 0x5080
leaq 0x90(%rsp), %rsi
movaps %xmm0, (%rsi)
movabsq $0x4008000000000000, %rax # imm = 0x4008000000000000
movq %rax, 0x10(%rsi)
leaq 0x130(%rsp), %rdi
pushq $0x3
popq %rdx
leaq 0x160(%rsp), %rcx
callq 0x19a8
movups 0x3d36(%rip), %xmm0     # 0x50a8
leaq 0x90(%rsp), %rsi
movaps %xmm0, 0x10(%rsi)
movups 0x3d13(%rip), %xmm0     # 0x5098
movaps %xmm0, (%rsi)
movabsq $0x40314ccccccccccd, %rax # imm = 0x40314CCCCCCCCCCD
movq %rax, 0x20(%rsi)
leaq 0x118(%rsp), %rdi
pushq $0x5
popq %rdx
leaq 0x160(%rsp), %rcx
callq 0x19a8
leaq 0x90(%rsp), %r14
leaq 0x148(%rsp), %rsi
movq %r14, %rdi
callq 0x19de
leaq 0xa8(%rsp), %r15
leaq 0x130(%rsp), %rsi
movq %r15, %rdi
callq 0x19de
leaq 0xc0(%rsp), %r15
leaq 0x118(%rsp), %rsi
movq %r15, %rdi
callq 0x19de
leaq 0x60(%rsp), %rdi
leaq 0x90(%rsp), %rsi
pushq $0x3
popq %rdx
leaq 0x160(%rsp), %rcx
callq 0x1a2c
pushq $0x30
popq %rbx
leaq (%rsp,%rbx), %rdi
addq $0x90, %rdi
callq 0x2f82
addq $-0x18, %rbx
cmpq $-0x18, %rbx
jne 0x1416
leaq 0x1c8(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x1a66
leaq 0x160(%rsp), %rsi
andq $0x0, (%rsi)
movq $0x1, 0x8(%rsi)
leaq 0x90(%rsp), %r14
pushq $0x2
popq %rdx
leaq 0xf8(%rsp), %rcx
movq %r14, %rdi
callq 0x1afe
leaq 0xa8(%rsp), %r15
leaq 0x250(%rsp), %rsi
andq $0x0, (%rsi)
movq $0x2, 0x8(%rsi)
pushq $0x2
popq %rdx
leaq 0xf(%rsp), %rcx
movq %r15, %rdi
callq 0x1afe
leaq 0xc0(%rsp), %r15
leaq 0x200(%rsp), %rsi
movq $0x1, (%rsi)
movq $0x2, 0x8(%rsi)
pushq $0x2
popq %rdx
leaq 0xe(%rsp), %rcx
movq %r15, %rdi
callq 0x1afe
leaq 0x48(%rsp), %rdi
leaq 0x90(%rsp), %rsi
pushq $0x3
popq %rdx
leaq 0xd(%rsp), %rcx
callq 0x1b34
pushq $0x30
popq %rbx
leaq (%rsp,%rbx), %rdi
addq $0x90, %rdi
callq 0x2644
addq $-0x18, %rbx
cmpq $-0x18, %rbx
jne 0x14e9
leaq 0xf8(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x1b6e
leaq 0x250(%rsp), %rdi
leaq 0x1c8(%rsp), %rsi
callq 0x1ca2
leaq 0x250(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x1cea
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x1de4
movq 0x7a83(%rip), %rdi      # 0x8fd8
leaq 0x3b64(%rip), %rsi      # 0x50c0
callq 0x10b0
movq %rax, %rdi
callq 0x1060
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r15
movq 0x7a5e(%rip), %r14      # 0x8fd8
cmpq %r15, %rbx
je 0x1598
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1eb0
movq %rax, %rdi
callq 0x1060
addq $0x10, %rbx
jmp 0x157a
movq 0x7a39(%rip), %rdi      # 0x8fd8
leaq 0x3b4b(%rip), %rsi      # 0x50f1
callq 0x10b0
leaq 0x200(%rsp), %rdi
leaq 0x1c8(%rsp), %rsi
callq 0x1f08
leaq 0x200(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0x1f54
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x1de4
movq 0x79ed(%rip), %rdi      # 0x8fd8
leaq 0x3b02(%rip), %rsi      # 0x50f4
callq 0x10b0
movq %rax, %rdi
callq 0x1060
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r15
movq 0x79c8(%rip), %r14      # 0x8fd8
cmpq %r15, %rbx
je 0x162e
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1eb0
movq %rax, %rdi
callq 0x1060
addq $0x10, %rbx
jmp 0x1610
movq 0x79a3(%rip), %rdi      # 0x8fd8
leaq 0x3ab5(%rip), %rsi      # 0x50f1
callq 0x10b0
leaq 0x90(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x1f86
leaq 0x90(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x206a
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x1de4
movq 0x7957(%rip), %rdi      # 0x8fd8
leaq 0x3a9d(%rip), %rsi      # 0x5125
callq 0x10b0
movq %rax, %rdi
callq 0x1060
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r15
movq 0x7932(%rip), %r14      # 0x8fd8
cmpq %r15, %rbx
je 0x16c4
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1eb0
movq %rax, %rdi
callq 0x1060
addq $0x10, %rbx
jmp 0x16a6
leaq 0x160(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x2138
leaq 0x160(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0x2220
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x1de4
movq 0x78cf(%rip), %rdi      # 0x8fd8
leaq 0x3a46(%rip), %rsi      # 0x5156
callq 0x10b0
movq %rax, %rdi
callq 0x1060
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r15
movq 0x78aa(%rip), %r14      # 0x8fd8
cmpq %r15, %rbx
je 0x174c
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1eb0
movq %rax, %rdi
callq 0x1060
addq $0x10, %rbx
jmp 0x172e
leaq 0x160(%rsp), %rdi
callq 0x2336
leaq 0x90(%rsp), %rdi
callq 0x234c
leaq 0x200(%rsp), %rdi
callq 0x2362
leaq 0x250(%rsp), %rdi
callq 0x2362
leaq 0xf8(%rsp), %rdi
callq 0x284a
leaq 0x48(%rsp), %rdi
callq 0x2378
leaq 0x1c8(%rsp), %rdi
callq 0x239a
leaq 0x60(%rsp), %rdi
callq 0x23b0
leaq 0x118(%rsp), %rdi
callq 0x2f82
leaq 0x130(%rsp), %rdi
callq 0x2f82
leaq 0x148(%rsp), %rdi
callq 0x2f82
leaq 0x78(%rsp), %rdi
callq 0x2f82
leaq 0x30(%rsp), %rdi
callq 0x2f82
leaq 0x10(%rsp), %rdi
callq 0x2c46
xorl %eax, %eax
addq $0x2a0, %rsp            # imm = 0x2A0
popq %rbx
popq %r14
popq %r15
retq
jmp 0x18f8
jmp 0x190a
jmp 0x191c
movq %rax, %rbx
jmp 0x192c
movq %rax, %rbx
jmp 0x1939
movq %rax, %rbx
pushq $0x30
popq %r14
leaq (%rsp,%r14), %rdi
addq $0x90, %rdi
callq 0x2644
addq $-0x18, %r14
cmpq $-0x18, %r14
jne 0x1828
jmp 0x1943
jmp 0x1849
movq %rax, %rbx
addq $-0x18, %r15
movq %r15, %rdi
callq 0x2644
cmpq %r14, %r15
jne 0x184c
jmp 0x1943
movq %rax, %rbx
jmp 0x1943
movq %rax, %rbx
jmp 0x1950
movq %rax, %rbx
pushq $0x30
popq %r14
leaq (%rsp,%r14), %rdi
addq $0x90, %rdi
callq 0x2f82
addq $-0x18, %r14
cmpq $-0x18, %r14
jne 0x1879
jmp 0x195a
movq %rax, %rbx
jmp 0x195a
movq %rax, %rbx
jmp 0x1967
movq %rax, %rbx
jmp 0x1974
movq %rax, %rbx
jmp 0x1981
movq %rax, %rbx
jmp 0x198b
movq %rax, %rbx
jmp 0x1995
movq %rax, %rbx
addq $-0x18, %r15
movq %r15, %rdi
callq 0x2f82
cmpq %r14, %r15
jne 0x18cb
jmp 0x195a
jmp 0x18e6
jmp 0x18f8
jmp 0x190a
jmp 0x191c
movq %rax, %rbx
leaq 0x160(%rsp), %rdi
callq 0x2336
jmp 0x18fb
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x234c
jmp 0x190d
movq %rax, %rbx
leaq 0x200(%rsp), %rdi
callq 0x2362
jmp 0x191f
movq %rax, %rbx
leaq 0x250(%rsp), %rdi
callq 0x2362
leaq 0xf8(%rsp), %rdi
callq 0x284a
leaq 0x48(%rsp), %rdi
callq 0x2378
leaq 0x1c8(%rsp), %rdi
callq 0x239a
leaq 0x60(%rsp), %rdi
callq 0x23b0
leaq 0x118(%rsp), %rdi
callq 0x2f82
leaq 0x130(%rsp), %rdi
callq 0x2f82
leaq 0x148(%rsp), %rdi
callq 0x2f82
leaq 0x78(%rsp), %rdi
callq 0x2f82
leaq 0x30(%rsp), %rdi
callq 0x2f82
leaq 0x10(%rsp), %rdi
callq 0x2c46
movq %rbx, %rdi
callq 0x1130
nop