// File: /workspace/github_cpp_makefile_star2_O3/rapirent[P]JPEG/./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;
      }

      width_  = 0;
      height_ = 0;

      bitmap_file_header bfh;
      bitmap_information_header bih;

      bfh.clear();
      bih.clear();

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

      if (bfh.type != 19778)
      {
         bfh.clear();
         bih.clear();

         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)
      {
         bfh.clear();
         bih.clear();

         stream.close();

         std::cerr << "bitmap_image::load_bitmap() ERROR: bitmap_image - Invalid bit depth " << bih.bit_count << " expected 24." << std::endl;

         return;
      }

      if (bih.size != bih.struct_size())
      {
         bfh.clear();
         bih.clear();

         stream.close();

         std::cerr << "bitmap_image::load_bitmap() ERROR: bitmap_image - Invalid BIH size " << bih.size << " expected " << bih.struct_size() << std::endl;

         return;
      }

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

      bytes_per_pixel_ = bih.bit_count >> 3;

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

      std::size_t bitmap_file_size = file_size(file_name_);

      std::size_t bitmap_logical_size = (height_ * width_ * bytes_per_pixel_) +
                                        (height_ * padding)                   +
                                         bih.struct_size()                    +
                                         bfh.struct_size()                    ;

      if (bitmap_file_size != bitmap_logical_size)
      {
         bfh.clear();
         bih.clear();

         stream.close();

         std::cerr << "bitmap_image::load_bitmap() ERROR: bitmap_image - Mismatch between logical and physical sizes of bitmap. " <<
                      "Logical: "  << bitmap_logical_size << " " <<
                      "Physical: " << bitmap_file_size    << std::endl;

         return;
      }

      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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x458, %rsp            # imm = 0x458
