// File: /workspace/github_cpp_makefile_star2_O1/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 0x527c(%rip), %rax      # 0xcbe0
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 0x7a13
testl %r13d, %r13d
jne 0x7ac7
leaq -0x60(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x1b26(%rip), %rsi      # 0x94ee
leaq 0x1b22(%rip), %rdx      # 0x94f1
leaq -0x70(%rbp), %rdi
callq 0x3906
leaq -0x40(%rbp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x1be4(%rip), %rsi      # 0x95cb
leaq 0x1beb(%rip), %rdx      # 0x95d9
leaq -0x50(%rbp), %rdi
callq 0x3906
leaq -0x278(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x50(%rbp), %rcx
movq %r12, %rdx
xorl %r8d, %r8d
callq 0x6f0c
jmp 0x7a6b
leaq -0x60(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x1acc(%rip), %rsi      # 0x94ee
leaq 0x1ac8(%rip), %rdx      # 0x94f1
leaq -0x70(%rbp), %rdi
callq 0x3906
leaq -0x40(%rbp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x1b99(%rip), %rsi      # 0x95da
leaq 0x1b9f(%rip), %rdx      # 0x95e7
leaq -0x50(%rbp), %rdi
callq 0x3906
leaq -0x278(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x50(%rbp), %rcx
movq %r12, %rdx
xorl %r8d, %r8d
callq 0x6f0c
leaq -0x278(%rbp), %r12
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0x32c0
movq (%r12), %rdi
leaq -0x268(%rbp), %rax
cmpq %rax, %rdi
je 0x7a9d
movq -0x268(%rbp), %rsi
incq %rsi
callq 0x3260
movq -0x50(%rbp), %rdi
cmpq %rbx, %rdi
je 0x7ab2
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3260
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0x7ac7
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x3260
movq 0x5502(%rip), %rdi      # 0xcfd0
leaq 0x1b13(%rip), %rsi      # 0x95e8
movl $0x17, %edx
callq 0x32a0
movq 0x10(%r15), %rsi
movq 0x18(%r15), %rdx
movq 0x54e2(%rip), %rdi      # 0xcfd0
callq 0x32a0
movq %rax, %r12
leaq 0x1bc2(%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 0x5440(%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 0x7c0c
movb $0x0, 0x8(%r15)
movq 0x5424(%rip), %r12      # 0xcff0
leaq 0x1a2d(%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 0x53f1(%rip), %rdi      # 0xcff0
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x1a18(%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 0x18ef(%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 0x18f4(%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 0x1982(%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 0x1949(%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 0x190c(%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 0x7d8c
cmpl $0x1, %eax
jne 0x7dc7
movl $0x11, %edx
leaq 0x193e(%rip), %rsi      # 0x96c8
jmp 0x7d98
movl $0x6, %edx
leaq 0x1929(%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 0x7ddb
movq %rax, %r15
movq -0x50(%rbp), %rdi
cmpq %rbx, %rdi
je 0x7dfa
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3260
jmp 0x7dfa
jmp 0x7df7
movq %rax, %r15
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0x7e30
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x3260
jmp 0x7e30
jmp 0x7e2d
jmp 0x7e2d
movq %rax, %r15
leaq -0x278(%rbp), %rdi
callq 0x3360
jmp 0x7e30
jmp 0x7e2d
movq %rax, %r15
jmp 0x7e38
movq %rax, %r15
movq %r14, %rdi
callq 0x3360
movq -0x30(%rbp), %rax
movq (%rax), %rdi
cmpq -0x78(%rbp), %rdi
je 0x7e54
movq -0x78(%rbp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x3260
movq %r15, %rdi
callq 0x3430