// File: /workspace/github_cpp_makefile_star2_O1/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, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x20(%rsp), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
callq 0x85982
leaq 0x40(%rsp), %rdi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movq %r15, %rsi
callq 0x530d6
movq 0x50(%rsp), %rax
movq %rax, 0x30(%rsp)
movups 0x40(%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x661a0
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsi)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x18, 0x8(%rsp)
jmp 0x661ad
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
callq 0x6a5be
leaq 0x40(%rsp), %rdi
movsd 0xe8e9e(%rip), %xmm2    # 0x14f058
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
movq %r15, %rsi
callq 0x530d6
movq 0x50(%rsp), %rax
movq %rax, 0x30(%rsp)
movups 0x40(%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x66201
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsi)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x18, 0x8(%rsp)
jmp 0x6620e
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
callq 0x6a5be
leaq 0x40(%rsp), %rdi
movsd 0xe8e3d(%rip), %xmm1    # 0x14f058
xorps %xmm0, %xmm0
xorps %xmm2, %xmm2
movq %r15, %rsi
callq 0x530d6
movq 0x50(%rsp), %rax
movq %rax, 0x30(%rsp)
movups 0x40(%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x66262
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsi)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x18, 0x8(%rsp)
jmp 0x6626f
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
callq 0x6a5be
leaq 0x40(%rsp), %rdi
movsd 0xe8ddc(%rip), %xmm1    # 0x14f058
xorps %xmm0, %xmm0
movq %r15, %rsi
movaps %xmm1, %xmm2
callq 0x530d6
movq 0x50(%rsp), %rax
movq %rax, 0x30(%rsp)
movups 0x40(%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x662c3
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsi)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x18, 0x8(%rsp)
jmp 0x662d0
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
callq 0x6a5be
leaq 0x40(%rsp), %rdi
movsd 0xe8d7b(%rip), %xmm0    # 0x14f058
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movq %r15, %rsi
callq 0x530d6
movq 0x50(%rsp), %rax
movq %rax, 0x30(%rsp)
movups 0x40(%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x66324
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsi)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x18, 0x8(%rsp)
jmp 0x66331
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
callq 0x6a5be
leaq 0x40(%rsp), %rdi
movsd 0xe8d1a(%rip), %xmm0    # 0x14f058
xorps %xmm1, %xmm1
movq %r15, %rsi
movaps %xmm0, %xmm2
callq 0x530d6
movq 0x50(%rsp), %rax
movq %rax, 0x30(%rsp)
movups 0x40(%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x66385
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsi)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x18, 0x8(%rsp)
jmp 0x66392
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
callq 0x6a5be
leaq 0x40(%rsp), %rdi
movsd 0xe8cb9(%rip), %xmm0    # 0x14f058
xorps %xmm2, %xmm2
movq %r15, %rsi
movaps %xmm0, %xmm1
callq 0x530d6
movq 0x50(%rsp), %rax
movq %rax, 0x30(%rsp)
movups 0x40(%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x663e6
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsi)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x18, 0x8(%rsp)
jmp 0x663f3
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
callq 0x6a5be
leaq 0x40(%rsp), %rdi
movsd 0xe8c58(%rip), %xmm0    # 0x14f058
movq %r15, %rsi
movaps %xmm0, %xmm1
movaps %xmm0, %xmm2
callq 0x530d6
movq 0x50(%rsp), %rax
movq %rax, 0x30(%rsp)
movups 0x40(%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x66447
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsi)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x18, 0x8(%rsp)
jmp 0x66454
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
callq 0x6a5be
movq 0x8(%rsp), %r15
subq (%rsp), %r15
sarq $0x3, %r15
movabsq $-0x5555555555555555, %r13 # imm = 0xAAAAAAAAAAAAAAAB
imulq %r13, %r15
movq (%r14), %rdx
leaq 0xef782(%rip), %rsi     # 0x155bfb
movq %rbx, %rdi
xorl %eax, %eax
callq 0x45f0
testb %bpl, %bpl
je 0x66496
leaq 0xef78a(%rip), %rdi     # 0x155c19
movl $0x3c, %esi
jmp 0x664a2
leaq 0xef7b9(%rip), %rdi     # 0x155c56
movl $0x3f, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x4850
leaq 0xed83f(%rip), %rsi     # 0x153cf5
movq %rbx, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x45f0
testl %r15d, %r15d
jle 0x6659b
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
xorl %ebp, %ebp
leaq 0xeda51(%rip), %r12     # 0x153f2d
xorl %r14d, %r14d
movq (%rsp), %rdi
movq 0x8(%rsp), %rdx
subq %rdi, %rdx
sarq $0x3, %rdx
imulq %r13, %rdx
cmpq %r14, %rdx
jbe 0x665d9
addq %rbp, %rdi
xorl %esi, %esi
callq 0x85d40
movq (%rsp), %rdi
movq 0x8(%rsp), %rdx
subq %rdi, %rdx
sarq $0x3, %rdx
imulq %r13, %rdx
cmpq %r14, %rdx
jbe 0x665d9
movsd (%rax), %xmm0
movsd %xmm0, 0x60(%rsp)
addq %rbp, %rdi
movl $0x1, %esi
callq 0x85d40
movq (%rsp), %rdi
movq 0x8(%rsp), %rdx
subq %rdi, %rdx
sarq $0x3, %rdx
imulq %r13, %rdx
cmpq %r14, %rdx
jbe 0x665d9
movsd (%rax), %xmm0
movsd %xmm0, 0x58(%rsp)
addq %rbp, %rdi
movl $0x2, %esi
callq 0x85d40
movsd (%rax), %xmm2
movq %rbx, %rdi
movq %r12, %rsi
movsd 0x60(%rsp), %xmm0
movsd 0x58(%rsp), %xmm1
movb $0x3, %al
callq 0x45f0
incq %r14
addq $0x18, %rbp
cmpq %r14, %r15
jne 0x664df
leaq 0xea1c0(%rip), %rdi     # 0x150762
movl $0x54, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x4850
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x665ca
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xe90c5(%rip), %rdi     # 0x14f6a5
movq %r14, %rsi
xorl %eax, %eax
callq 0x4630
jmp 0x665fe
jmp 0x665fe
jmp 0x665fe
jmp 0x665fe
jmp 0x665fe
jmp 0x665fe
jmp 0x665fe
jmp 0x665fe
jmp 0x665fe
jmp 0x665fe
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x66617
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq %rbx, %rdi
callq 0x4780