// File: /workspace/github_cpp_makefile_star2_O1/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
movq %r15, %rdi
movl $0x4, %edx
callq 0x5120
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x68(%rsp,%rax)
je 0x69f0
movq 0x3667(%rip), %rdi      # 0x9ff0
leaq 0x1047(%rip), %rsi      # 0x79d7
movl $0x38, %edx
callq 0x5130
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0x3648(%rip), %rdi      # 0x9ff0
callq 0x5130
movq %rax, %rbx
leaq 0x1059(%rip), %rsi      # 0x7a10
movl $0xd, %edx
movq %rax, %rdi
callq 0x5130
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x50f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x50a0
jmp 0x6c02
movl 0x20(%rbx), %eax
movl %eax, 0x14(%rsp)
movl 0x24(%rbx), %ecx
movl %ecx, 0x18(%rsp)
movl 0x2c(%rbx), %edx
leal (,%rdx,8), %esi
movw %si, 0x1e(%rsp)
movl $0x0, 0x20(%rsp)
movw $0x1, 0x1c(%rsp)
movl $0x28, 0x10(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rsp)
imull %eax, %edx
addl $0x3, %edx
andl $0xfffc, %edx           # imm = 0xFFFC
imull %ecx, %edx
movl %edx, 0x24(%rsp)
leaq 0x38(%rsp), %rsi
movw $0x4d42, (%rsi)         # imm = 0x4D42
addl $0x36, %edx
movl %edx, 0x4(%rsi)
movabsq $0x3600000000, %rax     # imm = 0x3600000000
movq %rax, 0x8(%rsi)
leaq 0x48(%rsp), %rdi
movl $0x2, %edx
callq 0x5170
leaq 0x3c(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x4, %edx
callq 0x5170
leaq 0x40(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x2, %edx
callq 0x5170
leaq 0x42(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x2, %edx
callq 0x5170
leaq 0x44(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x4, %edx
callq 0x5170
leaq 0x48(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movl $0x4, %edx
callq 0x5170
leaq 0x14(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x4, %edx
callq 0x5170
leaq 0x18(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x4, %edx
callq 0x5170
leaq 0x1c(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x2, %edx
callq 0x5170
leaq 0x1e(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x2, %edx
callq 0x5170
leaq 0x20(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x4, %edx
callq 0x5170
leaq 0x24(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x4, %edx
callq 0x5170
leaq 0x28(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x4, %edx
callq 0x5170
leaq 0x2c(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x4, %edx
callq 0x5170
leaq 0x30(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x4, %edx
callq 0x5170
leaq 0x34(%rsp), %rsi
leaq 0x48(%rsp), %rdi
movl $0x4, %edx
callq 0x5170
movl 0x20(%rbx), %r14d
movl $0x0, 0xc(%rsp)
movl 0x24(%rbx), %esi
testl %esi, %esi
je 0x6bf8
andl $0x3, %r14d
xorl %ebp, %ebp
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
leaq 0x48(%rsp), %r15
leaq 0xc(%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 0x5170
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x5170
incl %ebp
movl 0x24(%rbx), %esi
decl %r13d
cmpl %esi, %ebp
jb 0x6bc1
leaq 0x48(%rsp), %rdi
callq 0x5190
movq 0x33c7(%rip), %rax      # 0x9fd0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x50(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x48(%rsp,%rcx)
callq 0x50d0
leaq 0x140(%rsp), %rdi
callq 0x5050
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6c4c
jmp 0x6c4c
jmp 0x6c4c
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x51a0
movq %rbx, %rdi
callq 0x51f0
nop