movq %rdi, %rbx
movq (%rdi), %rsi
leaq 0x48(%rsp), %r14
movq %r14, %rdi
movl $0x4, %edx
callq 0x5230
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x68(%rsp,%rax)
je 0x6775
movq 0x48e2(%rip), %rdi      # 0xaff0
leaq 0x2243(%rip), %rsi      # 0x8958
movl $0x37, %edx
callq 0x5160
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x48c3(%rip), %rdi      # 0xaff0
callq 0x5160
movq %rax, %rbx
leaq 0x2254(%rip), %rsi      # 0x8990
movl $0xb, %edx
movq %rax, %rdi
callq 0x5160
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5120
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x50e0
jmp 0x6ace
xorl %eax, %eax
movq %rax, 0x20(%rbx)
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rsi
movaps %xmm0, (%rsi)
movaps %xmm0, (%rsp)
movaps %xmm0, 0x10(%rsp)
movq %rax, 0x20(%rsp)
leaq 0x48(%rsp), %rdi
movl $0x2, %edx
callq 0x51a0
leaq 0x34(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x4, %edx
callq 0x51a0
leaq 0x38(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x2, %edx
callq 0x51a0
leaq 0x3a(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x2, %edx
callq 0x51a0
leaq 0x3c(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x4, %edx
callq 0x51a0
leaq 0x48(%rsp), %rdi
movq %rsp, %rsi
movl $0x4, %edx
callq 0x51a0
leaq 0x4(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x4, %edx
callq 0x51a0
leaq 0x8(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x4, %edx
callq 0x51a0
leaq 0xc(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x2, %edx
callq 0x51a0
leaq 0xe(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x2, %edx
callq 0x51a0
leaq 0x10(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x4, %edx
callq 0x51a0
leaq 0x14(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x4, %edx
callq 0x51a0
leaq 0x18(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x4, %edx
callq 0x51a0
leaq 0x1c(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x4, %edx
callq 0x51a0
leaq 0x20(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x4, %edx
callq 0x51a0
leaq 0x24(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x4, %edx
callq 0x51a0
cmpw $0x4d42, 0x30(%rsp)     # imm = 0x4D42
jne 0x693b
cmpw $0x18, 0xe(%rsp)
jne 0x69b8
cmpl $0x28, (%rsp)
jne 0x6a35
movq 0x4(%rsp), %r12
movq %r12, 0x20(%rbx)
movl $0x3, 0x2c(%rbx)
movl $0x0, 0x44(%rsp)
movq (%rbx), %rsi
leaq 0x250(%rsp), %rdi
movl $0xc, %edx
callq 0x5230
movq 0x250(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x270(%rsp,%rax)
je 0x6aea
xorl %r14d, %r14d
jmp 0x6b0e
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, (%rsp)
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x5050
movq 0x468a(%rip), %rdi      # 0xaff0
leaq 0x202f(%rip), %rsi      # 0x899c
movl $0x45, %edx
callq 0x5160
movzwl 0x30(%rsp), %esi
movq 0x466d(%rip), %rdi      # 0xaff0
callq 0x50d0
movq %rax, %rbx
leaq 0x2050(%rip), %rsi      # 0x89e2
movl $0x10, %edx
movq %rax, %rdi
callq 0x5160
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5120
jmp 0x6abb
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, (%rsp)
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x5050
movq 0x460d(%rip), %rdi      # 0xaff0
leaq 0x2009(%rip), %rsi      # 0x89f3
movl $0x44, %edx
callq 0x5160
movzwl 0xe(%rsp), %esi
movq 0x45f0(%rip), %rdi      # 0xaff0
callq 0x50d0
movq %rax, %rbx
leaq 0x2029(%rip), %rsi      # 0x8a38
movl $0xd, %edx
movq %rax, %rdi
callq 0x5160
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5120
jmp 0x6abb
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, (%rsp)
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x5050
movq 0x4590(%rip), %rdi      # 0xaff0
leaq 0x1fdf(%rip), %rsi      # 0x8a46
movl $0x43, %edx
callq 0x5160
movl (%rsp), %esi
movq 0x4575(%rip), %rdi      # 0xaff0
callq 0x50d0
movq %rax, %rbx
leaq 0x2000(%rip), %rsi      # 0x8a8a
movl $0xa, %edx
movq %rax, %rdi
callq 0x5160
movl $0x28, %esi
movq %rbx, %rdi
callq 0x50d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5120
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x50e0
leaq 0x48(%rsp), %rdi
callq 0x5060
addq $0x458, %rsp            # imm = 0x458
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x250(%rsp), %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x51b0
leaq 0x250(%rsp), %rdi
callq 0x5200
movq %rax, %r14
andl $0x3, %r12d
leaq 0x250(%rsp), %rdi
callq 0x5060
movl 0x24(%rbx), %esi
movl 0x2c(%rbx), %eax
imull 0x20(%rbx), %eax
leal (%rax,%r12), %r15d
imull %esi, %r15d
addl $0x36, %r15d
cmpq %r15, %r14
jne 0x6ba5
movl %eax, 0x28(%rbx)
leaq 0x38(%rbx), %rdi
imull %eax, %esi
callq 0x6d34
movl 0x24(%rbx), %esi
testl %esi, %esi
je 0x6ace
movl %r12d, %r14d
xorl %ebp, %ebp
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
leaq 0x48(%rsp), %r15
leaq 0x44(%rsp), %r12
addl %r13d, %esi
imull 0x28(%rbx), %esi
addq 0x38(%rbx), %rsi
movl 0x20(%rbx), %edx
movl 0x2c(%rbx), %eax
imulq %rax, %rdx
movq %r15, %rdi
callq 0x51a0
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x51a0
incl %ebp
movl 0x24(%rbx), %esi
decl %r13d
cmpl %esi, %ebp
jb 0x6b69
jmp 0x6ace
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, (%rsp)
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x5050
movq 0x4420(%rip), %rdi      # 0xaff0
leaq 0x1ebe(%rip), %rsi      # 0x8a95
movl $0x69, %edx
callq 0x5160
movq 0x4408(%rip), %rdi      # 0xaff0
leaq 0x1f10(%rip), %rsi      # 0x8aff
movl $0x9, %edx
callq 0x5160
movq 0x43f0(%rip), %rdi      # 0xaff0
movq %r15, %rsi
callq 0x50d0
movq %rax, %rbx
leaq 0x1eeb(%rip), %rsi      # 0x8afd
movl $0x1, %edx
movq %rax, %rdi
callq 0x5160
leaq 0x1ee3(%rip), %rsi      # 0x8b09
movl $0xa, %edx
movq %rbx, %rdi
callq 0x5160
movq %rbx, %rdi
movq %r14, %rsi
callq 0x50d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5120
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x50e0
jmp 0x6ace
jmp 0x6c6f
movq %rax, %rbx
leaq 0x250(%rsp), %rdi
callq 0x5060
jmp 0x6c8c
jmp 0x6c89
jmp 0x6c89
jmp 0x6c89
jmp 0x6c89
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x5060
movq %rbx, %rdi
callq 0x5210