// File: drummyfish[P]flowchart/src/program.cpp
// Function: program::load_from_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool program::load_from_file(string filename)
  {
    if (!this->font_mask.load_file(FONT_PATH))
      return false;

    image source_image;
    bool error;

    if (!source_image.load_file(filename))
      return false;

    // cout << "=" << this->string_from_image_area(&source_image,make_coord(0,0),make_coord(100,100),error) << "=" << endl;

    vector<block_function> v = this->get_function_blocks(&source_image);

    unsigned int i;

    cout << "functions:" << endl;

    for (i = 0; i < v.size(); i++)
      {
        cout << v[i].get_string() << ": " << endl;
        print_coord(v[i].get_top_left());
        print_coord(v[i].get_bottom_right());
      }

    cout << "directives:" << endl;
    vector<block_directive> v2 = this->get_directive_blocks(&source_image);

    for (i = 0; i < v2.size(); i++)
      {
        cout << v2[i].get_string() << ": " << endl;
        print_coord(v2[i].get_top_left());
        print_coord(v2[i].get_bottom_right());
      }

    cout << "commands:" << endl;
    vector<block_command> v3 = this->get_command_blocks(&source_image);

    for (i = 0; i < v3.size(); i++)
      {
        cout << v3[i].get_string() << ": " << endl;
        print_coord(v3[i].get_top_left());
        print_coord(v3[i].get_bottom_right());
      }

    return true;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x220, %rsp            # imm = 0x220
movq %rsi, -0x188(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x180(%rbp)
movq %rax, -0x178(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0x170(%rbp)
callq 0x3470
movq -0x170(%rbp), %rdx
leaq 0x7f7b(%rip), %rsi      # 0x1f3f5
leaq -0x38(%rbp), %rdi
callq 0x15680
jmp 0x17485
movq -0x180(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x15c30
movb %al, -0x189(%rbp)
jmp 0x1749d
movb -0x189(%rbp), %al
xorb $-0x1, %al
movb %al, -0x18a(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x3160
leaq -0x39(%rbp), %rdi
callq 0x3270
movb -0x18a(%rbp), %al
testb $0x1, %al
jne 0x174c9
jmp 0x17503
movb $0x0, -0x1(%rbp)
jmp 0x17b4a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x174f5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x3160
leaq -0x39(%rbp), %rdi
callq 0x3270
jmp 0x17b58
leaq -0x58(%rbp), %rdi
callq 0x159e0
movq -0x188(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x30f0
jmp 0x1751e
leaq -0x58(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x15c30
movb %al, -0x18b(%rbp)
jmp 0x17533
movb -0x18b(%rbp), %al
xorb $-0x1, %al
movb %al, -0x18c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x3160
movb -0x18c(%rbp), %al
testb $0x1, %al
jne 0x17556
jmp 0x17594
movb $0x0, -0x1(%rbp)
movl $0x1, -0x84(%rbp)
jmp 0x17b34
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x17b3f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x3160
jmp 0x17b3f
movq -0x178(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0x17b70
jmp 0x175ad
movq 0x10a24(%rip), %rdi     # 0x27fd8
leaq 0x7e43(%rip), %rsi      # 0x1f3fe
callq 0x3210
movq %rax, -0x198(%rbp)
jmp 0x175c9
movq -0x198(%rbp), %rdi
movq 0x109f1(%rip), %rsi     # 0x27fc8
callq 0x3250
jmp 0x175de
movl $0x0, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
movq %rax, -0x1a0(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x18880
movq %rax, %rcx
movq -0x1a0(%rbp), %rax
cmpq %rcx, %rax
jae 0x17758
movl -0xa4(%rbp), %eax
movl %eax, %esi
leaq -0xa0(%rbp), %rdi
callq 0x188b0
movq %rax, %rsi
leaq -0xc8(%rbp), %rdi
callq 0x1d7a0
jmp 0x17639
movq 0x10998(%rip), %rdi     # 0x27fd8
leaq -0xc8(%rbp), %rsi
callq 0x3200
movq %rax, -0x1a8(%rbp)
jmp 0x17655
movq -0x1a8(%rbp), %rdi
leaq 0x7da6(%rip), %rsi      # 0x1f409
callq 0x3210
movq %rax, -0x1b0(%rbp)
jmp 0x17671
movq -0x1b0(%rbp), %rdi
movq 0x10949(%rip), %rsi     # 0x27fc8
callq 0x3250
jmp 0x17686
leaq -0xc8(%rbp), %rdi
callq 0x3160
movl -0xa4(%rbp), %eax
movl %eax, %esi
leaq -0xa0(%rbp), %rdi
callq 0x188b0
movq %rax, %rdi
callq 0x1d7d0
movq %rax, -0x1b8(%rbp)
jmp 0x176b7
movq -0x1b8(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rdi
callq 0x1cb00
jmp 0x176d3
movl -0xa4(%rbp), %eax
movl %eax, %esi
leaq -0xa0(%rbp), %rdi
callq 0x188b0
movq %rax, %rdi
callq 0x1d7f0
movq %rax, -0x1c0(%rbp)
jmp 0x176f8
movq -0x1c0(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rdi
callq 0x1cb00
jmp 0x17714
jmp 0x17716
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x175e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x17b26
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x3160
jmp 0x17b26
movq 0x10879(%rip), %rdi     # 0x27fd8
leaq 0x7ca6(%rip), %rsi      # 0x1f40c
callq 0x3210
movq %rax, -0x1c8(%rbp)
jmp 0x17774
movq -0x1c8(%rbp), %rdi
movq 0x10846(%rip), %rsi     # 0x27fc8
callq 0x3250
jmp 0x17789
movq -0x178(%rbp), %rsi
leaq -0xf0(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0x17bb0
jmp 0x177a2
movl $0x0, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
movq %rax, -0x1d0(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x188d0
movq %rax, %rcx
movq -0x1d0(%rbp), %rax
cmpq %rcx, %rax
jae 0x1791c
movl -0xa4(%rbp), %eax
movl %eax, %esi
leaq -0xf0(%rbp), %rdi
callq 0x18900
movq %rax, %rsi
leaq -0x110(%rbp), %rdi
callq 0x1d7a0
jmp 0x177fd
movq 0x107d4(%rip), %rdi     # 0x27fd8
leaq -0x110(%rbp), %rsi
callq 0x3200
movq %rax, -0x1d8(%rbp)
jmp 0x17819
movq -0x1d8(%rbp), %rdi
leaq 0x7be2(%rip), %rsi      # 0x1f409
callq 0x3210
movq %rax, -0x1e0(%rbp)
jmp 0x17835
movq -0x1e0(%rbp), %rdi
movq 0x10785(%rip), %rsi     # 0x27fc8
callq 0x3250
jmp 0x1784a
leaq -0x110(%rbp), %rdi
callq 0x3160
movl -0xa4(%rbp), %eax
movl %eax, %esi
leaq -0xf0(%rbp), %rdi
callq 0x18900
movq %rax, %rdi
callq 0x1d7d0
movq %rax, -0x1e8(%rbp)
jmp 0x1787b
movq -0x1e8(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x118(%rbp), %rdi
callq 0x1cb00
jmp 0x17897
movl -0xa4(%rbp), %eax
movl %eax, %esi
leaq -0xf0(%rbp), %rdi
callq 0x18900
movq %rax, %rdi
callq 0x1d7f0
movq %rax, -0x1f0(%rbp)
jmp 0x178bc
movq -0x1f0(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x120(%rbp), %rdi
callq 0x1cb00
jmp 0x178d8
jmp 0x178da
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x177ac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x17b1a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x3160
jmp 0x17b1a
movq 0x106b5(%rip), %rdi     # 0x27fd8
leaq 0x7aee(%rip), %rsi      # 0x1f418
callq 0x3210
movq %rax, -0x1f8(%rbp)
jmp 0x17938
movq -0x1f8(%rbp), %rdi
movq 0x10682(%rip), %rsi     # 0x27fc8
callq 0x3250
jmp 0x1794d
movq -0x178(%rbp), %rsi
leaq -0x138(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0x17bf0
jmp 0x17966
movl $0x0, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
movq %rax, -0x200(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x18920
movq %rax, %rcx
movq -0x200(%rbp), %rax
cmpq %rcx, %rax
jae 0x17ada
movl -0xa4(%rbp), %eax
movl %eax, %esi
leaq -0x138(%rbp), %rdi
callq 0x18950
movq %rax, %rsi
leaq -0x158(%rbp), %rdi
callq 0x1d7a0
jmp 0x179c1
movq 0x10610(%rip), %rdi     # 0x27fd8
leaq -0x158(%rbp), %rsi
callq 0x3200
movq %rax, -0x208(%rbp)
jmp 0x179dd
movq -0x208(%rbp), %rdi
leaq 0x7a1e(%rip), %rsi      # 0x1f409
callq 0x3210
movq %rax, -0x210(%rbp)
jmp 0x179f9
movq -0x210(%rbp), %rdi
movq 0x105c1(%rip), %rsi     # 0x27fc8
callq 0x3250
jmp 0x17a0e
leaq -0x158(%rbp), %rdi
callq 0x3160
movl -0xa4(%rbp), %eax
movl %eax, %esi
leaq -0x138(%rbp), %rdi
callq 0x18950
movq %rax, %rdi
callq 0x1d7d0
movq %rax, -0x218(%rbp)
jmp 0x17a3f
movq -0x218(%rbp), %rax
movq %rax, -0x160(%rbp)
movq -0x160(%rbp), %rdi
callq 0x1cb00
jmp 0x17a5b
movl -0xa4(%rbp), %eax
movl %eax, %esi
leaq -0x138(%rbp), %rdi
callq 0x18950
movq %rax, %rdi
callq 0x1d7f0
movq %rax, -0x220(%rbp)
jmp 0x17a80
movq -0x220(%rbp), %rax
movq %rax, -0x168(%rbp)
movq -0x168(%rbp), %rdi
callq 0x1cb00
jmp 0x17a9c
jmp 0x17a9e
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x17970
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x17b0e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x3160
jmp 0x17b0e
movb $0x1, -0x1(%rbp)
movl $0x1, -0x84(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x18970
leaq -0xf0(%rbp), %rdi
callq 0x189d0
leaq -0xa0(%rbp), %rdi
callq 0x18a30
jmp 0x17b34
leaq -0x138(%rbp), %rdi
callq 0x18970
leaq -0xf0(%rbp), %rdi
callq 0x189d0
leaq -0xa0(%rbp), %rdi
callq 0x18a30
jmp 0x17b3f
leaq -0x58(%rbp), %rdi
callq 0x15a00
jmp 0x17b4a
leaq -0x58(%rbp), %rdi
callq 0x15a00
jmp 0x17b58
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x3460
nopw %cs:(%rax,%rax)