// File: /workspace/github_cpp_makefile_star2_O2/knei-knurow[P]lidar-visualizations/src/cloud-writers.cpp
// Function: CloudFileSeriesWriter::CloudFileSeriesWriter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, CoordSystem)
CloudFileSeriesWriter::CloudFileSeriesWriter(const std::string& output_dir, CoordSystem coord_sys) {
  clouds_cnt_ = 0;
  coord_sys_ = coord_sys;

  if (coord_sys_ == CoordSystem::CART) {
    filename_ = generate_filename("txt", output_dir, "cloud-ser-cart");
  } else if (coord_sys_ == CoordSystem::CYL) {
    filename_ = generate_filename("txt", output_dir, "cloud-ser-cyl");
  }

  std::cout << "Starting cloud series: " << filename_ << "." << std::endl;
  file_ = std::ofstream(filename_);
  if (!file_) {
    status_ = false;
    std::cerr << "ERROR: Unable to create cloud series file." << std::endl;
  }
  file_ << "# RPLIDAR SCAN DATA SERIES" << std::endl;
  file_ << "# Software: https://github.com/knei-knurow/lidar-visualizations" << std::endl;
  file_ << "# Authors: Szymon Bednorz, Bartek Dudek" << std::endl;
  file_ << "#" << std::endl;
  file_ << "# Each frame (360 deg full scan) is followed by its number and a "
           "time elapsed from the previous frame (in milliseconds)."
        << std::endl;
  file_ << "#" << std::endl;
  if (coord_sys_ == CoordSystem::CART) {
    file_ << "# X, Y" << std::endl;
  } else if (coord_sys_ == CoordSystem::CYL) {
    file_ << "# Angle, Distance" << std::endl;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
movl %edx, %r13d
movq %rdi, %r15
movb $0x1, 0x8(%rdi)
leaq 0x53fd(%rip), %rax      # 0xbc60
movq %rax, (%rdi)
leaq 0x20(%rdi), %rax
movq %rax, 0x10(%rdi)
andq $0x0, 0x18(%rdi)
movq %rsi, %r12
leaq 0x10(%rdi), %rbx
movb $0x0, 0x20(%rdi)
leaq 0x30(%rdi), %r14
movq %r14, %rdi
callq 0x3460
andq $0x0, 0x240(%r15)
andq $0x0, 0x230(%r15)
movl %r13d, 0x238(%r15)
cmpl $0x1, %r13d
je 0x68f4
testl %r13d, %r13d
jne 0x6962
leaq 0x1d0f(%rip), %rsi      # 0x85c6
leaq -0x70(%rbp), %rdi
leaq -0x2a(%rbp), %rdx
callq 0x37f8
leaq 0x1dd8(%rip), %rsi      # 0x86a3
leaq -0x50(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x37f8
leaq -0x270(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x50(%rbp), %rcx
movq %r12, %rdx
xorl %r8d, %r8d
callq 0x62a8
jmp 0x6936
leaq 0x1ccb(%rip), %rsi      # 0x85c6
leaq -0x70(%rbp), %rdi
leaq -0x2a(%rbp), %rdx
callq 0x37f8
leaq 0x1da3(%rip), %rsi      # 0x86b2
leaq -0x50(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x37f8
leaq -0x270(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x50(%rbp), %rcx
movq %r12, %rdx
xorl %r8d, %r8d
callq 0x62a8
leaq -0x270(%rbp), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x32f0
movq %r12, %rdi
callq 0x3130
leaq -0x50(%rbp), %rdi
callq 0x3130
leaq -0x70(%rbp), %rdi
callq 0x3130
movq 0x5667(%rip), %rdi      # 0xbfd0
leaq 0x1d50(%rip), %rsi      # 0x86c0
callq 0x3290
movq %rax, %rdi
movq %rbx, %rsi
callq 0x3260
leaq 0x1e10(%rip), %rsi      # 0x8797
movq %rax, %rdi
callq 0x3290
movq %rax, %rdi
callq 0x3150
leaq -0x270(%rbp), %rdi
pushq $0x10
popq %rdx
movq %rbx, %rsi
callq 0x34d0
leaq -0x270(%rbp), %rsi
movq %r14, %rdi
callq 0x32e0
leaq -0x270(%rbp), %rdi
callq 0x33b0
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%r14,%rax)
je 0x69f3
movb $0x0, 0x8(%r15)
movq 0x5611(%rip), %rdi      # 0xbff0
leaq 0x1cf2(%rip), %rsi      # 0x86d8
callq 0x3290
movq %rax, %rdi
callq 0x3150
leaq 0x1d09(%rip), %rsi      # 0x8703
movq %r14, %rdi
callq 0x3290
movq %rax, %rdi
callq 0x3150
leaq 0x1c04(%rip), %rsi      # 0x8615
movq %r14, %rdi
callq 0x3290
movq %rax, %rdi
callq 0x3150
leaq 0x1c2d(%rip), %rsi      # 0x8655
movq %r14, %rdi
callq 0x3290
movq %rax, %rdi
callq 0x3150
leaq 0x1cdf(%rip), %rsi      # 0x871e
movq %r14, %rdi
callq 0x3290
movq %rax, %rdi
callq 0x3150
leaq 0x1cca(%rip), %rsi      # 0x8720
movq %r14, %rdi
callq 0x3290
movq %rax, %rdi
callq 0x3150
leaq 0x1cb1(%rip), %rsi      # 0x871e
movq %r14, %rdi
callq 0x3290
movq %rax, %rdi
callq 0x3150
movl 0x238(%r15), %eax
testl %eax, %eax
je 0x6a96
cmpl $0x1, %eax
jne 0x6aad
leaq 0x1d0c(%rip), %rsi      # 0x87a0
jmp 0x6a9d
leaq 0x1cfc(%rip), %rsi      # 0x8799
movq %r14, %rdi
callq 0x3290
movq %rax, %rdi
callq 0x3150
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6ac1
movq %rax, %r15
leaq -0x50(%rbp), %rdi
callq 0x3130
jmp 0x6ad4
jmp 0x6ad1
movq %rax, %r15
leaq -0x70(%rbp), %rdi
callq 0x3130
jmp 0x6afe
jmp 0x6afb
jmp 0x6afb
movq %rax, %r15
leaq -0x270(%rbp), %rdi
callq 0x33b0
jmp 0x6afe
jmp 0x6afb
movq %rax, %r15
jmp 0x6b06
movq %rax, %r15
movq %r14, %rdi
callq 0x33b0
movq %rbx, %rdi
callq 0x3130
movq %r15, %rdi
callq 0x3480