// File: /workspace/github_cpp_makefile_star2_O1/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 0x4ae0
leaq -0x9430(%rbp), %rdi
callq 0x583c
leaq -0xc8(%rbp), %rax
xorps %xmm0, %xmm0
movaps %xmm0, 0x8(%rax)
movaps %xmm0, 0x18(%rax)
movaps %xmm0, 0x28(%rax)
movaps %xmm0, 0x38(%rax)
movaps %xmm0, 0x48(%rax)
movaps %xmm0, -0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
xorl %ecx, %ecx
movq %rcx, 0x20(%rax)
leaq -0x98(%rbp), %rax
movl $0x0, (%rax)
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
movups 0x4a86(%rip), %xmm0     # 0x7039
leaq -0x110(%rbp), %rbx
movups %xmm0, 0x29(%rbx)
movaps 0x4a6b(%rip), %xmm0     # 0x7030
movaps %xmm0, 0x20(%rbx)
movaps 0x4a50(%rip), %xmm0     # 0x7020
movaps %xmm0, 0x10(%rbx)
movaps 0x4a35(%rip), %xmm0     # 0x7010
movaps %xmm0, (%rbx)
leaq 0x4a6b(%rip), %rsi      # 0x7050
leaq -0x1a0(%rbp), %rdi
movl $0x84, %edx
callq 0x21a0
movups 0x4b0c(%rip), %xmm0     # 0x7109
movups %xmm0, -0x47(%rbp)
movaps 0x4af8(%rip), %xmm0     # 0x7100
movaps %xmm0, -0x50(%rbp)
movaps 0x4add(%rip), %xmm0     # 0x70f0
movaps %xmm0, -0x60(%rbp)
movaps 0x4ac2(%rip), %xmm0     # 0x70e0
movaps %xmm0, -0x70(%rbp)
movq %rbx, %rdi
callq 0x20d0
movq 0x79a7(%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 0x797b(%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 0x2d16
leaq -0x9430(%rbp), %rdi
leaq -0x11a0(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x5e1c
leaq -0x4290(%rbp), %rdi
leaq -0x11a0(%rbp), %rsi
callq 0x4738
leaq -0x30(%rbp), %rdi
leaq -0x4290(%rbp), %rsi
callq 0x4de8
leaq -0x4260(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x26e5
callq 0x21d0
leaq -0x4280(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x26fa
callq 0x21d0
movq 0x78d7(%rip), %rdi      # 0x9fd8
leaq 0x4a11(%rip), %rsi      # 0x7119
movl $0xd, %edx
callq 0x2240
movq -0x28(%rbp), %rax
movq -0x1050(%rax), %rsi
movq -0x1048(%rax), %rdx
movq 0x78ad(%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 0x7868(%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 0x783c(%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 0x2d16
leaq -0x9430(%rbp), %rdi
leaq -0x11a0(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x5e1c
leaq -0x3240(%rbp), %rdi
leaq -0x11a0(%rbp), %rsi
callq 0x4738
leaq -0x30(%rbp), %rdi
leaq -0x3240(%rbp), %rsi
callq 0x4de8
leaq -0x3210(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2824
callq 0x21d0
leaq -0x3230(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2839
callq 0x21d0
movq 0x7798(%rip), %rdi      # 0x9fd8
leaq 0x48d2(%rip), %rsi      # 0x7119
movl $0xd, %edx
callq 0x2240
movq -0x28(%rbp), %rax
movq -0x1050(%rax), %rsi
movq -0x1048(%rax), %rdx
movq 0x776e(%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 0x772c(%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 0x7700(%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 0x2d16
leaq -0x9430(%rbp), %rdi
leaq -0x11a0(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x5e1c
leaq -0x21f0(%rbp), %rdi
leaq -0x11a0(%rbp), %rsi
callq 0x4738
leaq -0x30(%rbp), %rdi
leaq -0x21f0(%rbp), %rsi
callq 0x4de8
leaq -0x21c0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x295d
callq 0x21d0
leaq -0x21e0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2972
callq 0x21d0
movq 0x765f(%rip), %rdi      # 0x9fd8
leaq 0x4799(%rip), %rsi      # 0x7119
movl $0xd, %edx
callq 0x2240
movq -0x28(%rbp), %rax
movq -0x1050(%rax), %rsi
movq -0x1048(%rax), %rdx
movq 0x7635(%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 0x2aa0
leaq -0xd0(%rbp), %rdi
callq 0x2b0a
leaq -0x30(%rbp), %rdi
callq 0x2b74
xorl %eax, %eax
addq $0x9420, %rsp           # imm = 0x9420
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq -0x21f0(%rbp), %rdi
jmp 0x2a23
movq %rax, %rbx
leaq -0x3240(%rbp), %rdi
jmp 0x2a23
movq %rax, %rbx
leaq -0x4290(%rbp), %rdi
callq 0x2a5c
jmp 0x2a32
movq %rax, %rbx
jmp 0x2a4a
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
callq 0x2aa0
leaq -0xd0(%rbp), %rdi
callq 0x2b0a
leaq -0x30(%rbp), %rdi
callq 0x2b74
movq %rbx, %rdi
callq 0x22e0
nop