// File: /workspace/github_cpp_makefile_star2_O3/s0sasaki[P]ExecutableBlockchain/main.cpp
// Function: main
int main()
{
    Blockchain blockchain = Blockchain();
    VM vm = VM();
    Compiler compiler = Compiler();
    int32_t bin_data[Block::DATA_SIZE];
    char src_data1[] = "\
    : main              \n\
        1 2 3 4 * + + . \n\
    ; ";
    char src_data2[] = "\
    : square            \n\
        dup *           \n\
    ;                   \n\
    : main              \n\
        5 square .      \n\
    ; ";
    char src_data3[] = "\
    : main              \n\
        10 square .     \n\
    ; ";

    std::cout << src_data1 << std::endl;
    compiler.compile(bin_data, src_data1, blockchain.chain.size());
    vm.exec(bin_data, blockchain);
    blockchain.addBlock(Block(bin_data));
    std::cout << "Block mined: " << blockchain.chain.back().hash << std::endl;

    std::cout << src_data2 << std::endl;
    compiler.compile(bin_data, src_data2, blockchain.chain.size());
    vm.exec(bin_data, blockchain);
    blockchain.addBlock(Block(bin_data));
    std::cout << "Block mined: " << blockchain.chain.back().hash << std::endl;

    std::cout << src_data3 << std::endl;
    compiler.compile(bin_data, src_data3, blockchain.chain.size());
    vm.exec(bin_data, blockchain);
    blockchain.addBlock(Block(bin_data));
    std::cout << "Block mined: " << blockchain.chain.back().hash << std::endl;

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x9420, %rsp           # imm = 0x9420
leaq -0x30(%rbp), %rdi
callq 0x4a98
leaq -0x9430(%rbp), %rdi
callq 0x57bc
leaq -0xc8(%rbp), %rax
xorps %xmm0, %xmm0
movaps %xmm0, 0x8(%rax)
movaps %xmm0, 0x18(%rax)
movaps %xmm0, 0x28(%rax)
movaps %xmm0, -0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
leaq -0x98(%rbp), %rax
movl $0x0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
movups 0x4a92(%rip), %xmm0     # 0x7039
leaq -0x110(%rbp), %rbx
movups %xmm0, 0x29(%rbx)
movaps 0x4a77(%rip), %xmm0     # 0x7030
movaps %xmm0, 0x20(%rbx)
movaps 0x4a5c(%rip), %xmm0     # 0x7020
movaps %xmm0, 0x10(%rbx)
movaps 0x4a41(%rip), %xmm0     # 0x7010
movaps %xmm0, (%rbx)
leaq 0x4a77(%rip), %rsi      # 0x7050
leaq -0x1a0(%rbp), %rdi
movl $0x84, %edx
callq 0x21a0
movups 0x4b18(%rip), %xmm0     # 0x7109
movups %xmm0, -0x47(%rbp)
movaps 0x4b04(%rip), %xmm0     # 0x7100
movaps %xmm0, -0x50(%rbp)
movaps 0x4ae9(%rip), %xmm0     # 0x70f0
movaps %xmm0, -0x60(%rbp)
movaps 0x4ace(%rip), %xmm0     # 0x70e0
movaps %xmm0, -0x70(%rbp)
movq %rbx, %rdi
callq 0x20d0
movq 0x79b3(%rip), %r14      # 0x9fd8
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2240
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq 0x7987(%rip), %rdi      # 0x9fd8
callq 0x2030
movq %rax, %rdi
callq 0x2140
movq -0x28(%rbp), %rax
subq -0x30(%rbp), %rax
shrq $0x4, %rax
imull $0x2545a3cd, %eax, %ecx # imm = 0x2545A3CD
leaq -0xd0(%rbp), %rdi
leaq -0x11a0(%rbp), %rsi
leaq -0x110(%rbp), %rdx
callq 0x2cfe
leaq -0x9430(%rbp), %rdi
leaq -0x11a0(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x5d9c
leaq -0x4290(%rbp), %rdi
leaq -0x11a0(%rbp), %rsi
callq 0x46f8
leaq -0x30(%rbp), %rdi
leaq -0x4290(%rbp), %rsi
callq 0x4d5a
leaq -0x4260(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x26d9
callq 0x21d0
leaq -0x4280(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x26ee
callq 0x21d0
movq 0x78e3(%rip), %rdi      # 0x9fd8
leaq 0x4a1d(%rip), %rsi      # 0x7119
movl $0xd, %edx
callq 0x2240
movq -0x28(%rbp), %rax
movq -0x1050(%rax), %rsi
movq -0x1048(%rax), %rdx
movq 0x78b9(%rip), %rdi      # 0x9fd8
callq 0x2240
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
leaq -0x1a0(%rbp), %r14
movq %r14, %rdi
callq 0x20d0
movq 0x7874(%rip), %rbx      # 0x9fd8
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x2240
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq 0x7848(%rip), %rdi      # 0x9fd8
callq 0x2030
movq %rax, %rdi
callq 0x2140
movq -0x28(%rbp), %rax
subq -0x30(%rbp), %rax
shrq $0x4, %rax
imull $0x2545a3cd, %eax, %ecx # imm = 0x2545A3CD
leaq -0xd0(%rbp), %rdi
leaq -0x11a0(%rbp), %rsi
leaq -0x1a0(%rbp), %rdx
callq 0x2cfe
leaq -0x9430(%rbp), %rdi
leaq -0x11a0(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x5d9c
leaq -0x3240(%rbp), %rdi
leaq -0x11a0(%rbp), %rsi
callq 0x46f8
leaq -0x30(%rbp), %rdi
leaq -0x3240(%rbp), %rsi
callq 0x4d5a
leaq -0x3210(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2818
callq 0x21d0
leaq -0x3230(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x282d
callq 0x21d0
movq 0x77a4(%rip), %rdi      # 0x9fd8
leaq 0x48de(%rip), %rsi      # 0x7119
movl $0xd, %edx
callq 0x2240
movq -0x28(%rbp), %rax
movq -0x1050(%rax), %rsi
movq -0x1048(%rax), %rdx
movq 0x777a(%rip), %rdi      # 0x9fd8
callq 0x2240
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
leaq -0x70(%rbp), %r14
movq %r14, %rdi
callq 0x20d0
movq 0x7738(%rip), %rbx      # 0x9fd8
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x2240
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq 0x770c(%rip), %rdi      # 0x9fd8
callq 0x2030
movq %rax, %rdi
callq 0x2140
movq -0x28(%rbp), %rax
subq -0x30(%rbp), %rax
shrq $0x4, %rax
imull $0x2545a3cd, %eax, %ecx # imm = 0x2545A3CD
leaq -0xd0(%rbp), %rdi
leaq -0x11a0(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0x2cfe
leaq -0x9430(%rbp), %rdi
leaq -0x11a0(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x5d9c
leaq -0x21f0(%rbp), %rdi
leaq -0x11a0(%rbp), %rsi
callq 0x46f8
leaq -0x30(%rbp), %rdi
leaq -0x21f0(%rbp), %rsi
callq 0x4d5a
leaq -0x21c0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2951
callq 0x21d0
leaq -0x21e0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2966
callq 0x21d0
movq 0x766b(%rip), %rdi      # 0x9fd8
leaq 0x47a5(%rip), %rsi      # 0x7119
movl $0xd, %edx
callq 0x2240
movq -0x28(%rbp), %rax
movq -0x1050(%rax), %rsi
movq -0x1048(%rax), %rdx
movq 0x7641(%rip), %rdi      # 0x9fd8
callq 0x2240
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
leaq -0xa0(%rbp), %rdi
callq 0x2a94
leaq -0xd0(%rbp), %rdi
callq 0x2afe
leaq -0x30(%rbp), %rdi
callq 0x2b68
xorl %eax, %eax
addq $0x9420, %rsp           # imm = 0x9420
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq -0x21f0(%rbp), %rdi
jmp 0x2a17
movq %rax, %rbx
leaq -0x3240(%rbp), %rdi
jmp 0x2a17
movq %rax, %rbx
leaq -0x4290(%rbp), %rdi
callq 0x2a50
jmp 0x2a26
movq %rax, %rbx
jmp 0x2a3e
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
callq 0x2a94
leaq -0xd0(%rbp), %rdi
callq 0x2afe
leaq -0x30(%rbp), %rdi
callq 0x2b68
movq %rbx, %rdi
callq 0x22e0
nop