// File: /workspace/github_cpp_makefile_star2_O3/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 $0x258, %rsp            # imm = 0x258
movl %edx, %r13d
movq %rsi, %r12
movq %rdi, %r15
movb $0x1, 0x8(%rdi)
leaq 0x530a(%rip), %rax      # 0xcc48
movq %rax, (%rdi)
leaq 0x10(%rdi), %rax
movq %rax, -0x30(%rbp)
leaq 0x20(%rdi), %rax
movq %rax, -0x78(%rbp)
movq %rax, 0x10(%rdi)
movq $0x0, 0x18(%rdi)
movb $0x0, 0x20(%rdi)
leaq 0x30(%rdi), %r14
movq %r14, %rdi
callq 0x3410
xorl %eax, %eax
movq %rax, 0x240(%r15)
movq %rax, 0x230(%r15)
movl %r13d, 0x238(%r15)
cmpl $0x1, %r13d
je 0x79ed
testl %r13d, %r13d
jne 0x7aa1
leaq -0x60(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x1b4c(%rip), %rsi      # 0x94ee
leaq 0x1b48(%rip), %rdx      # 0x94f1
leaq -0x70(%rbp), %rdi
callq 0x38fa
leaq -0x40(%rbp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x1c0a(%rip), %rsi      # 0x95cb
leaq 0x1c11(%rip), %rdx      # 0x95d9
leaq -0x50(%rbp), %rdi
callq 0x38fa
leaq -0x278(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x50(%rbp), %rcx
movq %r12, %rdx
xorl %r8d, %r8d
callq 0x6ed8
jmp 0x7a45
leaq -0x60(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x1af2(%rip), %rsi      # 0x94ee
leaq 0x1aee(%rip), %rdx      # 0x94f1
leaq -0x70(%rbp), %rdi
callq 0x38fa
leaq -0x40(%rbp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x1bbf(%rip), %rsi      # 0x95da
leaq 0x1bc5(%rip), %rdx      # 0x95e7
leaq -0x50(%rbp), %rdi
callq 0x38fa
leaq -0x278(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x50(%rbp), %rcx
movq %r12, %rdx
xorl %r8d, %r8d
callq 0x6ed8
leaq -0x278(%rbp), %r12
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0x32c0
movq (%r12), %rdi
leaq -0x268(%rbp), %rax
cmpq %rax, %rdi
je 0x7a77
movq -0x268(%rbp), %rsi
incq %rsi
callq 0x3260
movq -0x50(%rbp), %rdi
cmpq %rbx, %rdi
je 0x7a8c
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3260
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0x7aa1
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x3260
movq 0x5528(%rip), %rdi      # 0xcfd0
leaq 0x1b39(%rip), %rsi      # 0x95e8
movl $0x17, %edx
callq 0x32a0
movq 0x10(%r15), %rsi
movq 0x18(%r15), %rdx
movq 0x5508(%rip), %rdi      # 0xcfd0
callq 0x32a0
movq %rax, %r12
leaq 0x1be8(%rip), %rsi      # 0x96bf
movl $0x1, %edx
movq %rax, %rdi
callq 0x32a0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r12, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq -0x278(%rbp), %r13
movq %r13, %rdi
movq -0x30(%rbp), %rsi
movl $0x10, %edx
callq 0x34a0
movq 0x30(%r15), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
leaq -0x270(%rbp), %r12
movq -0x8(%r12), %rax
addq -0x18(%rax), %r13
movq %r13, %rsi
callq 0x3480
leaq 0x38(%r15), %rdi
movq %r12, %rsi
callq 0x3250
movq 0x5466(%rip), %rax      # 0xcfc0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x180(%rbp), %r13
movq %rcx, -0xf8(%r13)
movq -0x18(%rcx), %rcx
movq %rax, -0x278(%rbp,%rcx)
movq %r12, %rdi
callq 0x31e0
movq %r13, %rdi
callq 0x30c0
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%r14,%rax)
je 0x7be6
movb $0x0, 0x8(%r15)
movq 0x544a(%rip), %r12      # 0xcff0
leaq 0x1a53(%rip), %rsi      # 0x9600
movl $0x2a, %edx
movq %r12, %rdi
callq 0x32a0
movq (%r12), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq 0x5417(%rip), %rdi      # 0xcff0
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x1a3e(%rip), %rsi      # 0x962b
movl $0x1a, %edx
movq %r14, %rdi
callq 0x32a0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x1915(%rip), %rsi      # 0x953d
movl $0x3f, %edx
movq %r14, %rdi
callq 0x32a0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x191a(%rip), %rsi      # 0x957d
movl $0x27, %edx
movq %r14, %rdi
callq 0x32a0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x19a8(%rip), %rsi      # 0x9646
movl $0x1, %edx
movq %r14, %rdi
callq 0x32a0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x196f(%rip), %rsi      # 0x9648
movl $0x78, %edx
movq %r14, %rdi
callq 0x32a0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x1932(%rip), %rsi      # 0x9646
movl $0x1, %edx
movq %r14, %rdi
callq 0x32a0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
movl 0x238(%r15), %eax
testl %eax, %eax
je 0x7d66
cmpl $0x1, %eax
jne 0x7da1
movl $0x11, %edx
leaq 0x1964(%rip), %rsi      # 0x96c8
jmp 0x7d72
movl $0x6, %edx
leaq 0x194f(%rip), %rsi      # 0x96c1
movq %r14, %rdi
callq 0x32a0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7db5
movq %rax, %r15
movq -0x50(%rbp), %rdi
cmpq %rbx, %rdi
je 0x7dd4
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3260
jmp 0x7dd4
jmp 0x7dd1
movq %rax, %r15
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0x7e0a
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x3260
jmp 0x7e0a
jmp 0x7e07
jmp 0x7e07
movq %rax, %r15
leaq -0x278(%rbp), %rdi
callq 0x3360
jmp 0x7e0a
jmp 0x7e07
movq %rax, %r15
jmp 0x7e12
movq %rax, %r15
movq %r14, %rdi
callq 0x3360
movq -0x30(%rbp), %rax
movq (%rax), %rdi
cmpq -0x78(%rbp), %rdi
je 0x7e2e
movq -0x78(%rbp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x3260
movq %r15, %rdi
callq 0x3430