// File: rapirent[P]JPEG/./bitmap_image.hpp
// Function: bitmap_image::save_image(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) const
void save_image(const std::string& file_name) const
   {
      std::ofstream stream(file_name.c_str(),std::ios::binary);

      if (!stream)
      {
         std::cerr << "bitmap_image::save_image(): Error - Could not open file "  << file_name << " for writing!" << std::endl;
         return;
      }

      bitmap_information_header bih;

      bih.width            = width_;
      bih.height           = height_;
      bih.bit_count        = static_cast<unsigned short>(bytes_per_pixel_ << 3);
      bih.clr_important    = 0;
      bih.clr_used         = 0;
      bih.compression      = 0;
      bih.planes           = 1;
      bih.size             = bih.struct_size();
      bih.x_pels_per_meter = 0;
      bih.y_pels_per_meter = 0;
      bih.size_image       = (((bih.width * bytes_per_pixel_) + 3) & 0x0000FFFC) * bih.height;

      bitmap_file_header bfh;

      bfh.type             = 19778;
      bfh.size             = bfh.struct_size() + bih.struct_size() + bih.size_image;
      bfh.reserved1        = 0;
      bfh.reserved2        = 0;
      bfh.off_bits         = bih.struct_size() + bfh.struct_size();

      write_bfh(stream,bfh);
      write_bih(stream,bih);

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

      for (unsigned int i = 0; i < height_; ++i)
      {
         const unsigned char* data_ptr = &data_[(row_increment_ * (height_ - i - 1))];

         stream.write(reinterpret_cast<const char*>(data_ptr), sizeof(unsigned char) * bytes_per_pixel_ * width_);
         stream.write(padding_data,padding);
      }

      stream.close();
   }

// Assembly:
subq $0x2b8, %rsp            # imm = 0x2B8
movq %rdi, 0x2b0(%rsp)
movq %rsi, 0x2a8(%rsp)
movq 0x2b0(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x2a8(%rsp), %rdi
callq 0x5080
movq %rax, %rsi
leaq 0xa8(%rsp), %rdi
movl $0x4, %edx
callq 0x51d0
movq 0xa8(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0xa8(%rsp,%rax), %rdi
callq 0x50a0
movb %al, 0x47(%rsp)
jmp 0x7675
movb 0x47(%rsp), %al
testb $0x1, %al
jne 0x7682
jmp 0x7716
movq 0x5967(%rip), %rdi      # 0xcff0
leaq 0x3564(%rip), %rsi      # 0xabf4
callq 0x5170
movq %rax, 0x30(%rsp)
jmp 0x769c
movq 0x30(%rsp), %rdi
movq 0x2a8(%rsp), %rsi
callq 0x5160
movq %rax, 0x28(%rsp)
jmp 0x76b5
movq 0x28(%rsp), %rdi
leaq 0x356c(%rip), %rsi      # 0xac2d
callq 0x5170
movq %rax, 0x20(%rsp)
jmp 0x76cd
movq 0x20(%rsp), %rdi
movq 0x58ef(%rip), %rsi      # 0xcfc8
callq 0x51a0
jmp 0x76e0
movl $0x1, 0x98(%rsp)
jmp 0x7930
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa0(%rsp)
movl %eax, 0x9c(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0x5280
jmp 0x7945
movq 0x38(%rsp), %rax
movl 0x20(%rax), %ecx
movl %ecx, 0x74(%rsp)
movl 0x24(%rax), %ecx
movl %ecx, 0x78(%rsp)
movl 0x2c(%rax), %eax
shll $0x3, %eax
movw %ax, 0x7e(%rsp)
movl $0x0, 0x94(%rsp)
movl $0x0, 0x90(%rsp)
movl $0x0, 0x80(%rsp)
movw $0x1, 0x7c(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x8780
movl %eax, 0x1c(%rsp)
jmp 0x776c
movq 0x38(%rsp), %rax
movl 0x1c(%rsp), %ecx
movl %ecx, 0x70(%rsp)
movl $0x0, 0x88(%rsp)
movl $0x0, 0x8c(%rsp)
movl 0x2c(%rax), %edx
movl 0x74(%rsp), %eax
movl 0x78(%rsp), %ecx
imull %edx, %eax
addl $0x3, %eax
andl $0xfffc, %eax           # imm = 0xFFFC
imull %ecx, %eax
movl %eax, 0x84(%rsp)
movw $0x4d42, 0x60(%rsp)     # imm = 0x4D42
leaq 0x60(%rsp), %rdi
callq 0x8790
movl %eax, 0x18(%rsp)
jmp 0x77c6
leaq 0x70(%rsp), %rdi
callq 0x8780
movl %eax, 0x14(%rsp)
jmp 0x77d6
movl 0x14(%rsp), %ecx
movl 0x18(%rsp), %eax
addl %ecx, %eax
movl 0x84(%rsp), %ecx
addl %ecx, %eax
movl %eax, 0x64(%rsp)
movw $0x0, 0x68(%rsp)
movw $0x0, 0x6a(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x8780
movl %eax, 0x10(%rsp)
jmp 0x780b
leaq 0x60(%rsp), %rdi
callq 0x8790
movl %eax, 0xc(%rsp)
jmp 0x781b
movq 0x38(%rsp), %rdi
movl 0xc(%rsp), %ecx
movl 0x10(%rsp), %eax
addl %ecx, %eax
movl %eax, 0x6c(%rsp)
leaq 0xa8(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq 0x87a0
jmp 0x7842
movq 0x38(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
leaq 0x70(%rsp), %rdx
callq 0x8950
jmp 0x785b
movq 0x38(%rsp), %rax
imull $0x3, 0x20(%rax), %ecx
andl $0x3, %ecx
movl $0x4, %eax
subl %ecx, %eax
andl $0x3, %eax
movl %eax, 0x5c(%rsp)
leaq 0x58(%rsp), %rdi
xorl %esi, %esi
movl $0x4, %edx
callq 0x50c0
movl $0x0, 0x54(%rsp)
movq 0x38(%rsp), %rcx
movl 0x54(%rsp), %eax
cmpl 0x24(%rcx), %eax
jae 0x7916
movq 0x38(%rsp), %rax
movq %rax, %rdi
addq $0x38, %rdi
movl 0x24(%rax), %edx
movl 0x28(%rax), %eax
movl 0x54(%rsp), %ecx
notl %ecx
addl %edx, %ecx
imull %ecx, %eax
movl %eax, %esi
callq 0x8d90
movq 0x38(%rsp), %rcx
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rsi
movl 0x20(%rcx), %eax
movl 0x2c(%rcx), %ecx
movl %ecx, %edx
imulq %rax, %rdx
leaq 0xa8(%rsp), %rdi
callq 0x5240
jmp 0x78ea
movl 0x5c(%rsp), %eax
movl %eax, %edx
leaq 0xa8(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x5240
jmp 0x7904
jmp 0x7906
movl 0x54(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x54(%rsp)
jmp 0x788e
leaq 0xa8(%rsp), %rdi
callq 0x5260
jmp 0x7925
movl $0x0, 0x98(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0x5280
addq $0x2b8, %rsp            # imm = 0x2B8
retq
movq 0xa0(%rsp), %rdi
callq 0x52d0
nopw %cs:(%rax,%rax)
nopl (%rax)