// File: theolepage[P]prophecy/src/main.cc
// Function: main
int main(void)
{
    Model<model_type> model = Model<model_type>();
    SigmoidActivationFunction s = SigmoidActivationFunction<model_type>();

    // Create model
    model.add(new InputLayer<model_type>(2));
    model.add(new DenseLayer<model_type>(2, s));
    model.add(new DenseLayer<model_type>(1, s));

    // Create dataset
    auto x_train = training_set();
    auto y_train = training_set();
    create_dataset(x_train, y_train);

    // Train model
    model.compile(0.1);
    model.train(x_train, y_train, 10000, 1);

    // Test the model
    for (size_t i = 0; i < x_train.size(); i++)
    {
        auto x = x_train.at(i);
        auto x_t = x.transpose();
        auto y = model.predict(x);
        std::cout << "Input:  " << x_t;
        std::cout << "Output: " << y << std::endl;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movl $0x0, -0x4(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x2aa0
leaq -0x70(%rbp), %rdi
callq 0x2af0
jmp 0x2396
movl $0x90, %edi
callq 0x2150
movq %rax, -0x130(%rbp)
jmp 0x23a9
movq -0x130(%rbp), %rdi
movl $0x2, %esi
callq 0x2b70
jmp 0x23bc
movq -0x130(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x2b40
jmp 0x23ce
movl $0x150, %edi            # imm = 0x150
callq 0x2150
movq %rax, -0x138(%rbp)
jmp 0x23e1
movq -0x138(%rbp), %rdi
movl $0x2, %esi
leaq -0x70(%rbp), %rdx
callq 0x2bb0
jmp 0x23f8
movq -0x138(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x2b40
jmp 0x240a
movl $0x150, %edi            # imm = 0x150
callq 0x2150
movq %rax, -0x140(%rbp)
jmp 0x241d
movq -0x140(%rbp), %rdi
movl $0x1, %esi
leaq -0x70(%rbp), %rdx
callq 0x2bb0
jmp 0x2434
movq -0x140(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x2b40
jmp 0x2446
xorps %xmm0, %xmm0
movaps %xmm0, -0x160(%rbp)
movaps %xmm0, -0xa0(%rbp)
movq $0x0, -0x90(%rbp)
leaq -0xa0(%rbp), %rdi
movq %rdi, -0x150(%rbp)
callq 0x2bf0
movaps -0x160(%rbp), %xmm0
movaps %xmm0, -0xc0(%rbp)
movq $0x0, -0xb0(%rbp)
leaq -0xc0(%rbp), %rdi
movq %rdi, -0x148(%rbp)
callq 0x2bf0
movq -0x150(%rbp), %rdi
movq -0x148(%rbp), %rsi
callq 0x27a0
jmp 0x24b6
leaq -0x30(%rbp), %rdi
movss 0x7b42(%rip), %xmm0     # 0xa004
callq 0x2c10
jmp 0x24c9
leaq -0x30(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
movl $0x2710, %ecx           # imm = 0x2710
movl $0x1, %r8d
callq 0x2f10
jmp 0x24ed
movq $0x0, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x168(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x31d0
movq %rax, %rcx
movq -0x168(%rbp), %rax
cmpq %rcx, %rax
jae 0x2724
movq -0xc8(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x31f0
movq %rax, -0x170(%rbp)
jmp 0x2541
movq -0x170(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x3230
jmp 0x2556
leaq -0x108(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x32a0
jmp 0x256b
leaq -0x128(%rbp), %rdi
leaq -0x30(%rbp), %rsi
leaq -0xe8(%rbp), %rdx
callq 0x3390
jmp 0x2584
movq 0xda3d(%rip), %rdi      # 0xffc8
leaq 0x7ad6(%rip), %rsi      # 0xa068
callq 0x2140
movq %rax, -0x178(%rbp)
jmp 0x25a0
movq -0x178(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x33f0
jmp 0x25b5
movq 0xda0c(%rip), %rdi      # 0xffc8
leaq 0x7aae(%rip), %rsi      # 0xa071
callq 0x2140
movq %rax, -0x180(%rbp)
jmp 0x25d1
movq -0x180(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x33f0
movq %rax, -0x188(%rbp)
jmp 0x25ed
movq -0x188(%rbp), %rdi
movq 0xd9ad(%rip), %rsi      # 0xffa8
callq 0x2170
jmp 0x2602
leaq -0x128(%rbp), %rdi
callq 0x34d0
leaq -0x108(%rbp), %rdi
callq 0x34d0
leaq -0xe8(%rbp), %rdi
callq 0x34d0
movq -0xc8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xc8(%rbp)
jmp 0x24f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x2782
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x2779
movq -0x130(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
movl $0x90, %esi
callq 0x2160
jmp 0x2779
movq -0x138(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
movl $0x150, %esi            # imm = 0x150
callq 0x2160
jmp 0x2779
movq -0x140(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
movl $0x150, %esi            # imm = 0x150
callq 0x2160
jmp 0x2779
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x2761
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x2716
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x270a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x34d0
leaq -0x108(%rbp), %rdi
callq 0x34d0
leaq -0xe8(%rbp), %rdi
callq 0x34d0
jmp 0x2761
movl $0x0, -0x4(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x3500
leaq -0xa0(%rbp), %rdi
callq 0x3500
leaq -0x70(%rbp), %rdi
callq 0x3560
leaq -0x30(%rbp), %rdi
callq 0x3580
movl -0x4(%rbp), %eax
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
leaq -0xc0(%rbp), %rdi
callq 0x3500
leaq -0xa0(%rbp), %rdi
callq 0x3500
leaq -0x70(%rbp), %rdi
callq 0x3560
leaq -0x30(%rbp), %rdi
callq 0x3580
movq -0x78(%rbp), %rdi
callq 0x2200
nopw %cs:(%rax,%rax)