// File: drummyfish[P]flowchart/src/bitmap_image.hpp
// Function: bitmap_image::load_bitmap()
void load_bitmap()
   {
      std::ifstream stream(file_name_.c_str(),std::ios::binary);
      if (!stream)
      {
         //std::cerr << "bitmap_image::load_bitmap() ERROR: bitmap_image - file " << file_name_ << " not found!" << std::endl;
         return;
      }

      bitmap_file_header bfh;
      bitmap_information_header bih;

      read_bfh(stream,bfh);
      read_bih(stream,bih);

      if (bfh.type != 19778)
      {
         stream.close();
         //std::cerr << "bitmap_image::load_bitmap() ERROR: bitmap_image - Invalid type value " << bfh.type << " expected 19778." << std::endl;
         return;
      }

      if (bih.bit_count != 24)
      {
         stream.close();
         //std::cerr << "bitmap_image::load_bitmap() ERROR: bitmap_image - Invalid bit depth " << bih.bit_count << " expected 24." << std::endl;
         return;
      }

      height_ = bih.height;
      width_  = bih.width;

      bytes_per_pixel_ = bih.bit_count >> 3;

      unsigned int padding = (4 - ((3 * width_) % 4)) % 4;
      char padding_data[4] = {0,0,0,0};

      create_bitmap();

      for (unsigned int i = 0; i < height_; ++i)
      {
         unsigned char* data_ptr = row(height_ - i - 1); // read in inverted row order
         stream.read(reinterpret_cast<char*>(data_ptr),sizeof(char) * bytes_per_pixel_ * width_);
         stream.read(padding_data,padding);
      }
   }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x290, %rsp            # imm = 0x290
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x280(%rbp)
callq 0x30e0
movq %rax, %rsi
leaq -0x210(%rbp), %rdi
movl $0x4, %edx
callq 0x3490
movq -0x210(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x210(%rbp,%rax), %rdi
callq 0x3110
movb %al, -0x271(%rbp)
jmp 0x16813
movb -0x271(%rbp), %al
testb $0x1, %al
jne 0x1681f
jmp 0x16851
movl $0x1, -0x220(%rbp)
jmp 0x169d8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
leaq -0x210(%rbp), %rdi
callq 0x30a0
jmp 0x169ed
movq -0x280(%rbp), %rdi
leaq -0x210(%rbp), %rsi
leaq -0x230(%rbp), %rdx
callq 0x16a00
jmp 0x1686d
movq -0x280(%rbp), %rdi
leaq -0x210(%rbp), %rsi
leaq -0x258(%rbp), %rdx
callq 0x16b20
jmp 0x16889
movzwl -0x230(%rbp), %eax
cmpl $0x4d42, %eax           # imm = 0x4D42
je 0x168b4
leaq -0x210(%rbp), %rdi
callq 0x3080
jmp 0x168a5
movl $0x1, -0x220(%rbp)
jmp 0x169d8
movzwl -0x24a(%rbp), %eax
cmpl $0x18, %eax
je 0x168dd
leaq -0x210(%rbp), %rdi
callq 0x3080
jmp 0x168ce
movl $0x1, -0x220(%rbp)
jmp 0x169d8
movq -0x280(%rbp), %rdi
movl -0x250(%rbp), %eax
movl %eax, 0x34(%rdi)
movl -0x254(%rbp), %eax
movl %eax, 0x30(%rdi)
movzwl -0x24a(%rbp), %eax
shrl $0x3, %eax
movl %eax, 0x28(%rdi)
movl 0x30(%rdi), %eax
addl $0x4, %eax
andl $0x3, %eax
movl %eax, -0x25c(%rbp)
movl $0x0, -0x260(%rbp)
callq 0x16d50
jmp 0x16923
movl $0x0, -0x264(%rbp)
movq -0x280(%rbp), %rcx
movl -0x264(%rbp), %eax
cmpl 0x34(%rcx), %eax
jae 0x169ce
movq -0x280(%rbp), %rdi
movl 0x34(%rdi), %eax
movl -0x264(%rbp), %esi
notl %esi
addl %eax, %esi
callq 0x16dc0
movq %rax, -0x288(%rbp)
jmp 0x16965
movq -0x280(%rbp), %rax
movq -0x288(%rbp), %rcx
movq %rcx, -0x270(%rbp)
movq -0x270(%rbp), %rsi
movl 0x28(%rax), %ecx
movl 0x30(%rax), %eax
movl %ecx, %edx
imulq %rax, %rdx
leaq -0x210(%rbp), %rdi
callq 0x3310
jmp 0x1699b
movl -0x25c(%rbp), %eax
movl %eax, %edx
leaq -0x210(%rbp), %rdi
leaq -0x260(%rbp), %rsi
callq 0x3310
jmp 0x169b8
jmp 0x169ba
movl -0x264(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x264(%rbp)
jmp 0x1692d
movl $0x0, -0x220(%rbp)
leaq -0x210(%rbp), %rdi
callq 0x30a0
addq $0x290, %rsp            # imm = 0x290
popq %rbp
retq
movq -0x218(%rbp), %rdi
callq 0x3460
nopl (%rax)