// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rsi
leaq 0x48(%rsp), %r15
pushq $0x4
popq %rdx
movq %r15, %rdi
callq 0x5140
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x68(%rsp,%rax)
je 0x6742
movq 0x38e1(%rip), %rdi      # 0x9ff0
leaq 0x12c1(%rip), %rsi      # 0x79d7
callq 0x5110
movq %rax, %rdi
movq %r14, %rsi
callq 0x5100
leaq 0x12e3(%rip), %rsi      # 0x7a10
movq %rax, %rdi
callq 0x5110
movq %rax, %rdi
callq 0x5090
jmp 0x682a
movl 0x20(%rbx), %eax
movl %eax, 0x14(%rsp)
movl 0x24(%rbx), %ecx
movl %ecx, 0x18(%rsp)
movl 0x2c(%rbx), %esi
leal (,%rsi,8), %edx
movw %dx, 0x1e(%rsp)
andl $0x0, 0x20(%rsp)
movw $0x1, 0x1c(%rsp)
movl $0x28, 0x10(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rsp)
imull %eax, %esi
addl $0x3, %esi
andl $0xfffc, %esi           # imm = 0xFFFC
imull %ecx, %esi
movl %esi, 0x24(%rsp)
leaq 0x38(%rsp), %rdx
movw $0x4d42, (%rdx)         # imm = 0x4D42
addl $0x36, %esi
movl %esi, 0x4(%rdx)
movabsq $0x3600000000, %rax     # imm = 0x3600000000
movq %rax, 0x8(%rdx)
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0x6a6e
leaq 0x48(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x6adc
movl 0x20(%rbx), %r14d
leaq 0xc(%rsp), %r15
andl $0x0, (%r15)
andl $0x3, %r14d
xorl %ebp, %ebp
pushq $-0x1
popq %r13
leaq 0x48(%rsp), %r12
movl 0x24(%rbx), %esi
cmpl %esi, %ebp
jae 0x6820
addl %r13d, %esi
imull 0x28(%rbx), %esi
addq 0x38(%rbx), %rsi
movl 0x20(%rbx), %edx
movl 0x2c(%rbx), %eax
imulq %rax, %rdx
movq %r12, %rdi
callq 0x5180
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x5180
incl %ebp
decl %r13d
jmp 0x67e7
leaq 0x48(%rsp), %rdi
callq 0x51a0
leaq 0x48(%rsp), %rdi
callq 0x51b0
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x684c
jmp 0x684c
jmp 0x684c
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x51b0
movq %rbx, %rdi
callq 0x5200
nop