// File: /workspace/github_cpp_makefile_star2_O3/drummyfish[P]flowchart/src/program.cpp
// Function: program::get_command_blocks(image*)
vector<block_command> program::get_command_blocks(image *img)
  {
    unsigned int i, j, x, y;
    coord_2d c1, c2;
    vector<block_command> result;

    for (j = 0; j < img->get_height(); j++)
      for (i = 0; i < img->get_width(); i++)
        {
          if (   // block corner
            img->pixel_is_black(i,j)     &&
            img->pixel_is_black(i + 1,j) &&
            img->pixel_is_black(i,j + 1) &&
            !img->pixel_is_black(i + 1,j + 1))
            {
              c1.x = i;
              c1.y = j;

              x = i + 1;
              y = j;

              // trace the block border:

              while (img->pixel_is_black(x + 1,y))
                x++;

              i = x;    // i can skip here

              if (x - c1.x < FONT_WIDTH + 2)       // the block must be at least one character wide + borders
                continue;

              while (img->pixel_is_black(x,y + 1))
                y++;

              c2.x = x;
              c2.y = y;

              if (c2.y - c1.y < FONT_HEIGHT + 2)   // the block must be at least one character high
                continue;

              while (img->pixel_is_black(x - 1,y))
                x--;

              while (img->pixel_is_black(x,y - 1))
                y--;

              if (x == c1.x && y == c1.y)
                {
                  string block_string;
                  bool error;

                  block_string = this->string_from_image_area(img,make_coord(c1.x + 1,c1.y + 1),make_coord(c2.x - 1,c2.y - 1),error);

                  block_command b(block_string,c1,c2);
                  result.push_back(b);
                }
            }
        }

    return result;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdx, %r13
movq %rsi, 0xb8(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq %rdi, 0x28(%rsp)
movq $0x0, 0x10(%rdi)
movl $0xfffffffe, 0x10(%rsp) # imm = 0xFFFFFFFE
movl $0x1, 0xc(%rsp)
xorl %ebx, %ebx
movq %rdx, 0x60(%rsp)
movq %r13, %rdi
callq 0xe554
movl %eax, %eax
cmpq %rax, %rbx
jae 0xf68c
leaq 0x1(%rbx), %rax
movq %rax, 0x18(%rsp)
movq %rbx, 0x20(%rsp)
shlq $0x20, %rbx
movq %rbx, 0xc0(%rsp)
xorl %edx, %edx
movl %edx, %ebx
movq %r13, %rdi
callq 0xe544
cmpl %eax, %ebx
jae 0xf67a
movq %r13, %rdi
movl %ebx, %esi
movq 0x20(%rsp), %rdx
callq 0xe5fc
movq %rbx, 0x30(%rsp)
incl %ebx
movl %ebx, %edx
testb %al, %al
je 0xf3d7
movq %r13, %rdi
movl %ebx, %esi
movq 0x20(%rsp), %rdx
callq 0xe5fc
movl %ebx, %edx
testb %al, %al
je 0xf3d7
movq %r13, %rdi
movq 0x30(%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0xe5fc
movl %ebx, %edx
testb %al, %al
je 0xf3d7
movq %r13, %rdi
movl %ebx, %esi
movq 0x18(%rsp), %rdx
callq 0xe5fc
movl %ebx, %edx
testb %al, %al
jne 0xf3d7
movl %ebx, 0x14(%rsp)
xorl %ecx, %ecx
movq 0x30(%rsp), %r12
movq 0x20(%rsp), %rbx
movl %r12d, %r15d
movl %ecx, %r14d
leal 0x2(%r15), %esi
movq %r13, %rdi
movl %ebx, %edx
callq 0xe5fc
leal 0x1(%r15), %r12d
leal 0x1(%r14), %ecx
testb %al, %al
jne 0xf457
leal 0x1(%r12), %edx
cmpl $0x9, %ecx
jb 0xf3d7
movl %edx, 0x8(%rsp)
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl 0xc(%rsp), %ecx
movl 0x10(%rsp), %eax
movl %eax, %ebp
movl %ecx, %ebx
leal 0x3(%rbp), %edx
movq 0x60(%rsp), %rdi
movl %r12d, %esi
callq 0xe5fc
incl %ebp
incl %r13d
leal 0x1(%rbx), %ecx
testb %al, %al
jne 0xf499
cmpl $0xa, %r13d
movq 0x60(%rsp), %r13
movl 0x8(%rsp), %edx
jb 0xf3d7
leal 0x1(%rbp), %eax
movq %rax, 0x58(%rsp)
notl %r14d
movq %r13, %rdi
movl %r15d, %esi
movq 0x58(%rsp), %rdx
callq 0xe5fc
incl %r14d
decl %r15d
testb %al, %al
jne 0xf4d5
movl 0x14(%rsp), %r15d
subl %r14d, %r15d
leal -0x2(%rbx), %edx
movq %r13, %rdi
movl %r15d, %esi
callq 0xe5fc
decl %ebx
testb %al, %al
jne 0xf4f7
cmpl $0x1, %r14d
movl 0x8(%rsp), %edx
movl 0x14(%rsp), %edi
jne 0xf3d7
movl %ebx, %eax
cmpq %rax, 0x20(%rsp)
jne 0xf3d7
leaq 0x48(%rsp), %rax
movq %rax, 0x38(%rsp)
movq $0x0, 0x40(%rsp)
movb $0x0, 0x48(%rsp)
movq 0x18(%rsp), %rsi
callq 0x1133c
movq %rax, %rbx
leal -0x1(%r12), %edi
movl %ebp, %esi
callq 0x1133c
leaq 0x88(%rsp), %rdi
movq 0xb8(%rsp), %rsi
movq %r13, %rdx
movq %rbx, %rcx
movq %rax, %r8
callq 0xf728
leaq 0x38(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x2230
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
leaq 0x68(%rsp), %rbx
je 0xf5b5
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x21c0
leaq 0x78(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0xec7c
movq 0x30(%rsp), %rax
movl %eax, %edx
orq 0xc0(%rsp), %rdx
movq 0x58(%rsp), %rax
shlq $0x20, %rax
movl %r12d, %ecx
orq %rax, %rcx
leaq 0x88(%rsp), %rdi
movq %rbx, %rsi
callq 0x11924
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0xf61e
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x28(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0xfe6c
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0xf655
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x21c0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0xf671
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x21c0
movl 0x8(%rsp), %edx
jmp 0xf3d7
incl 0x10(%rsp)
incl 0xc(%rsp)
movq 0x18(%rsp), %rbx
jmp 0xf3a8
movq 0x28(%rsp), %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0xf6eb
movq 0x98(%rsp), %rsi
jmp 0xf6dc
movq %rax, %rbx
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0xf6eb
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0xf6eb
jmp 0xf6e8
movq %rax, %rbx
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0xf716
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x21c0
jmp 0xf716
jmp 0xf713
jmp 0xf713
jmp 0xf713
jmp 0xf713
jmp 0xf713
movq %rax, %rbx
movq 0x28(%rsp), %rdi
callq 0xfd52
movq %rbx, %rdi
callq 0x2340