// File: /workspace/github_cpp_makefile_star2_O2/Luthaf[P]zeopp/networkstorage.cc
// Function: write_unit_cell(_IO_FILE*, ATOM_NETWORK*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool)
void write_unit_cell(FILE *orig_uc, ATOM_NETWORK *cell, string name, bool is_net) {
  //printf("DEBUG: called write_unit_cell()\n");
  //For each corner in abc, get the coords in xyz
  vector<XYZ> corners; XYZ p;
  p = cell->abc_to_xyz_returning_XYZ(0, 0, 0); corners.push_back(p);
  p = cell->abc_to_xyz_returning_XYZ(0, 0, 1); corners.push_back(p);
  p = cell->abc_to_xyz_returning_XYZ(0, 1, 0); corners.push_back(p);
  p = cell->abc_to_xyz_returning_XYZ(0, 1, 1); corners.push_back(p);
  p = cell->abc_to_xyz_returning_XYZ(1, 0, 0); corners.push_back(p);
  p = cell->abc_to_xyz_returning_XYZ(1, 0, 1); corners.push_back(p);
  p = cell->abc_to_xyz_returning_XYZ(1, 1, 0); corners.push_back(p);
  p = cell->abc_to_xyz_returning_XYZ(1, 1, 1); corners.push_back(p);
  // Write header, information about the cell, and footer
  int num_c = corners.size();
  fprintf(orig_uc, "# vtk DataFile Version 2.0\n%s", name.c_str());
  if(is_net) fprintf(orig_uc, " - vtk format representation of original unit cell boundary\n"); else fprintf(orig_uc, " - vtk format representation of structure's unit cell boundary\n");
  fprintf(orig_uc, "ASCII\nDATASET POLYDATA\nPOINTS %d double\n", num_c);
  for(int i=0; i<num_c; i++) fprintf(orig_uc, "%.3f %.3f %.3f\n", corners.at(i)[0], corners.at(i)[1], corners.at(i)[2]);
  fprintf(orig_uc, "LINES 12 36\n2 0 1\n2 0 2\n2 1 3\n2 2 3\n2 4 5\n2 4 6\n2 5 7\n2 6 7\n2 0 4\n2 1 5\n2 2 6\n2 3 7\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, 0x38(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
andq $0x0, 0x30(%rsp)
leaq 0x40(%rsp), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
callq 0x6402e
leaq 0x8(%rsp), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movq %r15, %rsi
callq 0x3f12a
movq 0x18(%rsp), %rax
leaq 0x40(%rsp), %rsi
movq %rax, 0x10(%rsi)
movups 0x8(%rsp), %xmm0
movaps %xmm0, (%rsi)
leaq 0x20(%rsp), %rdi
callq 0x4beaa
leaq 0x8(%rsp), %rdi
movsd 0xb1bc3(%rip), %xmm2    # 0xfc058
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
movq %r15, %rsi
callq 0x3f12a
movq 0x18(%rsp), %rax
leaq 0x40(%rsp), %rsi
movq %rax, 0x10(%rsi)
movups 0x8(%rsp), %xmm0
movaps %xmm0, (%rsi)
leaq 0x20(%rsp), %rdi
callq 0x4beaa
leaq 0x8(%rsp), %rdi
movsd 0xb1b88(%rip), %xmm1    # 0xfc058
xorps %xmm0, %xmm0
xorps %xmm2, %xmm2
movq %r15, %rsi
callq 0x3f12a
movq 0x18(%rsp), %rax
leaq 0x40(%rsp), %rsi
movq %rax, 0x10(%rsi)
movups 0x8(%rsp), %xmm0
movaps %xmm0, (%rsi)
leaq 0x20(%rsp), %rdi
callq 0x4beaa
leaq 0x8(%rsp), %rdi
movsd 0xb1b4d(%rip), %xmm1    # 0xfc058
xorps %xmm0, %xmm0
movq %r15, %rsi
movaps %xmm1, %xmm2
callq 0x3f12a
movq 0x18(%rsp), %rax
leaq 0x40(%rsp), %rsi
movq %rax, 0x10(%rsi)
movups 0x8(%rsp), %xmm0
movaps %xmm0, (%rsi)
leaq 0x20(%rsp), %rdi
callq 0x4beaa
leaq 0x8(%rsp), %rdi
movsd 0xb1b12(%rip), %xmm0    # 0xfc058
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movq %r15, %rsi
callq 0x3f12a
movq 0x18(%rsp), %rax
leaq 0x40(%rsp), %rsi
movq %rax, 0x10(%rsi)
movups 0x8(%rsp), %xmm0
movaps %xmm0, (%rsi)
leaq 0x20(%rsp), %rdi
callq 0x4beaa
leaq 0x8(%rsp), %rdi
movsd 0xb1ad7(%rip), %xmm0    # 0xfc058
xorps %xmm1, %xmm1
movq %r15, %rsi
movaps %xmm0, %xmm2
callq 0x3f12a
movq 0x18(%rsp), %rax
leaq 0x40(%rsp), %rsi
movq %rax, 0x10(%rsi)
movups 0x8(%rsp), %xmm0
movaps %xmm0, (%rsi)
leaq 0x20(%rsp), %rdi
callq 0x4beaa
leaq 0x8(%rsp), %rdi
movsd 0xb1a9c(%rip), %xmm0    # 0xfc058
xorps %xmm2, %xmm2
movq %r15, %rsi
movaps %xmm0, %xmm1
callq 0x3f12a
movq 0x18(%rsp), %rax
leaq 0x40(%rsp), %rsi
movq %rax, 0x10(%rsi)
movups 0x8(%rsp), %xmm0
movaps %xmm0, (%rsi)
leaq 0x20(%rsp), %rdi
callq 0x4beaa
leaq 0x8(%rsp), %rdi
movsd 0xb1a61(%rip), %xmm0    # 0xfc058
movq %r15, %rsi
movaps %xmm0, %xmm1
movaps %xmm0, %xmm2
callq 0x3f12a
movq 0x18(%rsp), %rax
leaq 0x40(%rsp), %rsi
movq %rax, 0x10(%rsi)
movups 0x8(%rsp), %xmm0
movaps %xmm0, (%rsi)
leaq 0x20(%rsp), %rdi
callq 0x4beaa
movq 0x28(%rsp), %rax
subq 0x20(%rsp), %rax
pushq $0x18
popq %rcx
cqto
idivq %rcx
movq %rax, %r15
movq (%r14), %rdx
leaq 0xb8607(%rip), %rsi     # 0x102c4b
movq 0x38(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x4610
testb %bpl, %bpl
je 0x4a663
leaq 0xb860a(%rip), %rdi     # 0x102c69
pushq $0x3c
jmp 0x4a66c
leaq 0xb863c(%rip), %rdi     # 0x102ca6
pushq $0x3f
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x4840
leaq 0xb6696(%rip), %rsi     # 0x100d15
xorl %r14d, %r14d
movq %rbx, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x4610
testl %r15d, %r15d
cmovlel %r14d, %r15d
leaq 0x20(%rsp), %r12
pushq $0x1
popq %rbp
pushq $0x2
popq %r13
leaq 0xb68a4(%rip), %rbx     # 0x100f4d
cmpq %r14, %r15
je 0x4a726
movq %r12, %rdi
movq %r14, %rsi
callq 0x4b6d6
movq %rax, %rdi
xorl %esi, %esi
callq 0x6424a
movsd (%rax), %xmm0
movsd %xmm0, 0x60(%rsp)
movq %r12, %rdi
movq %r14, %rsi
callq 0x4b6d6
movq %rax, %rdi
movl %ebp, %esi
callq 0x6424a
movsd (%rax), %xmm0
movsd %xmm0, 0x58(%rsp)
movq %r12, %rdi
movq %r14, %rsi
callq 0x4b6d6
movq %rax, %rdi
movl %r13d, %esi
callq 0x6424a
movsd (%rax), %xmm2
movq 0x38(%rsp), %rdi
movq %rbx, %rsi
movsd 0x60(%rsp), %xmm0
movsd 0x58(%rsp), %xmm1
movb $0x3, %al
callq 0x4610
incq %r14
jmp 0x4a6a9
leaq 0xb30a5(%rip), %rdi     # 0xfd7d2
pushq $0x54
popq %rsi
pushq $0x1
popq %rdx
movq 0x38(%rsp), %rcx
callq 0x4840
leaq 0x20(%rsp), %rdi
callq 0xb132
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4a768
jmp 0x4a768
jmp 0x4a768
jmp 0x4a768
jmp 0x4a768
jmp 0x4a768
jmp 0x4a768
jmp 0x4a768
jmp 0x4a768
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xb132
movq %rbx, %rdi
callq 0x4780