// File: /workspace/github_cpp_makefile_star2_O1/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 %r12
pushq %rbx
subq $0x2a8, %rsp            # imm = 0x2A8
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movups 0x4c26(%rip), %xmm0     # 0x6028
leaq 0x60(%rsp), %rsi
movaps %xmm0, (%rsi)
movabsq $-0x4003333333333333, %rax # imm = 0xBFFCCCCCCCCCCCCD
movq %rax, 0x10(%rsi)
leaq 0x30(%rsp), %rdi
leaq 0x168(%rsp), %rcx
movl $0x3, %edx
callq 0x1e54
movups 0x4c0a(%rip), %xmm0     # 0x6040
leaq 0x60(%rsp), %rsi
movaps %xmm0, (%rsi)
movabsq $0x4021666666666666, %rax # imm = 0x4021666666666666
movq %rax, 0x10(%rsi)
leaq 0x48(%rsp), %rdi
leaq 0x168(%rsp), %rcx
movl $0x3, %edx
callq 0x1e54
movups 0x4bfe(%rip), %xmm0     # 0x6068
leaq 0x60(%rsp), %rsi
movaps %xmm0, 0x10(%rsi)
movups 0x4bde(%rip), %xmm0     # 0x6058
movaps %xmm0, (%rsi)
movabsq $0x4024000000000000, %rax # imm = 0x4024000000000000
movq %rax, 0x20(%rsi)
leaq 0x118(%rsp), %rdi
leaq 0x168(%rsp), %rcx
movl $0x5, %edx
callq 0x1e54
movups 0x4bd4(%rip), %xmm0     # 0x6080
leaq 0x60(%rsp), %rsi
movaps %xmm0, (%rsi)
movabsq $0x4008000000000000, %rax # imm = 0x4008000000000000
movq %rax, 0x10(%rsi)
leaq 0x100(%rsp), %rdi
leaq 0x168(%rsp), %rcx
movl $0x3, %edx
callq 0x1e54
movups 0x4bc5(%rip), %xmm0     # 0x60a8
leaq 0x60(%rsp), %r14
movaps %xmm0, 0x10(%r14)
movups 0x4ba4(%rip), %xmm0     # 0x6098
movaps %xmm0, (%r14)
movabsq $0x40314ccccccccccd, %rax # imm = 0x40314CCCCCCCCCCD
movq %rax, 0x20(%r14)
leaq 0xe8(%rsp), %rdi
leaq 0x168(%rsp), %rcx
movl $0x5, %edx
movq %r14, %rsi
callq 0x1e54
leaq 0x118(%rsp), %rsi
movq %r14, %r15
movq %r14, %rdi
callq 0x1e9a
leaq 0x78(%rsp), %r15
leaq 0x100(%rsp), %rsi
movq %r15, %rdi
callq 0x1e9a
leaq 0x90(%rsp), %r15
leaq 0xe8(%rsp), %rsi
movq %r15, %rdi
callq 0x1e9a
leaq 0x130(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0x168(%rsp), %rcx
movl $0x3, %edx
callq 0x1f1a
movl $0x48, %ebx
movq 0x48(%rsp,%rbx), %rdi
testq %rdi, %rdi
je 0x159e
movq 0x58(%rsp,%rbx), %rsi
subq %rdi, %rsi
callq 0x10f0
addq $-0x18, %rbx
jne 0x1587
leaq 0x1d0(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0x1f64
leaq 0x168(%rsp), %rsi
movq $0x0, (%rsi)
movq $0x1, 0x8(%rsi)
leaq 0x60(%rsp), %r15
leaq 0x148(%rsp), %rcx
movl $0x2, %edx
movq %r15, %rdi
callq 0x200e
leaq 0x78(%rsp), %r14
leaq 0x258(%rsp), %rsi
movq $0x0, (%rsi)
movq $0x2, 0x8(%rsi)
leaq 0xf(%rsp), %rcx
movl $0x2, %edx
movq %r14, %rdi
callq 0x200e
leaq 0x90(%rsp), %r14
leaq 0x208(%rsp), %rsi
movq $0x1, (%rsi)
movq $0x2, 0x8(%rsi)
leaq 0xe(%rsp), %rcx
movl $0x2, %edx
movq %r14, %rdi
callq 0x200e
leaq 0xd0(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0xd(%rsp), %rcx
movl $0x3, %edx
callq 0x2054
movl $0x48, %ebx
movq 0x48(%rsp,%rbx), %rdi
testq %rdi, %rdi
je 0x1681
movq 0x58(%rsp,%rbx), %rsi
subq %rdi, %rsi
callq 0x10f0
addq $-0x18, %rbx
jne 0x166a
leaq 0x148(%rsp), %rdi
leaq 0x130(%rsp), %rsi
leaq 0xd0(%rsp), %rdx
callq 0x209e
leaq 0x258(%rsp), %rdi
leaq 0x1d0(%rsp), %rsi
callq 0x2220
leaq 0x258(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x2272
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x23ba
movq 0x88f9(%rip), %rbx      # 0x9fd8
leaq 0x49da(%rip), %rsi      # 0x60c0
movl $0x30, %edx
movq %rbx, %rdi
callq 0x1100
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq 0x88c7(%rip), %rdi      # 0x9fd8
callq 0x1030
movq %rax, %rdi
callq 0x10a0
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r12
cmpq %r12, %rbx
je 0x1772
movq 0x88a4(%rip), %r14      # 0x9fd8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x24a6
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
addq $0x10, %rbx
cmpq %r12, %rbx
jne 0x1734
movq 0x885f(%rip), %rdi      # 0x9fd8
leaq 0x4971(%rip), %rsi      # 0x60f1
movl $0x2, %edx
callq 0x1100
leaq 0x208(%rsp), %rdi
leaq 0x1d0(%rsp), %rsi
callq 0x2510
leaq 0x208(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x2564
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x23ba
movq 0x880e(%rip), %rbx      # 0x9fd8
leaq 0x4923(%rip), %rsi      # 0x60f4
movl $0x30, %edx
movq %rbx, %rdi
callq 0x1100
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq 0x87dc(%rip), %rdi      # 0x9fd8
callq 0x1030
movq %rax, %rdi
callq 0x10a0
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r12
cmpq %r12, %rbx
je 0x185d
movq 0x87b9(%rip), %r14      # 0x9fd8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x24a6
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
addq $0x10, %rbx
cmpq %r12, %rbx
jne 0x181f
movq 0x8774(%rip), %rdi      # 0x9fd8
leaq 0x4886(%rip), %rsi      # 0x60f1
movl $0x2, %edx
callq 0x1100
leaq 0x60(%rsp), %rdi
leaq 0x148(%rsp), %rsi
leaq 0xd0(%rsp), %rdx
callq 0x2596
leaq 0x60(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x26f6
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x23ba
movq 0x8726(%rip), %rbx      # 0x9fd8
leaq 0x486c(%rip), %rsi      # 0x6125
movl $0x30, %edx
movq %rbx, %rdi
callq 0x1100
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq 0x86f4(%rip), %rdi      # 0x9fd8
callq 0x1030
movq %rax, %rdi
callq 0x10a0
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r12
cmpq %r12, %rbx
je 0x1945
movq 0x86d1(%rip), %r14      # 0x9fd8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x24a6
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
addq $0x10, %rbx
cmpq %r12, %rbx
jne 0x1907
leaq 0x168(%rsp), %rdi
leaq 0x148(%rsp), %rsi
leaq 0xd0(%rsp), %rdx
callq 0x280a
leaq 0x168(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x296e
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x23ba
movq 0x864b(%rip), %rbx      # 0x9fd8
leaq 0x47c2(%rip), %rsi      # 0x6156
movl $0x30, %edx
movq %rbx, %rdi
callq 0x1100
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq 0x8619(%rip), %rdi      # 0x9fd8
callq 0x1030
movq %rax, %rdi
callq 0x10a0
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r12
cmpq %r12, %rbx
je 0x1a20
movq 0x85f6(%rip), %r14      # 0x9fd8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x24a6
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x10d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
addq $0x10, %rbx
cmpq %r12, %rbx
jne 0x19e2
leaq 0x1b8(%rsp), %rbx
movq %rbx, %rdi
callq 0x4d26
movq -0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x1a49
movq 0x1a8(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
movq 0x180(%rsp), %rdi
testq %rdi, %rdi
je 0x1a66
movq 0x190(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
leaq 0x168(%rsp), %rdi
callq 0x2b9a
leaq 0xb0(%rsp), %rbx
movq %rbx, %rdi
callq 0x43fa
movq -0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x1a9c
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x1ab6
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
leaq 0x60(%rsp), %rdi
callq 0x2b9a
movq 0x240(%rsp), %rdi
testq %rdi, %rdi
je 0x1add
movq 0x250(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
movq 0x228(%rsp), %rdi
testq %rdi, %rdi
je 0x1afa
movq 0x238(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
leaq 0x208(%rsp), %rdi
callq 0x2c0a
movq 0x290(%rsp), %rdi
testq %rdi, %rdi
je 0x1b24
movq 0x2a0(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
movq 0x278(%rsp), %rdi
testq %rdi, %rdi
je 0x1b41
movq 0x288(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
leaq 0x258(%rsp), %rdi
callq 0x2c0a
leaq 0x148(%rsp), %rdi
callq 0x3048
leaq 0xd0(%rsp), %rdi
callq 0x2b9a
movq 0x1f0(%rsp), %rdi
testq %rdi, %rdi
je 0x1b85
movq 0x200(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
leaq 0x1d0(%rsp), %rdi
callq 0x2c0a
leaq 0x130(%rsp), %rdi
callq 0x2c0a
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x1bbc
movq 0xf8(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
movq 0x100(%rsp), %rdi
testq %rdi, %rdi
je 0x1bd9
movq 0x110(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
movq 0x118(%rsp), %rdi
testq %rdi, %rdi
je 0x1bf6
movq 0x128(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x1c0d
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1c24
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1c3b
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
xorl %eax, %eax
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x1d4a
jmp 0x1d59
jmp 0x1d6b
movq %rax, %rbx
jmp 0x1d7b
movq %rax, %rbx
jmp 0x1d88
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x11e0
movb $0x1, %al
jmp 0x1c95
jmp 0x1c86
movq %rax, %rbx
xorl %eax, %eax
jmp 0x1c95
movq %rax, %rbx
xorl %eax, %eax
movq %r15, %r14
cmpq %r14, %r15
sete %cl
orb %al, %cl
jne 0x1d95
leaq 0x60(%rsp), %r15
movq -0x18(%r14), %rdi
testq %rdi, %rdi
je 0x1cbd
movq -0x8(%r14), %rsi
subq %rdi, %rsi
callq 0x10f0
addq $-0x18, %r14
cmpq %r15, %r14
jne 0x1ca8
jmp 0x1d95
movq %rax, %rbx
jmp 0x1da2
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x11b0
jmp 0x1daf
movq %rax, %rbx
jmp 0x1dcc
movq %rax, %rbx
jmp 0x1de9
movq %rax, %rbx
jmp 0x1e06
movq %rax, %rbx
jmp 0x1e1d
movq %rax, %rbx
jmp 0x1e34
movq %rax, %rbx
cmpq %r15, %r14
je 0x1daf
leaq 0x60(%rsp), %rsi
movq %r15, %rdi
callq 0x1180
jmp 0x1daf
jmp 0x1d38
jmp 0x1d4a
jmp 0x1d59
jmp 0x1d6b
movq %rax, %rbx
leaq 0x168(%rsp), %rdi
callq 0x2ae2
jmp 0x1d4d
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x2b22
jmp 0x1d5c
movq %rax, %rbx
leaq 0x208(%rsp), %rdi
callq 0x2b62
jmp 0x1d6e
movq %rax, %rbx
leaq 0x258(%rsp), %rdi
callq 0x2b62
leaq 0x148(%rsp), %rdi
callq 0x3048
leaq 0xd0(%rsp), %rdi
callq 0x2b9a
leaq 0x1d0(%rsp), %rdi
callq 0x2be8
leaq 0x130(%rsp), %rdi
callq 0x2c0a
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x1dcc
movq 0xf8(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
movq 0x100(%rsp), %rdi
testq %rdi, %rdi
je 0x1de9
movq 0x110(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
movq 0x118(%rsp), %rdi
testq %rdi, %rdi
je 0x1e06
movq 0x128(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x1e1d
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1e34
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1e4b
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x10f0
movq %rbx, %rdi
callq 0x1160
nop